opencode-plugin-flow 4.3.8 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -11,14 +11,18 @@ import { dirname, join, normalize, sep } from "node:path";
11
11
  var handoff_format_default = `# Flow worker handoff contract
12
12
 
13
13
  Flow managers merge only the worker's final response. Treat that response as the
14
- worker report of record: it must include the assigned scope, what was actually
15
- covered, the evidence for each useful claim, and the remaining gaps. End worker
16
- prompts with "Return only this Flow handoff."
17
-
18
- Empty or unstructured worker output is a failed handoff. If the worker cannot
19
- cover the assigned scope, verify the evidence, or satisfy the handoff shape, it
20
- must return \`Status: blocked\` with the missing elements, and the manager must
21
- not treat the slice as complete.
14
+ worker report of record. End worker prompts with "Return only this Flow
15
+ handoff."
16
+
17
+ <!-- flow-prompt:worker-integrity:start -->
18
+ Cite or drop every claim. Label single-source, inferred, and unsettled claims.
19
+ When usable evidence exists but named expected coverage could not be checked,
20
+ return the required handoff with \`## Status\` set to \`partial\` and enumerate the
21
+ unchecked items and reasons. If the assignment or required shape is missing,
22
+ or no usable coverage can be produced, return the required handoff with
23
+ \`## Status\` set to \`blocked\` and name the missing elements. Empty or
24
+ unstructured output is a failed handoff.
25
+ <!-- flow-prompt:worker-integrity:end -->
22
26
 
23
27
  Sections: evidence/review/validation/audit worker report, verifier worker report,
24
28
  and candidate implementation worker report.
@@ -34,149 +38,144 @@ Status meanings:
34
38
 
35
39
  ## Evidence, review, validation, or audit worker report
36
40
 
37
- Use this for \`flow-evidence-worker\`, \`flow-reviewer\`,
38
- \`flow-validation-worker\`, and \`flow-audit-worker\`.
41
+ Use the one role-specific block that matches the assigned worker.
39
42
 
40
- \`\`\`markdown
43
+ <!-- flow-prompt:handoff-evidence:start -->
44
+ Return only this Flow handoff:
41
45
  ## Status
42
46
  success | partial | blocked
43
-
44
47
  ## Scope
45
- <owned slice: path set, module, command, risk lens, route, data range, or question set>
46
-
48
+ assigned slice
47
49
  ## Pass metadata
48
- - Pass id: <stable pass id from the manifest>
49
- - Manifest row id: <row id from the manifest>
50
- - Depends on: <upstream row ids or "none">
51
- - Write scope: <none | manager-serial | exact-path | isolated-worktree | mixed>
52
-
50
+ pass id, manifest row id, dependencies, write scope
53
51
  ## Coverage
54
- - Expected: <files, ranges, questions, commands, or findings assigned>
55
- - Checked: <actual coverage, for example "12/12 files" or "command not run">
56
- - Not checked: <items skipped with reason, or "none">
57
-
52
+ expected, checked, not checked with reasons
58
53
  ## Findings or facts
59
- - [high|med|low] <claim>; evidence: <file:line | command summary | screenshot path | URL | metric>; corroboration: <N sources or "single source">
60
- - [high|med|low] <claim>; evidence: <...>; corroboration: <...>
61
-
54
+ confidence, atomic claim, citation, corroboration
62
55
  ## Sources
63
- - <paths read, commands run, docs fetched, data ranges covered, screenshots inspected>
64
-
56
+ paths, commands, documents, screenshots, or data ranges inspected
65
57
  ## Confidence and verification
66
- - Verified: <claims directly re-run, recounted, traced, or cross-checked>
67
- - Single-source: <claims with exactly one supporting source>
68
- - Inferred: <claims derived from surrounding evidence rather than directly observed>
69
- - Unsettled: <claims, sources, or citations that could not be resolved>
70
- - Falsifier or missing input: <what would overturn or materially change the result>
71
-
58
+ verified, single-source, inferred, unsettled, falsifier
72
59
  ## Open questions / gaps
73
- - <ambiguity, missing source, contradiction, skipped item, or out-of-scope dependency>
74
-
75
60
  ## Manager follow-ups
76
- - <concrete next tasks, verifier claims, validation commands, or Flow plan targets>
77
- \`\`\`
61
+ <!-- flow-prompt:handoff-evidence:end -->
78
62
 
79
- Validation workers must include exact command names and raw outcome summaries
80
- for commands they actually ran. Audit workers must include guards checked for
81
- any blocking-severity candidate. Review workers must separate blocking findings
82
- from advisory notes. In the shared \`Findings or facts\` section, review workers
83
- should prefix review items with \`blocking:\` or \`advisory:\` before the claim.
63
+ <!-- flow-prompt:handoff-validation:start -->
64
+ Return only this Flow handoff:
65
+ ## Status
66
+ success | partial | blocked
67
+ ## Scope
68
+ assigned checks or validation question
69
+ ## Pass metadata
70
+ pass id, manifest row id, dependencies, write scope
71
+ ## Coverage
72
+ expected, checked, not checked with reasons
73
+ ## Commands and outcomes
74
+ exact command, status, raw outcome summary, behavior covered
75
+ ## Confidence and verification
76
+ verified, single-source, inferred, unsettled, falsifier
77
+ ## Open questions / gaps
78
+ ## Manager follow-ups
79
+ <!-- flow-prompt:handoff-validation:end -->
84
80
 
85
- Example evidence quality:
81
+ <!-- flow-prompt:handoff-audit:start -->
82
+ Return only this Flow handoff:
83
+ ## Status
84
+ success | partial | blocked
85
+ ## Scope
86
+ assigned paths, risks, or candidate findings
87
+ ## Pass metadata
88
+ pass id, manifest row id, dependencies, write scope
89
+ ## Coverage
90
+ expected, checked, not checked with reasons
91
+ ## Findings
92
+ severity, atomic claim, citation, corroboration, guards checked, refutation result
93
+ ## Sources
94
+ ## Confidence and verification
95
+ verified, single-source, inferred, unsettled, falsifier
96
+ ## Open questions / gaps
97
+ ## Manager follow-ups
98
+ <!-- flow-prompt:handoff-audit:end -->
86
99
 
87
- - Good fact: \`[high] public Flow command prompts include bundled instructions;
88
- evidence: src/config-shared.ts:135; corroboration: single source\`.
89
- - Weak fact: \`[high] prompts look self-contained; evidence: read the config\`.
90
- - Good validation: \`bun test tests/distribution-and-surface.test.ts\`, status
91
- passed, summary \`surface tests passed and covered bundled command prompts\`.
92
- - Weak validation: \`tests pass\`, with no command, status, or raw outcome.
100
+ <!-- flow-prompt:handoff-review-slice:start -->
101
+ For an assigned review slice, return only this Flow handoff:
102
+ ## Status
103
+ success | partial | blocked
104
+ ## Scope
105
+ assigned files, risk lens, or validation surface
106
+ ## Pass metadata
107
+ pass id, manifest row id, dependencies, write scope
108
+ ## Coverage
109
+ expected, checked, not checked with reasons
110
+ ## Findings
111
+ prefix each \`blocking:\` or \`advisory:\`, then severity, claim, citation, and corroboration
112
+ ## Sources
113
+ ## Confidence and verification
114
+ verified, single-source, inferred, unsettled, falsifier
115
+ ## Open questions / gaps
116
+ ## Manager follow-ups
117
+ <!-- flow-prompt:handoff-review-slice:end -->
93
118
 
94
119
  ## Verifier worker report
95
120
 
96
- Use this for \`flow-verifier-worker\`. Give it atomic claims and the cited sources
97
- or commands. Do not include the generator's reasoning unless that reasoning is
98
- the thing being verified, and do not say which worker produced the claim.
121
+ Use this for \`flow-verifier-worker\`.
99
122
 
100
- \`\`\`markdown
123
+ <!-- flow-prompt:handoff-verifier:start -->
124
+ Return only this Flow handoff:
101
125
  ## Status
102
126
  success | partial | blocked
103
-
104
127
  ## Scope
105
- <claim ids, sources or commands checked, and the acceptance question>
106
-
128
+ atomic claim ids, sources or commands checked, acceptance question
107
129
  ## Pass metadata
108
- - Pass id: <stable pass id from the manifest>
109
- - Manifest row id: <row id from the manifest>
110
- - Depends on: <upstream row ids or "none">
111
-
130
+ pass id, manifest row id, dependencies
112
131
  ## Verdict per claim
113
- - <claim id>: verdict=<supported | partly-supported | unsupported | source-not-found>
114
- - claim: <claim text>
115
- - evidence: <supporting snippet, path plus line, measured value, command result, or "none">
116
- - source resolution: <URL, path, or command plus whether it resolved>
117
- - confidence level: high | med | low
118
- - recommended action: <keep, narrow, rewrite, or remove>
119
-
132
+ supported | partly-supported | unsupported | source-not-found; include claim, resolved evidence, confidence, recommended action
120
133
  ## Overall
121
- <accept | revise | reject> because <brief reason>
122
-
134
+ accept | revise | reject with reason
123
135
  ## Gaps
124
- - <unavailable source, ambiguous claim wording, missing oracle, or check not run>
125
-
126
136
  ## Manager follow-ups
127
- - <narrow recheck, plan adjustment, review finding, or none>
128
- \`\`\`
137
+ <!-- flow-prompt:handoff-verifier:end -->
129
138
 
130
139
  ## Candidate implementation worker report
131
140
 
132
- Use this only with explicit user authorization, in an isolated worktree or an
133
- exact non-overlapping path-owned slice assigned by the manager.
141
+ Use this only with explicit user authorization and isolated or exact-path
142
+ ownership.
134
143
 
135
- \`\`\`markdown
144
+ <!-- flow-prompt:handoff-candidate:start -->
145
+ Return only this Flow handoff:
136
146
  ## Status
137
147
  success | partial | blocked
138
-
139
148
  ## Scope
140
- <isolated worktree or exact path-owned slice>
141
-
149
+ isolated worktree or exact path-owned slice
142
150
  ## Pass metadata
143
- - Pass id: <stable pass id from the manifest>
144
- - Manifest row id: <row id from the manifest>
145
- - Depends on: <upstream row ids or "none">
146
- - Write scope: <exact-path | isolated-worktree>
147
-
151
+ pass id, manifest row id, dependencies, exact-path | isolated-worktree
148
152
  ## Changed or proposed patch
149
- - <path>: <what changed and why>
150
-
153
+ paths, change, reason
151
154
  ## Coverage
152
- - Assigned: <owned files/modules>
153
- - Touched: <files changed or proposed>
154
- - Skipped: <anything assigned but not changed and why, or "none">
155
-
155
+ assigned, touched, skipped with reasons
156
156
  ## Verification
157
- live-verified | test-verified | type-check-only | not-verified
158
- - <command, observed outcome, pass/fail counts, or manual check>
159
-
157
+ level, exact command or check, observed outcome
160
158
  ## Confidence and risk
161
- - Checked directly: <behavior, files, or commands verified by the worker>
162
- - Still open: <tests, review paths, or integration points the manager must cover>
163
- - Risk: low | medium | high -- <why>
164
-
159
+ directly checked, still open, risk with reason
165
160
  ## Merge notes
166
- - <conflicts, nearby user changes, assumptions, or deviations>
167
-
161
+ conflicts, user changes, assumptions, deviations
168
162
  ## Manager follow-ups
169
- - <merge, reject, rerun check, verifier pass, or replan task>
170
- \`\`\`
163
+ <!-- flow-prompt:handoff-candidate:end -->
171
164
 
172
165
  The manager must inspect and validate any candidate patch before recording Flow
173
166
  completion.
174
167
 
175
168
  ## Manager pass accounting record
176
169
 
177
- The manager, not the worker, may carry compact records into
170
+ The manager, not the worker, may carry bounded records into
178
171
  \`flow_feature_complete.orchestrationPasses\`. Use one record per material pass or
179
172
  implementation decision; keep handoffs and long artifacts outside \`.flow/**\`.
173
+ The candidate accounting rules — which \`candidateEligibility\`,
174
+ \`candidateDecision\`, and \`decision\` combinations validate, and what counts as
175
+ candidate execution evidence — live in
176
+ [parallel-decision.md](parallel-decision.md) under "Implementation pass
177
+ decision"; note \`decision: "parallel"\` is not valid on
178
+ \`implementation-decision\` records.
180
179
 
181
180
  \`\`\`json
182
181
  {
@@ -184,6 +183,16 @@ implementation decision; keep handoffs and long artifacts outside \`.flow/**\`.
184
183
  "kind": "discovery | audit | review | validation | verification | candidate | implementation-decision",
185
184
  "decision": "serial | parallel | candidate-exact-path | candidate-worktree | tournament | skipped",
186
185
  "decisionReason": "why this pass shape was chosen",
186
+ "candidateEligibility": "eligible | not_eligible | unknown",
187
+ "candidateDecision": "used | skipped | serial_required",
188
+ "decisionFactors": [
189
+ "shared_state",
190
+ "overlapping_files",
191
+ "small_slice",
192
+ "needs_manager_judgment",
193
+ "independent_surface",
194
+ "validation_available"
195
+ ],
187
196
  "modes": ["evidence"],
188
197
  "workerCount": 1,
189
198
  "candidateWorkerCount": 0,
@@ -193,449 +202,258 @@ implementation decision; keep handoffs and long artifacts outside \`.flow/**\`.
193
202
  "writeScope": "none | manager-serial | exact-path | isolated-worktree | mixed",
194
203
  "handoffRefs": ["/tmp/flow-handoff.md"],
195
204
  "verificationStatus": "not-needed | pending | passed | failed | mixed | downgraded",
196
- "outcome": "accepted | rejected | partial | not-covered | superseded",
205
+ "outcome": "accepted | modified | rejected | partial | not-covered | superseded",
197
206
  "synthesisRef": "/tmp/flow-synthesis.md"
198
207
  }
199
208
  \`\`\`
200
209
  `;
