pi-subagents 0.82.0 → 0.82.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 (37) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -1
  3. package/bundle/{chunk-GC4DSPMH.js → chunk-3JCDWF4V.js} +3 -3
  4. package/bundle/{chunk-NRQ75MGH.js → chunk-46XKCPJR.js} +33 -3
  5. package/bundle/{chunk-M2CTFYT3.js → chunk-4Y2ROR7L.js} +3 -3
  6. package/bundle/{chunk-VH5OAWVG.js → chunk-6XJB7PIX.js} +2 -2
  7. package/bundle/{chunk-7PCKZHR5.js → chunk-FXUXCX2K.js} +2 -2
  8. package/bundle/{chunk-7YMXOYEU.js → chunk-G4GZD3OJ.js} +7 -6
  9. package/bundle/{chunk-WVD4UEL4.js → chunk-IVAE5Z6Q.js} +12 -12
  10. package/bundle/{chunk-SIJ4S3EN.js → chunk-JYUKW2SY.js} +5 -5
  11. package/bundle/{chunk-7IVSUMQQ.js → chunk-PBK2I7WY.js} +3 -3
  12. package/bundle/{chunk-MHZ4G23A.js → chunk-PDZWJCHD.js} +1 -1
  13. package/bundle/{chunk-B5EKXDHE.js → chunk-QE4AGIMG.js} +11 -10
  14. package/bundle/{chunk-NGGAFDL6.js → chunk-UCPP4GNU.js} +1 -1
  15. package/bundle/{chunk-ZQGSDHL6.js → chunk-UTT254JE.js} +1 -1
  16. package/bundle/{chunk-W2SZ22EM.js → chunk-VSUSLDNW.js} +2 -2
  17. package/bundle/{chunk-ZLINIYTP.js → chunk-ZIV4J4HG.js} +6 -7
  18. package/bundle/index.js +1 -1
  19. package/bundle/preflight.js +2 -2
  20. package/docs/agents.md +6 -7
  21. package/package.json +1 -1
  22. package/skills/council-mode/SKILL.md +1 -4
  23. package/skills/pi-subagents/SKILL.md +130 -107
  24. package/skills/pi-subagents/references/orchestration.md +124 -0
  25. package/skills/pi-subagents/references/prompting-and-roles.md +96 -295
  26. package/src/extension/reply-workflow-script.js +5 -2
  27. package/src/extension/subagent-guide.js +1 -2
  28. package/src/runs/background/async-status.d.ts +2 -0
  29. package/src/runs/background/async-status.js +1 -1
  30. package/src/runs/background/terminal-run-index.d.ts +1 -0
  31. package/src/runs/background/terminal-run-index.js +40 -1
  32. package/src/tui/fleet.js +1 -0
  33. package/skills/pi-subagents/references/constraints-and-recipes.md +0 -74
  34. package/skills/pi-subagents/references/execution-controls.md +0 -564
  35. package/skills/pi-subagents/references/management-authoring-rpc.md +0 -165
  36. package/skills/pi-subagents/references/multi-lane-orchestration.md +0 -61
  37. package/skills/pi-subagents/references/review-and-validation.md +0 -73
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: pi-subagents
3
3
  description: |
4
- Technical guidance for operator-requested delegation to builtin or custom
5
- subagents: bounded handoffs, parallel review, scripted workflows, async work,
6
- forked context, isolation, and coordinated execution.
4
+ Delegate work to Pi subagents after the operator asks for it: one child,
5
+ parallel or scripted workflows, async runs, resume/steer/stop, review fanout,
6
+ and multi-lane or worktree orchestration.
7
7
  ---
8
8
 
9
9
  # Pi Subagents
@@ -14,111 +14,134 @@ instructions. Task size, complexity, risk, tool-call count, recipe fit, or an
14
14
  available specialist does not independently authorize delegation.
15
15
 
16
16
  Once authorized, choose the smallest bounded shape that earns its token and
