docs/contributor-standards.md
Standards for working with CONTEXT.md, docs/adr/, and AI-agent-assisted contributions.
These apply to every PR — fix, enhancement, or feature. They are part of the merge contract, not optional background reading.
Standards hierarchy (canonical, in order):
CONTEXT.md — domain language and module namingdocs/adr/ — accepted architectural decisionsCONTEXT.md is the single source of truth for domain vocabulary. It defines:
CONTEXT.md is written as flat named sections under ## Domain terms (for Modules/seams) and ## sections for recurring rules. Machine-oriented predicates use KEY.SUBKEY=value flat format in code blocks under ## AI Ops Memory.
Adding a new Module or seam:
### <Module Name> entry under ## Domain terms.Extending an existing predicate:
KEY.SUBKEY=value line inside the relevant ## AI Ops Memory block.When to add a new predicate vs extend an existing one:
CONTEXT.md in full before naming anything (modules, interfaces, seams, tests, PRs).CONTEXT.md vocabulary consistently in code comments, tests, issue/PR text, and docs.CONTEXT.md as part of drive-by cleanup; propose focused updates tied to the approved issue scope.CONTEXT.md is maintainer-owned. Contributors can propose additions via issue discussion, but final wording is the maintainer's call.A PR that adds a new query adapter should use the term Native Dispatch Adapter Module (from CONTEXT.md), not "native adapter," "query native handler," or any other variant.
docs/adr/ contains Architecture Decision Records. Each ADR is a concise record of one accepted decision: the problem, the decision, and the consequences. Accepted ADRs are the current standard.
Currently accepted ADRs:
| File | Decision |
|---|---|
0001-dispatch-policy-module.md | Dispatch Policy Module as the single seam for query execution outcomes |
0002-command-contract-validation-module.md | Command Contract Validation Module / command contract centralization |
0003-model-catalog-module.md | Model Catalog Module as the single source of truth for agent profiles and runtime tier defaults |
0004-worktree-workstream-seam-module.md | Planning Workspace Module as single seam for worktree and workstream state |
0005-sdk-architecture-seam-map.md | SDK Architecture seam map for query/runtime surfaces |
0006-planning-path-projection-module.md | Planning Path Projection Module for SDK query handlers |
0007-sdk-package-seam-module.md | SDK Package Seam Module owns SDK-to-get-shit-done-cc compatibility |
An ADR is required when a decision:
An ADR is optional (a comment in the relevant issue or PR is sufficient) when:
NNNN-<short-slug>.md — four-digit zero-padded sequence number, followed by a kebab-case slug that names the Module or decision. Example: 0003-model-catalog-module.md.
Every ADR must open with:
# <Title>
- **Status:** Accepted | Proposed | Deprecated
- **Date:** YYYY-MM-DD
Body: one-paragraph decision summary, then ## Decision (specifics), then ## Consequences (behavioral changes downstream callers can rely on).
Amendments are appended as ## Amendment (YYYY-MM-DD): <topic> sections — the original body is never rewritten.
- **Status:** Accepted
- **Date:** 2026-05-09
Status values: Proposed (under discussion), Accepted (current standard), Deprecated (superseded — include a forward reference to the replacement).
Reference sibling ADRs by filename, not by title prose: see \0001-dispatch-policy-module.md``. This survives title edits.
docs/adr/ does not currently maintain a separate README.md index. The canonical index is the table in this document (above). If an ADR is added, update this table in the same PR.
Accepted, reopening the decision must be explicit (a dedicated issue with rationale), not implied by a drive-by PR change.AI assistance is appropriate for every contribution type. The bar for correctness and review quality does not change because the code was AI-assisted.
Before any AI agent writes a single line of code or docs, it must read:
CONTEXT.md in full.docs/adr/).If you are dispatching an AI agent, include these reads in the agent's prompt explicitly. An agent that invents synonyms for CONTEXT.md vocabulary or contradicts an accepted ADR without flagging it has failed the pre-work requirement.
In the PR body, state which ADR or standards section was followed. If using an AI assistant, this statement is your responsibility as the author — not the agent's.
Agent-written code must use an isolated worktree to prevent branch pollution. The standard pattern:
git worktree add ../my-feature-worktree fix/NNNN-short-description
Never commit agent output directly to main or to an already-open feature branch without review.
Sonnet for most tasks — implementation, test writing, docs, triage. Use the current Sonnet model unless the task requires deep reasoning over a large context.
Opus for architecture-level tasks — ADR authorship (maintainer only), cross-cutting refactors, adversarial review of complex PRs. Using a more capable model when a capable model suffices wastes context and delays the cycle.
General-purpose vs specialist agents: prefer the specialist agent for the domain (e.g. a TypeScript-aware agent for SDK surface changes, a docs-aware agent for contributor docs) over a general-purpose agent. Specialist agents load less irrelevant context.
For any Behavior-Adding Task (see CONTEXT.md):
Commit each phase separately. A PR that has no failing-test commit for a new behavior will be asked to add one before merge.
Before opening a PR:
[proposed] in the text if they describe future intent rather than current behavior.After a reviewer thread is addressed:
gh api graphql -f query='mutation { resolveReviewThread(input:{threadId:"PRRT_..."}) { thread { isResolved } } }'
Address every reviewer finding claim-by-claim. Do not dismiss a thread because one sub-claim is a false positive — read all sub-claims before deciding.
The maintainer is evaluating whether to require a ## Standards followed block in every issue and PR body. Current proposal:
This is marked [proposed] — it is not yet a merge gate. Feedback on workflow impact is welcome in issue #3232.