201
210
 
202
- // skills/flow/references/parallel-orchestration.md
203
- var parallel_orchestration_default = `# Parallel orchestration
211
+ // skills/flow/references/parallel-decision.md
212
+ var parallel_decision_default = `# Parallel pass decisions
204
213
 
205
- Use fan-out when Flow work is broad enough that independent workers can gather
206
- evidence faster than one linear pass. The manager still owns the Flow session:
207
- only the manager calls state-changing Flow tools, approves plans, completes
208
- features, records reviews, or closes sessions.
214
+ Read this reference after serial orientation and before creating a pass
215
+ manifest. It decides whether fan-out is worth its coordination cost and records
216
+ why implementation stays serial or uses candidate workers.
209
217
 
210
- Every parallel pass runs the same loop:
218
+ <!-- flow-prompt:manager-parallel-core:start -->
219
+ ## Conditional parallel pass
211
220
 
212
- **orient slice manifest fan out account verify → synthesize →
213
- extend or stop.**
221
+ Use a parallel pass only when independent coverage is worth its coordination
222
+ cost. Orient serially first. Before fan-out record a stable pass id, purpose,
223
+ bounded worker count, exact non-overlapping slices, expected coverage, named
224
+ Flow worker roles, dependencies, write scope, handoff kind, verification plan,
225
+ and stop condition.
214
226
 