17
- elapsed-time overhead through concrete evidence, independent review,
18
- specialization, useful parallelism, or needed isolation. A single child is
19
- valid; writer, challenge, and review stages must each earn their overhead rather
20
- than becoming default ceremony. The parent keeps user intent, constraints,
21
- routing, arbitration, decisions, final acceptance, and publication authority,
22
- and may perform the work directly where it is the most efficient owner.
17
+ elapsed-time overhead through evidence, independent review, specialization,
18
+ useful parallelism, or isolation. A single child is valid. The parent keeps
19
+ intent, routing, decisions, final acceptance, and publication authority, and
20
+ does the work itself where that is cheaper.
21
+
22
+ ## Calls
23
+
24
+ ```typescript
25
+ subagent({ agent: "worker", task: "<brief>" }) // one child; async by default
26
+ subagent({ workflow: "parallel", args: { tasks: [{ agent, task, cwd?, model? }] } }) // independent children
27
+ subagent({ workflow: true }) // runs the one ```js workflow block in this same reply
28
+ subagent({ workflow: "./lane.js", args }) // script file, path relative to the request cwd
29
+ subagent({ action: "validate", workflow: "./lane.js" }) // check a script without launching
30
+ subagent({ action: "status", id }) // options: { view: "fleet" } or { view: "transcript", index: 0 }
31
+ subagent({ action: "resume", id, message }) // completed or paused child; returns a new run id
32
+ subagent({ action: "steer", id, message }) // live async child
33
+ subagent({ action: "stop", id }) // ends the run; not resumable
34
+ subagent({ action: "interrupt", id }) // pauses the child's current turn
35
+ subagent({ action: "list" }) · subagent({ action: "models" })
36
+ subagent({ action: "guide", options: { topic: "<section address>" } })
37
+ ```
38
+
39
+ Launches are async by default. Set `async: false` only when the parent must
40
+ block; final reviews and gates stay async. After launching, keep doing safe
41
+ independent work, or yield: native completion wakes this session. Do not sleep,
42
+ poll, or call `bg_wait` for ordinary children. Use `bg_wait` only for provider
43
+ or detached work that has no native notification and whose result this turn
44
+ needs.
45
+
46
+ ## Workflow scripts
47
+
48
+ Use a script when later steps depend on earlier results, or for keyed,
49
+ retried, aggregated, or resumed children. Write one ```` ```js workflow ````
50
+ block in the reply and call `subagent({ workflow: true })` in the same reply.
51
+ For a long script, or when a `workflow: true` call reports the block missing,
52
+ write it to a file and pass `workflow: "./path.js"`. On Claude 5.x models (Opus
53
+ 5.5, Sonnet 5.5, Fable 5.1), use the file whenever the turn already made a tool
54
+ call: text after one reaches the session as a summary without the block. Calls in one reply run at
55
+ the same time, so write the file in one reply and `validate` or launch it in
56
+ the next.
57
+
58
+ ```js workflow
59
+ const scan = await runs.run("scan", { label: "Map auth flow", agent: "scout", task: "..." });
60
+ const reviews = await runs.all([
61
+ { key: "correctness", label: "Review auth correctness", agent: "reviewer", task: "... " + scan.output },
62
+ { key: "tests", label: "Review auth tests", agent: "reviewer", task: "..." },
63
+ ]);
64
+ return reviews.map((review) => review.output);
65
+ ```
66
+
67
+ - Scripts are statement bodies with an explicit `return`, top-level `await`,
68
+ and plain helpers. Nested async functions, arrows, and methods are rejected.
69
+ - Every `runs.run` / `runs.all` item needs a stable `key`. Add a short
70
+ verb + behavior `label` unless the user gave one.
71
+ - Bind files with `output: "plans/x.md"` (relative paths land in run
72
+ artifacts) and return `outputReference` or `artifactPaths`. A filename in
73
+ task text does not route output. Never send reports to the repo root.
74
+ - `runs.lanes([{ key, stages: [...] }])` runs a predeclared plan: first stages
75
+ together, later stages in order per lane.
76
+
77
+ Resuming a retained child:
78
+
79
+ ```js workflow
80
+ let child = await runs.run("fix-1", { agent: "worker", task: "..." });
81
+ child = await runs.run("fix-2", { resume: child.runId, task: "Apply these accepted findings: ..." });
82
+ return child.output;
83
+ ```
84
+
85
+ - Always resume the latest returned run id; every resume returns a new one.
86
+ - Use a new stable key for every resume pass.
87
+ - `resume` excludes `agent` and `gate`; the child keeps its agent, model, and tools.
88
+ - Resume a completed child; steer a live one. Top-level `{ action: "resume" }` is detached.
89
+
90
+ ## Briefs
91
+
92
+ Every child starts cold. Its task states: goal; repo, explicit `cwd`, and
93
+ ref; authority and edit boundary; relevant files, decisions, and evidence;
94
+ success criteria; validation; expected output; and when to stop or ask.
95
+ Make parallel briefs differ by seam, evidence, and decision, not just an item
96
+ number.
97
+
98
+ ## Rules
99
+
100
+ - One writer per cwd or worktree. Parallelize reading, review, and
101
+ validation. `worktree: true` needs a clean checkout (untracked files count;
102
+ `.pi/subagents/` does not). For Pi extension repos, put lane worktrees
103
+ outside `~/.pi/agent/extensions`, for example `~/.pi/agent/worktrees`.
104
+ - Reviewers use fresh context. Use `context: "fork"` only when the child needs
105
+ the parent's history; it requires a persisted parent session.
106
+ - Children do not spawn subagents unless the parent delegated fanout and their
107
+ resolved `tools` include `subagent`.
108
+ - A failed workflow, launch, prompt runtime, extension load, or child tool
109
+ setup blocks the lane. Stop, report the exact failure and run/worktree state,
110
+ verify a clean worktree or capture the partial diff, then retry the same way
111
+ once. Switching to `interactive_shell`, `pi -ne`, or another CLI needs owner
112
+ approval.
113
+ - As a conservative orchestration policy, do not pass a hard `toolBudget` or tight `usageBudget` to mutation-capable workers. The default tool budget blocks read/search tools rather than mutation tools. If interrupted after a tool call starts, checkpoint after the current tool returns with changed files, build/test state, and commit or PR state.
114
+ - Route workers and scouts to a fast capable tier, serious reviews to a strong
115
+ tier, and top reasoning only to bounded read-only critique. Exact model names
116
+ belong in user or project settings, not here.
117
+ - `subagent`, `subagents_enable`, `subagent_supervisor`, `contact_supervisor`, and `structured_output` are model-only: call them as ordinary model tool calls. Codemode scripts cannot reach them through `tools.*`, `ALL_TOOLS`, or `searchTools`.
118
+ - Receipts, CI, and review bots are evidence, not authority. Backlog, release,
119
+ and merge policy belong to the user's or project's own skill.
23
120
 
