pi-gauntlet 7.43.1 → 8.0.1

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +2 -2
  3. package/agents/plan-writer.md +3 -3
  4. package/agents/wave-reviewer.md +111 -0
  5. package/extensions/lib/phase-tracker-helpers.test.ts +7 -8
  6. package/extensions/lib/phase-tracker-helpers.ts +2 -5
  7. package/extensions/lib/plan-check.test.ts +45 -0
  8. package/extensions/lib/plan-check.ts +19 -7
  9. package/extensions/lib/telemetry-collect.test.ts +21 -1
  10. package/extensions/lib/telemetry-collect.ts +23 -1
  11. package/extensions/phase-tracker.test.ts +80 -73
  12. package/extensions/phase-tracker.ts +10 -13
  13. package/extensions/telemetry.test.ts +11 -5
  14. package/extensions/telemetry.ts +2 -2
  15. package/package.json +1 -1
  16. package/skills/brainstorming/reference/amendment-surface.md +9 -1
  17. package/skills/chase-bug/hotfix.md +1 -1
  18. package/skills/dispatching-parallel-agents/SKILL.md +2 -2
  19. package/skills/finishing-a-development-branch/reference/disposition-protocol.md +1 -1
  20. package/skills/gatekeep-pr/SKILL.md +1 -1
  21. package/skills/gatekeep-pr/reference/assessment.md +1 -1
  22. package/skills/gatekeep-pr/reference/sync.md +1 -1
  23. package/skills/loop-implementation/SKILL.md +8 -87
  24. package/skills/loop-implementation/reference/coordinated-legs.md +104 -0
  25. package/skills/requesting-code-review/SKILL.md +9 -9
  26. package/skills/requesting-code-review/{code-reviewer.md → wave-reviewer.md} +2 -2
  27. package/skills/subagent-driven-development/SKILL.md +124 -121
  28. package/skills/subagent-driven-development/reference/dispatch-contract.md +10 -9
  29. package/skills/subagent-driven-development/reference/implement-amendments.md +3 -1
  30. package/skills/subagent-driven-development/stop-note.md +4 -4
  31. package/skills/subagent-driven-development/wave-reviewer-prompt.md +55 -0
  32. package/skills/verification-before-completion/reference/conformance-check.md +2 -2
  33. package/skills/writing-plans/SKILL.md +7 -1
  34. package/skills/writing-plans/reference/plan-contract.md +6 -0
  35. package/agents/code-reviewer.md +0 -115
  36. package/agents/spec-reviewer.md +0 -121
  37. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +0 -67
  38. package/skills/subagent-driven-development/reference/fix-loop.md +0 -45
  39. package/skills/subagent-driven-development/spec-reviewer-prompt.md +0 -125