215
- This file is the whole playbook; read it once and run the pass. Two companions
216
- stay separate:
217
-
218
- - \`handoff-format.md\` holds the worker response templates. The manager pastes
219
- the matching template verbatim into every worker prompt.
220
- - \`parallel-pass-example.md\` walks one concrete end-to-end pass (synced with
221
- the \`flow\` skill; not bundled into commands).
227
+ Use \`flow-evidence-worker\` for discovery, \`flow-validation-worker\` for commands,
228
+ \`flow-audit-worker\` for adversarial findings, \`flow-verifier-worker\` for
229
+ high-impact claim checks, and \`flow-reviewer\` for independent review. Account
230
+ for every manifest row. A missing, empty, malformed, partial, or blocked
231
+ handoff is a coverage gap, not success. Verify high-impact or single-source
232
+ claims, then let only the manager synthesize the result and mutate Flow state.
233
+ <!-- flow-prompt:manager-parallel-core:end -->
222
234
 
223
235
  ## Choose a pass
224
236
 
225
- | Situation | Flow pass | Output the manager may synthesize |
237
+ | Situation | Flow pass | Manager-owned result |
226
238
  | --- | --- | --- |
227
- | Repo shape is unclear before planning | Discovery pass | Requirements, decisions, targets, validation entries, or a review-first feature |
228
- | A broad finding set needs refutation | Audit pass | Surviving findings with guards checked and gaps named |
229
- | Changed files or risk lenses are too broad for one review pass | Review pass | One feature review packet or \`finalReview\` payload owned by the manager |
230
- | Test strategy or route coverage is unclear | Validation pass | Candidate commands or authorized raw command evidence |
231
- | A claim is single-source, surprising, high-stakes, or payload-bound | Verification pass | Per-claim keep, narrow, rewrite, or remove decisions |
232
- | Multiple implementation paths are plausible | Candidate pass | Candidate patches inspected and validated by the manager before use |
233
-
234
- Pass notes:
235
-
236
- - **Discovery**: workers read specific modules, routes, docs, commands, or risk
237
- lenses; only evidenced claims become plan fields.
238
- - **Audit**: workers actively look for guards, lifecycle resets, deployment
239
- constraints, and counterexamples before reporting a finding. A finding
240
- without refutation work stays advisory or becomes a follow-up question.
241
- - **Review**: workers separate blocking findings from advisory notes; the
242
- manager resolves conflicts and returns one review payload.
243
- - **Validation**: workers run only manager-authorized commands and report the
244
- exact command, status, and raw outcome summary.
245
- - **Verification**: verifiers judge atomic claims against cited sources or
246
- commands; do not ask a verifier to redesign the work or review the whole
247
- feature.
248
- - **Candidate**: only with explicit user authorization plus isolated worktrees
249
- or exact non-overlapping path ownership. Patches stay proposals until the
250
- manager inspects, merges or rejects, and validates.
239
+ | Repo shape is unclear before planning | Discovery | Evidenced requirements, decisions, targets, validation, or a review-first feature |
240
+ | A broad finding set needs refutation | Audit | Findings that survive guard and counterexample checks |
241
+ | Changed files or risk lenses exceed one review pass | Review | One feature review or final review payload |
242
+ | Test strategy or route coverage is unclear | Validation | Candidate commands or authorized raw command evidence |
243
+ | A claim is surprising, high-stakes, single-source, or payload-bound | Verification | Per-claim keep, narrow, rewrite, or remove decisions |
244
+ | Multiple independent implementation paths are plausible | Candidate | Inspected candidate patches, never direct Flow completion |
245
+
246
+ Discovery, audit, review, validation, and verification passes are read-only.
247
+ Validation workers run only manager-authorized commands. Verification workers
248
+ judge atomic claims rather than redesigning the work. Candidate passes require
249
+ explicit user authorization plus an isolated worktree or exact non-overlapping
250
+ path ownership; patches remain proposals until manager inspection and
251
+ validation.
251
252
 
252
253
  ## Implementation pass decision
253
254
 
254
- Before implementing a broad, risky, or multi-target feature, record one manager
255
- decision. This is required even when the answer is "stay serial"; the point is
256
- to make the skipped parallelism visible instead of relying on memory.
257
-
258
- Use one of these decisions:
259
-
260
- - \`serial\`: the manager implements directly because slices overlap, the next
261
- edit depends on one shared contract, or prompt/merge overhead would exceed the
262
- value.
263
- - \`candidate-exact-path\`: one or more candidate workers may edit exact
264
- non-overlapping paths or modules named by the manager.
265
- - \`candidate-worktree\`: one or more candidate workers may edit in isolated
266
- worktrees, then the manager inspects and merges or rejects.
267
- - \`tournament\`: several isolated candidate implementations compete for the same
268
- outcome; the manager filters by tests, review, and source inspection before
269
- accepting one.
270
- - \`skipped\`: candidate workers were considered but rejected; include the reason,
271
- such as shared fixtures, shared API contracts, unclear ownership, or no user
272
- authorization for worker edits.
273
-
274
- Record the decision in the pass manifest with a stable pass id,
275
- \`decisionReason\`, \`writeScope\`, expected verification, and where any handoff or
276
- synthesis artifact will live. If the feature completes, include the compact
277
- record in the \`orchestrationPasses\` array of the \`flow_feature_complete\`
278
- payload. The runtime stores only compact accounting; full worker handoffs stay
279
- in manager-owned scratch files or the conversation.
280
-
281
- ## When to stay serial
282
-
283
- - One file, command, or design question determines the next step.
284
- - Slices would share the same contracts, fixtures, or edit targets.
285
- - The manager can inspect the full scope faster than writing and checking
286
- worker prompts.
287
- - The result would still need the same manual synthesis with no time saved.
288
-
289
- Do not fan out to keep agents busy. Every worker should reduce a named
290
- planning, validation, review, audit, or implementation uncertainty. A normal
291
- first pass is two to five workers with independent slices; use more only when
292
- the manifest stays countable and non-overlapping.
293
-
294
- ## Modes
295
-
296
- When fanning out Flow work, select the matching hidden Flow agent by name. These
297
- workers are injected by the plugin config; invoke the named worker when it is
298
- available. Do not use generic subagents for Flow slices because Flow workers
299
- carry the permission boundaries for each mode.
300
-
301
- | Mode | Use agent | Worker output | Write access | Flow tools |
302
- | --- | --- | --- | --- | --- |
303
- | \`evidence\` | \`flow-evidence-worker\` | Coverage, facts, files inspected, confidence, gaps, suggested plan targets | No | \`flow_status\` only if needed |
304
- | \`review\` | \`flow-reviewer\` | Coverage, candidate findings or review slice summary, confidence, gaps | No | \`flow_status\` only if needed |
305
- | \`validation\` | \`flow-validation-worker\` | Command options or manager-authorized raw output, coverage, confidence, gaps | No code edits; commands only when explicitly allowed | \`flow_status\` only if needed |
306
- | \`audit\` | \`flow-audit-worker\` | Refuted or surviving finding candidates, guards checked, confidence, gaps | No | \`flow_status\` only if needed |
307
- | \`verifier\` | \`flow-verifier-worker\` | Per-claim verdicts against cited evidence or commands | No | \`flow_status\` only if needed |
308
- | \`candidate-implementation\` | \`flow-candidate-worker\` | Candidate patch summary from an isolated worktree or exact path-owned slice | Only with explicit user authorization plus isolation or exact non-overlapping path ownership | No state-changing Flow tools |
309
-
310
- Use worker-specific model routing where the installation can support it:
311
- \`OPENCODE_FLOW_READONLY_WORKER_MODEL\` for evidence, validation, and audit
312
- workers; \`OPENCODE_FLOW_REVIEW_WORKER_MODEL\` for reviewer and verifier workers;
313
- \`OPENCODE_FLOW_CANDIDATE_WORKER_MODEL\` for candidate implementation workers; and
314
- \`OPENCODE_FLOW_WORKER_MODEL\` as a fallback for all hidden Flow workers. Model IDs
315
- are OpenCode installation-specific (\`provider/model\`), so leave these unset when
316
- the configured provider is unknown. Spend stronger models where being wrong is
317
- expensive; read-heavy discovery slices tolerate the cheapest configured option,
318
- while verifier and review slices deserve the strongest.
319
-
320
- ## Permission contract
321
-
322
- The plugin injects these hidden workers with the following permission values.
323
- \`Flow state tools\` means the \`flow_*\` rule, while \`Flow status\` documents the
324
- explicit \`flow_status\` exception.
325
-
326
- | Worker | Edit | Bash | Task | Skill | Flow state tools | Flow status |
327
- | --- | --- | --- | --- | --- | --- | --- |
328
- | \`flow-reviewer\` | deny | deny | deny | deny | deny | allow |
329
- | \`flow-evidence-worker\` | deny | deny | deny | deny | deny | allow |
330
- | \`flow-validation-worker\` | deny | ask | deny | deny | deny | allow |
331
- | \`flow-audit-worker\` | deny | ask | deny | deny | deny | allow |
332
- | \`flow-candidate-worker\` | ask | ask | deny | deny | deny | allow |
333
- | \`flow-verifier-worker\` | deny | ask | deny | deny | deny | allow |
334
-
335
- Do not fan out parallel \`flow_plan_save\`, \`flow_plan_approve\`,
336
- \`flow_run_start\`, \`flow_feature_complete\`, \`flow_feature_reset\`, or
337
- \`flow_session_close\` calls. Runtime locking protects files, but Flow accepts only
338
- one active feature result at a time.
339
-
340
- Workers may read files, inspect docs, run authorized read-only commands, and
341
- summarize evidence. Candidate implementation workers may edit only when the
342
- manager assigned an isolated worktree or exact path ownership that does not
343
- overlap sibling workers or manager edits. Workers must not edit \`.flow/**\`,
344
- must not call state-changing Flow tools, and must not approve work, close
345
- sessions, record Flow validation, or claim validation they did not run. A
346
- worker may report raw validation output it actually ran; the manager decides
347
- whether it is strong enough to record.
348
-
349
- ## Stage 1 — Orient (serial)
350
-
351
- Call \`flow_status\` if a Flow session may already exist. Read enough files,
352
- schemas, docs, tests, commands, or artifacts to identify real slices. Keep the
353
- immediate blocker local: do not delegate the question that determines whether
354
- fan-out is even valid.
355
-
356
- Treat orientation as uncertainty reduction. Resolve environment uncertainty by
357
- inspecting the repo, running cheap commands, or assigning evidence workers; ask
358
- the user only when the remaining specification uncertainty would make a wrong
359
- slice expensive to undo. Do not split a vague goal into workers until the
360
- candidate slices have concrete targets, dependencies, and verification signals.
361
-
362
- ## Stage 2 — Slice
363
-
364
- Split along whichever axis keeps slices independent: modules or path sets,
365
- route or endpoint groups, risk lenses, command surfaces, data ranges, or claim
366
- sets. Each slice needs a one-line scope, expected coverage, and a defined
367
- output the manager can check.
368
-
369
- For implementation slices, also name dependencies and write ownership before
370
- spawning. A real dependency edge means the later slice waits for a verified
371
- handoff or manager synthesis from the earlier slice; a shared file, fixture,
372
- schema, or public contract usually means the work should stay serial unless an
373
- isolated worktree is used. The manifest owns those edges through \`dependsOn\`
374
- and \`writeScope\`.
375
-
376
- ## Stage 3 — Manifest (the pre-fan-out coverage gate)
377
-
378
- Before spawning, write a pass manifest: one row per slice, plus a totals check.
379
- Give the pass a stable id so later handoffs, verifier claims, and completion
380
- payloads can refer to the same work without replaying chat.
255
+ Before editing a broad, risky, or multi-target feature, record one manager
256
+ decision even when implementation stays serial. Keep \`candidateEligibility\`,
257
+ \`candidateDecision\`, and \`decision\` as distinct fields.
381
258
 
382
- | Row id | Slice scope | Expected coverage | Mode | Depends on | Write scope | Verification tier | Handoff ref | Verification status | Synthesis ref |
259
+ Classify candidate eligibility separately from the decision:
260
+
261
+ | Eligibility | Meaning |
262
+ | --- | --- |
263
+ | \`eligible\` | At least one slice has independent ownership and practical validation. |
264
+ | \`not_eligible\` | Shared state, files, tests, or judgment make isolation unsafe or wasteful. |
265
+ | \`unknown\` | Orientation is incomplete; never use this on an \`implementation-decision\` record. |
266
+
267
+ Use only these pairings on \`implementation-decision\` records:
268
+
269
+ | Eligibility | Candidate decision | Implementation decision |
270
+ | --- | --- | --- |
271
+ | \`eligible\` | \`used\` | \`candidate-exact-path\`, \`candidate-worktree\`, or \`tournament\` |
272
+ | \`eligible\` | \`skipped\` | \`skipped\` |
273
+ | \`not_eligible\` | \`serial_required\` | \`serial\` |
274
+
275
+ Candidate-shaped decisions and \`candidateDecision: "used"\` require execution
276
+ evidence on the same record: \`kind: "candidate"\`, \`modes\` containing
277
+ \`candidate-implementation\`, or \`candidateWorkerCount > 0\`. Keep
278
+ \`candidateWorkerCount <= workerCount\` and
279
+ \`verifierWorkerCount <= workerCount\`; one worker may fill both subtype counts.
280
+ Never use \`parallel\` as an implementation decision. Reserve \`parallel\` for
281
+ multi-worker read, audit, review, validation, or verification passes.
282
+
283
+ Implementation decision meanings:
284
+
285
+ - \`serial\`: the manager implements directly because work overlaps or depends on
286
+ one shared contract or mental model.
287
+ - \`candidate-exact-path\`: workers own exact, disjoint path sets in one checkout.
288
+ - \`candidate-worktree\`: isolated workers propose patches for manager integration.
289
+ - \`tournament\`: isolated candidates compete; the manager selects using source
290
+ inspection, validation, and review.
291
+ - \`skipped\`: candidate work was eligible, but coordination cost outweighed its
292
+ value. Do not use it for unsafe ownership; those cases are \`serial\`.
293
+
294
+ Record \`decisionReason\` plus the applicable structured \`decisionFactors\`:
295
+ \`shared_state\`, \`overlapping_files\`, \`small_slice\`,
296
+ \`needs_manager_judgment\`, \`independent_surface\`, and
297
+ \`validation_available\`. Also record a stable pass id, write scope, expected
298
+ verification, and the handoff or synthesis location. Carry the bounded record
299
+ into \`flow_feature_complete.orchestrationPasses\` when it materially shaped the
300
+ feature; keep full handoffs and logs outside Flow state.
301
+
302
+ ## Candidate judgment
303
+
304
+ Consider candidate workers when ownership is additive or localized, validation
305
+ can run per slice, and the manager can safely inspect or reject the result.
306
+ Separate frontend, core, docs, release, test, or binding surfaces are useful
307
+ signals, but the actual path and contract boundaries decide eligibility.
308
+
309
+ Stay serial when any of these apply:
310
+
311
+ - One file, command, contract, migration, or design question determines the
312
+ next step.
313
+ - Slices share state, callers, fixtures, generated output, lockfiles, tests, or
314
+ edit targets.
315
+ - Persistence or lifecycle behavior requires one mental model.
316
+ - Iterative debugging must happen in one checkout.
317
+ - Prompt, handoff, merge, and verification cost exceeds direct work.
318
+ - The manager would still need the same full synthesis with no coverage gain.
319
+
320
+ Do not fan out to keep workers busy. Every worker must reduce a named
321
+ uncertainty.
322
+
323
+ ## Worker count defaults
324
+
325
+ Use bounded caps rather than worker-count targets:
326
+
327
+ - Small implementation: zero or one worker.
328
+ - Medium independent implementation: at most two workers.
329
+ - Broad audit: three to five workers.
330
+ - Broad implementation: two to four candidate workers with non-overlapping
331
+ ownership.
332
+ - Medium- or high-risk final verification: one verifier.
333
+
334
+ Use more only when the manifest remains countable and non-overlapping.
335
+ `;
336
+
337
+ // skills/flow/references/parallel-execution.md
338
+ var parallel_execution_default = "# Parallel pass execution\n\nRead this after a pass decision and complete manifest. It defines Flow-native\nworker routing, permissions, and launch prompts. Do not use generic workers for\nFlow slices when the named hidden Flow worker is available.\n\n## Modes\n\n| Mode | Use worker | Output | Write access |\n| --- | --- | --- | --- |\n| `evidence` | `flow-evidence-worker` | Facts, coverage, confidence, gaps | None |\n| `review` | `flow-reviewer` | Review slice findings and coverage | None |\n| `validation` | `flow-validation-worker` | Proposed checks or authorized raw command evidence | Commands only when explicitly allowed |\n| `audit` | `flow-audit-worker` | Refuted or surviving findings and guards checked | None |\n| `verifier` | `flow-verifier-worker` | Per-claim verdicts against cited evidence | None |\n| `candidate-implementation` | `flow-candidate-worker` | Candidate patch from isolated or exact-path ownership | Explicitly authorized owned paths only |\n\n## Worker role contracts\n\nThese marked blocks are the canonical role instructions compiled into hidden\nworker prompts.\n\n<!-- flow-prompt:worker-role-evidence:start -->\n### Flow evidence worker\n\nInspect only the assigned read-only slice. Report observed facts and coverage;\ndo not edit files, expand scope, or synthesize the whole pass. Only the root\nmanager may mutate Flow state.\n<!-- flow-prompt:worker-role-evidence:end -->\n\n<!-- flow-prompt:worker-role-validation:start -->\n### Flow validation worker\n\nRun only manager-specified commands or propose focused checks. Do not edit\nfiles, expand scope, or synthesize completion. Only the root manager may mutate\nFlow state. Distinguish commands actually run from checks merely proposed.\n<!-- flow-prompt:worker-role-validation:end -->\n\n<!-- flow-prompt:worker-role-audit:start -->\n### Flow audit worker\n\nInspect only the assigned read-only slice and actively try to refute candidate\nfindings. Do not edit files, expand scope, or synthesize the whole audit. Only\nthe root manager may mutate Flow state. A blocking candidate must name the\nguards and mitigating paths checked.\n<!-- flow-prompt:worker-role-audit:end -->\n\n<!-- flow-prompt:worker-role-candidate:start -->\n### Flow candidate implementation worker\n\nWork only in the manager-assigned isolated worktree or exact non-overlapping\npath set. Preserve unrelated user changes. Never edit `.flow/**`, expand\nownership, claim completion, integrate other slices, commit, push, or publish.\nOnly the root manager may mutate Flow state. Your patch is a candidate for\nmanager inspection.\n<!-- flow-prompt:worker-role-candidate:end -->\n\n<!-- flow-prompt:worker-role-verifier:start -->\n### Flow verifier worker\n\nVerify only the assigned atomic claims against provided sources, commands,\ncounts, or current documentation. Resolve each source independently. Do not\ngenerate new scope, edit files, identify the originating worker, or synthesize\nthe whole pass. Only the root manager may mutate Flow state.\n<!-- flow-prompt:worker-role-verifier:end -->\n\n## Permission contract\n\nThe plugin injects these hidden workers. `Flow state tools` means every\nstate-changing `flow_*` call; `flow_status` is the explicit read-only exception.\n\n| Worker | Edit | Bash | Task | Skill | Flow state tools | `flow_status` |\n| --- | --- | --- | --- | --- | --- | --- |\n| `flow-reviewer` | deny | deny | deny | deny | deny | allow |\n| `flow-evidence-worker` | deny | deny | deny | deny | deny | allow |\n| `flow-validation-worker` | deny | ask | deny | deny | deny | allow |\n| `flow-audit-worker` | deny | ask | deny | deny | deny | allow |\n| `flow-candidate-worker` | ask | ask | deny | deny | deny | allow |\n| `flow-verifier-worker` | deny | ask | deny | deny | deny | allow |\n\nNever fan out `flow_plan_save`, `flow_plan_approve`, `flow_run_start`,\n`flow_feature_complete`, `flow_feature_reset`, or `flow_session_close`. Workers\nmust not edit `.flow/**`, approve work, record Flow evidence, or claim commands\nthey did not run. Candidate workers may edit only their authorized isolation or\nexact path scope.\n\n## Launch\n\nEvery worker prompt contains:\n\n```text\nOverall goal, context only: <goal>\nMode: evidence | review | validation | audit | verifier | candidate-implementation\nPass id and manifest row id: <stable ids>\nYour exact slice: <paths, modules, commands, claims, risk lens, or worktree>\nExpected coverage: <count, paths, range, or completeness rule>\nDependencies and write scope: <verified dependencies; approved write scope>\nDo: <bounded actions>\nDo not: call state-changing Flow tools, edit .flow/**, own sibling slices, or make the final Flow verdict.\nReturn only the Flow handoff in this exact shape:\n<matching handoff template copied verbatim from handoff-format.md>\n```\n\nHidden workers cannot load skills, references, or conversation history. Copy the\nmatching block from `handoff-format.md`; a filename alone is insufficient. Cite\npaths to any prerequisite synthesis artifact instead of restating accumulated\nchat. For current-doc research, require checks for versioned or time-sensitive\nfacts. Remind candidate workers not to revert unrelated changes.\n\nContinue only non-overlapping manager work while workers run.\n\n## Model routing\n\nWhen the installation supports worker-specific models, use\n`OPENCODE_FLOW_READONLY_WORKER_MODEL` for evidence, validation, and audit;\n`OPENCODE_FLOW_REVIEW_WORKER_MODEL` for review and verification;\n`OPENCODE_FLOW_CANDIDATE_WORKER_MODEL` for candidate implementation; and\n`OPENCODE_FLOW_WORKER_MODEL` as fallback. Model ids are installation-specific\n`provider/model` values. Leave overrides unset when the provider is unknown and\nprefer stronger models where incorrect findings or patches are expensive.\n";
339
+
340
+ // skills/flow/references/parallel-manifest.md
341
+ var parallel_manifest_default = `# Parallel pass manifest
342
+
343
+ Read this only after \`parallel-decision.md\` selects a parallel or candidate
344
+ pass. The manifest is the pre-fan-out coverage gate and the accounting contract
345
+ for every worker result.
346
+
347
+ ## Orient and slice
348
+
349
+ Call \`flow_status\` when a Flow session may exist. Read enough code, schemas,
350
+ docs, tests, commands, or artifacts to identify real slices. Keep the question
351
+ that determines whether fan-out is valid in manager context.
352
+
353
+ Split by an axis that keeps work independent: modules or paths, routes or
354
+ endpoints, risk lenses, commands, data ranges, or atomic claims. Give each slice
355
+ a one-line scope, expected coverage, checkable output, dependencies, write
356
+ scope, and verification tier. Shared files, fixtures, schemas, and public
357
+ contracts normally stay serial unless candidate work uses isolated worktrees.
358
+
359
+ ## Write the manifest
360
+
361
+ Before spawning, write one row per slice plus a totals or completeness check.
362
+ Use stable pass and row ids so later handoffs, verification, synthesis, and
363
+ completion accounting refer to the same work without replaying conversation
364
+ history.
365
+
366
+ | Row id | Slice | Expected coverage | Mode | Depends on | Write scope | Verification tier | Handoff ref | Verification status | Synthesis ref |
383
367
  | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
384
- | \`runtime-read\` | \`src/core/**\` plus its tests | 14 files | \`evidence\` | none | none | accept locally | pending | pending | pending |
385
- | \`release-read\` | release contract: CI workflows, \`package.json\`, changelog | 6 files | \`evidence\` | none | none | verify once | pending | pending | pending |
386
-
387
- \`writeScope\` values in runtime accounting are \`none\`, \`manager-serial\`,
388
- \`exact-path\`, \`isolated-worktree\`, or \`mixed\`. Use \`manager-serial\` for a
389
- recorded serial implementation decision, \`exact-path\` for disjoint candidate
390
- edits in one checkout, and \`isolated-worktree\` for candidate work that must be
391
- merged back by the manager.
392
-
393
- - Count the total work items when countable: files, modules, routes, commands,
394
- rows, findings, screenshots, or claims. Confirm slice counts add back to the
395
- total, with no overlaps, gaps, empty slices, or ambiguous shared contracts.
396
- - If the scope cannot be counted, state the completeness rule instead, such as
397
- "all changed files plus callers" or "all public commands plus release docs."
398
- - Assign each slice's verification tier now (see Stage 6). Deciding where a
399
- wrong claim is expensive belongs before handoffs arrive, not after.
400
- - Record dependency edges now. A row may be spawned only after every \`depends on\`
401
- row it names has returned a verified handoff or a manager synthesis that
402
- explicitly settles the dependency.
403
- - Fix the slice map centrally before spawning if the gate does not reconcile.
404
-
405
- The manifest is also the accounting contract for the pass: N rows spawned means
406
- N handoffs collected and checked in Stage 5 before anything is synthesized.
407
-
408
- For implementation decisions, add a manifest row even when no worker is spawned:
409
- \`kind=implementation-decision\`, \`decision=serial\` or \`decision=skipped\`,
410
- \`workerCount=0\`, \`writeScope=manager-serial\`, and a concrete \`decisionReason\`.
411
- This is how Flow distinguishes deliberate serial work from forgotten candidate
412
- or verifier passes.
413
-
414
- Write the manifest where it survives the pass: the conversation is enough for a
415
- single bounded pass, but when a follow-up pass or a session resume is
416
- plausible, persist it with the synthesis (Stage 7) so the accounting can be
417
- reconstructed.
418
-
419
- ## Stage 4 — Fan out
420
-
421
- Every worker prompt includes:
368
+ | \`runtime-read\` | \`src/core/**\` plus tests | 14 files | \`evidence\` | none | none | accept locally | pending | pending | pending |
369
+ | \`release-read\` | CI, package metadata, changelog | 6 files | \`audit\` | none | none | verify once | pending | pending | pending |
422
370
 
423
- \`\`\`text
424
- Overall goal, context only: <goal>
425
- Mode: evidence | review | validation | audit | verifier | candidate-implementation
426
- Pass id and manifest row id: <stable ids from the manifest>
427
- Your exact slice: <paths, modules, command, claim ids, risk lens, or worktree>
428
- Expected coverage: <count, paths, range, or complete question set>
429
- Dependencies and write scope: <verified dependencies, if any; none | manager-serial | exact-path | isolated-worktree>
430
- Do: <bounded actions>
431
- Do not: call state-changing Flow tools, edit .flow/**, own sibling slices, or make the final Flow verdict.
432
- Return only the Flow handoff in this exact shape:
433
- <matching handoff template copied verbatim from handoff-format.md>
434
- \`\`\`
371
+ Use runtime \`writeScope\` values exactly: \`none\`, \`manager-serial\`, \`exact-path\`,
372
+ \`isolated-worktree\`, or \`mixed\`.
435
373
 
436
- Hidden workers cannot load skills or read \`handoff-format.md\` themselves. The
437
- manager copies the matching handoff template into every worker prompt; a bare
438
- filename reference is not enough. Workers also cannot read the conversation, so
439
- prompts cite file paths — including any synthesis file from an earlier pass —
440
- instead of restating chat history.
441
-
442
- For research or current-doc slices, require source checks for versioned or
443
- time-sensitive facts. For implementation candidates, remind workers that other
444
- work may be active and that they must not revert unrelated changes.
445
-
446
- Continue non-overlapping manager work while workers run.
447
-
448
- ## Stage 5 — Account
449
-
450
- Check every manifest row off against a returned handoff before synthesis. A
451
- worker that never returns, errors out, returns empty or unstructured output, or
452
- reports \`partial\` or \`blocked\` is a hole in the pass, and synthesizing around it
453
- silently drops a slice.
454
-
455
- For each row, fill in:
456
-
457
- - \`handoffRefs\`: worker ids, handoff file paths, command output artifacts, or
458
- review packet location that the manager can re-open.
459
- - \`verificationStatus\`: \`not-needed\`, \`pending\`, \`passed\`, \`failed\`, \`mixed\`,
460
- or \`downgraded\`.
461
- - \`outcome\`: \`accepted\`, \`rejected\`, \`partial\`, \`not-covered\`, or \`superseded\`.
462
- - \`synthesisRef\`: the manager-owned synthesis file or plan field that carries
463
- the accepted result forward.
464
-
465
- Rows with no worker, such as serial or skipped implementation decisions, still
466
- need a row id, decision, reason, and outcome. They are not handoffs, but they
467
- are accounting.
468
-
469
- Worker failure ladder:
470
-
471
- 1. Re-spawn once with a narrower slice and a note about what the first attempt
472
- returned.
473
- 2. If it fails again, cover the slice directly in the manager session.
474
- 3. If it stays blocked, carry the slice into the synthesis explicitly as
475
- not-covered. Never present results as if coverage were complete.
476
-
477
- ## Stage 6 — Verify
478
-
479
- \`Status: success\` only says the worker believes its slice is done. Accept a
480
- handoff only after a cheap manager-side pass:
481
-
482
- - \`Status\` is present and terminal: \`success\`, \`partial\`, or \`blocked\`; empty or
483
- unstructured output fails this check.
484
- - Coverage matches the assigned slice, or skips are explicit.
485
- - Important claims have concrete evidence and confidence tags.
486
- - Cited paths, commands, screenshots, URLs, or metrics resolve.
487
- - The evidence supports the claim, not just the topic.
488
- - Findings stay inside the worker's slice.
489
- - Headline counts can be recounted or traced.
490
- - Dependency claims cite the verified upstream handoff, synthesis, or source
491
- artifact they depend on.
492
- - Candidate implementation claims identify whether they came from exact path
493
- ownership or an isolated worktree, and whether the manager inspected the
494
- resulting patch.
495
- - Contradictions between workers are either resolved or explicitly marked as
496
- contested.
497
-
498
- Demote, drop, re-task, or verify claims that fail this pass.
499
-
500
- ### Verification tiers
501
-
502
- One taxonomy decides how much verification a claim gets: the manifest assigns
503
- a default tier per slice, and this stage applies it per claim. Use the cheapest
504
- check that matches the risk:
505
-
506
- - **Accept locally**: low-risk claims with direct evidence that the manager can
507
- cheaply inspect or recount.
508
- - **Verify once** with \`flow-verifier-worker\`: single-source, surprising,
509
- inferred, low-confidence, citation-heavy, contested, or Flow-payload-bound
510
- claims, including any count, benchmark, command result, or pass/fail claim a
511
- Flow payload will rely on.
512
- - **Verify strongly**: blocking or release-sensitive claims and claims that
513
- affect user data, security, persistence, permissions, public API behavior,
514
- release behavior, or data loss. Use independent verifier checks, manager-run
515
- commands, or direct artifact inspection strong enough to settle the claim.
516
- - **Do not accept**: claims without concrete evidence, claims outside the
517
- assigned slice, claims contradicted by inspected artifacts, or claims where
518
- the cited evidence supports only the topic rather than the assertion.
519
-
520
- Verifier prompts use stable claim ids, one atomic assertion per id, the cited
521
- source or command for each id, and the exact acceptance question. Do not
522
- include the generator's reasoning unless that reasoning is the thing being
523
- verified, do not say which worker produced the claim, and do not ask a
524
- verifier to redesign the work or review the whole feature.
525
-
526
- ## Stage 7 — Synthesize
527
-
528
- Apply the manager synthesis barrier before presenting or recording anything:
529
-
530
- - Preserve confidence: verified, single-sourced, inferred, and unresolved claims
531
- stay distinct when it matters.
532
- - When workers disagree, inspect the cited artifact or rerun the cited command
533
- instead of arbitrating from summaries. Do not average conflicting claims.
534
- - Run the strongest practical local check for the deliverable.
535
- - Re-read critical files or docs that will be cited in the final decision.
536
- - Move only distilled, evidence-backed claims forward; raw handoffs remain
537
- candidate evidence, not a plan, review, completion payload, or final answer.
538
- - Record gaps honestly instead of converting missing evidence into success
539
- language.
540
-
541
- Where accepted evidence goes:
542
-
543
- - Planning evidence becomes \`requirements\`, \`decisions\`, feature \`targets\`,
544
- feature \`validation\`, or plan notes — only when the source and scope are
545
- clear. Unverified broad findings become a review-first feature, not a fix
546
- plan.
547
- - Validation evidence may become \`validationRun\` only when the worker was
548
- explicitly authorized to run the command and reported the exact command,
549
- status, and raw outcome summary.
550
- - Review evidence informs \`featureReviewDepth\` plus \`featureReview\`, or \`finalReview\`, but the manager
551
- owns the pass/fail verdict and must resolve blockers, contradictions, and
552
- coverage gaps before returning the payload.
553
- - Audit evidence becomes findings only after refutation; blocking findings need
554
- guards checked, deployment context, and evidence that the current code
555
- exhibits the behavior.
556
- - Candidate patches are not Flow evidence until the manager inspects, merges or
557
- rejects them, and validates the main Flow-managed workspace.
558
-
559
- When completing a feature, include compact pass accounting in
560
- \`flow_feature_complete.orchestrationPasses\` for any pass or implementation
561
- decision that materially affected the feature:
374
+ Before launch:
562
375
 
563
- \`\`\`json
564
- {
565
- "id": "feature-id-implementation-decision",
566
- "kind": "implementation-decision",
567
- "decision": "serial",
568
- "decisionReason": "Shared schema and tests made exact path ownership unsafe.",
569
- "modes": [],
570
- "workerCount": 0,
571
- "candidateWorkerCount": 0,
572
- "verifierWorkerCount": 0,
573
- "sliceIds": ["manager-implementation"],
574
- "dependsOn": [],
575
- "writeScope": "manager-serial",
576
- "handoffRefs": [],
577
- "verificationStatus": "not-needed",
578
- "outcome": "accepted",
579
- "synthesisRef": "/tmp/flow-pass-synthesis.md"
580
- }
581
- \`\`\`
376
+ - Reconcile countable work such as files, routes, commands, rows, findings,
377
+ screenshots, or claims. Slice totals must have no overlaps, gaps, or empty
378
+ rows.
379
+ - When scope is not countable, state a completeness rule such as "all changed
380
+ files plus callers" or "all public commands plus release docs."
381
+ - Assign a verification tier before handoffs arrive.
382
+ - Record dependency edges. Spawn a dependent row only after its prerequisite
383
+ has a verified handoff or manager synthesis that settles the dependency.
384
+ - Fix an unreconciled slice map centrally before fan-out.
385
+
386
+ N spawned rows require N collected and checked handoffs before synthesis.
387
+
388
+ ## Implementation decision rows
582
389
 
583
- For candidate and verifier passes, use \`kind: "candidate"\` or
584
- \`kind: "verification"\`, list the worker modes used, worker counts, slice ids,
585
- handoff refs, dependency ids, verification status, and whether the manager
586
- accepted, rejected, downgraded, or superseded the pass. The runtime aggregates
587
- these compact records into \`session.budget.orchestration\` and stores them on
588
- the feature history entry. Do not store full handoffs, long logs, or scratch
589
- tables in \`.flow/session.json\`.
590
-
591
- Persist the manifest and the synthesis when another pass may follow or the
592
- session is long enough to be compacted or resumed: write the distilled result —
593
- the accounted manifest, accepted claims with evidence and confidence, dropped
594
- claims with one-line reasons, and open gaps — into plan prose fields or a
595
- manager-owned scratch file outside both \`.flow/**\` and the repository worktree,
596
- such as a file in the OS temporary directory. The runtime owns the \`.flow/**\`
597
- layout, and scratch files left in the worktree end up staged or reviewed as if
598
- they were project changes. Follow-up worker prompts cite that path; files are
599
- the only shared memory between passes.
600
-
601
- ## Stage 8 — Extend or stop
602
-
603
- Stop after a pass when:
604
-
605
- - the manifest's coverage rule is satisfied and every row is accounted for.
606
- - accepted claims are evidenced, scoped, and confidence-labeled.
607
- - material single-source, contested, high-stakes, or payload-bound claims have
608
- been verified or downgraded.
609
- - every dependency edge named in the manifest has either a verified upstream
610
- result or an explicit not-covered outcome.
611
- - implementation pass decisions are recorded, including skipped candidate
612
- workers and the reason they were skipped.
613
- - remaining gaps are explicit and do not block the Flow artifact being produced.
614
-
615
- Start a bounded follow-up pass only when:
616
-
617
- - the original slice map missed material scope.
618
- - workers disagree on a claim that affects the Flow decision.
619
- - a high-stakes or payload-bound claim needs verification.
620
- - a dependency has just become verified and now unlocks a dependent slice.
621
- - a candidate patch was rejected and an isolated alternative is still cheaper
622
- than serial repair.
623
- - a first pass exposes a narrower implementation or validation slice worth
624
- isolating.
625
-
626
- Run at most one routine follow-up pass. Extra passes need an explicit manager
627
- reason, such as a high-stakes verifier check or a newly discovered bounded
628
- slice. Do not recurse by default: if a worker says it needs another worker, the
629
- manager decides whether that is a follow-up pass and writes the next bounded
630
- prompt, starting again from the manifest.
390
+ Add an implementation decision row even when no worker is spawned. Record:
391
+
392
+ - \`kind: "implementation-decision"\`
393
+ - the valid decision, eligibility, and candidate-decision pairing from
394
+ \`parallel-decision.md\`
395
+ - \`decisionFactors\`, \`decisionReason\`, and \`writeScope: "manager-serial"\`
396
+ - \`workerCount: 0\`, a stable row id, verification status, and outcome
397
+
398
+ When \`candidateDecision\` is \`used\`, record actual candidate execution evidence
399
+ and raise worker counts accordingly. A zero-worker record cannot claim candidate
400
+ use. Subtype counts may not exceed total worker count.
401
+
402
+ ## Persistence
403
+
404
+ The conversation is sufficient for one bounded pass. When a follow-up pass or
405
+ session resume is plausible, persist the accounted manifest with the synthesis
406
+ in a manager-owned temporary artifact outside \`.flow/**\` and outside the repo
407
+ worktree. The runtime stores bounded accounting, not complete worker handoffs.
408
+ `;
409
+
410
+ // skills/flow/references/parallel-orchestration.md
411
+ var parallel_orchestration_default = `# Parallel orchestration
412
+
413
+ Use this index after a serial orientation pass shows that independent slices
414
+ may reduce a named discovery, validation, review, audit, verification, or
415
+ implementation uncertainty. The root manager owns the Flow session and every
416
+ state-changing \`flow_*\` call throughout the pass.
417
+
418
+ ## Load only the selected branch
419
+
420
+ 1. Read \`parallel-decision.md\` whenever deciding whether work should fan out.
421
+ 2. Stop loading parallel references when the decision is serial. Record the
422
+ implementation decision when the active feature requires one.
423
+ 3. After selecting a parallel or candidate pass, read
424
+ \`parallel-manifest.md\`, then \`parallel-execution.md\`.
425
+ 4. When handoffs return, read \`parallel-synthesis.md\` before accepting claims,
426
+ recording evidence, or presenting a result.
427
+ 5. Copy exactly one matching worker response template from \`handoff-format.md\`
428
+ into each worker prompt. Hidden workers cannot load skills or references.
429
+ 6. Read \`parallel-pass-example.md\` only when a concrete end-to-end example is
430
+ needed.
431
+
432
+ Do not preload the manifest, worker, and synthesis runbooks merely because a
433
+ task could be parallel. The decision reference is enough to keep serial work
434
+ serial.
435
+
436
+ ## Pass routing
437
+
438
+ | Situation | Pass | Typical worker |
439
+ | --- | --- | --- |
440
+ | Repo shape is unclear before planning | Discovery | \`flow-evidence-worker\` |
441
+ | A broad finding set needs refutation | Audit | \`flow-audit-worker\` |
442
+ | Changed files or risk lenses exceed one review pass | Review | \`flow-reviewer\` |
443
+ | Test strategy or route coverage is unclear | Validation | \`flow-validation-worker\` |
444
+ | A claim is surprising, high-stakes, single-source, or payload-bound | Verification | \`flow-verifier-worker\` |
445
+ | An authorized independent implementation slice exists | Candidate | \`flow-candidate-worker\` |
446
+
447
+ Only the manager synthesizes the pass, decides whether evidence is sufficient,
448
+ integrates candidate patches, records Flow state, or returns the final verdict.
631
449
  `;