24
- Children do not spawn subagents unless the parent explicitly delegated fanout
25
- and their resolved `tools` allow `subagent`.
121
+ ## Look up the rest
26
122
 
27
- ## Launch shape
123
+ If only `subagents_enable` is visible, call it first; `subagent` and `guide`
124
+ work from the next request. Read one section, not a whole topic:
28
125
 
29
- | Need | Use |
30
- | --- | --- |
31
- | One bounded task for one child | direct `{ agent, task }` |
32
- | JavaScript control flow or data-dependent branching; sequence, fanout, retry, rolling fanout, or aggregation | a workflow script with `runs.run(...)` / `runs.all(...)` |
33
- | A broad plan split into visible narrow stages per lane | a workflow script with `runs.lanes([{ key, stages: [...] }])` |
34
- | Independent worktree or repository lanes | `references/multi-lane-orchestration.md` |
35
- | Council of advisors | `../council-mode/SKILL.md` |
36
- | Management, status, steering, authoring, or inspection | `action` |
37
-
38
- To launch a workflow script, write it as one ```` ```js workflow ```` fenced
39
- block in your reply, then call `subagent({ workflow: true, ... })` in the same
40
- reply. Use `workflow: "./path/to/script.js"` for a script file and
41
- `workflow: "<name>"` for a named resource.
42
-
43
- A workflow script is code-driven: `runs.run(...)` for keyed steps,
44
- `runs.all([...])` for fanout, plain JavaScript for branching and aggregation.
45
- Keep scripts portable: use top-level `await`, plain helpers, or explicit Promise
46
- chains, not nested async helpers. Legacy top-level `chain` / `tasks` inputs and
47
- durable `.chain.md` execution are inspection or migration material only, except
48
- that `disabledFeatures: ["workflow-scripts"]` replaces scripts with top-level
49
- `chain` and `tasks` (see [configuration](../../docs/configuration.md#chain-and-tasks-without-workflow-scripts)).
50
-
51
- Use `runs.lanes(...)` only inside a workflow script, not as a top-level mode,
52
- when a broad, predeclared plan benefits from visible per-lane stages; otherwise
53
- use ordinary `runs.run(...)` / `runs.all(...)`. See the [canonical staged-lane
54
- example](../../docs/workflows.md#parallel-sequential-lanes). Keep assignments
55
- bounded, but do not add stages or ceremony just to satisfy this skill.
56
-
57
- When composing `runs.run(...)`, `runs.all(...)`, or `runs.lanes(...)`, always
58
- supply a short verb + behavior display `label` derived from the task, unless
59
- the user supplied an explicit label; preserve that label. Keep the stable
60
- machine `key` independent (for example, `issue2011-writer` with
61
- `label: "Fix workflow steering"`). For `runs.lanes`, put labels on stage
62
- items, not lane objects. Use stage-appropriate labels for reviews and retained-child
63
- follow-ups too (for example, `Review workflow steering`). Generate labels in
64
- the orchestrator while composing the launch—no extra model call, runtime
65
- generator, or schema change. Native direct `{ agent, task }` calls have no
66
- top-level `label` parameter; do not invent one or wrap a tiny single task in
67
- a workflow just to label it.
68
-
69
- Use async/background by default. Set `async:false` only when the parent must
70
- block. Final reviews, validation gates, oracle checks, and publication checks
71
- stay async.
72
-
73
- In an ordinary interactive session, yield after launching or triaging useful
74
- async lanes and let Pi wake the parent on completion; ordinary async subagents
75
- already have native completion notifications, so do not call `bg_wait()` merely
76
- because a child is active. Use blocking `bg_wait()` only for provider,
77
- detached, or other background work without a native notification when a
78
- headless/run-to-completion contract or a required same-turn artifact makes the
79
- result necessary before this turn ends. For
80
- “continue/orchestrate/work until done,” keep the lane board moving while a safe
81
- immediate action remains; if only async lanes are running, record the revisit
82
- trigger and yield.
83
-
84
- Package agents appear in `subagent({ action: "list" })`. External CLI/job agents
85
- use their own runner contract. Do not pass native Pi child options to them unless
86
- that runner explicitly supports the option.
87
-
88
- ## Read the reference for the branch
89
-
90
- For exact API fields and worked examples, call `subagent({action:"guide",options:{topic:"tool-reference"}})` or `topic:"workflows"`. The compact tool definition is not the recipe catalog; use `topic:"missions"` for mission updates and schedules.
91
-
92
- | Branch | Read |
126
+ | Need | Guide section |
93
127
  | --- | --- |
94
- | Delegate or choose roles, prompts, models, or slash commands | `references/prompting-and-roles.md` |
95
- | Execute single, scripted, async, scheduled, mission, forked, watchdog, oracle, or intercom workflows | `references/execution-controls.md` |
96
- | Review, validate, triage gate failures, or prepare delivery | `references/review-and-validation.md` |
97
- | Coordinate lanes, worktrees, repositories, or writer waves | `references/multi-lane-orchestration.md` |
98
- | List, create, edit, disable, eject, or expose agents/RPC | `references/management-authoring-rpc.md` |
99
- | Check safety constraints, recipes, or error handling | `references/constraints-and-recipes.md` |
100
-
101
- For an authorized complex delegated workflow, read `prompting-and-roles.md` and
102
- `execution-controls.md`, then load `review-and-validation.md` and
103
- `constraints-and-recipes.md` before launch or review.
104
-
105
- ## Operating rules
106
-
107
- - Avoid duplicate scouts, overlapping writers, and vague prompts without a concrete deliverable.
108
- - Call `subagent`, `subagents_enable`, `subagent_supervisor`, `contact_supervisor`, and `structured_output` as ordinary model tool calls. They are model-only, so codemode scripts cannot reach them through `tools.*`, `ALL_TOOLS`, or `searchTools`.
109
- - Keep the parent on the ordinary strong default model. Route workers/scouts to a fast capable tier, serious reviews to a strong tier, and top reasoning to bounded read-only critique.
110
- - Exact model names are deployment policy. Put them in user/project settings or profiles, not package guidance.
111
- - Give every child a compact meta-prompt checklist: objective; repo/cwd/ref; authority/edit boundary; relevant files/contracts and constraints; success/acceptance criteria; validation; expected output/report; and stop/ask conditions. See `references/prompting-and-roles.md`.
112
- - Before launching a writer for substantial mutation work, classify it as single-seam or multi-seam and partition multi-seam work across exclusive component owners, gates, and durable handoffs before an integration-only owner. See `references/multi-lane-orchestration.md`.
113
- - For mutation work, use an isolated lane/worktree when isolation, overlap, or concurrent juggling matters; keep one writer per cwd/worktree. `worktree: true` refuses to launch unless the source checkout is clean (untracked files count; `.pi/subagents/` does not), so commit your own changes first or plan the lane without managed isolation. See `references/multi-lane-orchestration.md` for lane mechanics.
114
- - Keep long/high-output validation out of chat: prefer `interactive_shell` dispatch/background monitors, bounded logs, or subagent-owned reports; return a concise summary plus report path unless same-turn output is required. Do not use `interactive_shell` as an implicit fallback for a failed `subagent` lane; see `references/execution-controls.md`.
115
- - Treat subagent workflow, child launch, prompt runtime, extension load, and child tooling setup failures as lane infrastructure blockers. Stop, report the exact failure and run/worktree state, verify a clean worktree or capture a partial diff, and use only a clear same-protocol retry or an owner-approved execution-mode fallback.
116
- - For cross-codebase work, record the repo, explicit `cwd`, authority boundary, and expected output before launch.
117
- - Make parallel prompts distinct by source seam, evidence, and decision. Do not clone prompts with only item numbers swapped.
118
- - Prefer fresh-context review/validation fanout, then synthesize and apply fixes in the parent.
119
- - For Pi extension repos under `~/.pi/agent/extensions`, put lane worktrees outside extension auto-discovery, such as `~/.pi/agent/worktrees`.
120
- - Preserve capability ceilings, including child tool limits and allowed-agent restrictions.
121
- - Preserve parent authority and escalate unresolved choices.
122
- - Treat receipts, CI, review bots, and external-run records as evidence, not authority.
123
- - For backlog maintenance, releases, merge queues, or other public-repo mutation policy, load the matching user/project skill. This package defines delegation primitives, not private policy.
124
- - As a conservative orchestration policy, do not pass a hard `toolBudget` or tight `usageBudget` to mutation-capable workers. The default tool budget blocks read/search tools rather than mutation tools. If interrupted after a tool call starts, checkpoint after the current tool returns with changed files, build/test state, and commit or PR state.
128
+ | Script API: `runs.*`, `state`, limits | `workflows/scripted-workflows` |
129
+ | Typed gates, host commands, rolling fanout | `workflows/typed-post-run-checks-and-typed-steps`, `workflows/host-command-steps`, `workflows/advanced-rolling-child-runs` |
130
+ | Budgets, timeouts, `baseRef`, `gate`, `output` | `tool-reference/execution-parameters`, `tool-reference/output-mode-details` |
131
+ | Fresh or forked context | `tool-reference/fork-context-details` |
132
+ | Resume, steer modes, stop, status | `tool-reference/retained-children`, `tool-reference/resume`, `tool-reference/steer`, `tool-reference/stop`, `tool-reference/status` |
133
+ | Acceptance and review gates | `tool-reference/acceptance-gates` |
134
+ | Worktrees and handoffs | `workflows/worktree-isolation` |
135
+ | Child asks the parent (`contact_supervisor`) | `workflows/supervisor-coordination-child-asks-parent` |
136
+ | Agent create, update, eject, disable, refine | `tool-reference/management-actions`, `agents/frontmatter-reference` |
137
+ | Missions and schedules | `missions/missions`, `missions/schedules` |
138
+ | Watchdog | `watchdog/when-it-runs`, `watchdog/choosing-a-model` |
139
+ | Model overrides and profiles | `models/setting-defaults-and-overrides` |
140
+ | Other projects in panes | `tool-reference/herdr-project-panes` |
141
+ | Setup looks wrong | `subagent({ action: "doctor" })` |
142
+
143
+ ## References
144
+
145
+ - Choosing roles, writing prompts, review/research/cleanup techniques, oracle → [prompting-and-roles.md](references/prompting-and-roles.md)
146
+ - Several lanes, worktrees, repositories, staged fixes, review loops, finding and gate triage → [orchestration.md](references/orchestration.md)
147
+ - Advisor council → [../council-mode/SKILL.md](../council-mode/SKILL.md)
@@ -0,0 +1,124 @@
1
+ # Orchestration
2
+
3
+ Use this when several tasks need coordinated children, worktrees, or
4
+ repositories, or when a change goes through write, review, and fix rounds.
5
+ Create lanes only after delegation is operator-authorized and each lane
6
+ materially improves evidence, independent review, specialization, useful
7
+ parallelism, or isolated execution. Keep dependent work serial.
8
+
9
+ ## Recipes
10
+
11
+ Recipes select a shape; they do not authorize delegation. Pick the smallest:
12
+
13
+ - **Recon then implement:** one focused `scout`, then one `worker` that gets its findings.
14
+ - **Implementation:** settle scope and acceptance first, then use a scout, writer, or fresh reviewer only where that stage earns its overhead. Split large work into serial milestones, not a writer swarm.
15
+ - **Parallel analysis:** fan out only independent read, review, or validation work, or give each writer its own worktree.
16
+
17
+ ## Seams before writers
18
+
19
+ Before launching a writer for substantial mutation work, classify it as
20
+ **single-seam** or **multi-seam**. Two or more independently testable
21
+ contracts or source boundaries make it multi-seam. One PR does not imply one
22
+ writer.
23
+
24
+ - **Multi-seam:** give each component writer exclusive file or contract
25
+ ownership, a focused gate, and a committed or otherwise durable handoff.
26
+ Start one integration-only owner after those handoffs are ready. Repartition
27
+ any writer brief that owns all major outcomes across independent boundaries.
28
+ - **Single-seam:** one writer is right when the work is one coupled seam, or
29
+ when splitting would create overlapping ownership or artificial handoffs.
30
+ Record that evidence. Do not split coupled work to raise the lane count.
31
+
32
+ ## Lane board
33
+
34
+ Before more than one mutation-capable lane starts, record in the parent:
35
+
36
+ `Lane | repo/cwd | decision | owned files or contract | isolation path | authority | next gate | handoff | why independent`
37
+
38
+ One source seam or decision is one lane. Record each lane's delivery target,
39
+ allowed actions, validation, and review rigor. For cross-repository work,
40
+ name the shared contract and which repository changes first. A blocked
41
+ decision is a lane state: owner, options, recommended default, and the
42
+ evidence needed to continue.
43
+
44
+ Mutation lanes need distinct isolation paths and explicit `cwd` values.
45
+ `worktree: true` branches from `HEAD` (or `baseRef`) and refuses a dirty
46
+ checkout; in a shared or dirty checkout, commit first or give each lane a
47
+ worktree you created. Use one async workflow for a coordinated wave:
48
+ `runs.all` for independent lanes, `runs.run` for dependent stages, repo slug
49
+ or lane key in every child key and output path.
50
+
51
+ While one lane waits, run safe independent preparation, validation, or
52
+ read-only review. When only async lanes remain, record what reopens work and
53
+ yield; completion wakes the parent.
54
+
55
+ ## Review loop
56
+
57
+ 1. Inspect the source, diff, issue, or plan directly.
58
+ 2. One writer implements inside its boundary and runs focused validation that can fail for the changed behavior.
59
+ 3. When the delegation contract calls for independent review, fresh-context read-only reviewers inspect the actual worktree. Otherwise parent inspection is enough; skip review for trivial wording, renames, or local probes.
60
+ 4. The parent classifies findings (below) and sends accepted fixes to one writer: resume the original worker with its latest run id, or launch one forked `worker` as `/review-loop` does.
61
+ 5. Re-run affected validation and review only the changed blast radius.
62
+ 6. Stop when no blocker or fix worth doing now remains, an unapproved product, scope, or architecture decision appears, or the round cap is reached (default 3). Do not loop for polish. Children never decide the loop outcome.
63
+
64
+ An async writer's handoff is an intermediate state, not completion, unless the
65
+ user asked for writer-only work.
66
+
67
+ | Situation | Review shape |
68
+ | --- | --- |
69
+ | One coherent diff or risk | one reviewer |
70
+ | Independent risks (correctness, tests, security, UI) | parallel reviewers with distinct contracts |
71
+ | Possible over-scope | same-writer challenge before fresh review |
72
+ | Material design tradeoff | council mode |
73
+
74
+ ### Staged fixes
75
+
76
+ When reviews have produced findings across several clusters:
77
+
78
+ 1. Run a read-only planning fanout, one reviewer per cluster or angle, each returning exact files, lines, fixes, and validation.
79
+ 2. Classify the accepted fixes as single-seam or multi-seam (above) on the lane board before any writer starts.
80
+ 3. Give a writer only its assigned stage. Pass each earlier result into the later task by variable or by its declared `output` path, not as a whole aggregate blob. With `runs.lanes`, keep stages narrow: red test, helper change, one render seam, validation, review.
81
+ 4. Validate the integrated result with fresh read-only reviewers on distinct angles.
82
+
83
+ When a child returns a target list, validate it in JavaScript and map bounded
84
+ entries into `runs.all`.
85
+
86
+ ## Finding disposition
87
+
88
+ Classify each finding against the current head:
89
+
90
+ - **Valid blocker:** concrete failure, repro, security issue, contract mismatch, or source-proven regression. Fix now.
91
+ - **Valid non-blocker:** real but outside the slice. Record or defer.
92
+ - **Stale:** already fixed or absent. Cite current evidence.
93
+ - **Invalid:** contradicted by source, tests, docs, or approved scope. Cite it.
94
+ - **Out of scope or policy:** needs an unapproved product, architecture, authority, or release decision. Escalate.
95
+ - **Speculative:** no contract, repro, or reachable failure. Do not block.
96
+
97
+ Classify bot comments the same way before assigning severity.
98
+
99
+ ## Gate failures
100
+
101
+ 1. Confirm the run belongs to the exact head under judgment.
102
+ 2. Read the focused failing log; name the failing test, assertion, or contract.
103
+ 3. Classify: current diff, stale test, environment, or existing flake.
104
+ 4. Reproduce with the narrowest command when practical.
105
+ 5. Patch forward when the diff caused it. For a stale or flaky failure, collect proof before one rerun.
106
+ 6. Re-run the affected command or exact-head gate after every fix.
107
+
108
+ ## Handoff and cleanup
109
+
110
+ A handoff states lane status, repository and worktree, changed files,
111
+ validation, open decisions, next action, and artifact or receipt paths. Copy
112
+ only final evidence to memory, a mission, a PR, or an approved docs path, then
113
+ remove scratch reports from the worktree.
114
+
115
+ Keep a worktree until its handoff is durable, no run owns it, and no later
116
+ gate needs it. If a run stops or needs attention, preserve its worktree and
117
+ artifacts, then resume that run or start one replacement lane from the
118
+ handoff. Never start a second writer while worktree ownership is unclear.
119
+
120
+ Before reporting done, check the board: every lane terminal or blocked with a
121
+ named next action; one writer per worktree; required validation and fresh
122
+ review done; accepted findings fixed and revalidated; publication authority
123
+ present before any push, comment, merge, or release; residual risks and
124
+ skipped checks stated.