pi-gauntlet 7.41.2 → 7.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,15 +15,13 @@ If a tool result contains a ⚠️ workflow warning, stop immediately and addres
15
15
 
16
16
  Gauntlet execution dispatches are foreground: set top-level `async: false` on every implementation, review, conformance, retry, and prose-described dispatch. Preserve parallel `tasks` batches and chain groups. `forceTopLevelAsync` is incompatible; an unexpected async handle means stop and report, never poll or relaunch. See [pi-cohort dispatch configuration](https://github.com/jjuraszek/pi-cohort/blob/main/doc/configuration.md).
17
17
 
18
- ## Why Subagents
18
+ ## Orchestrator holds
19
19
 
20
- Your context window holds the full plan, prior decisions, and conversation history. Each subagent gets a fresh window with only the current task's text and context.
20
+ Keep only the plan_check manifest, tracker state, skill resources read at their absolute paths, structured JSON, `Artifacts:` patch paths, coordination/scoped-gate output, `Worktree ready` values, and delegated essence during implement. Delegate every plan/spec/task/report/source read, including content-loading shell commands. A file-only pointer never authorizes opening a report. Apply this boundary from `phase_tracker start implement` through implement completion; leave other phases and the loop engine unchanged.
21
21
 
22
- - **No context pollution.** Task N's noise doesn't leak into Task N+1.
23
- - **Tighter focus.** Subagent reads less, makes fewer cross-task assumptions, ships smaller diffs.
24
- - **Cheaper at scale.** Operator pins (`subagents.agentOverrides.<agent>.model`) route simple subtasks to smaller models; you spend top-tier tokens on orchestration and hard problems.
22
+ Read [reference/dispatch-contract.md](./reference/dispatch-contract.md) now for schemas, anchored payloads and one-step carriers. Read [reference/implement-amendments.md](./reference/implement-amendments.md) now for delegated amendments.
25
23
 
26
- You are the **orchestrator**. You read the plan, dispatch, review the review, decide. You do **not** write code yourself.
24
+ Use primary shell coordination only: `rev-parse`, `status --porcelain`, `diff --stat`, `apply`, `reset --soft`, `add -A`, `commit`, `update-ref`, plus the marked preflight, snapshot and scratch-index recipes and scoped-command redirection. Prohibit content-loading `cat`, `sed -n`, `git show <path>`, `git diff` without `--stat`, and contextual `grep`/`rg` over source. Route source questions, provenance and human escalation wording through the answer/evidence carrier; stop on delegated failure.
27
25
 
28
26
  ## Continuous Execution
29
27
 
@@ -43,23 +41,23 @@ Periodic "should I continue?" prompts add latency without adding safety. The pla
43
41
  - Approved plan or clear task scope
44
42
  - `plan_tracker` list initialized at writing-plans handoff with the full wave-ordered task list. Consume and preserve it on continuation; only direct recovery with no tracker initializes the full plan list once, before dispatch, and never over an existing list.
45
43
 
46
- Extract **`SCOPED_TEST_COMMANDS`** from the task's `**Tests:**` command bullets, backticks stripped, one per line; `- none:` -> `none`; a wave = the union of its tasks' commands. Treat `via:` and `baseline:` bullets and `- Test:` paths as contract, not commands: carry them with the task text, never in `SCOPED_TEST_COMMANDS`.
44
+ Call `plan_check({ planPath })` for the manifest; stop on FAIL; for `manifest-size`, emit a stop note asking for plan reduction. Consume each task's `files`, `tests`, `leg`, `mode`, heading and explicit `orchestrator`. Pass isolated implementers only their own task's `tests` as `SCOPED_TEST_COMMANDS`, or `none` when empty. Give in-place implementers, the integrated test gate and code reviews the wave union of `tests`. Preserve each array element as one command without splitting or joining command strings. Children read Tests metadata themselves.
47
45
 
48
- Keep the orchestrator as the spec's only writer during execution. On implementer `BLOCKED` citing a spec defect, or a review finding showing the spec (not the code) is wrong, pause the fix loop, read and execute brainstorming's [amendment path](../brainstorming/SKILL.md#amending-an-approved-spec) in place (it reviews first; with amend permission on the `**Amend-grant:**` line it applies amends without a stop and still stops on a redraw; without permission it stops on escalation or redraw), then resume. Keep code-vs-spec mismatch in the SR loop. Require an SR unable to read the spec at a cited anchor (missing file, unresolvable heading/range) to return a blocking finding - the contract is spec+task or stop, never a silent fallback to task-only review.
46
+ On a spec-defect citation, pause the fix loop and take the delegated amendment route for [amending an approved spec](../brainstorming/SKILL.md#amending-an-approved-spec) with amend permission on the `**Amend-grant:**` line decoded by the existing surface. Keep code-vs-spec mismatch in SR; an unreadable spec anchor blocks instead of falling back to task-only review.
49
47
 
50
48
  ## Fix-Loop Rounds
51
49
 
52
50
  Apply one rule to both review loops - spec-compliance and code-quality.
53
51
 
54
- **Re-review dispatch rule:** every re-review task includes the complete prior review report verbatim under the marker `## Previous review report (re-review trigger)`, plus the trajectory block from the reviewer's prompt template. The marker's presence is what obligates the reviewer to emit the `TRAJECTORY:` line. You never select, summarize, or diff findings yourself - pattern-match the sentinel line only. Include the delta defined in [Fix delta](#fix-delta) in every SR/CR re-review.
52
+ **Re-review dispatch rule:** every re-review task includes the previous report path under the marker `## Previous review report (re-review trigger)`, plus the trajectory block from the reviewer's prompt template. The marker's presence is what obligates the reviewer to emit the `TRAJECTORY:` line. Consume `trajectory.verdict`, `maxSeverity` and `findingCount` from structured JSON; let the child read findings. Include the delta defined in [Fix delta](#fix-delta) in every SR/CR re-review.
55
53
 
56
54
  **Fix fan-out.** When a fix round is fanned out per `/skill:requesting-code-review` Fix rounds, use the precondition and dispatch shape owned by `/skill:dispatching-parallel-agents` "Fix fan-out"; the fan-out counts as **one** fix against this budget, its scoped test gate is the consuming task/wave's `SCOPED_TEST_COMMANDS`, and one re-review of the integrated delta follows.
57
55
 
58
- **Behaviour-change reroute.** When the triggering CR report carries `Behaviour-change: yes`, the fix round's re-review is SR first, then CR. Include `## Fix delta` on this SR-first behavior-change repair. Dispatch SR against the fix diff and the task's spec anchors as a first review (no `## Previous review report` marker, so no `TRAJECTORY:` line; SR carries no test commands but does carry the task's `**Tests:**` block and `- Test:` paths), but its ordinal continues the task's SR-loop count - a task whose SR loop ended at review 2 gets review 3 here, and an issue-bearing rerouted SR after review 4 escalates. Issues follow the normal sequence: fix, then SR re-review pasting this SR's report. CR round numbering is unchanged. `Behaviour-change: no` re-reviews with CR only. A missing or malformed `Behaviour-change:` line is re-asked once like `Parallel-safe:` (see `dispatching-parallel-agents` "Structural probe"); still missing -> route through SR, never default to `no`. Target the SR re-review at the task(s) whose files the fix touched; after integration, dispatch it against the current implementation worktree, not a pre-integration snapshot.
56
+ **Behaviour-change reroute.** When the triggering CR structured result has `behaviourChange: true`, the fix round's re-review is SR first, then CR. Include `## Fix delta` on this SR-first behavior-change repair. Dispatch SR against the fix diff and the task's spec anchors as a first review (no `## Previous review report` marker, so no `TRAJECTORY:` line; SR carries anchored task paths and no test commands), but its ordinal continues the task's SR-loop count - a task whose SR loop ended at review 2 gets review 3 here, and an issue-bearing rerouted SR after review 4 escalates. Issues follow the normal sequence: fix, then SR re-review forwarding this SR's report path. CR round numbering is unchanged. `behaviourChange: false` re-reviews with CR only. Treat a missing or malformed required `behaviourChange` field as a failed attempt under [When a Subagent Fails](#when-a-subagent-fails); retain accepted siblings and never default to `no`. Use structured touchedTasks for affected owners; absent owners on a multi-task repair means all dispatched tasks. Target the SR re-review at the task(s) whose files the fix touched; after integration, dispatch it against the current implementation worktree, not a pre-integration snapshot.
59
57
 
60
- Every fix re-dispatch (implementer) and code-review re-review carries the consuming task/wave's `SCOPED_TEST_COMMANDS`; spec-reviewer re-reviews carry the `**Tests:**` block and `- Test:` paths, no commands - SR never executes.
58
+ Scope every fix re-dispatch (implementer) and code-review re-review through the Prerequisites test-scope rule; spec-reviewer re-reviews carry anchored paths, no commands - SR never executes.
61
59
 
62
- **The sequence.** Each review that finds issues is a decision point: read the `TRAJECTORY:` line before dispatching anything (review 1 has no line - on issues, dispatch fix 1). Any clean review ends the loop. For code review, *issue-bearing* means verdict `FIX_FIRST` and *clean* means verdict `SHIP`, whatever Minors the report lists; spec review keeps its gaps/acceptance meaning. `REJECT` is neither: stop and report per `stop-note.md`; the loop never enters.
60
+ **The sequence.** Each review that finds issues is a decision point: read structured `trajectory` before dispatching anything (review 1 has no line - on issues, dispatch fix 1). Any clean review ends the loop. For code review, *issue-bearing* means verdict `FIX_FIRST` and *clean* means verdict `SHIP`, whatever Minors the report lists; spec review keeps its gaps/acceptance meaning. `REJECT` is neither: stop and report per `stop-note.md`; the loop never enters.
63
61
 
64
62
  1. **Review 1** (first review - no sentinel). Issues -> dispatch fix 1.
65
63
  2. **Review 2** (re-review). Issues -> if `STAGNANT`, escalate now - no fix 2. Otherwise dispatch fix 2.
@@ -78,7 +76,7 @@ Read [reference/fix-loop.md](./reference/fix-loop.md) now for escalation and fun
78
76
 
79
77
  ## Fix delta
80
78
 
81
- Include a `## Fix delta` block in every SR/CR re-review payload: `git diff --binary <tree-before> <tree-after>` between the tree recorded at the prior review's dispatch and the tree recorded at this re-review's dispatch. Record each tree with the shell block below; keep the printed SHA keyed by task for SR or wave for CR. Run it in the spec-review snapshot for pre-integration reviews, or in the branch checkout for integrated reviews (`FD_ROOT`). Tree objects share the repository's object store; use `git -C "$FD_ROOT" diff --binary <tree-before> <tree-after>` to produce the delta. Worker commits and staging state do not affect it; never substitute a SHA range or working-tree diff.
79
+ Include a `## Fix delta` block in every SR/CR re-review payload: the recorded tree-before and tree-after object IDs between the tree recorded at the prior review's dispatch and the tree recorded at this re-review's dispatch. Record each tree with the shell block below; keep the printed SHA keyed by task for SR or wave for CR. Run it in the spec-review snapshot for pre-integration reviews, or in the branch checkout for integrated reviews (`FD_ROOT`). Tree objects share the repository's object store; require the reviewer child to run `git -C "$FD_ROOT" diff --binary <tree-before> <tree-after>` to produce/read the delta; the parent uses only `diff --stat` to detect empty changes. Worker commits and staging state do not affect it; never substitute a SHA range or working-tree diff.
82
80
 
83
81
  Substitute a shell-quoted checkout path for `{{CHECKOUT}}` and run the entire block. Stop review dispatch on a nonzero exit and report the shell error. The block reads the live index, writes only a scratch index and tree object, and preserves checkout status.
84
82
 
@@ -93,7 +91,7 @@ rm -f "$FD_INDEX"
93
91
  exit "$FD_STATUS"
94
92
  ```
95
93
 
96
- Omit the delta for whole-diff re-reviews. Otherwise omit it only when the prior tree is genuinely unavailable after a fresh-session resume; the reviewer then treats the task's whole diff as the delta. On an empty delta (including ignored-only repairs), dispatch no re-review: count a failed attempt under [When a Subagent Fails](#when-a-subagent-fails), resend the prior report with "your fix changed no tracked file", and stop after the existing two-attempt limit.
94
+ Omit the delta for whole-diff re-reviews. During implement, missing prior review-tree transcript lines take Recovery's stop-note path; never reconstruct dynamic state from reports. On an empty delta (including ignored-only repairs), dispatch no re-review: count a failed attempt under [When a Subagent Fails](#when-a-subagent-fails), resend the prior report path with "your fix changed no tracked file", and stop after the existing two-attempt limit.
97
95
 
98
96
  ## Implementer Status
99
97
 
@@ -106,7 +104,7 @@ Every implementer dispatch returns one of:
106
104
  | `NEEDS_CONTEXT` | Implementer needs information you have | For a spec-defect citation, take the amendment route below first. Resolve fact asks per [lookup handling](./stop-note.md). For decisions under amend permission, follow [Implementer-failure stops](reference/fix-loop.md#implementer-failure-stops); otherwise answer and re-dispatch or escalate to the user. |
107
105
  | `BLOCKED` | Cannot proceed (missing dependency, spec contradicts code, environment broken) | For a spec-defect citation, take the amendment route below first. Resolve fact asks per [lookup handling](./stop-note.md). For decisions under amend permission, follow [Implementer-failure stops](reference/fix-loop.md#implementer-failure-stops); otherwise diagnose and re-dispatch or escalate to the user. |
108
106
 
109
- Classify each question: treat a question whose candidate answers are each edits to the spec, plan, or an approved rule as an amendment batch per [amendment-surface.md](../brainstorming/reference/amendment-surface.md), never a decision. Treat a drafted AC row text correction backed by quoted implementer evidence (test, assertion, or code line) as an amend; record it in the granted `amend:` audit body. Stop for redraws: ticket rows, row add/remove, reviewer-only or taste objections, problem changes, or component boundary changes. Decode the `**Amend-grant:**` value through that surface's Standing grants. With amend permission, apply each item's `recommended` (`accept` or named `alt-n`), print `amended the spec: <title> - <what>`, and complete section 5's plan-writer amend dispatch, `plan_check`, tracker update, and one `amend:` commit in the same turn; skip reviewer, menu, and confirmation turns. Without permission (including absent or `none`), retain the surface's menu and escalation/redraw routing. For remaining questions, classify artifact location, value, or existence as a fact ask; scope and option choices as decisions; another-round approval as a decision only with no funded round left.
107
+ Classify each question: treat a question whose candidate answers are each edits to the spec, plan, or an approved rule as an amendment batch per [amendment-surface.md](../brainstorming/reference/amendment-surface.md), never a decision. Treat a drafted AC row text correction backed by quoted implementer evidence (test, assertion, or code line) as an amend through the delegated amendment route; record it in the granted `amend:` audit body. Stop for redraws: ticket rows, row add/remove, reviewer-only or taste objections, problem changes, or component boundary changes. Execute the delegated amendment reference above before other routing, preserving Standing grants decoding, recommended-choice application without reviewer, menu or confirmation turns under amend permission, and the same-turn plan-writer apply, parent `plan_check`, tracker update, printed amendment and single `amend:` commit; without permission retain the surface's menu and escalation/redraw routing. For remaining questions, delegate artifact location, value or existence as a fact ask; treat scope and option choices as decisions, and another-round approval as a decision only with no funded round left.
110
108
 
111
109
  Implementer prompt templates must instruct subagents to return one of these statuses explicitly.
112
110
 
@@ -120,7 +118,7 @@ Implementer prompt templates must instruct subagents to return one of these stat
120
118
 
121
119
  ## Leg routing
122
120
 
123
- Read `## Legs` in the home spec and [the leg contract](../brainstorming/reference/legs.md). Admit task `Leg:` through `plan_check`; absent means home. Repair `leg-unknown` in the plan, never membership. Keep the existing flat tracker and task indices.
121
+ Delegate `## Legs` reads in the home spec through [the leg contract](../brainstorming/reference/legs.md). Consume admitted task `leg` through `plan_check`; absent means home. Repair `leg-unknown` in the plan, never membership. Keep the existing flat tracker and task indices.
124
122
 
125
123
  Require leg-homogeneous waves. Split a mixed wave into consecutive single-leg waves preserving dependencies before dispatch. Select its owning worktree before capturing `WAVE_BASE_SHA`; use that root for isolation, dispatch `cwd`, `git -C`, snapshots, integration, scoped tests, in-place repair and wave commit. In the following recipes, substitute that root for every implementation worktree placeholder. Keep authoritative spec reads at the absolute home spec path, including companion SR snapshots.
126
124
 
@@ -128,38 +126,11 @@ Carry `Leg:` and combined spec/task `Rules:` as additive task context to every i
128
126
 
129
127
  ## Dispatch
130
128
 
131
- For the fan-out + worktree + patch-integration + conflict mechanics, see `dispatching-parallel-agents`.
132
-
133
- Pass the implementation worktree as top-level `cwd`. For per-patch spec reviews, use [Spec-review snapshots](#spec-review-snapshots) instead.
134
-
135
- ```ts
136
- // in-place repair worker
137
- subagent({ agent: "implementer", async: false, cwd: "<abs worktree path>", task: "<task text + context + prior report verbatim + SCOPED_TEST_COMMANDS + status protocol>" })
138
-
139
- // escalated fix round (Fix-Loop Rounds): same fix payload, model from gauntlet_setting({ key: "escalationLoop" }).implModel
140
- subagent({ agent: "implementer", model: "<implModel>", context: "fresh", async: false, cwd: "<abs worktree path>", task: "<the just-dispatched fix payload + prior review report verbatim>" })
141
-
142
- // spec compliance: per-patch reviews use the materialized snapshot cwd
143
- subagent({ agent: "spec-reviewer", async: false, cwd: "<abs review checkout path>", task: "<task text + patch diff + absolute spec path + task's Spec: anchors + Tests: block + Test: paths>" })
144
-
145
- // code quality
146
- subagent({ agent: "code-reviewer", async: false, cwd: "<abs worktree path>", task: "<diff range + SCOPED_TEST_COMMANDS (task commands; wave: union; whole-diff: none) + ask: production-ready?>" })
147
-
148
- // closing-loop conformance (origin vs deliverable) — its OWN dispatch, never fused with code quality
149
- // model: call gauntlet_setting({ key: "closureReview" }) first; use the returned model (omit model: if undefined to inherit) and maxFixRounds
150
- // If gauntlet_setting is unavailable, stop and report - never fall back to a manual bash/JSON settings merge.
151
- subagent({ agent: "conformance-reviewer", async: false, cwd: "<abs worktree path>", model: /* gauntlet_setting({ key: "closureReview" }).model, else omit to inherit */, task: "<spec path + verbatim original prompt + full diff vs main; per conformance-check.md>" })
152
- ```
153
-
154
- Prompt templates live alongside this SKILL.md:
155
-
156
- - `./implementer-prompt.md`
157
- - `./spec-reviewer-prompt.md`
158
- - `./code-quality-reviewer-prompt.md`
129
+ Use `dispatching-parallel-agents` for isolation and serial patch integration. Use the dispatch-contract one-step chain for every repair, CR and SR re-review, including escalated and funded rounds. Carry anchors, prior report path and scoped command arrays; never paste task or report contents. Resolve models only through the Model rules above. Keep verification conformance as its own dispatch under After All Tasks.
159
130
 
160
131
  ## The Wave Loop
161
132
 
162
- Run every plan task through this loop in a wave of N >= 1 tasks. Run waves in sequence; dispatch file- and runtime-resource-disjoint tasks concurrently in isolated worktrees, then integrate serially behind one test + review gate. For dependent tasks, include the previous task's implementation summary and relevant file paths in the next subagent's `task`; track outputs to pass them forward.
133
+ Run every plan task through this loop in a wave of N >= 1 tasks. Run waves in sequence; dispatch file- and runtime-resource-disjoint tasks concurrently in isolated worktrees, then integrate serially behind one test + review gate. For dependent tasks, include the previous task's structured status line and report path in the next subagent's `task`; track outputs to pass them forward.
163
134
 
164
135
  **Enter the implement phase first.** Before the first wave, call `phase_tracker({ action: "start", phase: "implement" })`; `plan_tracker` auto-completes it once every task across all waves is done.
165
136
 
@@ -175,19 +146,19 @@ For an `in-place` wave, dispatch one `implementer` with `cwd` the branch checkou
175
146
 
176
147
  **Per-wave loop:**
177
148
 
178
- 1. **Independence check.** Parse the wave's tasks' `Files:` blocks; assert pairwise-disjoint (mechanical, mirroring `wave-file-disjointness`: `Test`/`Test` on one path is not overlap, `Test` vs another task's `Create`/`Modify` is, `Modify`/`Modify` is). Runtime-resource disjointness (DB/schema, port, fixture, external service, shared temp path) is not machine-checkable here — trust the plan's wave grouping, which `writing-plans`' D5 contract guarantees. Either kind of overlap → the wave is mis-grouped; split it into one-task waves and note it.
179
- 2. **Start, then dispatch.** Record `WAVE_BASE_SHA` with `git -C <worktree> rev-parse HEAD` before dispatch; keep it fixed through the wave's commit. Mark every wave index `in_progress` in increasing index order. Run the once-per-phase preflight below before dispatching exactly one initial chain (including one-task waves).
180
- 3. **Read the result once.** Read statuses, verdicts, patches, and reports as specified below. All implementers `DONE` and all verdicts `COMPLIANT` -> step 4. Any other outcome -> [Chain stopped or failed](#chain-stopped-or-failed). The ticket's `FAIL` means a spec gap (`NEEDS_REWORK`), not a structured verdict or an SR `stopOn` condition.
149
+ 1. **Independence check.** Consume the manifest tasks' `files` arrays; assert pairwise-disjoint (mechanical, mirroring `wave-file-disjointness`: `Test`/`Test` on one path is not overlap, `Test` vs another task's `Create`/`Modify` is, `Modify`/`Modify` is). Runtime-resource disjointness (DB/schema, port, fixture, external service, shared temp path) is not machine-checkable here - trust the plan's wave grouping, which `writing-plans`' D5 contract guarantees. Either kind of overlap → the wave is mis-grouped; split it into one-task waves and note it.
150
+ 2. **Start, then dispatch.** Record and print `wave <w> base <sha>` from `WAVE_BASE_SHA` captured with `git -C <worktree> rev-parse HEAD` before dispatch; keep it fixed through the wave's commit. Mark every wave index `in_progress` in increasing index order. Run the once-per-phase preflight below before dispatching exactly one initial chain (including one-task waves).
151
+ 3. **Read the result once.** Consume statuses, verdicts, and artifact paths from structured JSON as specified below. All implementers `DONE` and all verdicts `COMPLIANT` -> step 4. Any other outcome -> [Chain stopped or failed](#chain-stopped-or-failed). The ticket's `FAIL` means a spec gap (`NEEDS_REWORK`), not a structured verdict or an SR `stopOn` condition.
181
152
  4. **Integrate.** Run `git -C <worktree> apply --index <patch-path>` for each accepted task's patch sequentially. This stages additions as well as tracked changes for review. On an apply failure, drop that task from the wave; finish steps 5-7 for the survivors, then re-dispatch the dropped task as a one-task wave from the new committed HEAD. With zero surviving patches, skip steps 5-7 and retry the failed task from the unchanged clean HEAD under [When a Subagent Fails](#when-a-subagent-fails)'s two-attempt limit; dispatch no empty review or commit. Keep its tracker index `in_progress` until its own wave commits.
182
- 5. **Test gate.** Run the wave's `SCOPED_TEST_COMMANDS` (union of its tasks' `Tests:` commands) on the integrated tree as `(cd "<worktree>" && <command>)` for each command — the full verification set is the verify phase's job, run once. On failure, dispatch one plain in-place `implementer` in the branch checkout with the failing output, the owning task's full text, and the wave's `SCOPED_TEST_COMMANDS`, under [When a Subagent Fails](#when-a-subagent-fails), then rerun the scoped gate. After the repaired tree passes, stage repair deliverables with `git -C <worktree> add -A` and dispatch spec review for every affected task against the integrated checkout before the initial CR; prior SR acceptance does not cover the repair. Pass each affected task's full text, absolute spec path, `Spec:` anchors, `Tests:` block, and `- Test:` paths; record its review tree per [Fix delta](#fix-delta). Resolve SR findings through [Fix-Loop Rounds](#fix-loop-rounds), with repairs in place and the scoped gate rerun. Never dispatch a nested wave from this dirty checkout: children cannot see integrated siblings from the old HEAD.
183
- 6. **Quality review.** CR binds to the wave: exactly one **initial** code-review dispatch per code-touching wave, over the integrated wave diff - never per task within a wave, never batched across waves. Subsequent dispatches within the wave are re-reviews triggered only by findings, per Fix-Loop Rounds. Pass the wave's `SCOPED_TEST_COMMANDS`, `BASE_SHA: <WAVE_BASE_SHA>`, and `HEAD_SHA: WORKTREE` per `code-quality-reviewer-prompt.md`; the review reads the staged and unstaged integrated diff, not a commit range. On findings, fix and re-review per `/skill:requesting-code-review` and [Fix-Loop Rounds](#fix-loop-rounds). Dispatch repairs as plain in-place workers in the branch checkout, never nested waves from the dirty checkout. Carry the report verbatim and no commit or staging instruction in the repair payload. Before every CR dispatch and every SR/CR re-review, run `git -C <worktree> add -A` so all deliverables appear in the whole diff; record the review tree per [Fix delta](#fix-delta). Preserve `WAVE_BASE_SHA` and `HEAD_SHA: WORKTREE` through every re-review and escalated in-place repair. Skip CR for doc-only waves (SR-only per the commit precondition below).
184
- 7. **Commit and complete the wave.** After CR accepts (SR alone for doc-only waves), fold worker commits and all remaining changes into one durable wave commit: `git -C <worktree> reset --soft "$WAVE_BASE_SHA" && git -C <worktree> add -A && git -C <worktree> commit -m <message>`. Then mark the wave's existing indices `complete`. Stop on an empty commit instead of completing tasks. Leave a clean tree so the next wave's children see the integrated work.
153
+ 5. **Test gate.** Run each element of the manifest tests union separately on the integrated tree as `(cd "<worktree>" && <command>) >"<REPORT_DIR>/gate-<i>.log" 2>&1`; retain its exit status. Keep full verification in verify. On failure, dispatch one one-step in-place `implementer` in the branch checkout with the failed-output paths, the owning task's anchors, and the wave's `SCOPED_TEST_COMMANDS`, under [When a Subagent Fails](#when-a-subagent-fails), then rerun the scoped gate. After the repaired tree passes, stage repair deliverables with `git -C <worktree> add -A` and dispatch spec review for every affected task against the integrated checkout before the initial CR; prior SR acceptance does not cover the repair. Pass each affected task's planPath, anchors and absolute home spec path; record its review tree per [Fix delta](#fix-delta). Resolve SR findings through [Fix-Loop Rounds](#fix-loop-rounds), with repairs in place and the scoped gate rerun. Never dispatch a nested wave from this dirty checkout: children cannot see integrated siblings from the old HEAD.
154
+ 6. **Quality review.** CR binds to the wave: exactly one **initial** code-review dispatch per code-touching wave, over the integrated wave diff - never per task within a wave, never batched across waves. Subsequent dispatches within the wave are re-reviews triggered only by findings, per Fix-Loop Rounds. Pass the wave's `SCOPED_TEST_COMMANDS`, `BASE_SHA: <WAVE_BASE_SHA>`, and `HEAD_SHA: WORKTREE` per `code-quality-reviewer-prompt.md`; the review reads the staged and unstaged integrated diff, not a commit range. On findings, fix and re-review per `/skill:requesting-code-review` and [Fix-Loop Rounds](#fix-loop-rounds). Dispatch repairs as plain in-place workers in the branch checkout, never nested waves from the dirty checkout. Carry the report path and no commit or staging instruction in the repair payload. Before every CR dispatch and every SR/CR re-review, run `git -C <worktree> add -A` so all deliverables appear in the whole diff; record the review tree per [Fix delta](#fix-delta). Preserve `WAVE_BASE_SHA` and `HEAD_SHA: WORKTREE` through every re-review and escalated in-place repair. Skip CR for doc-only waves (SR-only per the commit precondition below).
155
+ 7. **Commit and complete the wave.** After CR accepts (SR alone for doc-only waves), fold worker commits and all remaining changes into one durable wave commit: `git -C <worktree> reset --soft "$WAVE_BASE_SHA" && git -C <worktree> add -A && git -C <worktree> commit -m <message>`. Then mark the wave's existing indices `complete`. Execute each explicit manifest `orchestrator` instruction once at this completed-wave boundary before the next dispatch. Limit actions to `plan_tracker`, `phase_tracker`, `gauntlet_setting`, named git operations, observed-value forwarding or delegated amendments. Persist measured values only from structured output through delegated amendments. Emit a stop note quoting unknown action text. Ignore ordinary primary-directed task prose. Stop on an empty commit instead of completing tasks. Leave a clean tree so the next wave's children see the integrated work.
185
156
 
186
- **Two-stage review is preserved:** spec review per task (pre-integration, dispatched `spec-reviewer` — not inline), quality review per wave (post-integration). A wave commit requires one spec-review verdict per accepted task, plus one code-review verdict on the integrated diff for waves that touch code. A doc-only wave (every task's `Files:` block documentation-only, per `writing-plans`' Wave Grouping) is SR-only — the CR gate does not apply.
157
+ **Two-stage review is preserved:** spec review per task (pre-integration, dispatched `spec-reviewer` - not inline), quality review per wave (post-integration). A wave commit requires one spec-review verdict per accepted task, plus one code-review verdict on the integrated diff for waves that touch code. A doc-only wave (every task's `Files:` block documentation-only, per `writing-plans`' Wave Grouping) is SR-only - the CR gate does not apply.
187
158
 
188
- **Dependent context across waves:** wave N+1 tasks branch from a HEAD containing wave N, so they see the code; still forward wave N's task summaries into wave N+1 prompts.
159
+ **Dependent context across waves:** wave N+1 tasks branch from a HEAD containing wave N, so they see the code; still forward wave N's status lines and report paths into wave N+1 prompts.
189
160
 
190
- **Caveat:** each task must be independently runnable and verifiable in a fresh worktree — no reliance on uncommitted local state. `pi-cohort` symlinks `node_modules`; repos needing other per-worktree setup must account for it.
161
+ **Caveat:** each task must be independently runnable and verifiable in a fresh worktree - no reliance on uncommitted local state. `pi-cohort` symlinks `node_modules`; repos needing other per-worktree setup must account for it.
191
162
 
192
163
  Run this guard once per implement phase before the first wave. Stop on any error before dispatch; read the peer floor from the installed gauntlet package, not the consumer repository.
193
164
 
@@ -240,62 +211,53 @@ Pass the implementation worktree's absolute path as top-level `cwd`. Per-task `c
240
211
  REPORT_DIR=$(mktemp -d)
241
212
  ```
242
213
 
243
- ```ts
244
- IMPLEMENTER_STATUS_SCHEMA = { type: "object", required: ["status"], additionalProperties: true,
245
- properties: { status: { type: "string", enum: ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"] } } }
246
- ```
247
-
248
214
  ```ts
249
215
  subagent({
250
- async: false,
251
- context: "fresh",
252
- cwd: "<abs worktree path>",
216
+ async: false, context: "fresh", cwd: "<abs worktree path>",
253
217
  chain: [
254
- {
255
- parallel: [
218
+ { parallel: [
256
219
  { agent: "implementer", as: "impl_1", outputSchema: IMPLEMENTER_STATUS_SCHEMA,
257
- output: "<REPORT_DIR>/wave<w>-task1.md",
258
- task: "<full task text + owned files + SCOPED_TEST_COMMANDS + Tests: block + status protocol> pi-cohort saves your final report to the output path; do not write that file yourself, and it is not a concern about owned files." },
259
- // one entry per wave task, as: "impl_<n>" in plan index order
260
- ],
261
- worktree: true,
262
- concurrency: 4,
263
- stopOn: { path: "/status", in: ["BLOCKED", "NEEDS_CONTEXT", "DONE_WITH_CONCERNS"] },
264
- },
265
- {
266
- parallel: [
267
- { agent: "spec-reviewer", as: "sr_1",
268
- cwd: "{outputs.impl_1.treePath}",
269
- output: "<REPORT_DIR>/wave<w>-sr1.md",
270
- acceptance: { level: "none", reason: "the parent reads each SR Verdict: line; review trees are staged by design" },
271
- task: "<full task text + absolute spec path (in the implementation worktree) + Spec: anchors + Tests: block + Test: paths> The patch under review is the file at {outputs.impl_1.patchPath}; the working tree you run in already has it applied. The implementer's report is at <REPORT_DIR>/wave<w>-task1.md; read it for the 'What Implementer Claims They Built' section." },
272
- // one entry per wave task, paired by index
273
- ],
274
- concurrency: 4,
275
- },
220
+ output: "<REPORT_DIR>/wave<w>-task1.md", outputMode: "file-only",
221
+ task: "planPath: <absolute plan>; anchor: ### Task N:; Spec: <absolute home spec>; SCOPED_TEST_COMMANDS: <this task's manifest tests; none when empty>. pi-cohort saves your final report to the output path; do not write that file yourself, and it is not a concern about owned files." },
222
+ // one item per task in plan index order
223
+ ], worktree: true, concurrency: 4,
224
+ stopOn: { path: "/status", in: ["BLOCKED", "NEEDS_CONTEXT", "DONE_WITH_CONCERNS"] } },
225
+ { parallel: [
226
+ { agent: "spec-reviewer", as: "sr_1", cwd: "{outputs.impl_1.treePath}",
227
+ output: "<REPORT_DIR>/wave<w>-sr1.md", outputMode: "file-only", outputSchema: SPEC_VERDICT_SCHEMA,
228
+ acceptance: { level: "none", reason: "the parent takes each SR verdict from the chain's ## Outputs structured JSON; review trees are staged by design" },
229
+ task: "planPath: <absolute plan>; anchor: ### Task N:; Spec: <absolute home spec>. Patch: {outputs.impl_1.patchPath}; implementer report: <REPORT_DIR>/wave<w>-task1.md. Read the report and anchored task yourself; review the paired materialized tree, never run tests." },
230
+ // one paired item per task
231
+ ], concurrency: 4 },
276
232
  ],
277
233
  })
278
234
  ```
279
235
 
280
- Count the clean code-wave path as one chain plus one separate CR `subagent()` call; integration and tests remain parent actions between them. Use positional 1-based `impl_<n>` and `sr_<n>` names; map results to plan indices by wave position. Keep `context`, `async`, and top-level `cwd` invocation-level; `worktree`, `concurrency`, and `stopOn` step-level; `as`, `outputSchema`, `cwd`, `output`, `acceptance`, and `task` per-task. Give the SR step neither `worktree` nor `stopOn`, and its tasks no `outputSchema`.
236
+ Keep `context`, `async` and `cwd` invocation-level; `worktree`, `concurrency`, `stopOn` step-level; `as`, `output`, `outputMode`, `outputSchema`, task cwd and acceptance item-level. For manifest `"mode":"in-place"`, use the branch checkout and omit `worktree: true`; pass the wave union as `SCOPED_TEST_COMMANDS` and skip patch integration and reset-soft folding. Give the SR step no worktree or stopOn. Keep snapshot-backed spec reviews and code review free of acceptance overrides. Read the dispatch-contract schemas now before using the recipe.
281
237
 
282
- Tell SR to start from diff hunks carrying `file:line`, read every touched file in full from its materialized tree, read deleted files from `WAVE_BASE_SHA`, and never run tests. Pass the authoritative spec's absolute implementation-worktree path; SR reads the anchored ranges itself (never inline excerpts; authority hierarchy in `./spec-reviewer-prompt.md`; anchor-less tasks are task-text-only). Output references resolve only in `task` strings and `cwd` (`treePath` only), never `reads:`; paste no diff into the chain payload. Rely on pi-cohort's `structured_output` injection only for implementers carrying `outputSchema`; the runtime orders an enabled acceptance report before that call. Keep SR schema-free because no `stopOn` reads its verdict. Disable acceptance on each initial chained SR task with `none` and a nonempty reason because the parent reads each `Verdict:` line and review trees are staged by design: risky-word inference precedes read-only inference, non-none explicit levels only raise the inferred level, and `checked` or higher requires no staged files; snapshot-backed spec reviews and code review carry no `acceptance` field. Keep prompts and persona vocabularies unchanged.
283
-
284
- Read the tool-result text, not `details`: read implementer statuses from fenced JSON in `## Outputs` and the `## Stop` line; read SR verdicts from the `Verdict:` line of each SR `output:` report, one of `COMPLIANT`, `NEEDS_REWORK`, or `OUT_OF_SCOPE_CHANGES`. Read patch locations from `Artifacts:`: `<Artifacts dir>/worktree-diffs/step-0/task-<i>-implementer.patch`, with 0-based wave position `<i>`. Use these artifact patches for integration and later repairs. Exit-0 reports are the known `output:` files. A nonzero task has no `output:` file and no bound output. Recover its prose from its session `subagent-artifacts` output file (`<runId>_implementer_<index>_output.md`, defined by pi-cohort `src/shared/artifacts.ts`), matching the run/task identity in the result or session transcript. Use the same source-defined per-agent naming for a failed reviewer. Do not use the chain's empty `parallel-0/` directories for failed prose. If artifacts are disabled, missing, or cannot be unambiguously matched, enter [When a Subagent Fails](#when-a-subagent-fails) with the visible diagnostic; never invent a status. Keep SR's large-wave `outputMode: "file-only"` hint; read the report itself, not its `Output saved to:` pointer. Carry its full contents verbatim under `## Previous review report (re-review trigger)` on re-review.
238
+ Read the tool-result text, not `details`: take statuses and verdicts from fenced `structured` JSON in `## Outputs` and `## Stop`, never from output reports or `Output saved to:` pointers. Preserve SR enums `COMPLIANT`, `NEEDS_REWORK`, `OUT_OF_SCOPE_CHANGES`. Read `Artifacts:` patch locations at `<Artifacts dir>/worktree-diffs/step-0/task-<i>-implementer.patch` (zero-based wave position); keep known output report paths. After each observed result print `wave <w> task <n> <status|verdict> <value> report <path> patch <path>`; omit no observations and invent no verdict or patch. Print `wave <w> review <k> tree <path>` at each materialized review-tree capture. Use paths for routing only.
285
239
 
286
240
  ### Chain stopped or failed
287
241
 
288
- Route the result already read in step 3; retain all successful sibling patches and verdicts. Inspect failed tasks regardless of whether `## Stop` is also present: pi-cohort evaluates the stop condition before checking sibling failures, so both can coexist. Read exit-0 statuses from `## Outputs` when present or their `output:` reports; recover failed-task prose using the session-artifact rule above, including its unavailable-artifact fallback. Treat `## Stop` as a matched exit-0 status, not proof that every sibling succeeded. For `DONE_WITH_CONCERNS` alongside a nonzero `BLOCKED`, judge the concerns, diagnose the failed task, and retain accepted siblings:
242
+ Retain accepted patches and structured verdicts; never rerun accepted siblings and never repeat the initial wave chain. Inspect failed tasks even alongside `## Stop`: a matched stop precedes sibling-error checking. A required output missing or rejected is a failed task; siblings remain valid. Route anchorUnreadable through the two-attempt failure rule. `REJECT` stops. A completed chain with SR gaps repairs only the affected tasks.
243
+
244
+ When `## Outputs` is missing, or a task's structured JSON is absent, delegate artifact diagnosis with this sequential exception. Give the child `Artifacts:`, all known saved output paths and session-artifact locations, matched by run/task identity. The diagnosis child alone reads `<runId>_implementer_<index>_output.md` under session subagent-artifacts and source-defined failed-reviewer filenames; never use empty parallel-0 directories. Save its own report as well.
245
+
246
+ ```ts
247
+ subagent({ async: false, context: "fresh", cwd: "<owning checkout>",
248
+ chain: [{ task: "Diagnose <run/task identities>; Artifacts: <dir>; known reports: <paths>; session artifacts: <locations>. Return compact statuses and retry/repair/stop; never invent a verdict.",
249
+ output: "<REPORT_DIR>/wave<w>-diagnosis.md", outputMode: "file-only", outputSchema: DIAGNOSIS_SCHEMA,
250
+ stopOn: { path: "/decision", in: ["retry", "repair", "stop"] } }]
251
+ })
252
+ ```
253
+
254
+ Omit agent on this sequential step; use no parallel item. Route from the diagnosis JSON and existing status matrix with bounded retries; missing/ambiguous artifacts or delegated failure stop with the visible diagnostic, not recursive diagnosis. Retain all accepted siblings. Dispatch only accepted patches without a verdict through one-step SR fan-out against snapshots. A missing/empty accepted patch takes When a Subagent Fails, not an unchanged review.
289
255
 
290
- | Outcome | Recovery |
291
- |---|---|
292
- | Exit-0 stop (`## Stop`) with no failed siblings | Siblings finished, statuses remain in `## Outputs`, and no SR step ran. Judge `DONE_WITH_CONCERNS`, handle `NEEDS_CONTEXT` and `BLOCKED` per the status table, then snapshot accepted patches and use the ordinary SR fan-out below. |
293
- | Chain error, with or without `## Stop` | Identify and diagnose every failed task from the result, including prose `**Status:**` / `Verdict:` recovered through the session-artifact rule above. Completion-guard failure with no edits, rejected/missing `structured_output`, failed `treePath`, and sibling process failure all take this route. Handle a recoverable `BLOCKED` or `NEEDS_CONTEXT` through its status matrix even when that unaccepted task has no patch. Route a task with no recoverable status, or an accepted task with a missing/empty patch, to [When a Subagent Fails](#when-a-subagent-fails) with the visible diagnostic; never invent a status or review an unchanged tree. Retain exit-0 SR verdicts obtained in a materialized tree; dispatch only accepted patches without a verdict. Successful siblings are never re-run. |
294
- | Completed chain with `NEEDS_REWORK` or `OUT_OF_SCOPE_CHANGES` | Repair only those tasks using the spec-gap loop below. Preserve passing sibling patches/verdicts. |
256
+ For a pre-integration SR gap, reconstruct its original patch snapshot at WAVE_BASE_SHA and capture tree-before. Dispatch only the affected implementer through a one-step carrier, with isolated worktree for an ordinary wave and previous report path plus prior artifact patch. Give isolated spec-gap redispatch only its own task's `tests` as `SCOPED_TEST_COMMANDS`, or `none` when empty. Materialize its replacement patch in a fresh detached WAVE_BASE_SHA snapshot and capture tree-after. Stop and retain setup evidence on snapshot/tree failure. Re-review through a one-step SR carrier with the saved report path under `## Previous review report (re-review trigger)`, trajectory block and `## Fix delta` tree pair. Replace only that patch after acceptance. For in-place waves, keep every repair and SR in the branch checkout, without nested worktrees or patch replacement.
295
257
 
296
- Parse each `DONE`/`BLOCKED`/etc. (see [Implementer Status](#implementer-status)) **first**. Then **dispatch a `spec-reviewer` per accepted patch** (`DONE`, or a `DONE_WITH_CONCERNS` you proceeded with) still missing a verdict in one parallel fan-out - `context: "fresh"`, each task's `cwd` = its [Spec-review snapshot](#spec-review-snapshots), **no `worktree` flag** (read-only) - each passed its full task text, the returned **patch diff**, the absolute spec path, and the task's `**Spec:**` anchors, plus its `**Tests:**` block and `- Test:` paths as contract. SR reads the anchored ranges itself (never inline excerpts; authority hierarchy in `./spec-reviewer-prompt.md`; anchor-less tasks are task-text-only). Review starts from the diff (its hunks carry `file:line`) and reads each touched file in full; test execution is never the reviewer's job (step 5 runs the wave's `SCOPED_TEST_COMMANDS`). Inline verdicts are fine at normal wave sizes; large waves use `output:` + `outputMode: "file-only"`; read the full report file itself.
258
+ ### Recovery
297
259
 
298
- **Re-dispatch by cause:** Before fixing a chain-run SR's `NEEDS_REWORK` or `OUT_OF_SCOPE_CHANGES`, reconstruct the original artifact patch's snapshot from `WAVE_BASE_SHA` and record its tree-before per [Fix delta](#fix-delta); the chain's own trees are already removed. Route `BLOCKED`/`NEEDS_CONTEXT` per the [Implementer Status](#implementer-status) matrix; a **spec gap** re-dispatches only that implementer using a one-entry `tasks` array with invocation-level `worktree: true`, `context: "fresh"`, and implementation `cwd`, carrying the artifacts patch + full SR report verbatim. Materialize the replacement patch in a new detached `WAVE_BASE_SHA` checkout with `git apply --index` per [Spec-review snapshots](#spec-review-snapshots); on setup or tree-capture failure, stop dispatch and retain the failed snapshot directory and shell output for diagnosis. After successful setup, record tree-after in that replacement snapshot before dispatching one plain re-review with `## Previous review report (re-review trigger)`, the trajectory block, and `## Fix delta`. The new patch supersedes the old at step 4. Loop until accepted + spec compliant, within [Fix-Loop Rounds](#fix-loop-rounds). Never dispatch a second chain in the same wave.
260
+ Recover static data with `plan_check({ planPath })` and `plan_tracker({ action: "status" })`. Recover dynamic state only from the transcript templates above and `funded round <k> of <N> for task <n>`. For an `in_progress` wave with missing transcript lines, emit a stop note naming the wave and missing facts. Treat presence of all transcript line categories as not sufficient evidence to dispatch: a funded-round line records spending before dispatch, not its outcome. On a missing terminal funded-worker outcome or repair state, stop naming those facts and retain observed spending. Continue only when terminal worker/review observations and recorded tree object IDs establish the next operation; otherwise stop. Never infer integration, redispatch interrupted workers, or reset spending. Preserve WAVE_BASE_SHA, prior reports, review trees, verdicts and funded counts from observed lines.
299
261
 
300
262
  ## Spec-review snapshots
301
263
 
@@ -315,20 +277,20 @@ git -C "$SR_TREE" apply --index "$SR_PATCH" || exit 1
315
277
  printf 'snapshot: %s\n' "$SR_TREE"
316
278
  ```
317
279
 
318
- Record its review tree per [Fix delta](#fix-delta) before every parent-dispatched SR, keyed by task. Use the printed snapshot path as that spec-review task's `cwd` and whole-file read root. Keep the authoritative spec's absolute path in the implementation worktree. Pass the patch diff as before; the snapshot contains this task's changed and added files, with deleted files absent. Read deleted files from `WAVE_BASE_SHA` when the review needs their prior contents. Dispatch read-only, with no `worktree` flag. On snapshot setup or tree-capture failure, or a missing snapshot path, stop dispatch and retain the failed snapshot directory and shell output for diagnosis; dispatch no review and perform no snapshot cleanup. Save each snapshot-backed review's terminal report to its `output:` path, read it, then remove that review's snapshot with `git -C <implementation-worktree> worktree remove --force <snapshot-path>`. Keep every snapshot used as a reviewer `cwd` until that terminal report is saved; recording its tree never authorizes early cleanup. Remove a reconstruction used only to record tree-before after capturing its tree, since no reviewer runs there. Recreate from the replacement patch for each pre-integration re-review; on a failed recreate, stop dispatch and retain that snapshot directory and shell output, like any setup failure. Post-integration SR reviews the implementation worktree directly.
280
+ Record its review tree per [Fix delta](#fix-delta) before every parent-dispatched SR, keyed by task. Use the printed snapshot path as that spec-review task's `cwd` and whole-file read root. Keep the authoritative spec's absolute path in the implementation worktree. Pass the patch path; the snapshot contains this task's changed and added files, with deleted files absent. Read deleted files from `WAVE_BASE_SHA` when the review needs their prior contents. Dispatch read-only, with no `worktree` flag. On snapshot setup or tree-capture failure, or a missing snapshot path, stop dispatch and retain the failed snapshot directory and shell output for diagnosis; dispatch no review and perform no snapshot cleanup. Save each snapshot-backed review's terminal report to its `output:` path, consume its structured terminal result, then remove that review's snapshot with `git -C <implementation-worktree> worktree remove --force <snapshot-path>`. Keep every snapshot used as a reviewer `cwd` until that terminal report is saved; recording its tree never authorizes early cleanup. Remove a reconstruction used only to record tree-before after capturing its tree, since no reviewer runs there. Recreate from the replacement patch for each pre-integration re-review; on a failed recreate, stop dispatch and retain that snapshot directory and shell output, like any setup failure. Post-integration SR reviews the implementation worktree directly.
319
281
 
320
282
  ## When a Subagent Fails
321
283
 
322
284
  **You are the orchestrator. You do NOT write code.**
323
285
 
324
- 1. **Attempt 1:** dispatch a NEW fix subagent with the error output, the original task, and specific instructions about what went wrong.
286
+ 1. **Attempt 1:** dispatch a NEW fix subagent with error-output paths, the original task anchors, and specific instructions about what went wrong.
325
287
  2. **Attempt 2:** if attempt 1 also fails, dispatch one more with a simplified scope or different approach.
326
288
  3. **After 2 failed attempts:** under amend permission follow [Implementer-failure stops](reference/fix-loop.md#implementer-failure-stops) for one escalated attempt; otherwise STOP and report. Keep `in_progress` pending the human decision; completion requires the wave commit.
327
289
 
328
290
  **NEVER:**
329
291
 
330
292
  - Write code yourself to "help" or "finish up"
331
- - Fix the subagent's work inline — that pollutes your context and defeats fresh-subagent isolation
293
+ - Fix the subagent's work inline - that pollutes your context and defeats fresh-subagent isolation
332
294
  - Silently skip the failed task
333
295
  - Lower quality gates (skip reviews) because a task is "almost done"
334
296
 
@@ -337,25 +299,25 @@ Record its review tree per [Fix delta](#fix-delta) before every parent-dispatche
337
299
  For a coordinated run, execute verification and the following reviews for every leg in its own checkout against its owned original ACs and recorded verification contract, under home flow policy. Keep freshness per leg and route repairs to their owning checkout; repeat invalidated gates there. After every leg passes, finish the coordinated run once from home. Keep legacy and single-member execution free of companion loops, leg files, `legs:` briefs and `--leg` arguments.
338
300
 
339
301
  0. Call `phase_tracker({ action: "start", phase: "verify" })`. (The `implement` phase was started at execution start and auto-completes from `plan_tracker` once all tasks are done; this flow runs its own verify gate instead of `/skill:verification-before-completion`, so it must mark verify itself.)
340
- 1. **Parent full verification.** Run the complete plan-header `**Verification:**` command set foreground in the worktree via `(cd "<worktree>" && <command>)`: tests plus every declared lint, type, format, and build check. A failure must be repaired and the full set rerun successfully before the next step. Before dispatching a verification repair, reopen (`in_progress`) every existing plan-task index whose `Files:` ownership includes its touched files; leave unowned cross-cutting repair work in the verification report. Those indices stay `in_progress` through the successful full rerun **and** step 2's whole-diff review accepting the repair — that acceptance is their completion point, not the passing rerun. Commit any verification-produced tracked changes; use the resulting `HEAD_SHA` in the review task and include the commands/results in its existing `DESCRIPTION`.
341
- 2. **Whole-diff code review.** Only after passing full verification, dispatch one foreground whole-diff `code-reviewer` per `/skill:requesting-code-review` against that committed HEAD, with `SCOPED_TEST_COMMANDS: none`; the reviewer does not repeat the full suite. Act on the verdict per `/skill:requesting-code-review` Fix rounds; carry the final `SHIP` report's Minor finding lines verbatim into the closure block's `whole-diff minors:` section (`verification-before-completion/reference/conformance-check.md` "Closure / conformance"), or `whole-diff minors: none`. Before dispatching a review repair, reopen (`in_progress`) every existing plan-task index whose `Files:` ownership includes its touched files; leave unowned cross-cutting repair work in the review report. Mark each reopened index `complete` only once the repair is re-verified and the re-review accepts it — this is the same completion point step 1's reopened indices wait for, not an extra gate, and the gate order stays full verification -> whole-diff CR -> conformance. Any repair invalidates prior full verification, so rerun the full set successfully before the next gate.
342
- 3. **Close the loop — conformance check.** The review in step 2 is plan-vs-code (single-step); it inherits any requirement the plan already dropped.
302
+ 1. **Parent full verification.** Run the complete plan-header `**Verification:**` command set foreground in the worktree via `(cd "<worktree>" && <command>)`: tests plus every declared lint, type, format, and build check. A failure must be repaired and the full set rerun successfully before the next step. Before dispatching a verification repair, reopen (`in_progress`) every existing plan-task index whose `Files:` ownership includes its touched files; leave unowned cross-cutting repair work in the verification report. Those indices stay `in_progress` through the successful full rerun **and** step 2's whole-diff review accepting the repair - that acceptance is their completion point, not the passing rerun. Commit any verification-produced tracked changes; use the resulting `HEAD_SHA` in the review task and include the commands/results in its existing `DESCRIPTION`.
303
+ 2. **Whole-diff code review.** Only after passing full verification, dispatch one foreground whole-diff `code-reviewer` per `/skill:requesting-code-review` against that committed HEAD, with `SCOPED_TEST_COMMANDS: none`; the reviewer does not repeat the full suite. Act on the verdict per `/skill:requesting-code-review` Fix rounds; carry the final `SHIP` report's Minor finding lines verbatim into the closure block's `whole-diff minors:` section (`verification-before-completion/reference/conformance-check.md` "Closure / conformance"), or `whole-diff minors: none`. Before dispatching a review repair, reopen (`in_progress`) every existing plan-task index whose `Files:` ownership includes its touched files; leave unowned cross-cutting repair work in the review report. Mark each reopened index `complete` only once the repair is re-verified and the re-review accepts it - this is the same completion point step 1's reopened indices wait for, not an extra gate, and the gate order stays full verification -> whole-diff CR -> conformance. Any repair invalidates prior full verification, so rerun the full set successfully before the next gate.
304
+ 3. **Close the loop - conformance check.** The review in step 2 is plan-vs-code (single-step); it inherits any requirement the plan already dropped.
343
305
 
344
306
  **Happy-path run:** When the plan header carries a `**Happy path:**` line or the diff selects a row, `read` `reference/happy-path-run.md` at its absolute path beside this skill and follow its instructions. On an unreadable reference, stop with a blocking error; never reconstruct the runner.
345
307
 
346
- Before marking verify complete, dispatch a fresh-context **`conformance-reviewer`** — its **own** dispatch, never fused into the step-2 review — to confront the deliverable (code **and** docs) against the *origin* — the spec **and** the original prompt — per `verification-before-completion/reference/conformance-check.md`. Pass the spec path, the verbatim original prompt, the full diff, and - when a run happened - `Happy path: <abs path to $HP_DIR/summary.txt> (<outcome>)` (`<outcome>` = the outcome line without its `happy-path: ` prefix). Follow that reference for the partition rule, concern decomposition, and fix-loop mechanics; do not reimplement them here. The fix loop reuses durable `Gn` gap indices as defined in conformance-check.md; it never calls `phase_tracker`. Call `phase_tracker({ action: "complete", phase: "verify" })` only when the reference says the handoff is durably complete: either a current `CONFORMS` result, or a current `## Closure / conformance` inventory whose carried-open concerns all come from valid deferred gaps, including `recommended: fix` gaps carried open because a declared precondition made the fix loop unavailable (`maxFixRounds: 0`, or no eligible named-branch worktree). A started positive-cap fix loop that blocks, fails, or exhausts its rounds with an open `fix` gap is escalation, not completion; on escalation, do not complete verify, stop and report.
308
+ Before marking verify complete, dispatch a fresh-context **`conformance-reviewer`** - its **own** dispatch, never fused into the step-2 review - to confront the deliverable (code **and** docs) against the *origin* - the spec **and** the original prompt - per `verification-before-completion/reference/conformance-check.md`. Pass the spec path, the verbatim original prompt, the full diff, and - when a run happened - `Happy path: <abs path to $HP_DIR/summary.txt> (<outcome>)` (`<outcome>` = the outcome line without its `happy-path: ` prefix). Follow that reference for the partition rule, concern decomposition, and fix-loop mechanics; do not reimplement them here. The fix loop reuses durable `Gn` gap indices as defined in conformance-check.md; it never calls `phase_tracker`. Call `phase_tracker({ action: "complete", phase: "verify" })` only when the reference says the handoff is durably complete: either a current `CONFORMS` result, or a current `## Closure / conformance` inventory whose carried-open concerns all come from valid deferred gaps, including `recommended: fix` gaps carried open because a declared precondition made the fix loop unavailable (`maxFixRounds: 0`, or no eligible named-branch worktree). A started positive-cap fix loop that blocks, fails, or exhausts its rounds with an open `fix` gap is escalation, not completion; on escalation, do not complete verify, stop and report.
347
309
  4. Summarize what was implemented (tasks completed, files changed, test counts, code-review verdict). Emit the `## Closure / conformance` block exactly as defined in `verification-before-completion/reference/conformance-check.md`: it must open with the sentinel (`status: CONFORMS (0 open)` or `status: GAPS (N open)`, then `audited-base: <full HEAD SHA>`, then - exactly when a happy-path run happened - `happy-path: <value of the reviewer's Happy path: line from the final audit, the text after Happy path: >`), then carry the exact durable concern schema by reference with no renamed or reformatted fields. `finishing-a-development-branch` Step 3.5 consumes that block verbatim.
348
- 5. **Proceed to finishing — no confirmation prompt.** Once verify is complete per step 3's criterion, invoke `/skill:finishing-a-development-branch <abs worktree path>` immediately - the same absolute path every dispatch in this flow carried as `cwd`; finishing stops without it. Its Step 4 menu (PR / draft PR / squash / keep / discard) is the human gate; a separate "ready to finish?" prompt only stacks a second stop in front of it. Carried-open concerns are resolved there per concern via the `## Closure / conformance` block from step 4. Manual testing is a follow-up after the finishing choice (on `<base-branch>` after a squash-merge, or on the PR branch), never a reason to hold this gate.
310
+ 5. **Proceed to finishing - no confirmation prompt.** Once verify is complete per step 3's criterion, invoke `/skill:finishing-a-development-branch <abs worktree path>` immediately - the same absolute path every dispatch in this flow carried as `cwd`; finishing stops without it. Its Step 4 menu (PR / draft PR / squash / keep / discard) is the human gate; a separate "ready to finish?" prompt only stacks a second stop in front of it. Carried-open concerns are resolved there per concern via the `## Closure / conformance` block from step 4. Manual testing is a follow-up after the finishing choice (on `<base-branch>` after a squash-merge, or on the PR branch), never a reason to hold this gate.
349
311
 
350
- ## Red Flags — STOP
312
+ ## Red Flags - STOP
351
313
 
352
314
  - Writing code yourself instead of dispatching.
353
315
  - Pausing between tasks for anything other than `NEEDS_CONTEXT`, `BLOCKED`, a fix-loop escalation, a workflow warning, a redraw, or an amend with no standing grant.
354
316
  - Dispatching parallel implementers on overlapping files, on a shared mutable runtime resource, or without `worktree: true`.
355
- - Making a subagent read the plan, inlining spec excerpts to the spec reviewer, or dispatching with a `SCOPED_TEST_COMMANDS` value missing or not copied from the plan's `Tests:` bullets.
317
+ - Pasting task text, spec excerpts, or report contents into a dispatch, or opening the plan, spec, a report, or a source file in the primary
356
318
  - Dispatching `code-reviewer` before every in-scope spec-review verdict is ✅, or per task inside a wave.
357
319
  - Moving to the next task with either review still showing issues, or skipping the `Implementer Status` parse.
358
- - Second chain call in the same wave after a stop or a chain error - the retained results are the fan-out result; continue on the snapshot path.
320
+ - Repeating the initial wave chain after a stop or error instead of retaining accepted siblings and using one-step repair/re-review carriers.
359
321
  - Dispatching fix 3 without a reviewer-emitted `CONVERGING` verdict, or continuing past `STAGNANT` instead of escalating (or, on a funded re-review, stopping).
360
322
  - Running the full verification entrypoint, or any test command outside `SCOPED_TEST_COMMANDS`, during the implement phase.
361
323
  - Dispatching a repair before reopening the plan-task indices that own its files, whole-diff CR before parent verification passes, or conformance before the CR result is accepted.
@@ -365,17 +327,17 @@ For a coordinated run, execute verification and the following reviews for every
365
327
 
366
328
  **Required workflow skills:**
367
329
 
368
- - `/skill:using-git-worktrees` — set up isolation first (small changes can branch in place with user approval)
369
- - `/skill:writing-plans` — creates the plan this skill executes
370
- - `/skill:requesting-code-review` — review template for reviewer subagents
371
- - `/skill:finishing-a-development-branch <abs worktree path>` — invoked automatically once every gap is fixed (`CONFORMS`) or carried open
330
+ - `/skill:using-git-worktrees` - set up isolation first (small changes can branch in place with user approval)
331
+ - `/skill:writing-plans` - creates the plan this skill executes
332
+ - `/skill:requesting-code-review` - review template for reviewer subagents
333
+ - `/skill:finishing-a-development-branch <abs worktree path>` - invoked automatically once every gap is fixed (`CONFORMS`) or carried open
372
334
 
373
335
  **Subagents follow by default:**
374
336
 
375
- - TDD — runtime warnings on source-before-test. Implementer agents receive the three-scenario TDD instructions (new feature / modifying tested code / trivial) via agent profile and prompt template.
337
+ - TDD - runtime warnings on source-before-test. Implementer agents receive the three-scenario TDD instructions (new feature / modifying tested code / trivial) via agent profile and prompt template.
376
338
 
377
339
  ## Project overrides
378
340
 
379
- If a gauntlet overrides file exists - checked in order: `.pi/gauntlet-overrides.md`, `<repo root>/gauntlet-overrides.md`, `<repo root>/doc/gauntlet-overrides.md`; first found wins - read it once per session - a skill that already has the file's content in context from an earlier skill's read skips the read; a restored session has nothing in context and reads it. Read and apply `## conventions` whenever present, without a relevance judgment. Give this skill's named section precedence over conflicting `## conventions` rules. Use other relevant sections - by name match, by topic (routing, verification, worktrees, etc.), or by workflow convention - to override or extend the instructions above. Project-local `AGENTS.md` is already in context — check it for project-specific routing tables, service paths, and verification commands.
341
+ If a gauntlet overrides file exists - checked in order: `.pi/gauntlet-overrides.md`, `<repo root>/gauntlet-overrides.md`, `<repo root>/doc/gauntlet-overrides.md`; first found wins - read it once per session - a skill that already has the file's content in context from an earlier skill's read skips the read; a restored session has nothing in context and reads it. Read and apply `## conventions` whenever present, without a relevance judgment. Give this skill's named section precedence over conflicting `## conventions` rules. Use other relevant sections - by name match, by topic (routing, verification, worktrees, etc.), or by workflow convention - to override or extend the instructions above. Project-local `AGENTS.md` is already in context - check it for project-specific routing tables, service paths, and verification commands.
380
342
 
381
343
  The recognized headings, their readers, and the rules an override cannot change are listed in the [configuration front door](../../README.md#project-specific-overrides); an override extends or replaces the step it names and never lifts this skill's HARD CONSTRAINT or MUST text.
@@ -7,14 +7,19 @@ Use this template when dispatching a code quality reviewer subagent.
7
7
  **Only dispatch after spec compliance review passes.**
8
8
 
9
9
  ```
10
- Dispatch a subagent with the code-reviewer template:
11
- Use the template at ../requesting-code-review/code-reviewer.md
12
-
13
- DESCRIPTION: [wave summary, from implementers' reports; whole-diff review: implementation summary]
14
- PLAN_OR_REQUIREMENTS: [wave tasks from plan-file; whole-diff review: full plan/requirements]
15
- BASE_SHA: [WAVE_BASE_SHA recorded before worker dispatch; whole-diff review: committed implementation base]
16
- HEAD_SHA: [the literal WORKTREE for the integrated wave, including re-reviews; whole-diff review: committed HEAD]
17
- SCOPED_TEST_COMMANDS: [the union of the wave's tasks' Tests: commands; `none` for the whole-diff verify-phase review]
10
+ Dispatch one code-reviewer for the code-touching wave:
11
+ planPath: [absolute plan path]
12
+ anchor: "### Task N:"
13
+ anchors: [use instead of anchor for all tasks in the wave]
14
+ Spec: [absolute authoritative home spec path]
15
+ Work from: [integrated review checkout]
16
+ Implementer reports: [saved report paths]
17
+ BASE_SHA: [WAVE_BASE_SHA recorded before worker dispatch]
18
+ HEAD_SHA: [the literal WORKTREE for the integrated wave, including re-reviews]
19
+ SCOPED_TEST_COMMANDS: [dispatch-supplied union of scoped command values verbatim | none]
20
+
21
+ Read the selected task sections, Spec anchors, Tests:/via: and Files: Create:/Test: paths yourself. Derive Rules from the task and home-spec leg as your persona directs. Read the implementer reports by path; verify against the integrated diff.
22
+ Keep the report layout and emit structured output matching the persona contract, verdict and footer, including behaviourChange on every report. On an unreadable plan/anchor report REJECT with anchorUnreadable and the required Reasoning line.
18
23
  ```
19
24
 
20
25
  **In addition to standard code quality concerns, the reviewer should check:**
@@ -23,13 +28,14 @@ Dispatch a subagent with the code-reviewer template:
23
28
  - Is the implementation following the file structure from the plan?
24
29
  - Did this implementation create new files that are already large, or significantly grow existing files? (Don't flag pre-existing file sizes — focus on what this change contributed.)
25
30
 
26
- Read `Verdict:` and the footer lines from the report; `agents/code-reviewer.md` defines its format.
31
+ Keep inline callers of `../requesting-code-review/code-reviewer.md` unchanged; this local template carries the anchored SDD wave contract.
27
32
 
28
33
  ## Re-review: trajectory verdict
29
34
 
30
35
  Include the following in the reviewer's task text on every re-review, after
31
- the prior review report pasted verbatim under a
32
- `## Previous review report (re-review trigger)` heading:
36
+ the prior review report path under a
37
+ `## Previous review report (re-review trigger)` heading.
38
+ Read the saved report yourself; retain the supplied `## Fix delta` block:
33
39
 
34
40
  If your task contains a "Previous review report (re-review trigger)" section
35
41
  and you found issues, append exactly one more line after `Behaviour-change:` — this
@@ -6,24 +6,27 @@ Use this template when dispatching an implementer subagent.
6
6
  Dispatch a subagent with this prompt:
7
7
  description: "Implement Task N: [task name]"
8
8
  prompt: |
9
- You are implementing Task N: [task name]
9
+ You are implementing the selected task sections.
10
10
 
11
- ## Task Description
11
+ planPath: [absolute plan path]
12
+ anchor: "### Task N:"
13
+ anchors: [use instead of anchor for a multi-task repair]
14
+ Spec: [absolute authoritative home spec path]
15
+ Work from: [worker checkout]
12
16
 
13
- [FULL TEXT of task from plan - paste it here, don't make subagent read file]
17
+ SCOPED_TEST_COMMANDS: [dispatch-supplied scoped command values verbatim | none]
14
18
 
15
- ## Context
16
-
17
- [Scene-setting: where this fits, dependencies, architectural context, task-specific clarifications]
19
+ Read the selected task sections, Spec anchors, Tests:/via: and Files: Create:/Test: paths yourself. Derive Rules from the task and home-spec leg as your persona directs. Tests call the via: seam directly, not a wrapper or its internals. Create every Create: path at exactly that path.
18
20
 
19
- Work from: [directory]
21
+ ## Context
20
22
 
21
- SCOPED_TEST_COMMANDS: [only the task's Tests: command bullets, backticks stripped, verbatim; exclude via:, baseline:, and none: metadata | none]
23
+ [Dependencies and task-specific clarifications; for a dependent task, previous task's status line and report path]
24
+ Implementer report: [previous task report path when applicable]
22
25
 
23
- TEST_CONTRACT: [the task's **Tests:** block verbatim (commands, via:, baseline: bullets verbatim, none:) and its Files: Create:/Test: paths]
26
+ ## Previous review report (re-review trigger)
24
27
 
25
- Tests call the via: seam directly - not a wrapper, not the internals behind it.
26
- Create every Create: path at exactly that path.
28
+ [Repair only: prior review report path; omit this section on initial implementation]
29
+ Read the saved report yourself before repairing. Read any failing scoped-gate output from its supplied file path.
27
30
 
28
31
  Report test-contract evidence: one line per SCOPED_TEST_COMMANDS command - `met` (exit 0; quote the last output line) or `unmet <reason>`;
29
32
  one line per via: - `met <test file:line calling it>` or `unmet <reason>`; `none` when the block is `none:`.
@@ -35,5 +38,7 @@ Dispatch a subagent with this prompt:
35
38
  BLOCKED: Cannot complete the task.
36
39
  NEEDS_CONTEXT: Need information not provided.
37
40
 
41
+ Keep the report layout and emit structured output matching the persona contract and report status. On an unreadable plan/anchor report BLOCKED with anchorUnreadable and the required Reasoning line.
42
+
38
43
  Conduct (TDD scenarios, test economy, scope discipline, escalation, report shape) is your persona; this prompt carries only the task and its test scope.
39
44
  ```