632
450
 
633
451
  // skills/flow/references/parallel-pass-example.md
634
452
  var parallel_pass_example_default = `# Parallel pass example
635
453
 
636
- Use this example after \`parallel-orchestration.md\` when a broad Flow task needs a
637
- concrete pass shape. The project below is illustrative; derive your own slices
638
- from the actual repo during serial orientation.
454
+ Use this example only after \`parallel-orchestration.md\` routes a broad Flow task
455
+ to fan-out. It illustrates the manifest, execution, and synthesis references;
456
+ derive real slices from the actual repo during serial orientation.
639
457
 
640
458
  Goal: review whether a web app's API error handling is consistent before
641
459
  planning a refactor.
@@ -721,18 +539,21 @@ keeps only verified or clearly labeled claims, and records one artifact such as
721
539
  a plan decision, review payload, or docs patch. Raw handoffs and unverified
722
540
  suggestions do not move into the next pass or user-facing answer.
723
541
 
724
- If the pass shaped feature execution, the manager records compact accounting in
542
+ If the pass shaped feature execution, the manager records bounded accounting in
725
543
  \`flow_feature_complete.orchestrationPasses\`, such as pass id
726
544
  \`api-error-handling-read\`, kind \`review\`, worker count \`3\`, slice ids
727
545
  \`routes-auth\`, \`routes-billing\`, and \`routes-admin\`, verification status
728
546
  \`mixed\` or \`passed\`, and a synthesis ref pointing to the manager-owned summary.
729
547
  `;
