--- feature: tracker-references name: "Tracker References (Git-agent contract/mechanics split, tracker contract, PR-host references)" description: "Use when editing git.mds, an operation's generated reference, the tracker contract or its loading section, or adding a provider. Keywords: one reference per operation, _ops.mds, _steps.mds, _contract.md, references/pr." category: architecture directories: [src/assets/agents/git.mds, src/assets/mds/tracker, src/assets/mds/git, src/assets/mds/.mdsroot, src/assets/scripts/resolve-base.cjs, src/core/mds-variants.ts, src/core/reference-sweep.ts, src/targets/claude-code/installer.ts, src/assets/commands/_partials/_tracker.mds, src/assets/skills/git, src/assets/skills/review-methodology, tests/tracker, tests/installer, tests/guards/capability-hoist.test.ts, tests/guards/provider-scope.test.ts, tests/guards/requires-closure.test.ts, tests/guards/report-cap.test.ts, tests/fixtures/agent-config.ts, tests/review/convergence-detection.test.ts, src/assets/skills/agent-references/references/commands] created: 2026-09-14 updated: 2026-10-22 --- # Tracker References ## Rules - **KB-INV-1** `git.mds` holds routing and shared rules only; each operation's contract (Input, degradation, Output with Handoff Values) and its `### Process` are ONE generated reference, contract first, so a spawn loads exactly one reference for the op it runs. - **KB-INV-2** The build manifest, the install manifest and the per-spawn loaded set are three different things; every install carries every provider tree, `pr/`, the cross-cutting documents and both tracker-root contracts, because a repository can select its own tracker. - **KB-INV-3** The provider token is resolved once per spawn, in `tracker/_contract.md`, from the `resolve-settings.cjs` line; it selects a static-map row and is never concatenated. Exactly one line of `git.md` (`## Loading the mechanics`) composes a provider-keyed path. - **KB-INV-4** PR-host mechanics are provider-independent: generated once under `references/pr/` for `PR_HOST_OPS`, never fanned per provider. `ensure-pr-ready` is a tracker operation: one file per provider holding both halves, the PR-host half written once and expanded into all three. - **KB-INV-5** All three providers read the one `TRACKER_OPS` roster; a new provider needs a registry entry, a resolver token, a static-map row and a `MODEL_TRANSITIVE_REFS` row (even empty). - **KB-INV-6** Provider-neutral text is authored once and expanded by every provider, so the copies are byte-identical by construction: step text in `_steps.mds` at the step's numeric position, operation contracts in `_ops.mds` and `_ops_pr.mds`, identical inline steps in `_ops_steps.mds`; a condition travels with its step. - **KB-INV-7** The one-reference rule, the hop rule and the table naming every non-tracker operation's reference stay in the agent's `## Loading the mechanics`: a PR-only spawn needs them and never reads the contract. - **KB-INV-8** Containment controls are never optional to load: the `## Comment-sink scrub (D11)` section and Principle 8's non-reproduction bullet stay in the agent; the summary ops' `publication-gate.md` naming sentence, `post-resolution-summary`'s non-reproduction clause and `resolve-review-threads` step 3 sit in the operation's own reference, and the agent names the gate nowhere. - **KB-INV-9** `update-pr-evidence` and `check-merge-readiness` are script pointers (run `verify-evidence.cjs publish` / `readiness`, print its stdout) and stay in `PR_HOST_OPS` so a direct delegation runs the same script; the commands run it inline, with no Git spawn. - **KB-INV-10** `ensure-pr-ready` step 5 and `validate-branch` step 6 run `resolve-base.cjs pr --name-stdin --cross "${X}" < "$F"` once, after the strict name check, with `trap 'rm -- "$F"' EXIT` in the same Bash call; `F` is a `mktemp` name file: `gh … --jq .baseRefName > "$F"` fills it on the main path, a `for-each-ref` redirect fills the origin/HEAD fallback, and the Write tool writes only a given name or the literal `main`/`master`, after a Read. One `BASE_REF=` line counts only with `exit=0` (else `REASON=resolver-unavailable`), and every later diff takes the commit ID `base_ref`, never the name. Step 5 is one shared define, identical under every provider. - **KB-INV-11** The one reason-to-fix sentence is written in `_ops_steps.mds` (ensure-pr-ready 5b) and `_pr.mds` (validate-branch step 6), different importers, pinned identical by `tests/git-agent.test.ts` and equal to /implement's copy by the `reason-fix-table` rule of `tests/guards/base-ref-guard.test.ts`: all three change together. Its `name-file-procedure` rule holds the name-file procedure equal in both ops and in /implement's re-validation. - **KB-INV-12** The two summary ops (`post-review-summary`, `post-resolution-summary`) carry one `private_sections_rule()` define in `_ops_pr.mds`, called from exactly their two contracts above `### Process`; step 4 strips private sections before the FULL/STUB branch, the FULL templates read `{stripped …}`, and a failed strip or blank stripped text posts nothing and reports `**Status**: DEGRADED (no postable summary)`. - **KB-AP-1** Moving text verbatim without checking the destination's reserved tokens: a column-0 `## ` outside a fence ends an op section for `extractOpSectionFromCorpus`, so everything under an `## Operation:` anchor is `###`. - **KB-AP-2** Putting provider-neutral step text in `_common.mds`, or any define in `_mcp.mds`: the compile cost is exponential in define count (see tracker-references-build-install KB-AP-1); use `_steps.mds`, or the `_ops*.mds` partials for contract and inline-step text. - **KB-AP-3** Naming `_contract.md` or `_mcp.md` from a provider or operation reference, or adding a stop/DEGRADED rule for their absence: both are fixed per-spawn loads named only by the agent's loading section. - **KB-AP-4** Pointing the project-key rule at `learn-conventions` (loaded only when conventions are absent): the contract states the untrusted-git-history rule itself. - **KB-AP-5** Widening the single-naming-line count to the loading table: its rows are fixed `references/pr/…` literals composing nothing from the provider token. - **KB-AP-6** Hand-keeping an operation roster beyond the agent's Operations and loading tables, or a second per-provider roster: `GIT_OPERATIONS` (from `TRACKER_OPS`, `PR_HOST_OPS` and `DOC_BACKED_OPS`) is the authority. - **KB-AP-7** An opaque `{token}` for the Branch token: it is the branch name the operation created or suggested. - **KB-AP-8** Carrying legacy MDS syntax (`\{…\}` escapes, single-brace `{helper()}` calls) into moved text: it ships literally with a clean build. - **KB-AP-9** Treating a control cited by name in one section as living there: an obligation an op carries must be readable from that op's own reference. - **KB-AP-10** Putting a gh call, `--body-file`, a scrubber chain or a marker back into `update-pr-evidence`'s reference: the script owns the posting path and scrubs (D11) each body before it writes. - **KB-AP-11** Describing `validate-branch` as read-only or accepting an empty `### Diff Scope`: it fetches the base once (remote-tracking ref only), diffs `base_ref...HEAD`, and no usable base or a non-zero diff exit is BLOCKED. - **KB-AP-12** Rewording validate-branch's `### Diff Scope` line or ensure-pr-ready's "steps 4b/4c" Output line: the frozen `github-status-lines` fixture samples both (owner `--unfreeze`); add adjacent lines instead. - **KB-AP-13** A base name or retitle value in any shell span: it reaches a command only from a file (`< "$F"`, `--base="$(cat -- "$F")"`, `--title="$(cat -- "$F")"`), and `tests/guards/base-ref-guard.test.ts` reports any other site. - **KB-AP-14** Hand-copying the private-sections rule into one op, or letting a FULL template read the whole summary file: the copies drift and private text reaches the post; call the define and read `{stripped …}`. - **KB-AP-15** Raising `BUDGET_LOADED_SET_PR_HOST` or a resolve, code-review or Synthesize template ceiling to land an addition: those sit at or near zero headroom, so the same file gives up wording of equal size. ## Overview `src/assets/agents/git.mds` — the always-loaded, per-spawn-billed Git agent prompt — holds routing and shared rules only (sections in Key Files) and declares no operation. Every operation is **one generated reference**, contract first and then `### Process`, and a spawn loads exactly the one for the op it runs: `references/pr/{op}.md` for a `PR_HOST_OPS` member, `references/tracker/{provider}/{op}.md` for a `TRACKER_OPS` member, the named `references/learn-conventions.md` for `learn-conventions`. A tracker operation also reads the tracker contract (provider resolution plus the tracker input contract, `references/tracker/_contract.md`) once per spawn; a PR-only spawn reads none of the tracker half. The three providers share the one `TRACKER_OPS` roster, so file-set parity is a compile-time property. A second, orthogonal axis is `PR_HOST_OPS`: pull requests, reviews and checks stay on GitHub under every tracker, so those bodies are generated once under `references/pr/` for every provider. **The build and the install are different sets, and confusing them is the standing trap.** The build (`generatedReferenceManifest()`) compiles every provider plus every provider-independent tree: the tracker ops per provider, the PR-host ops, four cross-cutting documents (`decision-markers`, `learn-conventions`, `publication-gate`, `trust-rule`) and the two tracker-root contracts (`tracker/_contract.md`, ungated, and the tool-call contract `tracker/_mcp.md`, behind a gate). The tarball and every install carry all of it (`D-INSTALL-ALL-PROVIDERS`: `installedReferenceManifest()` returns the same manifest whatever the machine's provider; only the compliance switch narrows it, dropping the posting operation files and `publication-gate.md`), yet the two stay separate functions and the overlay's prune stays, so a retired generated document still leaves on the next install. A third quantity is the per-SPAWN loaded set the byte budget gates: it prices every op a loaded body hops to in the same spawn as well as the files an op's own reference names. The feature spans four knowledge bases: this one (the split, the tracker contract and loading section, Handoff Values, base resolution in the PR ops, adding a provider) and its build-install (MDS registry, compiler cliff, partial homes, installer overlay), byte-budget (ceilings, loaded-set formula, body-hop closure) and guards (corpus modes, single-authority and reachability guards, floors, goldens) siblings, linked under Related. Provider SELECTION (how a provider is chosen, the background Tracker agent, hook Section 3, `--emit`, the reader-side resolution contract) is owned by the tracker-feature KB. Broader per-spawn budget work is tracked in issue #342 (related #333). ## System Context `git.md` compiles from `git.mds` (`output-dir: dist/agents`) and is re-sent on every Git agent spawn (one `/resolve` run spawns it several times), a per-run multiplier on every character. Each operation contract is provider-neutral; its GitHub-specific `gh` invocations, header names and rate-limit detectors sit in the reference the operation loads, so provider resolution has one convergence point (GAP-10) and the D4/D11 detectors sit with the resolved provider (GAP-03). Three places hold operation text, not the agent. (1) Provider resolution and the tracker input contract live in `references/tracker/_contract.md` (`D-TRACKER-CONTRACT-ON-DEMAND`), read once per spawn by a tracker operation before its first tracker step; a PR-only spawn never reads it. (2) Provider-neutral step text lives in the per-provider references through the import-free `_steps.mds` partial (`D-NEUTRAL-STEP-MOVE`). (3) Each operation's contract joins its steps in one reference (`D-OP-ONE-REF`), written once as a `{op}_contract` define and called by every module that emits the op (`D-OP-CONTRACT-ONCE`), so a spawn pays for the one reference of the op it runs (a tracker spawn saves less than a PR-only one, which reads no contract file). The agent's frontmatter sits on the shared agent table (`D-GIT-ROW`, see Gotchas), and its closing `## Output` section carries the report cap and the lines callers parse that must stay inline; each operation's `**Output:**` template, in its reference, is its return. ## Component Architecture ### 1. Tracker operations: one reference each Each tracker operation is `references/tracker/{github,jira,linear}/{op}.md`, generated from `src/assets/mds/tracker/_github.mds`, `_jira.mds` and `_linear.mds`. The file opens with `## Operation: {name}`, then the contract (description, `**Input:**`, `**Degradation (D4):**` where present, `**Output:**` including any `### Handoff Values` block), then `### Process`. The contract is the `{op}_contract` define in `src/assets/mds/git/_ops.mds`, called right after the anchor by every module that emits the op, so the three provider copies match by construction; `tests/tracker/reference-structure.test.ts` holds the order (`**Input:**` before `**Output:**`, both before the first `###` outside a fence). `_ops.mds` also holds `learn-conventions`' contract, compiled into the named document `references/learn-conventions.md`, loaded when `setup-task` step 1b finds `.devflow/conventions.md` absent and invokes `learn-conventions` in the same spawn. The agent's loading table routes the PR-host operations and `learn-conventions`; every other operation is a tracker operation whose reference the one tracker rule names (section 5). `TRACKER_OPS` in `src/core/mds-variants.ts` (`TRACKER_GITHUB_OPS = TRACKER_OPS`, an alias, not a second list) names the tracker ops. `GIT_OPERATIONS` (the PR-host ops, `TRACKER_OPS` and `DOC_BACKED_OPS`) is the whole roster, and `operationReferenceRel(op, provider)` is the one owner of where an operation's reference lives. `associate-release`'s reference hops to `backlink-shipped-issues` on every provider (priced by the byte-budget closure). `create-release`'s steps 1a–6 are the release-host half (`create_release_steps`, section 2), expanded beside each provider's own shipped-issues step inside step 5. ### 2. Provider-neutral steps — `_steps.mds` (`D-NEUTRAL-STEP-MOVE`) `src/assets/mds/tracker/_steps.mds` holds step text whose wording is identical under github, jira and linear and carries no transport. Its defines cover `setup-task` steps 1a and 4–5 (`base_branch_step`, `branch_create_steps`: branch create, conventions commit, return), `fetch-issue`'s marker-neutralisation reminder, `fetch-issues-batch` steps 3–4 and `gather-release-evidence` steps 1, 2–3 and 5 (`release_evidence_*`). Each provider module alias-imports the partial (`@import "./_steps.mds" as steps`) and calls each define at the step's numeric position inside its own `### Process`, so each reference still reads as one numbered list. `branch_create_steps` opens its commit step with its own condition on the conventions result and `release_evidence_gate_step` states the project-key condition on a `KEY-N` grammar, so each copy keeps its gate on the line it governs. `_ops_steps.mds` holds, beside the operation contracts, the inline steps that sit at a numbered position among a provider's own steps: `create_release_steps` (they carry `gh release create`, a GitHub-host shape the tool-call providers' transport guards read around by exact line through `withoutHostSteps`, and they hold `create-release` in the remote-I/O detection set); `shipped_issues_step_0`, `shipped_issues_loop` and `associate_release_marker_step` (`backlink-shipped-issues`' step 0 and loop bound, shared with `associate-release`; each provider places the loop itself, since a loop line ahead of a hoisted identity lookup breaks the capability-hoist guard); `fetch_issue_step_1` and `fetch_issues_batch_step_1`/`_5` (the batch GraphQL null-alias rule); and `ensure_pr_ready_*` (section 3). `setup-task`'s `learn-conventions` pointer is part of its contract block. ### 3. PR-host operations `PR_HOST_OPS` (`validate-branch`, `post-review-summary`, `check-ci-status`, `fetch-review-threads`, `resolve-review-threads`, `post-resolution-summary`, `check-merge-readiness`, `update-pr-evidence`) generates once from `src/assets/mds/git/_pr.mds` into `references/pr/{op}.md` (`PR_HOST_DESTINATION_ROOT = 'pr'`), installed under **every** provider, never fanned: under `tracker/github/` a jira or linear user's PR mechanics would read as their tracker's, and fanning ships three identical trees. `update-pr-evidence` edits the PR body and the evidence comment (by its script, below), both GitHub facts whatever the tracker is. Each file holds its contract (called from `_ops_pr.mds`, alias `props`), then its steps. The roster sits exactly at `MIN_VARIANT_PAIRS`; the floor refuses a shrink, not growth. `ensure-pr-ready` is a TRACKER operation, not a PR-host one: `references/tracker/{provider}/ensure-pr-ready.md`, one file per provider holding both halves. The PR skeleton (branch/commit/push, create, retitle, step 4b's PR-host half: the open-PR lookup and the scrub-then-edit) is written once as `ensure_pr_ready_steps_to_4a`, `ensure_pr_ready_steps_from_4c` and `ensure_pr_ready_pr_edit` in `_ops_steps.mds`; each provider module places its own step 4b between the first two and its note covers only the closing effects. Step 4b runs only when `ISSUE_PR_LINK` is absent; it takes only the `PR link line` of the Handoff Values block and composes no line itself (a failing line is refused in step 4a's words; with no line it skips silently). The Git agent opens the PR and the Code agent opens none (`/implement` Phase 9 spawns it once, outside the strategy branches). The reference holds the paste gates: `ISSUE_PR_LINK` verbatim after its shape gate (a given link is final; 4b does not resolve), `PR_EXCEPTIONS` after its grammar check, the caller blocks after `verify-evidence.cjs check`, a given `BASE_BRANCH` after the name check, through a name file (an empty file ends BLOCKED with no PR; its `rm --` runs in the D11 shell after the last create attempt, the D11 trap unchanged), `COMMIT_UNCOMMITTED` (default true; false commits nothing and lists the stray files), and on a scrubber failure the PR is still created with the fixed minimal body, because PR existence is the deliverable. The 4c title travels through a file the same way. **Base resolution (a fresh base for branch diffs).** `ensure-pr-ready` step 5 (in `ensure_pr_ready_steps_from_4c`) and `validate-branch` step 6 (`_pr.mds`; step 7 diffs `base_ref...HEAD` into the triage agent's DIFF_FILES) read a base through `src/assets/scripts/resolve-base.cjs`, as does `/implement`'s re-validation reference (`implement-revalidate.md`, step 3; `local --name-stdin` when no PR applies). The name travels by file (KB-INV-10, KB-AP-13): one Bash call prints `F=` from `mktemp`, redirects `baseRefName` into it and prints both gh statuses (`gh=$G,$?`), a failed Write is a missing value, a file whose only content is an empty line counts as empty, the Read tool reads it back, the strict class is judged by reading, and each exit before the call runs a plain `rm --`. The resolver (rules: resolve-pipeline KB) accepts a name of at most 256 bytes (`STDIN_CAP_BYTES`) and reads up to 257 to detect an over-long input, strips one trailing LF or CRLF, and runs the strict class then `git check-ref-format` before any other git call; empty or unreadable input is `resolver-unavailable`, over-cap or malformed input `invalid-name`. A `degraded` NOTE continues with `TRACEABILITY: DEGRADED (base {REASON}; fix: {fix})`; on a stop, `ensure-pr-ready` stops only for an invalid name (else Base ref `none`), and `validate-branch` returns BLOCKED naming REASON and its fix when `base_ref` is `none` or not hex, or no base branch can be determined. `ensure-pr-ready` also takes an optional `BASE_REF` input (/implement's Phase 1 value) that skips the resolver and 5b when it is 40/64 lowercase hex and the base name equals `BASE_BRANCH`. A PR with no readable base name keeps its PR line, shows Base `(unreadable)` and Base ref `none`, and emits `TRACEABILITY: DEGRADED (base name unreadable; fix: re-run)`. Its Output gains `- **Base ref**: {base_ref}` after the Base line; validate-branch's template has none, yet `base_ref` is in the report-cap exempt list for both ops (`EXEMPT_MARKERS`). Pins: `tests/tracker/schema-scope.test.ts` (both degraded spellings: `HOST_COMPOSED_REASONS`, `PR_HOST_REASONS`), the "PR ops use a fresh base" tests in `tests/git-agent.test.ts`, and the step-5 equality and `reason-fix-table` arms of `tests/guards/base-ref-guard.test.ts`. **Script pointers (`D-OP-SCRIPT-POINTER`).** `update-pr-evidence`'s `### Process` is two steps: run `verify-evidence.cjs publish --pr {n}` and print its stdout, exactly the `## PR Evidence` block or `TRACEABILITY: DEGRADED (evidence unavailable)`. The script runs the whole sequence (verify, scrubbed block and comment edits, each read back; a mismatch is DEGRADED), runs no gh after a failed scrub, and bounds its gh calls and write stage (`D-PUBLISH-BOUNDS`). The comment is edited in place, not appended: the newest own one carrying the evidence head prefix is PATCHed unless a strict evidence comment from another login follows it, and a new one posts when none is editable. `check-merge-readiness` opens with the `readiness` run (the `## Merge Readiness` block, else `TRACEABILITY: DEGRADED (readiness unavailable)`) and keeps its prose steps 1–5 as the ladder's specification: the frozen status-lines golden samples its fetch steps, and `merge-readiness.test.ts` holds prose, model and the script's `readinessVerdict` arm for arm. `/implement` (Phase 11) and `/resolve` (Step 9b-3, Phase 9c) run it inline through Bash. Each PR-host reference is the whole operation, and its obligations are readable from that one file. A step names another operation only to run it or to follow its reference (the hop rule in the loading section): `check-merge-readiness` step 3 reuses `check-ci-status`'s classification and names `references/pr/check-ci-status.md` ("load it and apply them"), and the budget model charges both files to it. `tests/tracker/reference-reachability.test.ts` holds that every "same logic as `{op}`" in a `pr/` file names that op's `pr/` file, and that each operation reaches exactly one reference through the agent's routing (the table, or the single templated tracker line) and declares one `## Operation:` anchor. **Private sections in the summary ops (KB-INV-12).** `private_sections_rule()` sits in each summary contract: a section starts at a `Private` heading (any case, fenced or not) and ends before the next unfenced heading of equal or higher rank, else at end of file. Step 4 strips before either mode, so STUB never reads private text; compose, cap and re-cap use only the stripped text, the file stays unedited, and each cut closes any fence it leaves open. A failed read or strip, blank stripped text or, before step 6, a body line of that start shape posts nothing and reports `**Status**: DEGRADED (no postable summary)` (in `PR_HOST_REASONS`), quoting no private text. `publication-gate.md` step 4 reads "Compose body (defined per op)"; the writers carry the matching line; /code-review Step 0e-i cuts the prior resolution summary by the post rule's word boundary and rank, "when unsure, cut more", and `PRIOR_RESOLUTIONS=(none)` on a failed cut; the `post-rule` kind's `SHARED_RULE_PHRASES` tie the copies. ### 4. Controls that stay in the agent, by rule `## Comment-sink scrub (D11)` never moves out of the agent; only the concrete D11 sink calls (`gh pr comment`, `gh pr create --body-file`, `gh pr edit --body-file`, the GraphQL mutation) sit in the operation references that own each sink (`ensure-pr-ready`'s step 4a create and step 4b PR-host half); `update-pr-evidence`'s two are `verify-evidence.cjs publish`'s, which scrubs before each write. A control a spawn can decline to load is not guaranteed to run before the write, and the review-summary and resolution-summary comment posts are an append-only sink (only the evidence comment is edited in place), so their scrub must precede the post. Four more sit in the operation's own reference (`_pr.mds`'s header states them): the two summary operations' sentence naming `references/publication-gate.md` (D10's scope property is asserted over the references that name the gate; a name in the agent bills every spawn); their `private_sections_rule()` (KB-INV-12); `post-resolution-summary`'s non-reproduction clause (Principle 8's obligation); and `resolve-review-threads` step 3, the D9 gate application between steps 2 and 4 (the D9 predicate has one authority, `references/decision-markers.md`). Headings below each reference's `## Operation:` anchor are `###`; the `## ` lines inside the two summary operations' compose fences are indented payload. **Principle 8.** The cross-op non-reproduction rule — no comment-posting operation (`post-review-summary`, `post-resolution-summary`, `backlink-shipped-issues`) may reproduce verbatim `` or `` content — is its own sub-bullet under Principle 8's marker-neutralisation bullet in `git.mds` `## Principles`, naming all three. It sits **beside** `post-resolution-summary`'s op-local clause: the global bullet shows the rule spans every posting op, the op-local clause keeps it readable from that op's section. **`Boundaries` carries only the escalation list**, so no roster paragraph can drift. ### 5. The tracker contract and the loading section `references/tracker/_contract.md` (source `src/assets/mds/tracker/_contract.mds`) holds `## Tracker contract`, then `### Tracker provider resolution` and `### Tracker input contract` (`###` by grammar). Its length is bounded by `PREAMBLE_MAX_LINES`, and `contractBlock()` in the budget model throws when the title or either section is missing or out of order. It is the single convergence point (GAP-10): it runs `resolve-settings.cjs` once per spawn and accepts only the script's own line shape (`exit=0` plus one line opening `TRACKER=… TRACKER_SOURCE=… TRACKER_WARN=… SITE=… KEY=…`), else the fail-closed `TRACKER=github TRACKER_SOURCE=default TRACKER_WARN=invalid SITE=none KEY=none` — reject, never repair. `TRACKER` then *selects* a static-map row (`github → tracker/github/`; `jira → tracker/jira/` + `~/.devflow/tracker/jira.md`; `linear → tracker/linear/` + `~/.devflow/tracker/linear.md`) — select, never concatenate; the conventions file likewise. The prompt reads neither `.devflow/config.json` nor the manifest: the script folds project.json, the narrow-only personal override and the manifest. `TRACKER_WARN=mismatch` and `=invalid` map to the existing `tracker configuration mismatch (repository override)` and `unknown tracker provider` reasons. Neither agent nor contract carries a stop or DEGRADED rule for the contract's own absence: only a corrupted install causes it, and the installer reports that (`reference-reachability.test.ts` pins both absences). **The agent keeps `## Loading the mechanics`**, between the D4 block and `## Comment-sink scrub (D11)`, and it is what names the contract. It holds: the one-reference rule with its hop rule ("Read another operation's reference only when a step tells you to run that operation or to follow its reference" — a flat "read no other reference" would set the loading rule against steps like `setup-task` 1c, which runs `ensure-traceable-issue`); the table giving every PR-host operation and `learn-conventions` its fixed `references/…` path; and the one tracker bullet — a tracker operation reads `references/tracker/_contract.md` once per spawn, before its first tracker step, and runs the settings line it defines; under any non-`github` provider it then reads `references/tracker/_mcp.md` once, before its first tracker call (both fixed literals), then `references/tracker/{provider}/{op}.md` for the resolved provider. Three paths on one physical line keeps the single-naming-line count at one; the section runs no resolver and names no config file. These stay in the agent because a PR-only spawn needs them and never reads the contract, which cannot instruct a spawn to load itself (known-bad probes pin both placements, and a Loading section that forbids every other reference). No provider or operation reference names or restates either contract file. **The project-key rule is self-contained.** The non-github project-key chain (settings `KEY` → task-input ref → git history → the conventions file) states itself why git-history strings are untrusted. A pointer to `learn-conventions`' UNTRUSTED-strings block would send every other spawn toward a file it never loads, an unpriced closure hop; `alwaysLoadedBodies()` holds the whole agent, both preloaded skills and both contract files to a "no hop at all" rule (probe P9, byte-budget KB). `### Tracker input contract` carries: the capability-hoist rule; the Read-tool rule for the conventions file (a shell read can be rewritten into a truncated view — the static map's `~/` literal, which the Read tool expands per `docs/reference/platform-assumptions.md`); the size bound; the frontmatter-mismatch and unparseable-file rules; the conventions-file sections it reads and what an absent one means; the shape-gate-at-the-sink rule; and the `{ISSUE_REF}` rendering rule. The D4/D11 **legend** (`## Operations` table footer) keeps only the D4 and D11 rows; D1–D3/D5–D10 live in `references/decision-markers.md`, a `kind: 'named'` cross-cutting document. ### 6. Handoff Values — the producer side of the issue-capture contract `setup-task` and `fetch-issue`'s Output blocks each end with a `### Handoff Values` block (PR link line, branch token, issue ID). The Branch token is defined: `setup-task` emits `- **Branch token**: {branch-name}` (the placeholder its `## Task Setup:` heading uses) and `fetch-issue` emits `- **Branch token**: {suggested-branch}` (its `### Suggested Branch` section). The consumer is the Git agent's `ensure-pr-ready` reference: it names the `- **PR link line**:` and `- **Branch token**:` labels, never re-derives the token, and re-checks the pasted `ISSUE_PR_LINK` against the tracker reference grammars before the paste. `tests/seams/pr-link-handoff.test.ts` pins each token to its own branch-producing heading through `collectBranchTokenDefects` (`BRANCH_TOKEN_SOURCES`), with known-bad probes for an opaque `{token}` and a token on the wrong operation, and pins the consumer's labels. `fetch-issues-batch`'s mechanics project each issue's `state` (`OPEN`/`CLOSED`) into a `**State**: {state}` line. ## Component Interactions Runtime order in a Git spawn: the agent's `## Loading the mechanics` → a PR-host operation Reads its `references/pr/{op}.md` only; a tracker operation first Reads `_contract.md` once and runs the settings line, under a non-`github` provider Reads `_mcp.md` once, then Reads `references/tracker/{provider}/{op}.md` (`ensure-pr-ready` included) → a loaded body can name a sibling op to run or follow (`setup-task` → `ensure-traceable-issue`, `gather-release-evidence`/`associate-release` → `backlink-shipped-issues`, `check-merge-readiness` → `check-ci-status`), pulling that op's reference into the same spawn under the hop rule → the op executes its numbered list → any body-posting step passes through the always-inline D11 scrub before the provider-specific post command. Build order and verification order are in the build-install and guards KBs. ## Integration Patterns — adding a provider - The contract takes the provider from the settings line (`resolve-settings.cjs`: project.json → narrow-only personal override → manifest → `github`); a new provider adds a registry entry, a resolver token and a static-map row in `_contract.mds` (mechanics directory + conventions file), no resolution logic. - A provider module slots into `VARIANT_MODULES` as another `kind: 'fanout'` entry over the SAME `TRACKER_OPS` roster; `installedReferenceManifest` picks it up without edit. It alias-imports `_ops.mds` (each op's contract, called right after the op's anchor), `_ops_steps.mds` and `_steps.mds` and calls the same defines at the same positions, so its `ensure-pr-ready` gets step 5 (base resolution) from the shared define. It also needs a `MODEL_TRANSITIVE_REFS` row, even if empty (the byte-budget non-vacuity arm fails a provider with none). - `tracker/_mcp.md` is generated iff a registered module lands in `tracker/jira` or `tracker/linear`, and then installs on every machine; `tracker/_contract.md` is always generated, so a new provider changes no gate; `references/pr/` is unaffected: a new provider adds only its own `tracker/{id}` directory. - **The `## Operations` table is provider-neutral**; its tracker cells read "tracker issue(s)". `create-release` still names GitHub: release hosting stays there under every provider. `src/assets/skills/git/SKILL.md`'s `X-RateLimit-Remaining` threshold was KEPT, deliberately. - **`backlink-shipped-issues`' step 0 defers to the resolved provider's anchored reference grammar**: `shipped_issues_step_0` in `_ops_steps.mds` states the requirement once for it and for `associate-release`, and each provider's own reference states and enforces the grammar. ## Anti-Patterns - **KB-AP-1** `##` is a section inside `SKILL.md` but a section **terminator** in a generated reference (`extractOpSectionFromCorpus`, outside a fence), so a byte-identical move across that grammar boundary is not semantics-preserving. - **KB-AP-3, KB-AP-4** The contract files are fixed per-spawn loads, not per-op ones, and the loading section alone names them: a per-operation name reaches only those operations, and the rest would run tracker calls without the tool-call contract's transport prohibition. A stop rule for an absence only an install fault can cause is prompt bloat. ## Gotchas - **KB-INV-3, KB-AP-5** The single-naming-line assertion covers the TRACKER path only: exactly one line in `dist/agents/git.md` may name a `references/tracker/` path (`collectTrackerNamingLines`), the one composing the provider-keyed path from the token. Counting the table's fixed `references/pr/…` rows would conflate one convergence point with one pointer vocabulary. - **KB-AP-8** A single-brace placeholder such as `DEGRADED ({reason})` is literal everywhere (prose, inline code, every fence) and only `{{…}}` interpolates, so moved text needs no re-escaping. The remaining hazard is legacy text: a `\{…\}` escape ships its backslash and a single-brace `{helper()}` call ships literally (the backslash-leak and lost-expansion guards in `tests/build-mds.test.ts` catch them). - **The Git agent's frontmatter is table-driven** (`D-GIT-ROW`). `model: haiku`, `effort: medium`, a `tools:` allowlist of Bash, Read, Write and ToolSearch, and `omitClaudeMd: true` are the `git` row of `AGENT_CONFIG` in `tests/fixtures/agent-config.ts` (plus skills `git` and `worktree-support`, and the row's `policy` and `digest` lines). The allowlist exists because the installer stamps one whole-server entry per configured tracker server onto the INSTALLED `tools:` line (`D-TRACKER-SERVER-ALLOWLIST`), so the shipped source names no server and the row pins that vendor-neutral half. Model and effort stay overridable through `devflow agents`. Git is in the report-cap roster (`report-cap-roster-count`), so `## Output` (after the Operations table, before Principles) caps every operation's return with its report cap and exempt-line list. - **The review-methodology skill holds no posting recipe** (`references/patterns.md`, `violations.md`): its PR-comment function points to the Git agent's `post-review-summary` operation, where D10 and D11 already live. - **`SKILL.md`'s Extended References table** carries a row only for the generated per-op tracker mechanics (`references/tracker/{provider}/{op}.md`), none for the flat cross-cutting documents or `pr/`: each is named from the agent at its point of use, and a row would cost per-spawn characters in the one file preloaded on every Git spawn (`tests/guards/extended-references.test.ts` holds every row's path real, except the generated `references/tracker/` prefix). - **`references/github-api.md`** states its D4 STOP-and-report rule once and fails closed on a malformed rate probe; its size is pinned by equality (`GITHUB_API_MD_CHARS`, byte-budget KB). The GitHub posting recipes live in `references/github-posting.md` (pinned by `GITHUB_POSTING_MD_CHARS`), which a compliance-off install never copies. - **KB-AP-11, KB-AP-12** The sampled `### Diff Scope` line reads `from git diff {base}...HEAD --name-only`; the base wording sits in adjacent lines: the contract's first sentence, step 7, the `Base ref` Output line and the step-5 DEGRADED Output line (guards KB). - **The manage-debt item-source rule has one author, `manage_debt_contract()` in `_ops.mds`; step 3 is written once, as `manage_debt_step_3` in `_ops_steps.mds`, so every provider's copy is identical.** `tests/provider-literals.test.ts` pins step 3 as an allowlist and the rule verbatim against the contract only, counts the rule by a short key fragment, and reports any other review-report source. Rewording the rule moves `MANAGE_DEBT_RULE`. The `github-status-lines` fixture freezes step 3's built bytes (rewording needs an owner `--unfreeze`). - **KB-INV-12, KB-AP-14** The rule is one LLM-applied control, so each summary op's reference must reach every clause: `PRIVATE_SECTION_ROWS` is spread into `D10_PER_OP_LITERALS` (mode 'union') in `tests/git-agent.test.ts`, beside the collectors `collectFullContentPlaceholders`, `collectPrivateRuleDrift`, `collectPrivateRuleOrderDefects` and `collectPrivateRuleCallers` (the two callers), each with a seeded known-bad probe. `collectPrivateMarkerDefects` in `tests/review/convergence-detection.test.ts` holds the writer lines and the /code-review Step 0e-i clause over both builds (curation on and off); an absent cut is one defect, never a skip. - **KB-INV-12** The STUB counts line in both summary templates still reads "verbatim from local artifact": the frozen status-lines fixture samples it. The STUB header ("stripped text only") and the rule govern, so the counts never come from the file. Do not reword it. - **KB-AP-15** Zero headroom: `BUDGET_LOADED_SET_PR_HOST` and the resolve, code-review and Synthesize template ceilings are at or near their limit, so a wording addition in any of them is funded by wording cuts in the same file (byte-budget KB). - **Load cost.** Step 5 rides in every provider's `ensure-pr-ready` reference. The worst per-op load is still linear `setup-task` (hops included), close to `GIT_OP_LOAD_MAX`, so growth is condensed first, never met by raising the cap (byte-budget KB). ## Key Files - `src/assets/agents/git.mds` — routing and shared rules, declaring no operation: frontmatter; the Input and D4 blocks; `## Loading the mechanics`; the D11 scrub; the Operations table with the two-row D4/D11 legend; the closing `## Output`; Principles with the Principle 8 sub-bullet; Core rules; the escalation-only Boundaries - `src/assets/mds/tracker/_github.mds`, `_jira.mds`, `_linear.mds` — sole sources of the per-op tracker references (`_github.mds` includes `### Provider signals (GitHub)` for `backlink-shipped-issues`) - `src/assets/mds/git/_pr.mds` — sole source of the `PR_HOST_OPS` files; its header states the controls that sit in each operation's own reference and the heading-depth rule; two of its ops point at the script - `src/assets/scripts/verify-evidence.cjs` — `publish` and `readiness`, behind `update-pr-evidence` and `check-merge-readiness` (CI read with `ci-wait.cjs`'s `parseChecks`, `classifyChecks` and `mergeGate`/`isConflicting`; `probeWorkflows` and its own `bindCiHead` cover the workflow list and the evidence head) - `src/assets/mds/git/_references.mds` — sole source of the four named cross-cutting documents (`learn-conventions` takes its contract from `_ops.mds`; `publication-gate` step 4 reads "Compose body (defined per op)") - `src/assets/mds/tracker/_contract.mds` — sole source of `tracker/_contract.md`; no define, no import, one `` marker; header records `D-TRACKER-CONTRACT-ON-DEMAND` - `src/assets/mds/tracker/_steps.mds` — the provider-neutral step text; its header records why it is not `_common.mds` and what did not move (`_common.mds` and `_mcp.mds`: build-install KB) - `src/assets/commands/_partials/_tracker.mds` — `issue_ref_grammar()`, `issue_capture_contract()` - `src/assets/mds/git/_ops.mds`, `_ops_pr.mds`, `_ops_steps.mds` — the operation contracts (tracker ops and `learn-conventions`; then the PR-host ops, with `private_sections_rule()` called by the two summary contracts) and the inline steps every provider runs identically, each written once; `_ops_steps.mds` holds the `ensure_pr_ready_*` skeleton, paste gates and step 5. `src/assets/mds/.mdsroot` pins the MDS root so the provider modules can import across `tracker/` and `git/` - `src/assets/scripts/resolve-base.cjs` — the base resolver both PR ops call (contract: resolve-pipeline KB; the prompt-side tests are named in section 3) - `tests/seams/pr-link-handoff.test.ts`, `tests/tracker/reference-reachability.test.ts`, `tests/tracker/reference-structure.test.ts` — Branch token pins, the `ensure-pr-ready` consumer and its file-fed `--base`; loading-section, one-reference and parity arms; contract-first order (guards KB) - `tests/fixtures/agent-config.ts`, `tests/guards/report-cap.test.ts` — `AGENT_CONFIG.git`, `CORE_RULES_DIGEST`; Git's report-cap roster membership ## Related - `.devflow/features/tracker-references-build-install/KNOWLEDGE.md`, `.devflow/features/tracker-references-byte-budget/KNOWLEDGE.md`, `.devflow/features/tracker-references-guards/KNOWLEDGE.md` — the sibling facets of this feature - `.devflow/features/tracker-feature/KNOWLEDGE.md` — provider selection layered on this split: machine default and repository selection via the settings line, `~/.devflow/tracker/{provider}.md` conventions, the generation gate on `_mcp.md`, the reader-side resolution order and mismatch guard - `.devflow/features/compliance-feature-traceability/KNOWLEDGE.md` — the D-marker, scrub and containment semantics of the PR-host references - `.devflow/features/feature-knowledge-system/KNOWLEDGE.md` — the general MDS build pipeline this feature's build side extends - `.devflow/features/test-harness/KNOWLEDGE.md` — `extractOpSectionFromCorpus`, `collectUnfencedH2`, `gitAgentSinkCorpus`, goldens lifecycle, guard conventions - `.devflow/features/command-shared-partials/KNOWLEDGE.md` — `_tracker.mds`'s adoption sites among the command-layer partials - `.devflow/features/installer-shadowing/KNOWLEDGE.md` — the install pipeline the reference overlay runs inside - `.devflow/features/resolve-pipeline/KNOWLEDGE.md` — the base resolver contract (`local` and `pr` modes, reasons, bounds) and /implement's call sites - Principles behind the split: shared prompts are billed per spawn; a document is generated only for a reachable consumer (`_mcp.md` only with an MCP-backed provider, no Extended References row for the flat documents or `pr/`)