@@ -7,9 +7,9 @@ description: Use when executing an implementation plan in the current session (t
7
7
 
8
8
  # Subagent-Driven Development
9
9
 
10
- Execute a plan by dispatching a **fresh subagent per task**, with two-stage review after each: spec compliance first, then code quality.
10
+ Execute a plan by dispatching a **fresh subagent per task**, then review each integrated wave once for spec compliance and code quality.
11
11
 
12
- **Core principle:** Fresh subagent per task + two-stage review = high quality, fast iteration.
12
+ **Core principle:** Fresh subagent per task + one integrated wave review.
13
13
 
14
14
  If a tool result contains a ⚠️ workflow warning, stop immediately and address it before continuing.
15
15
 
@@ -17,18 +17,20 @@ Gauntlet execution dispatches are foreground: set top-level `async: false` on ev
17
17
 
18
18
  ## Orchestrator holds
19
19
 
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.
20
+ Keep 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 source facts during implement. Delegate plan/spec/task/source reads, including content-loading shell commands. Apply this boundary from implement start through completion; leave other phases and the loop engine unchanged.
21
+
22
+ Consume structured `status`, `verdict`, `maxSeverity`, `findingCount`, `findings`, `touchedTasks`, `trajectory`, `concerns`, `question` and `anchorUnreadable` first. Use a direct `read` with `limit: 300` only for unresolved `DONE_WITH_CONCERNS` concerns, `BLOCKED` / `NEEDS_CONTEXT` question evidence, or `FIX_FIRST` / `REJECT` findings needed for repair or a stop note. Read at most once per printed `report <path>` observation per wave; never paginate or use an offset past the bound. When the read does not reach the report's footer (its `Parallel-safe:` line; `TRAJECTORY:` on a re-review), re-dispatch the same wave-reviewer once with `Compact report: findings and footer only, at most 150 lines`. Read its saved report under the same bound; stop naming the oversized path on a second overflow. Never dispatch `scout`, `delegate` or another child to relay reports. Retain delegated source-fact lookup.
21
23
 
22
24
  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.
23
25
 
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.
26
+ Use primary shell coordination only: `rev-parse`, `status --porcelain`, `diff --stat`, `apply`, `reset --soft`, `add -A`, `commit`, `update-ref`, plus the marked preflight, repair-base 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.
25
27
 
26
28
  ## Continuous Execution
27
29
 
28
30
  **Do not pause to check in with the user between tasks.** The plan is already approved. Pause only when:
29
31
 
30
32
  - A subagent returns `NEEDS_CONTEXT` or `BLOCKED` (see [Implementer Status](#implementer-status))
31
- - An escalated round fails with no funded round left (stop note per [Fix-Loop Rounds](#fix-loop-rounds))
33
+ - An escalated round fails with no funded round left (stop note per [The Wave Loop](#the-wave-loop))
32
34
  - A ⚠️ workflow warning fires
33
35
 
34
36
  Reaching the end of the plan is not a pause: continue through verification and invoke `/skill:finishing-a-development-branch <abs worktree path>` as defined in [After All Tasks](#after-all-tasks-complete).
@@ -37,46 +39,17 @@ Periodic "should I continue?" prompts add latency without adding safety. The pla
37
39
 
38
40
  ## Prerequisites
39
41
 
40
- - The worktree path is known - from the `using-git-worktrees` Step 4 report in this session or the handoff brief's `worktree:` row - and is passed as the top-level dispatch `cwd`, except per-patch spec reviews use [Spec-review snapshots](#spec-review-snapshots). If no worktree path exists, stop and invoke `/skill:using-git-worktrees` first - implementation never lands directly on `main`. The process cwd is the primary checkout; nothing here changes it.
42
+ - The worktree path is known - from the `using-git-worktrees` Step 4 report in this session or the handoff brief's `worktree:` row - and is passed as the top-level dispatch `cwd`. If no worktree path exists, stop and invoke `/skill:using-git-worktrees` first - implementation never lands directly on `main`. The process cwd is the primary checkout; nothing here changes it.
41
43
  - Approved plan or clear task scope
42
44
  - `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.
43
45
 
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.
45
-
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.
47
-
48
- ## Fix-Loop Rounds
49
-
50
- Apply one rule to both review loops - spec-compliance and code-quality.
51
-
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.
53
-
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.
55
-
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.
57
-
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.
59
-
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.
61
-
62
- 1. **Review 1** (first review - no sentinel). Issues -> dispatch fix 1.
63
- 2. **Review 2** (re-review). Issues -> if `STAGNANT`, escalate now - no fix 2. Otherwise dispatch fix 2.
64
- 3. **Review 3** (re-review). Issues -> if the line reads `CONVERGING` and does not contain `max severity Critical` (spec reviews: `CONVERGING` alone), run the convergence exception: dispatch fix 3, then review 4. Any other outcome - `STAGNANT`, `DIVERGING`, a missing or malformed line, `max severity Critical` - escalate. Do not re-dispatch just to obtain the line.
65
- 4. **Review 4** (re-review, only after the exception). Issues -> escalate, whatever the verdict. The exception fires at most once per loop; verdicts never chain into a second grant.
66
-
67
- Every dispatched fix is verified by a re-review before escalation or task progression - the loop only ever exits on a clean review or an escalation.
68
-
69
- Read [reference/fix-loop.md](./reference/fix-loop.md) now for escalation and funded-round dispatch rules.
70
-
71
- **Worked examples:**
46
+ 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 wave reviews the wave union of `tests`. Preserve each array element as one command without splitting or joining command strings. Children read Tests metadata themselves.
72
47
 
73
- - Review-2 verdict `TRAJECTORY: STAGNANT (repeat of: unchecked error path in parser)` -> escalate now, before fix 2 - earlier than the ordinary budget.
74
- - Review-3 verdict `TRAJECTORY: CONVERGING (3 -> 1, max severity Moderate)` -> dispatch fix 3; if review 4 still finds issues, escalate.
75
- - Review-3 verdict `TRAJECTORY: CONVERGING (3 -> 2, max severity Critical)` or `TRAJECTORY: DIVERGING` or no `TRAJECTORY:` line -> escalate.
48
+ 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 wave review; an unreadable spec anchor blocks instead of falling back to task-only review.
76
49
 
77
50
  ## Fix delta
78
51
 
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.
52
+ Include a `## Fix delta` block in every wave 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 wave. Run it in the integrated branch checkout (`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.
80
53
 
81
54
  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.
82
55
 
@@ -91,7 +64,7 @@ rm -f "$FD_INDEX"
91
64
  exit "$FD_STATUS"
92
65
  ```
93
66
 
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.
67
+ 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 follow the transition table for escalation and funding.
95
68
 
96
69
  ## Implementer Status
97
70
 
@@ -99,10 +72,10 @@ Every implementer dispatch returns one of:
99
72
 
100
73
  | Status | Meaning | Orchestrator action |
101
74
  |---|---|---|
102
- | `DONE` | Implemented + tests pass + self-reviewed; work present in the worker's tree; the wave commit is step 7 | Proceed to spec review |
75
+ | `DONE` | Implemented + tests pass + self-reviewed; work present in the worker's tree; the wave commit follows SHIP | Proceed to integration and gate |
103
76
  | `DONE_WITH_CONCERNS` | Implemented + tests pass, but flagged a deviation or risk | Read concerns. If acceptable, proceed. If not, dispatch fix subagent. |
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. |
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. |
77
+ | `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 [takeable-decision ladder](#escalation-and-funding); otherwise answer and re-dispatch or escalate to the user. |
78
+ | `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 [takeable-decision ladder](#escalation-and-funding); otherwise diagnose and re-dispatch or escalate to the user. |
106
79
 
107
80
  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.
108
81
 
@@ -113,20 +86,20 @@ Implementer prompt templates must instruct subagents to return one of these stat
113
86
  - Omit `model:` so the operator's `subagents.agentOverrides.<agent>.model` pin applies, or else the child inherits the main loop.
114
87
  - Pass `model:` only a runtime-resolved `gauntlet_setting` value (`closureReview.model`, `escalationLoop.implModel`, `specCouncil.members[]`, `specCouncil.chair`) or a model the user named for that dispatch.
115
88
  - Read the main loop's own string from `$PI_PROVIDER`/`$PI_MODEL` with the bash tool only when a skill must bypass a persona's frontmatter `thinking` pin for cost or must pass an explicit fallback after a configured model is unreachable.
116
- - Omit `model:` when `closureReview.model` or `specCouncil.chair` is `undefined`; pass an `implModel` string verbatim, and stop with a note when `implModel` is `undefined` (Fix-Loop Rounds).
89
+ - Omit `model:` when `closureReview.model` or `specCouncil.chair` is `undefined`; pass an `implModel` string verbatim, and stop with a note when `implModel` is `undefined` (The Wave Loop).
117
90
  - Apply suffix edits such as `:low` only to a runtime-resolved string, never to a name the skill wrote; never write a provider or model name, tier tasks by cost, or swap a pinned model for a cheaper or stronger one.
118
91
 
119
92
  ## Leg routing
120
93
 
121
94
  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.
122
95
 
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.
96
+ 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.
124
97
 
125
- Carry `Leg:` and combined spec/task `Rules:` as additive task context to every implementer, spec-reviewer and code-reviewer, including repairs and re-reviews; require reading those files before acting. Resolve rules from the owning checkout, not home. Keep dispatch and acceptance shapes unchanged.
98
+ Carry `Leg:` and combined spec/task `Rules:` as additive task context to every implementer, wave-reviewer and conformance-reviewer, including repairs and re-reviews, as `Leg: <leg>; Rules: <task Rules> + <leg> Rules from home ## Legs, resolved in the owning checkout`; require reading those files before acting. Resolve rules from the owning checkout, not home; keep `Spec:` the absolute home path. Keep dispatch and acceptance shapes unchanged.
126
99
 
127
100
  ## Dispatch
128
101
 
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.
102
+ Use `dispatching-parallel-agents` for isolation and serial patch integration. Use the dispatch-contract one-step chain for every repair and wave 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.
130
103
 
131
104
  ## The Wave Loop
132
105
 
@@ -142,23 +115,88 @@ Run every plan task through this loop in a wave of N >= 1 tasks. Run waves in se
142
115
  - **Lifecycle per task:** `pending → in_progress (wave fan-out) → complete (wave commit)`; keep `in_progress` through exhausted integration or repair attempts pending the human's decision (see [When a Subagent Fails](#when-a-subagent-fails)); use `failed` only for a human-decided terminal failure; `skipped` when the plan drops it as not applicable (terminal, counted done). A rejected `update` names the earlier pending tasks and the legal fixes - record those tasks' true state, never `clear` or re-`init` to move on.
143
116
  - **Widget caveat (known, deliberately unfixed).** The persistent `plan_tracker` widget's icon strip (`○ → ✓`) and `(c/total)` count reflect every task, but its trailing *name* shows only the **first** `in_progress` task. Use the icon strip and the `status` action for the full in-flight view; a richer multi-task widget is a separate extension change, out of scope (YAGNI).
144
117
 
145
- For an `in-place` wave, dispatch one `implementer` with `cwd` the branch checkout and no `worktree: true`; skip step 4 integration and step 7's `reset --soft` fold, retain the test gate, SR against the branch checkout, and CR, and record the next wave's `WAVE_BASE_SHA` after completion. Repair every SR gap (including initial `NEEDS_REWORK` / `OUT_OF_SCOPE_CHANGES`), stopped chain, test-gate failure, and CR finding with a plain in-place `implementer` in the branch checkout; record Fix-delta trees from that checkout, never use the snapshot/patch-replacement path, and after the gates accept, commit any remaining changes as one new descendant commit on the branch before marking indices `complete`, without amending or running `reset --soft` across the recorded rework base.
118
+ 1. **Independence check.** Assert pairwise-disjoint manifest `files`: Test/Test is allowed, Test/Create, Test/Modify and Modify/Modify overlap. Split overlaps into singleton waves. Trust the plan for runtime-resource disjointness; capture `WAVE_BASE_SHA` with `git -C <worktree> rev-parse HEAD`, print `wave <w> base <sha>` and hold it.
119
+ 2. **Dispatch.** One one-step chain whose single `parallel` step contains only implementers, one item per task: `subagent({ async: false, context: "fresh", cwd: <worktree>, chain: [{ parallel: [{ agent: "implementer", as: "impl_<n>", outputSchema: IMPLEMENTER_STATUS_SCHEMA, output: "<REPORT_DIR>/wave<w>-task<n>.md", outputMode: "file-only", task: ... }], worktree: true, concurrency: 4, stopOn: { path: "/status", in: ["BLOCKED", "NEEDS_CONTEXT", "DONE_WITH_CONCERNS"] } }] })`. Use step `stopOn` to expose `## Outputs` structured JSON in the tool-result text; top-level `tasks` has no item schema and is not used. For manifest `"mode":"in-place"`: `cwd` the branch checkout, no `worktree:`, the wave union as `SCOPED_TEST_COMMANDS`. Payload is `planPath`, task anchor, spec path, `Leg:` with additive `Rules:` per [Leg routing](#leg-routing), `SCOPED_TEST_COMMANDS` (the task's own `tests` for isolated waves), status protocol. Dispatch no reviewer step after the implementers.
120
+ 3. **Read and integrate.** Read each child's structured output and report under the bound above; print `wave <w> task <n> <status> report <path> patch <path>`. Isolated waves: `DONE` / `DONE_WITH_CONCERNS` with a patch -> `git -C <worktree> apply --index <patch>` in plan index order, print `wave <w> integrated task <n>`; an initial patch that fails to apply prints `wave <w> task <n> apply failed`, leaves every already-integrated sibling staged, and stops with a stop note listing which tasks are integrated and which failed - no automatic rebuild (the human may ask for one, which runs the rebuild recipe below). In-place waves: nothing to apply; the checkout already carries the work. `BLOCKED` / `NEEDS_CONTEXT` -> the takeable-decision ladder below.
121
+ 4. **Test gate.** Run each manifest test for the wave union separately, logs to `gate-<i>.log`; print `wave <w> gate <i> exit <code>`. A red gate enters step 6 as a gate repair for every task whose `files` the failing test belongs to (the manifest's `tests` owner), before any review; the review in step 5 runs only on a green gate.
122
+ 5. **Review.** One `wave-reviewer` dispatch per wave, doc-only waves included (`context: "fresh"`, `async: false`, read-only, one-step carrier with `WAVE_VERDICT_SCHEMA` and `stopOn: { path: "/verdict", in: ["FIX_FIRST", "REJECT"] }`), `cwd` the integrated tree after `git -C <worktree> add -A`, with `planPath`, the wave's task `anchors`, `Spec:` (absolute home spec), `Leg:` with additive `Rules:` per [Leg routing](#leg-routing), `BASE_SHA: <WAVE_BASE_SHA>`, `HEAD_SHA: WORKTREE`, and the wave union as `SCOPED_TEST_COMMANDS` (`none` for a doc-only wave, so the reviewer runs nothing and applies the clause table and documentation checks only). Record the review tree per `## Fix delta`; print `wave <w> review <k> verdict <value> report <path> tree <sha>`. `SHIP` -> step 7; `FIX_FIRST` -> step 6; `REJECT` -> hard stop with a stop note.
123
+ 6. **Repair round.** Attribute each finding to a task: the task whose manifest `files` contain the finding's file, else the tasks in the structured `touchedTasks`; a finding with neither a file inside any wave task's `files` nor a `touchedTasks` owner stops with `Recommendation: spec/plan amendment` through [delegated amendments](./reference/implement-amendments.md) - findings are never dropped from a repair payload. For each attributed task, dispatch one `implementer` on the current tree with the findings block or gate log as its task text, the prior report path under `## Previous review report`, the task's anchors, and `SCOPED_TEST_COMMANDS` (isolated: the task's own `tests`; in-place: the wave union), through the one-step carrier with no `context: "fresh"` override and no prior-patch path:
124
+ - *Isolated waves* use the repair-base recipe below: a committed snapshot of the current integrated tree (every integrated patch, every applied repair delta, added files included), so the dispatch root is clean and pi-cohort's exported patch is exactly the repair delta. The snapshot carries the current tree forward; it is not the rebuild below and discards nothing. Dispatch with `cwd: <RP_TREE>`, `worktree: true`; the delta is the `Artifacts:` patch at `<Artifacts dir>/worktree-diffs/step-0/task-0-implementer.patch`. Apply it to the integrated tree with `git -C <worktree> apply --index <delta>`; print `wave <w> repair <k> task <n> <status> report <path> delta <path> applied <yes|no>`; then `git -C <worktree> worktree remove --force <RP_TREE>`.
125
+ - *In-place waves* dispatch with `cwd` the branch checkout and no `worktree:`; the child edits the checkout directly; apply no patch and run no snapshot recipe; print the same line with `delta none applied n/a`.
126
+
127
+ After the round: `git -C <worktree> add -A`; `git -C <worktree> diff --stat` against the recorded pre-repair tree decides emptiness; re-run the test gate for the touched tasks' `tests`; on green, one `wave-reviewer` re-review with the marker `## Previous review report (re-review trigger)`, the prior report path, the `## Fix delta` tree pair, the same `BASE_SHA` / `HEAD_SHA: WORKTREE`. Transitions follow the table below.
128
+ 7. **Commit.** Only when the gate is green and the latest `wave-reviewer` verdict is `SHIP`: isolated waves `git -C <worktree> reset --soft "$WAVE_BASE_SHA" && git -C <worktree> add -A && git -C <worktree> commit -m <message>`; in-place waves commit a descendant commit without amending or `reset --soft`. Then mark every index of the original wave `complete` together; execute manifest `orchestrator` instructions at the completed-wave boundary.
129
+
130
+ `WAVE_BASE_SHA` is fixed across repair rounds, so every re-review diffs against the same root the first review saw.
131
+
132
+ **Repair-base recipe** - a committed snapshot of the current integrated tree, not a rebuild (isolated waves; substitute shell-quoted literals; run the whole block, stop on nonzero exit and retain `RP_DIR` for diagnosis):
133
+
134
+ <!-- repair-base-shell -->
135
+ ```bash
136
+ RP_ROOT={{WORKTREE}}
137
+ RP_BASE={{BASE_SHA}}
138
+ RP_DIR=$(mktemp -d) || exit 1
139
+ RP_TREE="$RP_DIR/tree"
140
+ git -C "$RP_ROOT" add -A || exit 1
141
+ git -C "$RP_ROOT" diff --binary --cached "$RP_BASE" > "$RP_DIR/integrated.patch" || exit 1
142
+ git -C "$RP_ROOT" worktree add --detach "$RP_TREE" "$RP_BASE" || exit 1
143
+ if [ -s "$RP_DIR/integrated.patch" ]; then git -C "$RP_TREE" apply --index "$RP_DIR/integrated.patch" || exit 1; fi
144
+ git -C "$RP_TREE" -c user.name=gauntlet -c user.email=gauntlet@local commit -q --allow-empty -m "wave integrated snapshot" || exit 1
145
+ printf 'repair-base: %s %s\n' "$RP_TREE" "$(git -C "$RP_TREE" rev-parse HEAD)"
146
+ ```
147
+
148
+ The redirected `diff --binary --cached` writes a file and loads nothing into the orchestrator's context; the orchestrator never reads `integrated.patch`.
149
+
150
+ **Transition table.** One per-task counter `failed[n]` starts at 0 when the wave enters step 3; `escalated[n]` and `converged[n]` are once-per-wave flags.
151
+
152
+ | Event | Counts for task n | Next operation |
153
+ |---|---|---|
154
+ | Red gate at step 4 or after a repair (any implementer status, including `DONE`) | +1 for each task owning a failing test | repair from the gate log; no review until green |
155
+ | Dispatch error, missing structured output after diagnosis says `repair`, or `BLOCKED` / `NEEDS_CONTEXT` answered by the ladder | +1 | re-dispatch the identical payload with the answer appended under `## Answer to your BLOCKED question` into the existing repair tree (the registered `RP_TREE` when one exists, otherwise the owning checkout); never remove, re-snapshot or rebuild that tree - the snapshot recipe and `worktree remove` run only when a repair round starts fresh or after a delta apply failure |
156
+ | Repair delta or in-place repair leaves `diff --stat` empty (`DONE` with an unchanged tree) | +1 | no re-review of the unchanged tree; next repair resends the prior report path with "your fix changed no tracked file" |
157
+ | Repair delta fails `git apply --index` | +1 | rebuild |
158
+ | Review 1 `FIX_FIRST` (no `TRAJECTORY:` line) | +1 for each attributed task | repair |
159
+ | Re-review `FIX_FIRST`, `TRAJECTORY: CONVERGING` or `DIVERGING` | +1 for each attributed task | repair while `failed[n] < 2`; else escalation |
160
+ | Re-review `FIX_FIRST`, `TRAJECTORY: STAGNANT`, or a missing/malformed line | sets `failed[n] = 2` for each attributed task | escalation now (ordinary rounds), no convergence exception; never re-dispatch the review merely to obtain the line; stop immediately on a funded re-review |
161
+ | `failed[n] == 2` reached by a `CONVERGING` re-review whose line lacks `max severity Critical`, `converged[n]` unset | sets `converged[n]` | one extra ordinary repair, then re-review; a further `FIX_FIRST` escalates whatever the trajectory |
162
+ | `failed[n] == 2` (or `> 2` after the convergence exception), `escalated[n]` unset | sets `escalated[n]` | escalated round with `model: <implModel>` |
163
+ | Escalated round fails (dispatch error, non-`DONE`, red gate, empty delta, or attributed `FIX_FIRST`) | spent | funded round while the task's ledger has one left, else stop note |
164
+ | Funded round fails the same way | spends one | next funded round while one remains, else stop note; `STAGNANT` stops regardless |
165
+ | Gate green and review or re-review `SHIP` | - | step 7 |
166
+ | `REJECT`, `anchorUnreadable` on a reviewer, or the round cap: more than `4 + N` re-reviews in one wave (`N` = the largest funded grant among the wave's tasks, 0 without a token) | - | hard stop with the stop note |
167
+
168
+ Execution escalation to `implModel` is available whenever `failed[n]` reaches 2, independently of any `**Amend-grant:**` value; funding only adds rounds after the escalated round. Follow this table after two failed attempts, without requiring amend permission.
169
+
170
+ ### Rebuild
146
171
 
147
- **Per-wave loop:**
172
+ A repair delta that fails `git apply --index` prints `rebuild: task <n> - delta apply failed` and counts one failed attempt. Then, in the integrated tree: partition the task's manifest paths - every `Create` path (including a new test file declared as both `Create` and `Test`) is removed (`git -C <worktree> rm -q -f --ignore-unmatch -- <paths>`), and the remaining `Modify` / `Test` paths, deduplicated and excluding every `Create` path, are restored from the wave base (`git -C <worktree> restore --source="$WAVE_BASE_SHA" --staged --worktree -- <paths>`); sibling paths are untouched (step 1 guarantees disjointness). Run the repair-base recipe on that tree, so the snapshot holds the base plus every accepted sibling and nothing of task n; dispatch one `implementer` from `<RP_TREE>` with `worktree: true` and the task's original payload (this dispatch is the next attempt on `failed[n]`'s counter - the escalated round when the counter has reached 2); apply its `Artifacts:` patch to the integrated tree with `git apply --index` (a failure here is a hard stop, not a second rebuild). The rebuilt task rejoins its original wave: re-run the gate for the wave union, one `wave-reviewer` re-review with the marker and the prior report path, and step 7 commits the whole wave once and completes all of its indices together. The human may ask for a rebuild at any stop, which runs this same recipe; nothing else triggers one. `BLOCKED` / `NEEDS_CONTEXT` on a repair never rebuilds or re-snapshots: the ladder answers, then the identical payload is re-dispatched into the existing repair tree with the answer appended.
148
173
 
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.
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.
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.
174
+ ### Escalation and funding
156
175
 
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.
176
+ - **Execution escalation.** When the transition table reaches the escalated round for task n, print `escalated round for task <n> after 2 failed attempts`, call `gauntlet_setting({ key: "escalationLoop" })`, and dispatch one `implementer` with `model: <implModel>`, `async: false`, on the current tree (repair-base snapshot for isolated waves, branch checkout for in-place) with the same payload as the failed round; no `context: "fresh"`, no prior-patch path. `implModel` undefined or the settings tool unavailable -> stop note. Once per task per wave; spends independently of funding. The escalated round runs the ordinary test gate and `wave-reviewer` re-review.
177
+ - **Funded rounds.** Delegate current grant read and Value decoding through [Standing grants](../brainstorming/reference/amendment-surface.md#standing-grants); one per-task ledger from zero; `funded round <k> of <N> for task <n>` before each funded dispatch; each funded dispatch repeats the escalated payload (`model: <implModel>`, same tree, same anchors) and spends one including failures; `STAGNANT` on a funded re-review stops immediately; `budget: <spent> of <N> spent` in stop notes after `Problem:` and `Searched:` lines; resume recovers spent only from `funded round` transcript lines, otherwise exhausted with `(not recovered on resume)`. Funding never supplies a missing `implModel`.
178
+ - **Takeable decision.** `BLOCKED` / `NEEDS_CONTEXT` with attempts remaining: compare the whitespace-normalized `file:line` or failing command plus assertion against decisions already auto-taken on this task (`Recommendation: none - evidence repeats task <n>` and stop on a repeat); in-task repair counts as an ordinary attempt under the two-attempt limit; spec/plan rule edits route through [amendment aftermath](../brainstorming/reference/amendment-surface.md#5-apply-aftermath-commit) under the grant; `fix-first` enters `/skill:shape-ticket`; everything else emits the stop note ending in `Recommendation: <option> - <why>` and waits. Print `took recommendation: <option> for task <n>` when taken.
179
+ - **Hard stops:** malformed grants, missing `implModel`, unavailable settings tools, dirty-tree or commit-boundary returns, empty-commit stagnation, the round cap in the table, funded re-review `STAGNANT`, `REJECT`, an initial-patch or rebuild-patch apply failure, an oversized compact report, redraws.
158
180
 
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.
181
+ The `TRAJECTORY:` block and `stop-note.md` grammar bind to the single `wave-reviewer` line.
160
182
 
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.
183
+
184
+ ### Initial dispatch carrier
185
+
186
+ Run the preflight once per implement phase, before the first dispatch. Use owning checkout `cwd`; omit `worktree: true` for manifest `"mode":"in-place"` and pass that wave's tests union.
187
+
188
+ ```ts
189
+ subagent({ async: false, context: "fresh", cwd: "<owning checkout>",
190
+ chain: [{ parallel: [
191
+ { agent: "implementer", as: "impl_1", outputSchema: IMPLEMENTER_STATUS_SCHEMA,
192
+ output: "<REPORT_DIR>/wave<w>-task1.md", outputMode: "file-only",
193
+ task: "planPath: <absolute plan>; anchor: ### Task N:; Spec: <absolute home spec>; Leg: <owning leg>; Rules: <combined task/leg Rules>; SCOPED_TEST_COMMANDS: <task manifest tests or none>. pi-cohort saves your final report; do not write it yourself." }
194
+ ], worktree: true, concurrency: 4,
195
+ stopOn: { path: "/status", in: ["BLOCKED", "NEEDS_CONTEXT", "DONE_WITH_CONCERNS"] } }]
196
+ })
197
+ ```
198
+
199
+ Keep context/async/cwd invocation-level; worktree/concurrency/stopOn step-level; as/output/outputMode/outputSchema/task item-level. Never use top-level `tasks`. Consume fenced structured JSON in `## Outputs` / `## Stop` from result text, not details or saved prose verdicts. Obtain patches from `Artifacts:` at `<Artifacts dir>/worktree-diffs/step-0/task-<i>-implementer.patch` (zero-based wave position). Keep known report paths. Require accepted statuses and a patch before initial isolated integration; count empty repair deltas through the transition table.
162
200
 
163
201
  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.
164
202
 
@@ -205,43 +243,12 @@ PREFLIGHT_STATUS=$?
205
243
  [[ "$PREFLIGHT_STATUS" == 0 ]] || exit "$PREFLIGHT_STATUS"
206
244
  ```
207
245
 
208
- Pass the implementation worktree's absolute path as top-level `cwd`. Per-task `cwd` outranks step and run `cwd`; only the SR tasks override it. Rule and rationale for editing dispatches: `dispatching-parallel-agents` "pi-cohort Integration".
209
-
210
- ```bash
211
- REPORT_DIR=$(mktemp -d)
212
- ```
213
-
214
- ```ts
215
- subagent({
216
- async: false, context: "fresh", cwd: "<abs worktree path>",
217
- chain: [
218
- { parallel: [
219
- { agent: "implementer", as: "impl_1", outputSchema: IMPLEMENTER_STATUS_SCHEMA,
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 },
232
- ],
233
- })
234
- ```
235
246
 
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.
237
-
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.
247
+ Create `REPORT_DIR` with `mktemp -d`. Forward predecessor status and report paths across dependent waves; never paste task text.
239
248
 
240
249
  ### Chain stopped or failed
241
250
 
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.
251
+ Retain accepted siblings; never repeat the initial chain or rerun accepted tasks. Inspect failed tasks alongside `## Stop`; a matched stop precedes sibling-error checking. Missing/rejected required output fails only that task. When Outputs or structured JSON is missing, delegate identity-matched artifact diagnosis once:
245
252
 
246
253
  ```ts
247
254
  subagent({ async: false, context: "fresh", cwd: "<owning checkout>",
@@ -251,41 +258,37 @@ subagent({ async: false, context: "fresh", cwd: "<owning checkout>",
251
258
  })
252
259
  ```
253
260
 
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.
255
-
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.
261
+ Omit agent on this sequential step; use no parallel item. Let the child alone inspect identity-matched session failure artifacts, not empty parallel-0 directories. Route diagnosis JSON through the transition table. Missing/ambiguous artifacts or delegated failure stop; never recursively diagnose. An implementer anchor failure takes the failed-attempt path; reviewer anchorUnreadable hard-stops.
257
262
 
258
263
  ### Recovery
259
264
 
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.
261
-
262
- ## Spec-review snapshots
263
-
264
- Materialize each accepted patch for every pre-integration review not run by the chain: accepted siblings after errors/stops, replacement patches on re-review. Keep the implementation worktree unchanged; pi-cohort removes its worker checkouts before returning patches.
265
-
266
- Substitute shell-quoted literals for the implementation worktree, the recorded `WAVE_BASE_SHA`, and the absolute patch path. Run this block once per patch:
267
-
268
- <!-- spec-review-snapshot-shell -->
269
- ```bash
270
- SR_ROOT={{WORKTREE}}
271
- SR_BASE={{BASE_SHA}}
272
- SR_PATCH={{PATCH_PATH}}
273
- SR_DIR=$(mktemp -d) || exit 1
274
- SR_TREE="$SR_DIR/tree"
275
- git -C "$SR_ROOT" worktree add --detach "$SR_TREE" "$SR_BASE" || exit 1
276
- git -C "$SR_TREE" apply --index "$SR_PATCH" || exit 1
277
- printf 'snapshot: %s\n' "$SR_TREE"
265
+ Recover static state only with `plan_check({ planPath })` and tracker status. Recover dynamic state only from the observations below. Stop for an in_progress wave without its base, repair applied status or terminal outcome. Continue after a repair only with a terminal review after `applied yes` or a green gate after the last repair. Old tree-only review lines do not authorize continuation. Keep original base, report paths, tree IDs and funding spending; never infer integration or redispatch interrupted workers. Recover funded spent only from `funded round` observations; absent history means exhausted, not reset. A funded observation records spending before dispatch, not a terminal outcome.
266
+
267
+ ```text
268
+ wave <w> base <sha>
269
+ wave <w> task <n> <status> report <path> patch <path>
270
+ wave <w> integrated task <n>
271
+ wave <w> task <n> apply failed
272
+ wave <w> gate <i> exit <code>
273
+ wave <w> review <k> verdict <value> report <path> tree <sha>
274
+ wave <w> repair <k> task <n> <status> report <path> delta <path> applied <yes|no>
275
+ rebuild: task <n> - delta apply failed
276
+ escalated round for task <n> after 2 failed attempts
277
+ funded round <k> of <N> for task <n>
278
+ repair-base: <path> <sha>
278
279
  ```
279
280
 
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.
281
+ For in-place repairs print `delta none applied n/a`. Print each observation immediately after the operation returns; invent no path, result or SHA.
281
282
 
282
283
  ## When a Subagent Fails
283
284
 
284
285
  **You are the orchestrator. You do NOT write code.**
285
286
 
286
- 1. **Attempt 1:** dispatch a NEW fix subagent with error-output paths, the original task anchors, and specific instructions about what went wrong.
287
- 2. **Attempt 2:** if attempt 1 also fails, dispatch one more with a simplified scope or different approach.
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.
287
+ Use the transition table as the only attempt counter; count each failed operation once.
288
+
289
+ 1. **Attempt 1:** dispatch a NEW fix subagent on the same tree with error-output paths, the original task anchors, and specific instructions about what went wrong.
290
+ 2. **Attempt 2:** if attempt 1 also fails, dispatch one more on the same tree with a simplified scope or different approach.
291
+ 3. after 2 failed attempts the transition table's escalated round runs; STOP only when that round and any funded round are spent. Keep `in_progress` pending the human decision; completion requires the wave commit.
289
292
 
290
293
  **NEVER:**
291
294
 
@@ -300,7 +303,7 @@ For a coordinated run, execute verification and the following reviews for every
300
303
 
301
304
  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.)
302
305
  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.
306
+ 2. **Whole-diff code review.** Only after passing full verification, dispatch one foreground whole-diff `wave-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
307
  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.
305
308
 
306
309
  **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.
@@ -314,11 +317,11 @@ For a coordinated run, execute verification and the following reviews for every
314
317
  - Writing code yourself instead of dispatching.
315
318
  - 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.
316
319
  - Dispatching parallel implementers on overlapping files, on a shared mutable runtime resource, or without `worktree: true`.
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
318
- - Dispatching `code-reviewer` before every in-scope spec-review verdict is ✅, or per task inside a wave.
319
- - Moving to the next task with either review still showing issues, or skipping the `Implementer Status` parse.
320
+ - Pasting task text, spec excerpts, or report contents into a dispatch, or opening plan/spec/source files in the primary or reading a report beyond its bound
321
+ - Dispatching wave review before a green gate, or per task inside a wave.
322
+ - Moving to the next task with the wave verdict still showing blocking issues, or skipping the `Implementer Status` parse.
320
323
  - Repeating the initial wave chain after a stop or error instead of retaining accepted siblings and using one-step repair/re-review carriers.
321
- - Dispatching fix 3 without a reviewer-emitted `CONVERGING` verdict, or continuing past `STAGNANT` instead of escalating (or, on a funded re-review, stopping).
324
+ - Dispatching a third ordinary repair without a reviewer-emitted `CONVERGING` verdict, or continuing past `STAGNANT` instead of escalating (or, on a funded re-review, stopping).
322
325
  - Running the full verification entrypoint, or any test command outside `SCOPED_TEST_COMMANDS`, during the implement phase.
323
326
  - 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.
324
327
  - Polling, joining, or relaunching an unexpectedly asynchronous dispatch, or starting on main without explicit user consent.
@@ -4,36 +4,37 @@ Read these schemas and carrier rules before the first implement dispatch. Keep t
4
4
 
5
5
  ## Schemas
6
6
 
7
- Mirror each child's saved report, not an independent verdict calculation. Bound implementer reasoning to one sentence and 300 characters; keep concerns and evidence entries one line each, questions explicit, and delegated answers one paragraph. Preserve `parallelSafe` as the `Parallel-safe:` line verbatim and `trajectory.line` as the `TRAJECTORY:` line verbatim. Require `behaviourChange` on every CR report, mirroring `Behaviour-change:`. Use `measured` only for values an explicit `orchestrator` instruction consumes.
7
+ Mirror each child's saved report, not an independent verdict calculation. Bound implementer reasoning to one sentence and 300 characters; keep concerns and evidence entries one line each, questions explicit, and delegated answers one paragraph. Preserve `parallelSafe` as the `Parallel-safe:` line verbatim and `trajectory.line` as the `TRAJECTORY:` line verbatim. Use `measured` only for values an explicit `orchestrator` instruction consumes.
8
8
 
9
9
  ```ts
10
10
  const IMPLEMENTER_STATUS_SCHEMA = {"type":"object","required":["status","reasoning"],"additionalProperties":false,"properties":{"status":{"type":"string","enum":["DONE","DONE_WITH_CONCERNS","NEEDS_CONTEXT","BLOCKED"]},"reasoning":{"type":"string","maxLength":300},"concerns":{"type":"array","items":{"type":"string"}},"question":{"type":"string"},"anchorUnreadable":{"type":"string"},"measured":{"type":"object"}},"allOf":[{"if":{"properties":{"status":{"const":"DONE_WITH_CONCERNS"}}},"then":{"required":["concerns"]}},{"if":{"properties":{"status":{"const":"NEEDS_CONTEXT"}}},"then":{"required":["question"]}}]};
11
- const SPEC_VERDICT_SCHEMA = {"type":"object","required":["verdict","reasoning"],"additionalProperties":false,"properties":{"reasoning":{"type":"string"},"findingCount":{"type":"integer","minimum":0},"parallelSafe":{"type":"string"},"touchedTasks":{"type":"array","items":{"type":"integer"}},"trajectory":{"type":"object","required":["verdict","line"],"additionalProperties":false,"properties":{"verdict":{"type":"string","enum":["CONVERGING","DIVERGING","STAGNANT"]},"line":{"type":"string"}}},"anchorUnreadable":{"type":"string"},"verdict":{"type":"string","enum":["COMPLIANT","NEEDS_REWORK","OUT_OF_SCOPE_CHANGES"]},"maxSeverity":{"type":"string","enum":["PARTIAL","MISSING","SCOPE_CREEP"]}}};
12
- const CODE_VERDICT_SCHEMA = {"type":"object","required":["verdict","reasoning","behaviourChange"],"additionalProperties":false,"properties":{"reasoning":{"type":"string"},"findingCount":{"type":"integer","minimum":0},"parallelSafe":{"type":"string"},"touchedTasks":{"type":"array","items":{"type":"integer"}},"trajectory":{"type":"object","required":["verdict","line"],"additionalProperties":false,"properties":{"verdict":{"type":"string","enum":["CONVERGING","DIVERGING","STAGNANT"]},"line":{"type":"string"}}},"anchorUnreadable":{"type":"string"},"verdict":{"type":"string","enum":["SHIP","FIX_FIRST","REJECT"]},"maxSeverity":{"type":"string","enum":["Critical","Moderate","Minor"]},"behaviourChange":{"type":"boolean"}}};
11
+ const WAVE_VERDICT_SCHEMA = {"type":"object","required":["verdict","reasoning","findingCount","findings"],"additionalProperties":false,"properties":{"reasoning":{"type":"string"},"findingCount":{"type":"integer","minimum":0},"parallelSafe":{"type":"string"},"touchedTasks":{"type":"array","items":{"type":"integer"}},"trajectory":{"type":"object","required":["verdict","line"],"additionalProperties":false,"properties":{"verdict":{"type":"string","enum":["CONVERGING","DIVERGING","STAGNANT"]},"line":{"type":"string"}}},"anchorUnreadable":{"type":"string"},"verdict":{"type":"string","enum":["SHIP","FIX_FIRST","REJECT"]},"maxSeverity":{"type":"string","enum":["Critical","Moderate","Minor"]},"findings":{"type":"object","required":["critical","moderate","minor"],"additionalProperties":false,"properties":{"critical":{"type":"integer","minimum":0},"moderate":{"type":"integer","minimum":0},"minor":{"type":"integer","minimum":0}}},"clauses":{"type":"array","items":{"type":"object","required":["clause","status","evidence"],"additionalProperties":false,"properties":{"clause":{"type":"string"},"status":{"type":"string","enum":["met","unmet","out-of-scope"]},"evidence":{"type":"string"}}}}}};
13
12
  const ANSWER_SCHEMA = {"type":"object","required":["answer","evidence"],"additionalProperties":false,"properties":{"answer":{"type":"string"},"evidence":{"type":"array","items":{"type":"string"}}}};
14
13
  const DIAGNOSIS_SCHEMA = {"type":"object","required":["tasks","decision","diagnostic"],"additionalProperties":false,"properties":{"tasks":{"type":"array","items":{"type":"object","required":["task","status","reportPath","diagnostic"],"additionalProperties":false,"properties":{"task":{"type":"integer"},"status":{"type":"string"},"reportPath":{"type":"string"},"patchPath":{"type":"string"},"diagnostic":{"type":"string"}}}},"decision":{"type":"string","enum":["retry","repair","stop"]},"diagnostic":{"type":"string"}}};
15
14
  const PREPARE_SCHEMA = {"type":"object","required":["items","redraws"],"additionalProperties":false,"properties":{"items":{"type":"array","items":{"type":"object","required":["evidence","recommended","location","edit"],"additionalProperties":false,"properties":{"evidence":{"type":"string"},"recommended":{"type":"string","pattern":"^(accept|alt-[0-9]+)$"},"location":{"type":"string"},"edit":{"type":"string"}}}},"redraws":{"type":"array","items":{"type":"object","required":["location","reason"],"additionalProperties":false,"properties":{"location":{"type":"string"},"reason":{"type":"string","maxLength":300}}}}}};
16
15
  const APPLY_SCHEMA = {"type":"object","required":["amendedSections","tasksAdded","tasksAnchorChanged","tasksRemoved","passed"],"additionalProperties":false,"properties":{"amendedSections":{"type":"array","items":{"type":"string"}},"tasksAdded":{"type":"array","items":{"type":"integer"}},"tasksAnchorChanged":{"type":"array","items":{"type":"integer"}},"tasksRemoved":{"type":"array","items":{"type":"integer"}},"passed":{"type":"boolean"},"failLines":{"type":"array","items":{"type":"string"}}}};
17
16
  ```
18
17
 
18
+ Keep `APPLY_SCHEMA` unchanged. Interpret `tasksAnchorChanged` as semantic obligation or work changes against the original anchored obligation text, task bodies and Tests, not line offsets or meaning-preserving rewording; reopen completed tasks only for those semantic changes. Preserve original inventory in the saved apply report through failures and idempotent retry.
19
+
19
20
  ## One-step carrier
20
21
 
21
- Use this shape for initial CR, repair implementers, post-repair SR fan-outs, SR/CR re-reviews, escalated/funded rounds, delegated answers and amendment workers. Set the persona and schema for each item; use `/status` for implementers and `/verdict` for reviewers with their non-clean enums. Put `output`, `outputMode` and `outputSchema` on every item, never on a `ParallelStep`. Keep `context: "fresh"` and `async: false` invocation-level. Omit `model` except a runtime-resolved setting or a user-named override. A schema-bound `anchorUnreadable` is a failed attempt, not permission for the primary to inspect the file.
22
+ Use this shape for initial wave review, repair implementers and wave re-reviews, escalated/funded rounds, delegated answers and amendment workers. Set the persona and schema for each item; use `/status` for implementers and `/verdict` for reviewers with their non-clean enums. Put `output`, `outputMode` and `outputSchema` on every item, never on a `ParallelStep`. Keep `async: false` invocation-level. Set `context: "fresh"` for initial implementers and reviews, diagnosis, answers and amendments; omit context on repair, escalated and funded implementers. Omit `model` except a runtime-resolved setting or a user-named override. A reviewer `anchorUnreadable` is a hard stop; an implementer anchor failure is a failed attempt, not permission for the primary to inspect the file.
22
23
 
23
24
  ```ts
24
25
  subagent({ async: false, context: "fresh", cwd: "<owning checkout>",
25
26
  chain: [{ parallel: [
26
- { agent: "code-reviewer", output: "<REPORT_DIR>/wave<w>-cr<k>.md",
27
- outputMode: "file-only", outputSchema: CODE_VERDICT_SCHEMA,
27
+ { agent: "wave-reviewer", output: "<REPORT_DIR>/wave<w>-review<k>.md",
28
+ outputMode: "file-only", outputSchema: WAVE_VERDICT_SCHEMA,
28
29
  task: "planPath: <absolute plan>; anchors: <wave task prefixes>; Spec: <absolute home spec>; BASE_SHA: <WAVE_BASE_SHA>; HEAD_SHA: WORKTREE; SCOPED_TEST_COMMANDS: <manifest union>" }
29
30
  ], stopOn: { path: "/verdict", in: ["FIX_FIRST", "REJECT"] } }]
30
31
  })
31
32
  ```
32
33
 
33
- For answer/evidence, preparation and apply results, retain their approved schemas without adding a status field. Use carrier-only `stopOn: { path: "/status", in: ["BLOCKED"] }`: an absent pointer does not match, but the presence of stopOn exposes successful `## Outputs` JSON. Save each report under `REPORT_DIR`. Give delegated reads the question, artifact paths, owning checkout, and documented lookup ordering; let the child read source, provenance, task contents or current grants. Consume only `answer` and `evidence`. A delegated failure stops; never recursively diagnose delegated failures.
34
+ For answer/evidence, preparation and apply results, retain their approved schemas without adding a status field. Use carrier-only `stopOn: { path: "/status", in: ["BLOCKED"] }`: an absent pointer does not match, but the presence of stopOn exposes successful `## Outputs` JSON. Save each report under `REPORT_DIR`. Give delegated source lookups the question, source artifact paths, owning checkout, and documented lookup ordering; let the child read source, provenance, task contents or current grants. Consume only `answer` and `evidence`. A delegated failure stops; never recursively diagnose delegated failures.
34
35
 
35
36
  ## Anchored payload
36
37
 
37
- Pass `planPath: <absolute plan path>`, `anchor: "### Task N:"` or `anchors: [<exact prefixes>]`, and `Spec: <absolute authoritative home spec path>` to every implementer, SR and CR. `### Task 4:` never matches `### Task 40:`; end each selected section at `^#{2,3}\s`. Children read the union of selected sections, `Spec:`, `Files:`, `Tests:`, `Rules:` and `Leg:` themselves. Combine task Rules with that leg's Rules in home `## Legs`; absent Leg uses the first `### Leg:`. Resolve rules in the owning checkout. Pass isolated implementers only their own task's manifest `tests` as `SCOPED_TEST_COMMANDS`, or `none` when empty, including isolated spec-gap redispatch. Give the integrated gate, in-place repairs and code reviews the wave union; give initial in-place implementers that union too. Preserve command strings verbatim; keep dispatch-supplied commands independent of the Tests metadata children read.
38
+ Pass `planPath: <absolute plan path>`, `anchor: "### Task N:"` or `anchors: [<exact prefixes>]`, and `Spec: <absolute authoritative home spec path>` to every implementer and wave-reviewer. `### Task 4:` never matches `### Task 40:`; end each selected section at `^#{2,3}\s`. Children read the union of selected sections, `Spec:`, `Files:`, `Tests:`, `Rules:` and `Leg:` themselves. Combine task Rules with that leg's Rules in home `## Legs`; absent Leg uses the first `### Leg:`. Resolve rules in the owning checkout. Pass isolated implementers only their own task's manifest `tests` as `SCOPED_TEST_COMMANDS`, or `none` when empty, including isolated repairs. Give the integrated gate, in-place repairs and wave reviews the wave union; give initial in-place implementers that union too. Preserve command strings verbatim; keep dispatch-supplied commands independent of the Tests metadata children read.
38
39
 
39
- Forward dependent context as the prior status line plus report path. Put the saved prior report path under `## Previous review report (re-review trigger)`; require the child to read it and apply the existing trajectory block. Findings and binary delta bytes stay child-owned.
40
+ Forward dependent context as the prior status line plus report path. Put the saved prior report path under `## Previous review report (re-review trigger)`; require the child to read it and apply the existing trajectory block. Read report findings only under the bounded direct-read rule in SKILL.md; never dispatch a child to relay reports. Keep binary delta bytes child-owned.
@@ -4,6 +4,8 @@ Read [amendment-surface.md](../../brainstorming/reference/amendment-surface.md)
4
4
 
5
5
  1. Dispatch `plan-writer` with `Amend-prepare:`, the five absolute paths (worktree, approved spec, plan, plan skill and plan contract) and the evidence already in context: plan_check FAIL lines, structured concerns/question or measured baseline rows. Include the literal sentence `Do not edit any file.` in the `Amend-prepare:` task text. Preparation writes nothing. Require `{ items: [{ evidence, recommended: "accept" | "alt-<n>", location: "<spec section>", edit: string }], redraws: [{ location: "<spec section>", reason: string (max 300 characters) }] }`; keep each edit one paragraph. Keep the existing menu spelling `alt-n` for a named alternative; encode the selected number as `alt-<n>` in JSON. Require both items and redraws arrays, including empty arrays; put redraws only in redraws, never items. Fail malformed preparation output.
6
6
  2. Inspect structured redraws first. A nonempty array holds the whole batch at the redraw gate before grant evaluation or applying any sibling item, for redraw-only and mixed batches alike. Never open the preparation report to discover redraws. With no redraws, delegate reading the current `Amend-grant:` and Value decoding through the answer/evidence carrier. Preserve the surface's grant predicate: malformed -> stop and quote; absent, none or no permission -> the existing human menu and escalation gate. Stop on changed problem statement or a component added, removed or re-bounded.
7
- 3. With amend permission, apply the recommended choice without reviewer, menu or confirmation turns; pass granted items verbatim to `plan-writer` under `Amend-apply:` plus the existing `Amend:` entry and parent-supplied `In-flight:` paths from `status --porcelain`, including staged in-place repair deliverables. Preserve Baseline ownership, protected-path and dirty-baseline exits; delegate attribution reads and human wording instead of loading documents in the primary. Authorize only the named spec sections and plan regeneration, preserving unaffected task titles and wave positions. Before the first apply, require original task numbers, titles, spec anchors, and wave positions in the existing saved apply report; retain that original inventory on every return, including failures. Add no sidecar.
7
+ 3. With amend permission, apply the recommended choice without reviewer, menu or confirmation turns; pass granted items verbatim to `plan-writer` under `Amend-apply:` plus the existing `Amend:` entry and parent-supplied `In-flight:` paths from `status --porcelain`, including staged in-place repair deliverables. Preserve Baseline ownership, protected-path and dirty-baseline exits; delegate attribution reads and human wording instead of loading documents in the primary. Authorize only the named spec sections and local patches to affected task entries, coverage and shifted anchors; preserve unaffected ids, titles, wave order, state and evidence. Use the implement-only historical Baseline policy, not wholesale regeneration. Admit declared in-flight repairs, including staged source, for maintenance requiring no execution; preserve staged repairs rather than committing, restoring or discarding them merely to plan. For necessary runs require an identified execution tree and nonzero executed-test count; stop on unidentified dirt, contamination or moved test revision. Before the first apply, require original task numbers, titles, spec anchors, and wave positions in the existing saved apply report; retain that original inventory on every return, including failures. Also capture anchored obligation text, task bodies and Tests. Add no sidecar.
8
8
  4. Consume the unchanged apply result `{ amendedSections: string[], tasksAdded: number[], tasksAnchorChanged: number[], tasksRemoved: number[], passed: boolean, failLines?: string[] }`. On `passed: false`, retry once in a fresh child with failLines as the rule and `previousApplyReport` set to the first apply report path. Require the retry to read original inventory, apply granted edits idempotently without duplicates, and compute deltas against that original inventory rather than the already-mutated plan. Missing original inventory fails the retry. Escalate a second failure; never repeat granted edits blindly.
9
+ Match retained failures by failing command, assertion or path plus corresponding repair evidence, never task membership. Preserve failed revision/output and resolving evidence; route outstanding repairs to their existing task gate loop and keep unrelated regressions substantive blockers. Decode the standing grant at each batch boundary. Repeated authorized intermediate evidence is neither new consent nor a refresh trigger; keep budget-only, malformed-grant and redraw stops and the existing funding unchanged.
10
+
9
11
  5. After child success, run parent `plan_check({ planPath })`. Reconcile only after parent PASS: replace the manifest; use tracker update and `add` for tasksAdded, reopen completed tasksAnchorChanged as `in_progress`, and handle tasksRemoved through the surface's existing path. Print `amended the spec: <title> - <what>` from structured item location/edit observations, and make the existing single `amend:` audit commit. Keep the parent from opening spec, plan or reports. Persist measured values from explicit orchestrator instructions through this same path.
@@ -1,12 +1,12 @@
1
1
  # Stop note (subagent-driven-development companion)
2
2
 
3
- For a `NEEDS_CONTEXT`/`BLOCKED` fact ask, dispatch a delegated answer/evidence child to search the locations documented by the spec, plan, or repo: one bounded lookup per location in documented order, stopping at the first hit. Record each lookup and result, including earlier misses; consume the compact answer/evidence and re-dispatch with the found result. Never open source or deliverable reports in the primary. Stop on a delegated failure.
3
+ For a `NEEDS_CONTEXT`/`BLOCKED` fact ask, dispatch a delegated answer/evidence child to search the locations documented by the spec, plan, or repo: one bounded lookup per location in documented order, stopping at the first hit. Record each lookup and result, including earlier misses; consume the compact answer/evidence and re-dispatch with the found result. Keep source reads delegated; use the bounded direct-report read rule in SKILL.md for child reports. Stop on a delegated failure.
4
4
 
5
- Emit when no escalation model resolves, the escalated dispatch errors, its one escalated round fails (see `SKILL.md` "Fix-Loop Rounds"), or a `NEEDS_CONTEXT`/`BLOCKED` fact ask exhausts documented locations, needs credentials for a remaining location, or lacks its named lookup tool; an unavailable `gauntlet_setting` tool is a configuration error - stop and report, no stop note. Inline in the reply; the turn ends; phase stays `implement`, the task stays `in_progress`; no further tasks start. Emit one note per stalled task, after the current batch returns.
5
+ Emit when no escalation model resolves, the escalated dispatch errors, its one escalated round and any funded rounds fail (see `SKILL.md` "The Wave Loop"), or a `NEEDS_CONTEXT`/`BLOCKED` fact ask exhausts documented locations, needs credentials for a remaining location, or lacks its named lookup tool; an unavailable `gauntlet_setting` tool also ends in this stop note. Inline in the reply; the turn ends; phase stays `implement`, the task stays `in_progress`; no further tasks start. Emit one note per stalled task, after the current batch returns.
6
6
 
7
7
  ## Template
8
8
 
9
- Delegate human escalation wording through the answer/evidence carrier with the final review path, scoped-output paths, structured routing fields and lookup observations. Require the child to read findings and return the exact one-screen note below as its answer. Keep the primary from opening the report. Apply funded-round budget placement from reference/fix-loop.md.
9
+ Write the note from structured fields, bounded report findings and lookup observations. Never dispatch a child to relay a report. While a budget token exists, put `budget: <spent> of <N> spent` after `Problem:` and any `Searched:` lines and before findings, including zero-spent stops. On unrecoverable resume use `budget: <N> of <N> spent (not recovered on resume)`. Omit budget without a token.
10
10
 
11
11
  Read and apply [menu-layout](../brainstorming/reference/menu-layout.md). Start the message with `gauntlet: question` alone on the first output line, followed by a newline before the stop note; this is an implementation decision, not a done or stuck outcome.
12
12
 
@@ -30,7 +30,7 @@ Recommendation: <option> - <why>
30
30
 
31
31
  ## Rules
32
32
 
33
- - End every note with `Recommendation: <option> - <why>`, or `Recommendation: none - <why>` when no named change is recommended. Apply [Implementer-failure stops](reference/fix-loop.md#implementer-failure-stops) before emitting an execution decision note.
33
+ - End every note with `Recommendation: <option> - <why>`, or `Recommendation: none - <why>` when no named change is recommended. Apply [takeable-decision ladder](./SKILL.md#escalation-and-funding) before emitting an execution decision note.
34
34
  - Bracketed header clause only when an escalated round actually ran; omit it when no model was resolvable or the dispatch errored.
35
35
  - For review stalls, quote only residual issues from the final review report; do not summarize history.
36
36
  - For fact asks, put one `Searched: <where> - <result>` line per lookup directly under `Problem:`, in lookup order. For an unavailable named tool, write `Searched: <tool> - not available`. Omit `Searched:` for decisions, including extra-round approval.