730
548
 
549
+ // skills/flow/references/parallel-synthesis.md
550
+ var parallel_synthesis_default = "# Parallel pass synthesis\n\nRead this when worker handoffs return. Account for every manifest row, verify\nmaterial claims, and let only the root manager synthesize or mutate Flow state.\n\n## Account for handoffs\n\nCheck each manifest row before synthesis. A missing, errored, empty,\nunstructured, malformed, `partial`, or `blocked` response is a coverage gap.\nFor each row record:\n\n- `handoffRefs`: worker ids or reopenable artifact locations.\n- `verificationStatus`: `not-needed`, `pending`, `passed`, `failed`, `mixed`,\n or `downgraded`.\n- `outcome`: `accepted`, `modified`, `rejected`, `partial`, `not-covered`, or\n `superseded`.\n- `synthesisRef`: the manager-owned result that carries accepted work forward.\n\nSerial and skipped decision rows have no handoff, but still require an id,\ndecision, reason, verification status, and outcome.\n\nWorker failure ladder:\n\n1. Retry once with a narrower slice and the first attempt's concrete gap.\n2. Cover the slice directly in manager context if the retry fails.\n3. Carry a persistent blocker into synthesis as `not-covered`.\n\nNever present incomplete coverage as a complete pass.\n\n## Accept and verify\n\nTreat worker `Status: success` as a claim, not proof. Accept a handoff only when:\n\n- status is exactly `success`, `partial`, or `blocked` and every required\n section is non-empty;\n- coverage matches the assigned slice or names every omission;\n- important claims have concrete evidence and confidence;\n- paths, commands, screenshots, URLs, counts, and metrics resolve;\n- evidence supports the assertion rather than merely its topic;\n- findings stay inside the assigned slice;\n- dependency claims cite a verified upstream handoff or synthesis;\n- candidate work identifies exact-path or isolated-worktree ownership and the\n manager's patch inspection result;\n- contradictions are settled from source evidence or marked contested.\n\nDemote, drop, retry, or independently verify claims that fail these checks.\n\n### Verification tiers\n\nAssign the cheapest tier that matches the consequence of error:\n\n- **Accept locally**: direct, low-risk evidence the manager can cheaply inspect\n or recount.\n- **Verify once**: use `flow-verifier-worker` for surprising, inferred,\n low-confidence, citation-heavy, contested, single-source, or\n Flow-payload-bound claims, including counts and command results.\n- **Verify strongly**: independently inspect or rerun evidence for blocking,\n release-sensitive, data-loss, security, persistence, permissions, or public\n API claims.\n- **Do not accept**: unsupported, out-of-scope, contradicted, or topic-only\n evidence.\n\nVerifier prompts use stable ids, one atomic assertion and cited source or\ncommand per id, and one exact acceptance question. Do not reveal the generating\nworker or ask the verifier to redesign the work.\n\n## Synthesize\n\nBefore presenting or recording a result:\n\n- Preserve meaningful distinctions between verified, single-source, inferred,\n and unresolved claims.\n- Resolve worker conflicts from the cited artifact or command; never average\n contradictory summaries.\n- Run the strongest practical local check for the deliverable.\n- For medium- or high-risk broad implementation, use one verifier after manager\n synthesis to check planned coverage, worker validation claims, changed code,\n generated artifacts, and plausible test coverage.\n- Re-read critical sources that support the final decision.\n- Move only distilled evidence forward and name remaining gaps honestly.\n\nPlanning evidence may become requirements, decisions, targets, validation, or a\nreview-first feature. Authorized command evidence may become `validationRun`\nonly with exact command, status, and observed result. Review workers inform but\ndo not own the final review payload. Audit findings must survive refutation.\nCandidate patches become usable only after manager inspection, integration, and\nvalidation in the Flow-managed workspace.\n\n## Record bounded accounting\n\nUse the canonical manager record in `handoff-format.md` for every material pass\nor implementation decision. Runtime semantics are:\n\n- `candidateDecision: \"used\"` requires actual candidate execution evidence.\n- `candidateDecision: \"serial_required\"` means candidate work was ineligible.\n- `candidateEligibility: \"eligible\"` plus `candidateDecision: \"skipped\"`\n increments skipped-candidate accounting.\n- Candidate and verifier pass counts come from actual pass kind, mode, or worker\n count evidence, never a decision label alone.\n\nKeep full handoffs, scratch tables, and long logs out of `.flow/session.json`.\nWhen another pass or resume is likely, persist the accounted manifest, accepted\nclaims with evidence and confidence, dropped claims with short reasons, and\nopen gaps in a manager-owned temporary file outside `.flow/**` and the repo\nworktree. Follow-up prompts cite that artifact; do not replay the transcript.\n\n## Extend or stop\n\nStop when every manifest row and dependency is accounted for, accepted claims\nare evidenced and scoped, material claims have the required verification, and\nremaining gaps are explicit but non-blocking.\n\nStart at most one routine follow-up pass when material scope was missed,\nworkers disagree on a decision-changing claim, a high-impact claim needs more\nverification, a newly verified dependency unlocks a slice, or a rejected\ncandidate still has a cheaper isolated alternative. Extra passes require a\nspecific high-impact reason. Workers never recursively launch workers; the\nmanager creates any follow-up manifest and prompt.\n";
551
+
731
552
  // skills/flow/references/recovery-playbook.md
732
553
  var recovery_playbook_default = '# Recovery playbook\n\nUse this when a Flow tool returns `status: "error"`, a blocker, or a `nextAction` that conflicts with memory.\n\n## First response\n\n1. Re-anchor with `flow_status`.\n2. Read the returned `summary`, `recovery`, `lastError`, and active feature.\n3. Fix the cause, then retry the smallest valid Flow action.\n\n## Common cases\n\n- `missing_session`: start with `flow_plan_save` using the user\'s goal.\n- `missing_goal`: ask for a concrete goal before planning.\n- `Approved plans cannot be changed`: use `flow_feature_reset` when only affected features need another pass; otherwise close and start a new goal.\n- `No feature is currently running`: call `flow_run_start` before completing.\n- `already in progress`: finish, reset, or block the active feature before starting another.\n- `Completion requires recorded validation evidence`: run real validation and include at least one passing `validationRun`.\n- `Completion requires all recorded validation to pass`: fix failures and rerun. Do not relabel failed checks as passed.\n- `Non-final feature completion requires targeted validation`: use `validationScope: "targeted"` for ordinary features.\n- `Final feature completion requires broad validation`: run the project-level gate and use `validationScope: "broad"`.\n- `Feature review depth ... does not meet the plan requirement`: rerun review\n at the feature\'s planned depth or reset/replan if the depth was chosen\n incorrectly.\n- `Completion requires a passing featureReview`: run or request a real review and include a passing `featureReview` only when there are no blocking findings.\n- `Review retry budget exhausted`: stop and report the remaining blocker. Do\n not keep patching; reset or replan only after explicit user direction.\n- `Final feature completion requires a finalReview`: perform final review and include `finalReview`.\n- `Final review depth must match the plan policy`: use `reviewDepth` equal to the approved plan\'s `finalReviewPolicy`; valid final-review values are `broad` and `detailed`.\n- `Cannot close ... unfinished features`: complete, reset, defer, or abandon honestly. Do not mark completed while work remains.\n\n## Reset guidance\n\nUse `flow_feature_reset` when the active or completed work was built on the wrong assumption, validation revealed a design issue, dependencies need to be rerun, or dependent features must be invalidated. Resetting a feature also resets its dependents.\n\n## Closure guidance\n\nUse `flow_session_close`:\n\n- `completed`: only after all planned features are complete.\n- `deferred`: the user intentionally postpones unfinished work.\n- `abandoned`: the session should be archived without claiming delivery.\n\nAfter closure, the active `.flow/session.json` is removed and the archived JSON is stored under `.flow/history/`.\n';
733
554
 
734
555
  // skills/flow/SKILL.md
735
- var SKILL_default = "---\nname: flow\ndescription: Manage the end-to-end Flow loop for skills-first OpenCode work. Use when a user asks for Flow-guided delivery from goal to completion, resumable autonomous delivery, or resuming or closing a Flow session. For plan-only work use flow-plan; for executing one approved feature use flow-run.\n---\n\n# Flow\n\nUse Flow as a minimal state ledger, not as a framework. Skills provide judgment; the runtime only records the approved plan, active feature, validation evidence, review evidence, and closure.\n\nRouting: this manager skill owns the whole loop and every state-changing `flow_*` call. Load `flow-plan` alone for plan-only requests and `flow-run` alone when an approved plan needs one feature executed. Answer status-only questions with `flow_status`; no skill load is needed. `flow-test`, `flow-deslop`, and `flow-ui-quality` are optional helpers loaded from inside the loop; `flow-commit` is user-triggered only and never part of the autonomous loop.\n\n## Loop\n\n1. Call `flow_status` first. Trust its active session and next action over conversation memory.\n If the result includes `setup.skills`, follow the Skill Availability rules\n below before loading any Flow skill.\n If it includes `session.resumePacket` or `session.budget.phaseBoundary`, stop\n and report the resume instructions unless this is a fresh user invocation\n explicitly resuming the session. Only then may the next `flow_run_start` use\n `phaseBoundaryAck: true`.\n2. If there is no active session and the user gave a goal, load `flow-plan`, save a plan with `flow_plan_save`, then approve it with `flow_plan_approve` only after explicit user approval or prior authorization for autonomous implementation. If there is no goal, ask for one.\n3. Load `flow-run`, call `flow_run_start`, implement exactly one feature, validate it, and prepare a `flow_feature_complete` payload. For validation-heavy, regression-sensitive, browser QA, route QA, or failure-prone work, use `flow-test` to choose and summarize evidence before completion.\n4. Load `flow-review` for the required feature review. Send a compact review\n packet, not the accumulated root transcript. The reviewer reports\n `featureReviewDepth` and `featureReview`; the manager records both inside\n `flow_feature_complete`.\n5. On the final feature, run broad validation and include `finalReview` in the same `flow_feature_complete` call. Its `reviewDepth` must match the plan's `finalReviewPolicy`.\n6. After all features are complete, archive the session with `flow_session_close` using `kind: \"completed\"`.\n\nUse `references/parallel-orchestration.md` for broad read-only discovery, audit, validation, review, verification, or candidate implementation passes. It is the whole pass playbook orient, slice, manifest, fan out, account, verify, synthesize, extend or stop and its `references/handoff-format.md` companion holds the worker report templates the manager pastes into prompts. Hidden Flow workers are injected by plugin config; invoke the named worker when it is available. The manager owns every `flow_*` state change.\n\nDo not commit, push, amend, rebase, publish, or mutate releases during the\nautonomous Flow loop. Load `flow-commit` only when the user explicitly asks for\ncommit preparation or commit creation.\n\n## Skill Availability\n\nIf `flow_status` returns `setup.skills`, report that setup status and stop\nnative-loading Flow skills in the current OpenCode startup. Missing, incomplete,\nor outdated managed skills require a sync/restart cycle before their native skill\ninstructions can be trusted by the running process. Public command bundles are\nself-contained and may continue when the command prompt already embeds the\nrequired Flow instructions.\n\nIf optional helper skills such as `flow-test`, `flow-deslop`, or\n`flow-ui-quality` are unavailable, continue only with explicit coverage gaps. Do\nnot copy their rubrics into another skill and do not claim their quality checks\nwere completed.\n\n## Runtime Surface\n\n- `flow_status`: read the active session.\n- `flow_plan_save`: create a session and/or save a draft plan.\n- `flow_plan_approve`: lock the draft plan.\n- `flow_run_start`: start one runnable feature.\n- `flow_feature_complete`: record completion or a real blocker with validation and review evidence.\n- `flow_feature_reset`: reset one feature and its dependents.\n- `flow_session_close`: archive the active session as `completed`, `deferred`, or `abandoned`.\n\nThere is no `flow_context`, no separate review-record tool, and no multi-session activation surface. The single active source of truth is `.flow/session.json`; closed sessions are archived under `.flow/history/`.\n\nPlanning and running require loaded Flow tools; do not simulate plan approval or feature completion when the runtime is unavailable. Review may still return advisory output when tools, skills, or references are stale or unavailable, but the manager must not record it as Flow-gated evidence.\n\n## Hard Gates\n\n- Approved plans are immutable. To change direction, reset affected features or close the session and start a new goal.\n- Only one feature can be active at a time.\n- Each feature's planned `reviewDepth` is the minimum accepted\n `featureReviewDepth` for completion.\n- Completion requires at least one passing `validationRun` entry.\n- Non-final completion requires `validationScope: \"targeted\"`.\n- Final completion requires `validationScope: \"broad\"` and a passing `finalReview`.\n- Every completed feature requires a passing `featureReview` with no blocking findings.\n- Failed reviews pause the loop by default. Autonomous repair may make at most\n one repair plus one retry review before stopping.\n- Phase boundaries stop the current root session; resume from\n `.flow/session.json` in a fresh OpenCode session.\n- `flow_session_close` accepts `kind: \"completed\"` only after an approved plan has passed final completion.\n\n## Budget And Retry Boundaries\n\nFlow enforces review retry counts in the runtime ledger and tracks completed\nfeature counts as telemetry only. The current OpenCode plugin surface does not\nexpose per-turn token usage to Flow; when usage is visible in the host UI or\nlogs, stop the current autonomous loop once the root session is large enough to\nthreaten latency or cost and report a compact handoff instead of continuing.\nTreat high visible tokens, high non-cache tokens, or repeated reviewer fan-out\nas a reason to finish the current feature, emit the resume packet, and continue\nin a fresh session.\n\n## Recovery\n\n- Confused state: call `flow_status` and follow `nextAction`.\n- Wrong assumption or failed implementation path: use `flow_feature_reset` for the feature and dependents, then rerun from the corrected plan.\n- Missing validation or review evidence: gather real evidence, then call `flow_feature_complete`.\n- Approved plan is materially wrong: reset the affected features, save a revised plan if the session is back in planning; otherwise close and start a new goal.\n- Unknown runtime error: read `summary` and `recovery`; see `references/recovery-playbook.md` for common cases.\n\nNever fabricate validation output, backfill review approval you did not perform, or close as `deferred`/`abandoned` merely to avoid an unfinished-work blocker.\n";
556
+ var SKILL_default = "---\nname: flow\ndescription: Manage the end-to-end Flow loop for skills-first OpenCode work. Use when a user asks for Flow-guided delivery from goal to completion, resumable autonomous delivery, or resuming or closing a Flow session. For plan-only work use flow-plan; for executing one approved feature use flow-run.\n---\n\n# Flow\n\nUse Flow as a minimal state ledger, not as a framework. Skills provide judgment; the runtime only records the approved plan, active feature, validation evidence, review evidence, and closure.\n\nRouting: this manager skill owns the whole loop and every state-changing `flow_*` call. Load `flow-plan` alone for plan-only requests and `flow-run` alone when an approved plan needs one feature executed. Answer status-only questions with `flow_status`; no skill load is needed. `flow-test`, `flow-deslop`, and `flow-ui-quality` are optional helpers loaded from inside the loop; `flow-commit` is user-triggered only and never part of the autonomous loop.\n\n## Loop\n\n1. Call `flow_status` first. Trust its active session and next action over conversation memory.\n If the result includes `setup.skills`, follow the Skill Availability rules\n below before loading any Flow skill.\n If it includes `session.resumePacket` or `session.budget.phaseBoundary`, stop\n and report the resume instructions unless this is a fresh user invocation\n explicitly resuming the session. Only then may the next `flow_run_start` use\n `phaseBoundaryAck: true`.\n2. If there is no active session and the user gave a goal, load `flow-plan`, save a plan with `flow_plan_save`, then approve it with `flow_plan_approve` only after explicit user approval or prior authorization for autonomous implementation. If there is no goal, ask for one.\n3. Load `flow-run`, call `flow_run_start`, implement exactly one feature, validate it, and prepare a `flow_feature_complete` payload. For validation-heavy, regression-sensitive, browser QA, route QA, or failure-prone work, use `flow-test` to choose and summarize evidence before completion.\n4. Load `flow-review` for the required feature review. Send a bounded review\n packet, not the accumulated root transcript. The reviewer reports\n `featureReviewDepth` and `featureReview`; the manager records both inside\n `flow_feature_complete`.\n5. On the final feature, run broad validation and include `finalReview` in the same `flow_feature_complete` call. Its `reviewDepth` must match the plan's `finalReviewPolicy`.\n6. After all features are complete, archive the session with `flow_session_close` using `kind: \"completed\"`.\n\nFor broad discovery, audit, validation, review, verification, or candidate work,\nuse `references/parallel-orchestration.md` as the routing index. Read\n`references/parallel-decision.md` first. Load\n`references/parallel-manifest.md` and `references/parallel-execution.md` only\nafter selecting fan-out, then read `references/parallel-synthesis.md` when\nhandoffs return. Paste one matching template from\n`references/handoff-format.md` into each worker prompt. Hidden Flow workers are\ninjected by plugin config; invoke the named worker when available. The manager\nowns every `flow_*` state change.\n\nDo not commit, push, amend, rebase, publish, or mutate releases during the\nautonomous Flow loop. Load `flow-commit` only when the user explicitly asks for\ncommit preparation or commit creation.\n\n## Skill Availability\n\nIf `flow_status` returns `setup.skills`, report that setup status and stop\nnative-loading Flow skills in the current OpenCode startup. Missing, incomplete,\nor outdated managed skills require a sync/restart cycle before their native skill\ninstructions can be trusted by the running process. Public command bundles are\nself-contained and may continue when the command prompt already embeds the\nrequired Flow instructions.\n\nIf optional helper skills such as `flow-test`, `flow-deslop`, or\n`flow-ui-quality` are unavailable, continue only with explicit coverage gaps. Do\nnot copy their rubrics into another skill and do not claim their quality checks\nwere completed.\n\n## Runtime Surface\n\n- `flow_status`: read the active session.\n- `flow_plan_save`: create a session and/or save a draft plan.\n- `flow_plan_approve`: lock the draft plan.\n- `flow_run_start`: start one runnable feature.\n- `flow_feature_complete`: record completion or a real blocker with validation and review evidence.\n- `flow_feature_reset`: reset one feature and its dependents.\n- `flow_session_close`: archive the active session as `completed`, `deferred`, or `abandoned`.\n\nThere is no `flow_context`, no separate review-record tool, and no multi-session activation surface. The single active source of truth is `.flow/session.json`; closed sessions are archived under `.flow/history/`.\n\nPlanning and running require loaded Flow tools; do not simulate plan approval or feature completion when the runtime is unavailable. Review may still return advisory output when tools, skills, or references are stale or unavailable, but the manager must not record it as Flow-gated evidence.\n\n## Hard Gates\n\n- Approved plans are immutable. To change direction, reset affected features or close the session and start a new goal.\n- Only one feature can be active at a time.\n- Each feature's planned `reviewDepth` is the minimum accepted\n `featureReviewDepth` for completion.\n- Completion requires at least one passing `validationRun` entry.\n- Non-final completion requires `validationScope: \"targeted\"`.\n- Final completion requires `validationScope: \"broad\"` and a passing `finalReview`.\n- Every completed feature requires a passing `featureReview` with no blocking findings.\n- Failed reviews pause the loop by default. Autonomous repair may make at most\n one repair plus one retry review before stopping.\n- Phase boundaries stop the current root session; resume from\n `.flow/session.json` in a fresh OpenCode session.\n- `flow_session_close` accepts `kind: \"completed\"` only after an approved plan has passed final completion.\n\n## Recovery\n\n- Confused state: call `flow_status` and follow `nextAction`.\n- Wrong assumption or failed implementation path: use `flow_feature_reset` for the feature and dependents, then rerun from the corrected plan.\n- Missing validation or review evidence: gather real evidence, then call `flow_feature_complete`.\n- Approved plan is materially wrong: reset the affected features, save a revised plan if the session is back in planning; otherwise close and start a new goal.\n- Unknown runtime error: read `summary` and `recovery`; see `references/recovery-playbook.md` for common cases.\n\nNever fabricate validation output, backfill review approval you did not perform, or close as `deferred`/`abandoned` merely to avoid an unfinished-work blocker.\n";
736
557
 
737
558
  // skills/flow-commit/SKILL.md
738
559
  var SKILL_default2 = `---
@@ -981,9 +802,13 @@ var parallel_discovery_default = `# Parallel discovery
981
802
 
982
803
  Use this only after a serial orientation pass has identified the repo shape and the likely slices. Workers are read-only evidence gatherers; the planner owns the plan.
983
804
 
984
- For broad parallel passes, also load \`../../flow/references/parallel-orchestration.md\`.
985
- Use its pass manifest as the pre-fan-out coverage gate and
986
- \`../../flow/references/handoff-format.md\` response shapes.
805
+ For broad parallel passes, start with
806
+ \`../../flow/references/parallel-orchestration.md\`. If it selects fan-out, use
807
+ \`../../flow/references/parallel-manifest.md\` as the coverage gate,
808
+ \`../../flow/references/parallel-execution.md\` for worker prompts, and
809
+ \`../../flow/references/parallel-synthesis.md\` when handoffs return. Copy the
810
+ matching \`../../flow/references/handoff-format.md\` response shape into each
811
+ prompt.
987
812
 
988
813
  ## Good slices
989
814
 
@@ -1007,8 +832,8 @@ config, or release surfaces in the pass manifest.
1007
832
 
1008
833
  ## Manifest and prompts
1009
834
 
1010
- Write the pass manifest and the worker prompts exactly as Stages 3 and 4 of
1011
- \`../../flow/references/parallel-orchestration.md\` define them: one manifest row
835
+ Write the pass manifest and worker prompts as \`parallel-manifest.md\` and
836
+ \`parallel-execution.md\` define them: one manifest row
1012
837
  per slice with expected coverage, dependencies, write scope, and a verification
1013
838
  tier, and a self-contained prompt per worker naming the mode (usually
1014
839
  \`evidence\`), the exact slice, and the expected coverage. Discovery-specific
@@ -1035,7 +860,7 @@ Convert only evidence-backed work into plan fields:
1035
860
  If workers disagree, inspect the source artifact yourself. If a candidate finding lacks a concrete citation or refutation pass, make it a review-first deliverable rather than a fix feature.
1036
861
 
1037
862
  Apply the manager synthesis barrier from
1038
- \`../../flow/references/parallel-orchestration.md\`: only distilled,
863
+ \`../../flow/references/parallel-synthesis.md\`: only distilled,
1039
864
  evidence-backed claims become plan fields.
1040
865
  `;
1041
866
 
@@ -1044,7 +869,7 @@ var plan_quality_checklist_default = `# Plan quality checklist
1044
869
 
1045
870
  Use this checklist before \`flow_plan_save\` and again before approval if the plan
1046
871
  changed during discussion. The goal is not a long planning artifact; it is a
1047
- compact plan another agent can execute without rediscovering the work.
872
+ concise plan another agent can execute without rediscovering the work.
1048
873
 
1049
874
  ## Must pass
1050
875
 
@@ -1347,14 +1172,19 @@ description: "Use when Flow work needs planning before implementation: a new goa
1347
1172
 
1348
1173
  # Flow Plan
1349
1174
 
1350
- Use this skill before implementation. The output is a compact plan the runtime can enforce and future agents can execute without rediscovering the goal.
1175
+ Use this skill before implementation. The output is a concise plan the runtime can enforce and future agents can execute without rediscovering the goal.
1176
+
1177
+ ## Planning runtime availability
1351
1178
 
1352
1179
  If \`flow_plan_save\` or \`flow_plan_approve\` is unavailable, stop and tell the user to check that \`opencode-plugin-flow\` is loaded in OpenCode. Planning requires the loaded Flow runtime.
1353
1180
 
1354
1181
  ## Inspect first
1355
1182
 
1356
1183
  - Read the files, docs, tests, package scripts, and local conventions that determine the work.
1357
- - For broad discovery, read \`references/parallel-discovery.md\` after a serial orientation pass. Use \`../flow/references/parallel-orchestration.md\` when discovery needs multiple workers, and write its pass manifest before fan-out.
1184
+ - For broad discovery, read \`references/parallel-discovery.md\` after a serial
1185
+ orientation pass. When multiple workers may help, start with
1186
+ \`../flow/references/parallel-orchestration.md\` and load only the branch it
1187
+ selects.
1358
1188
  - Helper rule: when a named helper skill is unavailable, record a planning gap
1359
1189
  and keep the corresponding claims conservative instead of simulating its
1360
1190
  checks.
@@ -1458,6 +1288,65 @@ See \`references/planning-examples.md\` for payload examples and decomposition
1458
1288
  anti-patterns.
1459
1289
  `;
1460
1290
 
1291
+ // skills/flow-review/references/hidden-reviewer-contract.md
1292
+ var hidden_reviewer_contract_default = `# Hidden Flow reviewer contract
1293
+
1294
+ This is the canonical role-safe contract bundled into \`flow-reviewer\`. It does
1295
+ not grant manager capabilities and does not tell the hidden reviewer to load
1296
+ skills, run commands, edit files, or launch workers.
1297
+
1298
+ ## Role and availability
1299
+
1300
+ You are an independent read-only reviewer. Call \`flow_status\` when available,
1301
+ prefer the manager's bounded review packet, and inspect the actual changed
1302
+ artifacts and supplied validation evidence. Only the root manager may mutate
1303
+ Flow state; return findings without fixing them. Your permissions intentionally
1304
+ exclude edits, shell commands, skill loading, and nested workers. Record missing
1305
+ evidence as a gap or blocker instead of claiming coverage.
1306
+
1307
+ If Flow setup or required evidence is stale or unavailable, label the result
1308
+ advisory and do not present it as Flow-gated evidence.
1309
+
1310
+ ## Feature review depths
1311
+
1312
+ - \`quick\`: docs, comments, config-only changes, generated output, or mechanical
1313
+ changes fully covered by tooling.
1314
+ - \`standard\`: read every changed file and relevant test; this is the default for
1315
+ ordinary implementation work.
1316
+ - \`detailed\`: inspect risky behavior, persistence, security, cross-module
1317
+ refactors, migrations, releases, weak validation, and expensive edge cases.
1318
+
1319
+ The actual feature-review depth must meet or exceed the approved feature's
1320
+ \`reviewDepth\`. Final reviews use \`reviewDepth: "broad"\` or \`"detailed"\` and must
1321
+ match the plan's \`finalReviewPolicy\`. Claim only the depth actually performed.
1322
+
1323
+ ## Direct review outputs
1324
+
1325
+ For a direct feature review, return only \`featureReviewDepth\` plus
1326
+ \`featureReview\`. For a direct final review, return only \`status\`, \`summary\`,
1327
+ \`blockingFindings\`, and \`reviewDepth\`. Use \`status: "failed"\` whenever a
1328
+ blocking finding remains. Advisory notes belong in the summary, while
1329
+ \`blockingFindings\` contains only blockers.
1330
+
1331
+ ## Special-case evidence
1332
+
1333
+ - Cleanup/refactor: verify that the smell was real, refutation paths were
1334
+ checked, and behavior was preserved. If helper evidence is unavailable,
1335
+ record a coverage gap instead of approving the cleanup claim.
1336
+ - UI/frontend: verify relevant states and supplied visual evidence. When visual
1337
+ evidence is missing, record a coverage gap and do not claim visual polish was
1338
+ verified.
1339
+ - Audit reports: findings must survive refutation against cited code, guards,
1340
+ and mitigating paths before they can drive fixes.
1341
+
1342
+ ## Completion checkpoint
1343
+
1344
+ Before returning, confirm that the stated depth matches work actually
1345
+ inspected, every blocker has concrete evidence, missing coverage is explicit,
1346
+ and the response uses exactly the direct-review payload or assigned-slice
1347
+ handoff requested.
1348
+ `;
1349
+
1461
1350
  // skills/flow-review/references/review-rubric.md
1462
1351
  var review_rubric_default = `# Review rubric
1463
1352
 
@@ -1610,13 +1499,15 @@ These instructions run in two contexts, and only one of them can load helpers:
1610
1499
  subagents. In this context, skip every "load" and "fan out" instruction
1611
1500
  below: judge from the diff, the plan fields, and the recorded validation
1612
1501
  evidence, and record a coverage gap for any judgment that would have needed
1613
- a helper skill or a command run.
1502
+ a helper skill or a command run. The bundled hidden reviewer prompt uses the
1503
+ canonical role-safe contract in
1504
+ \`references/hidden-reviewer-contract.md\`.
1614
1505
 
1615
1506
  ## Start
1616
1507
 
1617
1508
  - Call \`flow_status\` when available.
1618
1509
  - Identify whether this is a feature review or final review.
1619
- - Prefer the manager's compact review packet over parent-session memory. The
1510
+ - Prefer the manager's bounded review packet over parent-session memory. The
1620
1511
  packet should name the active feature, minimum \`reviewDepth\`, changed files,
1621
1512
  diff summary, validation evidence, and targeted paths or risk lenses. If the
1622
1513
  packet is missing important scope or evidence, record that as a coverage gap
@@ -1677,14 +1568,15 @@ Use \`status: "failed"\` when any blocking finding remains. Advisory findings ma
1677
1568
  - Cleanup/refactor: in manager context, load \`flow-deslop\`; verify the smell was real, refutation paths were checked, and behavior was preserved. If it is unavailable or you are the hidden reviewer, record a coverage gap instead of approving cleanup claims.
1678
1569
  - UI/frontend: in manager context, load \`flow-ui-quality\`; verify state coverage and visual evidence when a local target was available. If it is unavailable or you are the hidden reviewer, record a coverage gap and do not claim visual polish was verified.
1679
1570
  - Audit reports: use \`../flow-run/references/audit-rubric.md\`; findings must survive refutation before they can drive fix features.
1680
- - Large reviews (manager context only): use
1571
+ - Large reviews (manager context only): start with
1681
1572
  \`../flow/references/parallel-orchestration.md\` for read-only slices by
1682
- changed-file group, risk lens, or validation surface. Use the named review,
1683
- audit, evidence, or validation agents from that reference instead of generic
1684
- subagents. Write its pass manifest before fan-out and apply its Stage 6
1685
- handoff acceptance and verification tiers; only the manager
1686
- returns the final \`featureReview\` or \`finalReview\` payload. If that reference
1687
- is unavailable in the current context (for example in a bundled public Flow
1573
+ changed-file group, risk lens, or validation surface. If fan-out is selected,
1574
+ use \`../flow/references/parallel-manifest.md\`,
1575
+ \`../flow/references/parallel-execution.md\`, and
1576
+ \`../flow/references/parallel-synthesis.md\` with the named review, audit,
1577
+ evidence, or validation workers; only the manager returns the final
1578
+ \`featureReview\` or \`finalReview\` payload. If those references are unavailable
1579
+ in the current context (for example in a bundled public Flow
1688
1580
  command that does not include it), review serially and record the skipped
1689
1581
  fan-out as a coverage gap instead of improvising worker contracts. The hidden
1690
1582
  reviewer cannot spawn workers; it reviews its assigned scope directly and
@@ -1712,7 +1604,7 @@ A finding that survives this pass is worth reporting. A finding you did not try
1712
1604
 
1713
1605
  ## Parallel audit slices
1714
1606
 
1715
- For broad audits, use \`../../flow/references/parallel-orchestration.md\` to split
1607
+ For broad audits, start with \`../../flow/references/parallel-orchestration.md\` to split
1716
1608
  read-only slices by module, data flow, or risk lens. Workers surface candidates;
1717
1609
  the audit author owns the report. Apply its handoff format and verification
1718
1610
  gates. Before blocking severity, dedupe, trace guards, fill cross-layer checks,
@@ -1768,7 +1660,9 @@ Use the strongest practical tier. For risky work, combine tiers.
1768
1660
  - Each \`validationRun\` entry has \`command\`, \`status\`, and \`summary\`.
1769
1661
  - Completion accepts only passing entries. Failed or skipped checks belong in the summary/notes and must be resolved or explained as blockers.
1770
1662
  - Do not claim a command was run unless it was run in this session or directly reported by a trusted worker with raw output.
1771
- - Worker-reported command output must satisfy the verification stage of \`../../flow/references/parallel-orchestration.md\`: exact command, status, raw outcome summary, coverage, and manager acceptance.
1663
+ - Worker-reported command output must satisfy the acceptance and verification
1664
+ rules in \`../../flow/references/parallel-synthesis.md\`: exact command, status,
1665
+ raw outcome summary, coverage, and manager acceptance.
1772
1666
  - Include scope in the summary: what behavior, files, routes, or states the check covered.
1773
1667
  - UI work should include browser or screenshot evidence when the app can run locally.
1774
1668
  - Cleanup/refactor work should show behavior preservation, not only formatting success.
@@ -1810,7 +1704,170 @@ Never trim failing output, relabel a failed command as passed, or use "not run"
1810
1704
  `;
1811
1705
 
1812
1706
  // skills/flow-run/SKILL.md
1813
- var SKILL_default6 = '---\nname: flow-run\ndescription: "Use when an approved Flow plan has a feature to implement, validate, or complete in the v4 runtime, and the work is scoped to one active feature. For planning a goal first use flow-plan; for the full goal-to-completion loop or resuming a session use flow."\n---\n\n# Flow Run\n\nUse this skill for implementation after a Flow plan is approved. Work one feature at a time.\n\nIf `flow_run_start` is unavailable, stop and tell the user to check that `opencode-plugin-flow` is loaded in OpenCode.\n\n## Start\n\n- Call `flow_status`.\n- If `flow_status` returns a `session.resumePacket` or\n `session.budget.phaseBoundary`, stop the current autonomous loop and report\n the resume instructions. Only call `flow_run_start` with\n `phaseBoundaryAck: true` at the start of a fresh user invocation that is\n explicitly resuming the Flow session; do not acknowledge a boundary inside\n the same uninterrupted loop that created it.\n- Call `flow_run_start` with no `featureId` unless the user or plan requires a specific runnable feature.\n- Treat the returned feature as the sole scope until it is completed, blocked, or reset.\n- Helper rule: when a named helper skill is unavailable, record the gap and\n keep the corresponding claims conservative instead of simulating its checks.\n- Load `flow-deslop` for cleanup/refactor features.\n- Load `flow-ui-quality` for frontend, UX, responsive, accessibility, or visual work.\n\n## Implement\n\n- Read the feature `targets`, `summary`, `validation`, dependencies, and plan `requirements`/`decisions`.\n- Treat the feature\'s `reviewDepth` as the minimum feature-review depth that\n must be recorded in `flow_feature_complete`.\n- For broad, risky, or multi-target work, record an implementation pass\n decision before editing: `serial`, `candidate-exact-path`,\n `candidate-worktree`, `tournament`, or `skipped`. Use\n `../flow/references/parallel-orchestration.md` for the decision rules,\n manifest fields, and compact `orchestrationPasses` record.\n- If candidate workers are skipped, record the reason, such as overlapping\n targets, shared contracts, missing isolation, or no explicit authorization\n for worker edits.\n- Keep edits scoped to the active feature. If new scope appears, stop and replan or defer it to another feature.\n- Preserve unrelated user changes in the worktree.\n- When a wrong assumption invalidates the feature, use `flow_feature_reset`; do not pile patches onto a bad path.\n- Do not stage, commit, push, amend, rebase, publish, or mutate releases as part\n of feature execution. If the user explicitly asks for commit preparation, load\n `flow-commit` only after `flow_feature_complete` has been recorded, unless the\n user explicitly asks for a WIP commit path. Keep Git boundaries separate from\n Flow state recording.\n\n## Validate\n\n- For complex validation, regression-sensitive changes, browser QA, route QA,\n failure-prone checks, unclear coverage, exploratory QA, or\n `validationRun` summarization, load `flow-test` (helper rule applies).\n- Read `references/validation-rubric.md` before completing.\n- Run the strongest practical checks for the changed behavior.\n- Record concrete command names, status, and observed results. "Tests pass" is not evidence.\n- Non-final features complete with `validationScope: "targeted"`.\n- The final feature must run a broad project-level gate and use `validationScope: "broad"`.\n\nFor broad validation research, risky changes, or unclear coverage, use\n`../flow/references/parallel-orchestration.md` to fan out named Flow workers.\nUse the mode-to-agent mapping in that reference instead of generic subagents.\nWrite its pass manifest before fan-out, paste the matching handoff template\nfrom `../flow/references/handoff-format.md` into every worker prompt, and\napply its verification tiers to the handoffs that come back.\nThey may report command output they actually ran or propose focused checks; the\nmanager decides what is strong enough to record.\n\nFor independent implementation attempts, use candidate workers only with\nexplicit user authorization plus isolated worktrees or exact non-overlapping\npath ownership. Treat their output as candidate patches. The manager inspects,\nmerges, validates, and records Flow state serially.\nWhen a candidate pass or serial/skipped implementation decision materially\nshaped the feature, include its compact record in\n`flow_feature_complete.orchestrationPasses`. Do not paste full worker handoffs\nor long logs into the runtime payload.\n\n## Review and complete\n\nBefore `flow_feature_complete`, obtain a `featureReview` payload. Load\n`flow-review`; for read-only subagent reviews, the manager receives the review\npacket and records both `featureReviewDepth` and `featureReview`.\n\nSend reviewers a compact review packet. Do not rely on the accumulated parent\nconversation. Include only:\n\n- active feature id, title, summary, `reviewDepth`, targets, validation, and dependencies\n- relevant plan requirements, decisions, and final review policy\n- changed files and a short diff summary\n- validation evidence with exact commands, status, and observed result\n- targeted paths or risk lenses the reviewer must inspect\n\nIf the review returns `status: "failed"`, do not fix inside the review pass.\nRecord the failed attempt by calling `flow_feature_complete` with the otherwise\nprepared completion payload, the failed `featureReview`, and the attempted\n`featureReviewDepth`; the runtime will reject completion and update the retry\nbudget. Default to stopping and reporting the blocker. When the user already\nauthorized autonomous implementation, make at most one repair and run one retry\nreview. If the retry fails or the runtime reports review retry budget\nexhausted, stop with the blocker.\n\nIf `flow_status` reports `setup.skills` or `flow-review` cannot be loaded, do\nnot record a Flow-gated `featureReview` or `finalReview`. You may perform an\nadvisory review using available context or the bundled review fallback provided\nby plugin config, then complete with `status: "needs_input"` if review evidence\nis required to proceed.\n\nFor the final feature, also obtain a `finalReview` payload whose `reviewDepth` equals the approved plan\'s `finalReviewPolicy`.\n\nComplete with:\n\n```json\n{\n "status": "ok",\n "featureId": "active-feature-id",\n "summary": "what changed",\n "artifactsChanged": [{ "path": "src/file.ts" }],\n "validationRun": [\n { "command": "bun test tests/foo.test.ts", "status": "passed", "summary": "3 pass, exercised foo behavior" }\n ],\n "validationScope": "targeted",\n "featureReviewDepth": "standard",\n "featureReview": { "status": "passed", "summary": "review summary", "blockingFindings": [] },\n "orchestrationPasses": [\n {\n "id": "active-feature-id-implementation-decision",\n "kind": "implementation-decision",\n "decision": "serial",\n "decisionReason": "Shared contract edits made worker ownership unsafe.",\n "writeScope": "manager-serial",\n "verificationStatus": "not-needed",\n "outcome": "accepted"\n }\n ]\n}\n```\n\nIf `flow_feature_complete` returns a `session.resumePacket` or\n`session.budget.phaseBoundary`, stop after reporting the compact handoff. If\ngenuinely blocked, call `flow_feature_complete` with `status: "needs_input"` and\nan `outcome` that explains the blocker and next step. Never fabricate validation\nor review evidence to force progress.\n';
1707
+ var SKILL_default6 = `---
1708
+ name: flow-run
1709
+ description: "Use when an approved Flow plan has a feature to implement, validate, or complete in the v4 runtime, and the work is scoped to one active feature. For planning a goal first use flow-plan; for the full goal-to-completion loop or resuming a session use flow."
1710
+ ---
1711
+
1712
+ # Flow Run
1713
+
1714
+ Use this skill for implementation after a Flow plan is approved. Work one feature at a time.
1715
+
1716
+ ## Execution runtime availability
1717
+
1718
+ If \`flow_run_start\` is unavailable, stop and tell the user to check that \`opencode-plugin-flow\` is loaded in OpenCode.
1719
+
1720
+ ## Start
1721
+
1722
+ - Call \`flow_status\`.
1723
+ - If \`flow_status\` returns a \`session.resumePacket\` or
1724
+ \`session.budget.phaseBoundary\`, stop the current autonomous loop and report
1725
+ the resume instructions. Only call \`flow_run_start\` with
1726
+ \`phaseBoundaryAck: true\` at the start of a fresh user invocation that is
1727
+ explicitly resuming the Flow session; do not acknowledge a boundary inside
1728
+ the same uninterrupted loop that created it.
1729
+ - Call \`flow_run_start\` with no \`featureId\` unless the user or plan requires a specific runnable feature.
1730
+ - Treat the returned feature as the sole scope until it is completed, blocked, or reset.
1731
+ - Helper rule: when a named helper skill is unavailable, record the gap and
1732
+ keep the corresponding claims conservative instead of simulating its checks.
1733
+ - Load \`flow-deslop\` for cleanup/refactor features.
1734
+ - Load \`flow-ui-quality\` for frontend, UX, responsive, accessibility, or visual work.
1735
+
1736
+ ## Implement
1737
+
1738
+ - Read the feature \`targets\`, \`summary\`, \`validation\`, dependencies, and plan \`requirements\`/\`decisions\`.
1739
+ - Treat the feature's \`reviewDepth\` as the minimum feature-review depth that
1740
+ must be recorded in \`flow_feature_complete\`.
1741
+ - Keep edits scoped to the active feature. If new scope appears, stop and replan or defer it to another feature.
1742
+ - Preserve unrelated user changes in the worktree.
1743
+ - When a wrong assumption invalidates the feature, use \`flow_feature_reset\`; do not pile patches onto a bad path.
1744
+ - Do not stage, commit, push, amend, rebase, publish, or mutate releases as part
1745
+ of feature execution. If the user explicitly asks for commit preparation, load
1746
+ \`flow-commit\` only after \`flow_feature_complete\` has been recorded, unless the
1747
+ user explicitly asks for a WIP commit path. Keep Git boundaries separate from
1748
+ Flow state recording.
1749
+
1750
+ ## Candidate implementation
1751
+
1752
+ \`flow-run\` remains the candidate-implementation manager entry route. Invoke the
1753
+ hidden \`flow-candidate-worker\` only after feature start and a complete pass
1754
+ manifest; never route the user's feature request directly to it.
1755
+
1756
+ For broad, risky, or multi-target work, record an implementation pass decision
1757
+ before editing: \`serial\`, \`candidate-exact-path\`, \`candidate-worktree\`,
1758
+ \`tournament\`, or \`skipped\`. Candidate implementation requires explicit user
1759
+ authorization and either an isolated worktree or exact non-overlapping path
1760
+ ownership. It is eligible only when the slice has an independent surface and
1761
+ practical validation, with no shared state, overlapping files, or unresolved
1762
+ manager judgment. Shared contracts, migrations, lockfiles, generated outputs,
1763
+ tightly coupled callers, unclear ownership, and small slices remain serial.
1764
+
1765
+ Classify \`candidateEligibility\` (\`eligible\`, \`not_eligible\`, or \`unknown\`) and
1766
+ \`candidateDecision\` (\`used\`, \`skipped\`, or \`serial_required\`) separately. Read
1767
+ \`../flow/references/parallel-decision.md\` for valid pairings and factors. After
1768
+ selecting fan-out, read \`../flow/references/parallel-manifest.md\` and
1769
+ \`../flow/references/parallel-execution.md\`, then
1770
+ \`../flow/references/parallel-synthesis.md\` when handoffs return.
1771
+ Set \`decision\`, \`decisionReason\`, \`decisionFactors\`, and \`writeScope\`.
1772
+
1773
+ Candidate workers return patches for manager inspection. The manager accepts,
1774
+ modifies, or rejects them, integrates accepted work, validates, reviews, and
1775
+ records Flow state serially. Record the candidate outcome as \`accepted\`,
1776
+ \`modified\`, or \`rejected\`. When a candidate pass or serial/skipped decision
1777
+ materially shaped the feature, include its bounded record in
1778
+ \`flow_feature_complete.orchestrationPasses\`; keep full handoffs and long logs
1779
+ outside the runtime payload.
1780
+
1781
+ ## Validate
1782
+
1783
+ - For complex validation, regression-sensitive changes, browser QA, route QA,
1784
+ failure-prone checks, unclear coverage, exploratory QA, or
1785
+ \`validationRun\` summarization, load \`flow-test\` (helper rule applies).
1786
+ - Read \`references/validation-rubric.md\` before completing.
1787
+ - Run the strongest practical checks for the changed behavior.
1788
+ - Record concrete command names, status, and observed results. "Tests pass" is not evidence.
1789
+ - Non-final features complete with \`validationScope: "targeted"\`.
1790
+ - The final feature must run a broad project-level gate and use \`validationScope: "broad"\`.
1791
+
1792
+ For broad validation research, risky changes, or unclear coverage, start with
1793
+ \`../flow/references/parallel-orchestration.md\`. If it routes to fan-out, write
1794
+ the manifest from \`../flow/references/parallel-manifest.md\`, use the named Flow
1795
+ workers and prompt contract in \`../flow/references/parallel-execution.md\`, paste
1796
+ the matching handoff template from \`../flow/references/handoff-format.md\`, and
1797
+ apply \`../flow/references/parallel-synthesis.md\` when the handoffs return.
1798
+ They may report command output they actually ran or propose focused checks; the
1799
+ manager decides what is strong enough to record.
1800
+
1801
+ ## Review and complete
1802
+
1803
+ Before \`flow_feature_complete\`, obtain a \`featureReview\` payload. Load
1804
+ \`flow-review\`; for read-only subagent reviews, the manager receives the review
1805
+ packet and records both \`featureReviewDepth\` and \`featureReview\`.
1806
+
1807
+ Send reviewers a bounded review packet. Do not rely on the accumulated parent
1808
+ conversation. Include only:
1809
+
1810
+ - active feature id, title, summary, \`reviewDepth\`, targets, validation, and dependencies
1811
+ - relevant plan requirements, decisions, and final review policy
1812
+ - changed files and a short diff summary
1813
+ - validation evidence with exact commands, status, and observed result
1814
+ - targeted paths or risk lenses the reviewer must inspect
1815
+
1816
+ If the review returns \`status: "failed"\`, do not fix inside the review pass.
1817
+ Record the failed attempt by calling \`flow_feature_complete\` with the otherwise
1818
+ prepared completion payload, the failed \`featureReview\`, and the attempted
1819
+ \`featureReviewDepth\`; the runtime will reject completion and update the retry
1820
+ budget. Default to stopping and reporting the blocker. When the user already
1821
+ authorized autonomous implementation, make at most one repair and run one retry
1822
+ review. If the retry fails or the runtime reports review retry budget
1823
+ exhausted, stop with the blocker.
1824
+
1825
+ If \`flow_status\` reports \`setup.skills\` or \`flow-review\` cannot be loaded, do
1826
+ not record a Flow-gated \`featureReview\` or \`finalReview\`. You may perform an
1827
+ advisory review using available context or the bundled review fallback provided
1828
+ by plugin config, then complete with \`status: "needs_input"\` if review evidence
1829
+ is required to proceed.
1830
+
1831
+ For the final feature, also obtain a \`finalReview\` payload whose \`reviewDepth\` equals the approved plan's \`finalReviewPolicy\`.
1832
+
1833
+ Complete with:
1834
+
1835
+ \`\`\`json
1836
+ {
1837
+ "status": "ok",
1838
+ "featureId": "active-feature-id",
1839
+ "summary": "what changed",
1840
+ "artifactsChanged": [{ "path": "src/file.ts" }],
1841
+ "validationRun": [
1842
+ { "command": "bun test tests/foo.test.ts", "status": "passed", "summary": "3 pass, exercised foo behavior" }
1843
+ ],
1844
+ "validationScope": "targeted",
1845
+ "featureReviewDepth": "standard",
1846
+ "featureReview": { "status": "passed", "summary": "review summary", "blockingFindings": [] },
1847
+ "orchestrationPasses": [
1848
+ {
1849
+ "id": "active-feature-id-implementation-decision",
1850
+ "kind": "implementation-decision",
1851
+ "decision": "serial",
1852
+ "decisionReason": "Shared contract edits made worker ownership unsafe.",
1853
+ "candidateEligibility": "not_eligible",
1854
+ "candidateDecision": "serial_required",
1855
+ "decisionFactors": ["shared_state", "overlapping_files"],
1856
+ "writeScope": "manager-serial",
1857
+ "verificationStatus": "not-needed",
1858
+ "outcome": "accepted"
1859
+ }
1860
+ ]
1861
+ }
1862
+ \`\`\`
1863
+
1864
+ If \`flow_feature_complete\` returns a \`session.resumePacket\` or
1865
+ \`session.budget.phaseBoundary\`, stop after reporting the runtime-provided resume
1866
+ packet. If
1867
+ genuinely blocked, call \`flow_feature_complete\` with \`status: "needs_input"\` and
1868
+ an \`outcome\` that explains the blocker and next step. Never fabricate validation
1869
+ or review evidence to force progress.
1870
+ `;
1814
1871
 
1815
1872
  // skills/flow-test/SKILL.md
1816
1873
  var SKILL_default7 = `---
@@ -2096,6 +2153,22 @@ var FLOW_SKILL_DEFINITIONS = [
2096
2153
  relativePath: "references/parallel-orchestration.md",
2097
2154
  content: parallel_orchestration_default
2098
2155
  },
2156
+ {
2157
+ relativePath: "references/parallel-decision.md",
2158
+ content: parallel_decision_default
2159
+ },
2160
+ {
2161
+ relativePath: "references/parallel-manifest.md",
2162
+ content: parallel_manifest_default
2163
+ },
2164
+ {
2165
+ relativePath: "references/parallel-execution.md",
2166
+ content: parallel_execution_default
2167
+ },
2168
+ {
2169
+ relativePath: "references/parallel-synthesis.md",
2170
+ content: parallel_synthesis_default
2171
+ },
2099
2172
  {
2100
2173
  relativePath: "references/parallel-pass-example.md",
2101
2174
  content: parallel_pass_example_default
@@ -2146,6 +2219,10 @@ var FLOW_SKILL_DEFINITIONS = [
2146
2219
  name: "flow-review",
2147
2220
  files: [
2148
2221
  { relativePath: "SKILL.md", content: SKILL_default5 },
2222
+ {
2223
+ relativePath: "references/hidden-reviewer-contract.md",
2224
+ content: hidden_reviewer_contract_default
2225
+ },
2149
2226
  {
2150
2227
  relativePath: "references/review-rubric.md",
2151
2228
  content: review_rubric_default
@@ -2734,4 +2811,4 @@ main(process.argv).catch((error) => {
2734
2811
  process.exitCode = 1;
2735
2812
  });
2736
2813
 
2737
- //# debugId=F8C7F51F0C6F267C64756E2164756E21
2814
+ //# debugId=62569BF7C9EAD96D64756E2164756E21