opencode-plugin-flow 4.3.9 → 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,154 +38,143 @@ 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/**\`.
180
173
  The candidate accounting rules — which \`candidateEligibility\`,
181
174
  \`candidateDecision\`, and \`decision\` combinations validate, and what counts as
182
175
  candidate execution evidence — live in
183
- [parallel-orchestration.md](parallel-orchestration.md) under "Implementation
184
- pass decision"; note \`decision: "parallel"\` is not valid on
176
+ [parallel-decision.md](parallel-decision.md) under "Implementation pass
177
+ decision"; note \`decision: "parallel"\` is not valid on
185
178
  \`implementation-decision\` records.
186
179
 
187
180
  \`\`\`json
@@ -215,557 +208,252 @@ pass decision"; note \`decision: "parallel"\` is not valid on
215
208
  \`\`\`
216
209
  `;
217
210
 
218
- // skills/flow/references/parallel-orchestration.md
219
- var parallel_orchestration_default = `# Parallel orchestration
220
-
221
- Use fan-out when Flow work is broad enough that independent workers can gather
222
- evidence faster than one linear pass. The manager still owns the Flow session:
223
- only the manager calls state-changing Flow tools, approves plans, completes
224
- features, records reviews, or closes sessions.
211
+ // skills/flow/references/parallel-decision.md
212
+ var parallel_decision_default = `# Parallel pass decisions
225
213
 
226
- Every parallel pass runs the same loop:
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.
227
217
 
228
- **orient slice → manifest → fan out → account → verify → synthesize →
229
- extend or stop.**
218
+ <!-- flow-prompt:manager-parallel-core:start -->
219
+ ## Conditional parallel pass
230
220
 
231
- This file is the whole playbook; read it once and run the pass. Two companions
232
- stay separate:
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.
233
226
 
234
- - \`handoff-format.md\` holds the worker response templates. The manager pastes
235
- the matching template verbatim into every worker prompt.
236
- - \`parallel-pass-example.md\` walks one concrete end-to-end pass (synced with
237
- 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 -->
238
234
 
239
235
  ## Choose a pass
240
236
 
241
- | Situation | Flow pass | Output the manager may synthesize |
237
+ | Situation | Flow pass | Manager-owned result |
242
238
  | --- | --- | --- |
243
- | Repo shape is unclear before planning | Discovery pass | Requirements, decisions, targets, validation entries, or a review-first feature |
244
- | A broad finding set needs refutation | Audit pass | Surviving findings with guards checked and gaps named |
245
- | 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 |
246
- | Test strategy or route coverage is unclear | Validation pass | Candidate commands or authorized raw command evidence |
247
- | A claim is single-source, surprising, high-stakes, or payload-bound | Verification pass | Per-claim keep, narrow, rewrite, or remove decisions |
248
- | Multiple implementation paths are plausible | Candidate pass | Candidate patches inspected and validated by the manager before use |
249
-
250
- Pass notes:
251
-
252
- - **Discovery**: workers read specific modules, routes, docs, commands, or risk
253
- lenses; only evidenced claims become plan fields.
254
- - **Audit**: workers actively look for guards, lifecycle resets, deployment
255
- constraints, and counterexamples before reporting a finding. A finding
256
- without refutation work stays advisory or becomes a follow-up question.
257
- - **Review**: workers separate blocking findings from advisory notes; the
258
- manager resolves conflicts and returns one review payload.
259
- - **Validation**: workers run only manager-authorized commands and report the
260
- exact command, status, and raw outcome summary.
261
- - **Verification**: verifiers judge atomic claims against cited sources or
262
- commands; do not ask a verifier to redesign the work or review the whole
263
- feature.
264
- - **Candidate**: only with explicit user authorization plus isolated worktrees
265
- or exact non-overlapping path ownership. Patches stay proposals until the
266
- 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.
267
252
 
268
253
  ## Implementation pass decision
269
254
 
270
- Before implementing a broad, risky, or multi-target feature, record one manager
271
- decision. This is required even when the answer is "stay serial"; the point is
272
- to make the skipped parallelism visible instead of relying on memory.
273
-
274
- First classify candidate eligibility:
275
-
276
- - \`eligible\`: at least one slice is independent enough for a candidate worker.
277
- - \`not_eligible\`: worker isolation would not make the implementation safer or
278
- cheaper because the slice shares state, files, tests, or one mental model.
279
- - \`unknown\`: orientation did not produce enough evidence to classify; use this
280
- only for non-decision pass rows or legacy low-signal records, not for
281
- \`implementation-decision\` records and not as a substitute for judgment.
282
-
283
- Then record the candidate decision:
284
-
285
- - \`used\`: candidate workers were used or a candidate pass carried the work.
286
- - \`skipped\`: candidates were eligible, but the manager chose serial anyway.
287
- This is the underused-parallelism signal counted by Flow status; use it only
288
- on \`kind: "implementation-decision"\` records.
289
- - \`serial_required\`: candidates were not eligible, so serial work was the
290
- correct implementation shape. Use it only on \`kind: "implementation-decision"\`
291
- records.
292
-
293
- Use one of these decisions:
294
-
295
- - \`serial\`: the manager implements directly because slices overlap, the next
296
- edit depends on one shared contract, or prompt/merge overhead would exceed the
297
- value. Pair unsafe or not-useful worker cases with
298
- \`candidateEligibility: "not_eligible"\` and
299
- \`candidateDecision: "serial_required"\`.
300
- - \`candidate-exact-path\`: one or more candidate workers may edit exact
301
- non-overlapping paths or modules named by the manager.
302
- - \`candidate-worktree\`: one or more candidate workers may edit in isolated
303
- worktrees, then the manager inspects and merges or rejects.
304
- - \`tournament\`: several isolated candidate implementations compete for the same
305
- outcome; the manager filters by tests, review, and source inspection before
306
- accepting one.
307
- - Candidate-shaped decisions (\`candidate-exact-path\`, \`candidate-worktree\`,
308
- \`tournament\`) require candidate execution evidence on the same record:
309
- \`kind: "candidate"\`, \`modes\` includes \`candidate-implementation\`, or
310
- \`candidateWorkerCount > 0\`. The same evidence rule applies to
311
- \`candidateDecision: "used"\`. Non-decision candidate rows (for example
312
- \`kind: "candidate"\`) may omit \`decision\`; \`implementation-decision\` rows must
313
- always set one, and when \`candidateDecision\` is \`"used"\` that decision must
314
- be candidate-shaped — never \`serial\`, \`parallel\`, or \`skipped\`.
315
- - \`parallel\` describes multi-worker read or audit passes (discovery, audit,
316
- review); it is not a valid \`implementation-decision\` value. Implementation
317
- decisions use \`serial\`, \`skipped\`, or a candidate-shaped decision.
318
- - \`skipped\`: candidate workers were eligible but the manager chose serial
319
- anyway; pair this with \`candidateEligibility: "eligible"\` and
320
- \`candidateDecision: "skipped"\`. Do not use \`skipped\` for shared fixtures,
321
- shared API contracts, unclear ownership, or other unsafe worker cases; use
322
- \`serial\` plus \`serial_required\` for those.
323
-
324
- Use structured \`decisionFactors\` alongside prose \`decisionReason\`:
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.
258
+
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\`:
325
295
  \`shared_state\`, \`overlapping_files\`, \`small_slice\`,
326
296
  \`needs_manager_judgment\`, \`independent_surface\`, and
327
- \`validation_available\`. Serial-required records usually cite
328
- \`shared_state\`, \`overlapping_files\`, or \`needs_manager_judgment\`; eligible
329
- records usually cite \`independent_surface\` and \`validation_available\`, with
330
- \`small_slice\` explaining an eligible-but-skipped choice.
331
-
332
- ### Worker decision rubric
333
-
334
- Default to considering candidate workers when:
335
-
336
- - the plan has three or more features.
337
- - features touch separate surfaces such as frontend, core, docs, release
338
- scripts, tests, or bindings.
339
- - validation can run per slice.
340
- - the work is mostly additive or localized.
341
- - the final manager can review, apply, adapt, or reject the result safely.
342
-
343
- Prefer serial when:
344
-
345
- - one tight invariant crosses shared files.
346
- - migrations, persistence, storage, or lifecycle semantics require one mental
347
- model.
348
- - tests require iterative local debugging in one checkout.
349
- - multiple slices would edit the same files or fixtures.
350
- - the slice is so small that prompt, handoff, merge, and verification overhead
351
- costs more than direct work.
352
-
353
- Record the decision in the pass manifest with a stable pass id,
354
- \`candidateEligibility\`, \`candidateDecision\`, \`decisionFactors\`,
355
- \`decisionReason\`, \`writeScope\`, expected verification, and where any handoff or
356
- synthesis artifact will live. If the feature completes, include the compact
357
- record in the \`orchestrationPasses\` array of the \`flow_feature_complete\`
358
- payload. The runtime stores only compact accounting; full worker handoffs stay
359
- in manager-owned scratch files or the conversation.
360
-
361
- ## When to stay serial
362
-
363
- - One file, command, or design question determines the next step.
364
- - Slices would share the same contracts, fixtures, or edit targets.
365
- - The manager can inspect the full scope faster than writing and checking
366
- worker prompts.
367
- - The result would still need the same manual synthesis with no time saved.
368
-
369
- Do not fan out to keep agents busy. Every worker should reduce a named
370
- planning, validation, review, audit, or implementation uncertainty. A normal
371
- first pass is two to five workers with independent slices; use more only when
372
- the manifest stays countable and non-overlapping.
373
-
374
- ## Modes
375
-
376
- When fanning out Flow work, select the matching hidden Flow agent by name. These
377
- workers are injected by the plugin config; invoke the named worker when it is
378
- available. Do not use generic subagents for Flow slices because Flow workers
379
- carry the permission boundaries for each mode.
380
-
381
- | Mode | Use agent | Worker output | Write access | Flow tools |
382
- | --- | --- | --- | --- | --- |
383
- | \`evidence\` | \`flow-evidence-worker\` | Coverage, facts, files inspected, confidence, gaps, suggested plan targets | No | \`flow_status\` only if needed |
384
- | \`review\` | \`flow-reviewer\` | Coverage, candidate findings or review slice summary, confidence, gaps | No | \`flow_status\` only if needed |
385
- | \`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 |
386
- | \`audit\` | \`flow-audit-worker\` | Refuted or surviving finding candidates, guards checked, confidence, gaps | No | \`flow_status\` only if needed |
387
- | \`verifier\` | \`flow-verifier-worker\` | Per-claim verdicts against cited evidence or commands | No | \`flow_status\` only if needed |
388
- | \`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 |
389
-
390
- Use worker-specific model routing where the installation can support it:
391
- \`OPENCODE_FLOW_READONLY_WORKER_MODEL\` for evidence, validation, and audit
392
- workers; \`OPENCODE_FLOW_REVIEW_WORKER_MODEL\` for reviewer and verifier workers;
393
- \`OPENCODE_FLOW_CANDIDATE_WORKER_MODEL\` for candidate implementation workers; and
394
- \`OPENCODE_FLOW_WORKER_MODEL\` as a fallback for all hidden Flow workers. Model IDs
395
- are OpenCode installation-specific (\`provider/model\`), so leave these unset when
396
- the configured provider is unknown. Spend stronger models where being wrong is
397
- expensive; read-heavy discovery slices tolerate the cheapest configured option,
398
- while verifier and review slices deserve the strongest.
399
-
400
- ## Permission contract
401
-
402
- The plugin injects these hidden workers with the following permission values.
403
- \`Flow state tools\` means the \`flow_*\` rule, while \`Flow status\` documents the
404
- explicit \`flow_status\` exception.
405
-
406
- | Worker | Edit | Bash | Task | Skill | Flow state tools | Flow status |
407
- | --- | --- | --- | --- | --- | --- | --- |
408
- | \`flow-reviewer\` | deny | deny | deny | deny | deny | allow |
409
- | \`flow-evidence-worker\` | deny | deny | deny | deny | deny | allow |
410
- | \`flow-validation-worker\` | deny | ask | deny | deny | deny | allow |
411
- | \`flow-audit-worker\` | deny | ask | deny | deny | deny | allow |
412
- | \`flow-candidate-worker\` | ask | ask | deny | deny | deny | allow |
413
- | \`flow-verifier-worker\` | deny | ask | deny | deny | deny | allow |
414
-
415
- Do not fan out parallel \`flow_plan_save\`, \`flow_plan_approve\`,
416
- \`flow_run_start\`, \`flow_feature_complete\`, \`flow_feature_reset\`, or
417
- \`flow_session_close\` calls. Runtime locking protects files, but Flow accepts only
418
- one active feature result at a time.
419
-
420
- Workers may read files, inspect docs, run authorized read-only commands, and
421
- summarize evidence. Candidate implementation workers may edit only when the
422
- manager assigned an isolated worktree or exact path ownership that does not
423
- overlap sibling workers or manager edits. Workers must not edit \`.flow/**\`,
424
- must not call state-changing Flow tools, and must not approve work, close
425
- sessions, record Flow validation, or claim validation they did not run. A
426
- worker may report raw validation output it actually ran; the manager decides
427
- whether it is strong enough to record.
428
-
429
- ## Stage 1 — Orient (serial)
430
-
431
- Call \`flow_status\` if a Flow session may already exist. Read enough files,
432
- schemas, docs, tests, commands, or artifacts to identify real slices. Keep the
433
- immediate blocker local: do not delegate the question that determines whether
434
- fan-out is even valid.
435
-
436
- Treat orientation as uncertainty reduction. Resolve environment uncertainty by
437
- inspecting the repo, running cheap commands, or assigning evidence workers; ask
438
- the user only when the remaining specification uncertainty would make a wrong
439
- slice expensive to undo. Do not split a vague goal into workers until the
440
- candidate slices have concrete targets, dependencies, and verification signals.
441
-
442
- ## Stage 2 — Slice
443
-
444
- Split along whichever axis keeps slices independent: modules or path sets,
445
- route or endpoint groups, risk lenses, command surfaces, data ranges, or claim
446
- sets. Each slice needs a one-line scope, expected coverage, and a defined
447
- output the manager can check.
448
-
449
- For implementation slices, also name dependencies and write ownership before
450
- spawning. A real dependency edge means the later slice waits for a verified
451
- handoff or manager synthesis from the earlier slice; a shared file, fixture,
452
- schema, or public contract usually means the work should stay serial unless an
453
- isolated worktree is used. The manifest owns those edges through \`dependsOn\`
454
- and \`writeScope\`.
455
-
456
- ## Stage 3 — Manifest (the pre-fan-out coverage gate)
457
-
458
- Before spawning, write a pass manifest: one row per slice, plus a totals check.
459
- Give the pass a stable id so later handoffs, verifier claims, and completion
460
- payloads can refer to the same work without replaying chat.
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.
461
301
 
462
- | Row id | Slice scope | Expected coverage | Mode | Depends on | Write scope | Verification tier | Handoff ref | Verification status | Synthesis ref |
463
- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
464
- | \`runtime-read\` | \`src/core/**\` plus its tests | 14 files | \`evidence\` | none | none | accept locally | pending | pending | pending |
465
- | \`release-read\` | release contract: CI workflows, \`package.json\`, changelog | 6 files | \`evidence\` | none | none | verify once | pending | pending | pending |
466
-
467
- \`writeScope\` values in runtime accounting are \`none\`, \`manager-serial\`,
468
- \`exact-path\`, \`isolated-worktree\`, or \`mixed\`. Use \`manager-serial\` for a
469
- recorded serial implementation decision, \`exact-path\` for disjoint candidate
470
- edits in one checkout, and \`isolated-worktree\` for candidate work that must be
471
- merged back by the manager.
472
-
473
- - Count the total work items when countable: files, modules, routes, commands,
474
- rows, findings, screenshots, or claims. Confirm slice counts add back to the
475
- total, with no overlaps, gaps, empty slices, or ambiguous shared contracts.
476
- - If the scope cannot be counted, state the completeness rule instead, such as
477
- "all changed files plus callers" or "all public commands plus release docs."
478
- - Assign each slice's verification tier now (see Stage 6). Deciding where a
479
- wrong claim is expensive belongs before handoffs arrive, not after.
480
- - Record dependency edges now. A row may be spawned only after every \`depends on\`
481
- row it names has returned a verified handoff or a manager synthesis that
482
- explicitly settles the dependency.
483
- - Fix the slice map centrally before spawning if the gate does not reconcile.
484
-
485
- The manifest is also the accounting contract for the pass: N rows spawned means
486
- N handoffs collected and checked in Stage 5 before anything is synthesized.
487
-
488
- For implementation decisions, add a manifest row even when no worker is spawned:
489
- \`kind=implementation-decision\`, \`decision=serial\` or \`decision=skipped\`,
490
- \`candidateEligibility\`, \`candidateDecision\`, \`decisionFactors\`,
491
- \`workerCount=0\`, \`writeScope=manager-serial\`, and a concrete \`decisionReason\`.
492
- Use \`decision=serial\` with \`candidateDecision=serial_required\` for ineligible
493
- worker cases; reserve \`decision=skipped\` for eligible candidate work that the
494
- manager chose not to delegate. When an implementation-decision row uses
495
- \`candidateDecision=used\`, it must also record actual candidate execution
496
- evidence: either \`modes=candidate-implementation\`, or \`candidateWorkerCount > 0\`
497
- with \`workerCount\` raised to cover it — a \`workerCount=0\` row cannot carry a
498
- positive \`candidateWorkerCount\`. Neither subtype count may exceed the total:
499
- \`candidateWorkerCount <= workerCount\` and \`verifierWorkerCount <= workerCount\`
500
- (a single worker may fill both roles).
501
- This is how Flow distinguishes deliberate serial work from forgotten candidate
502
- or verifier passes.
503
-
504
- Write the manifest where it survives the pass: the conversation is enough for a
505
- single bounded pass, but when a follow-up pass or a session resume is
506
- plausible, persist it with the synthesis (Stage 7) so the accounting can be
507
- reconstructed.
508
-
509
- ## Stage 4 — Fan out
510
-
511
- Every worker prompt includes:
302
+ ## Candidate judgment
512
303
 
513
- \`\`\`text
514
- Overall goal, context only: <goal>
515
- Mode: evidence | review | validation | audit | verifier | candidate-implementation
516
- Pass id and manifest row id: <stable ids from the manifest>
517
- Your exact slice: <paths, modules, command, claim ids, risk lens, or worktree>
518
- Expected coverage: <count, paths, range, or complete question set>
519
- Dependencies and write scope: <verified dependencies, if any; none | manager-serial | exact-path | isolated-worktree>
520
- Do: <bounded actions>
521
- Do not: call state-changing Flow tools, edit .flow/**, own sibling slices, or make the final Flow verdict.
522
- Return only the Flow handoff in this exact shape:
523
- <matching handoff template copied verbatim from handoff-format.md>
524
- \`\`\`
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.
525
308
 
526
- Hidden workers cannot load skills or read \`handoff-format.md\` themselves. The
527
- manager copies the matching handoff template into every worker prompt; a bare
528
- filename reference is not enough. Workers also cannot read the conversation, so
529
- prompts cite file paths — including any synthesis file from an earlier pass —
530
- instead of restating chat history.
531
-
532
- For research or current-doc slices, require source checks for versioned or
533
- time-sensitive facts. For implementation candidates, remind workers that other
534
- work may be active and that they must not revert unrelated changes.
535
-
536
- Continue non-overlapping manager work while workers run.
537
-
538
- ## Stage 5 — Account
539
-
540
- Check every manifest row off against a returned handoff before synthesis. A
541
- worker that never returns, errors out, returns empty or unstructured output, or
542
- reports \`partial\` or \`blocked\` is a hole in the pass, and synthesizing around it
543
- silently drops a slice.
544
-
545
- For each row, fill in:
546
-
547
- - \`handoffRefs\`: worker ids, handoff file paths, command output artifacts, or
548
- review packet location that the manager can re-open.
549
- - \`verificationStatus\`: \`not-needed\`, \`pending\`, \`passed\`, \`failed\`, \`mixed\`,
550
- or \`downgraded\`.
551
- - \`outcome\`: \`accepted\`, \`modified\`, \`rejected\`, \`partial\`, \`not-covered\`, or
552
- \`superseded\`.
553
- - \`synthesisRef\`: the manager-owned synthesis file or plan field that carries
554
- the accepted result forward.
555
-
556
- Rows with no worker, such as serial or skipped implementation decisions, still
557
- need a row id, decision, reason, and outcome. They are not handoffs, but they
558
- are accounting.
559
-
560
- Worker failure ladder:
561
-
562
- 1. Re-spawn once with a narrower slice and a note about what the first attempt
563
- returned.
564
- 2. If it fails again, cover the slice directly in the manager session.
565
- 3. If it stays blocked, carry the slice into the synthesis explicitly as
566
- not-covered. Never present results as if coverage were complete.
567
-
568
- ## Stage 6 — Verify
569
-
570
- \`Status: success\` only says the worker believes its slice is done. Accept a
571
- handoff only after a cheap manager-side pass:
572
-
573
- - \`Status\` is present and terminal: \`success\`, \`partial\`, or \`blocked\`; empty or
574
- unstructured output fails this check.
575
- - Coverage matches the assigned slice, or skips are explicit.
576
- - Important claims have concrete evidence and confidence tags.
577
- - Cited paths, commands, screenshots, URLs, or metrics resolve.
578
- - The evidence supports the claim, not just the topic.
579
- - Findings stay inside the worker's slice.
580
- - Headline counts can be recounted or traced.
581
- - Dependency claims cite the verified upstream handoff, synthesis, or source
582
- artifact they depend on.
583
- - Candidate implementation claims identify whether they came from exact path
584
- ownership or an isolated worktree, and whether the manager inspected the
585
- resulting patch. Record the manager result as \`accepted\`, \`modified\`, or
586
- \`rejected\` where that is the most precise candidate outcome.
587
- - Contradictions between workers are either resolved or explicitly marked as
588
- contested.
589
-
590
- Demote, drop, re-task, or verify claims that fail this pass.
591
-
592
- ### Verification tiers
593
-
594
- One taxonomy decides how much verification a claim gets: the manifest assigns
595
- a default tier per slice, and this stage applies it per claim. Use the cheapest
596
- check that matches the risk:
597
-
598
- - **Accept locally**: low-risk claims with direct evidence that the manager can
599
- cheaply inspect or recount.
600
- - **Verify once** with \`flow-verifier-worker\`: single-source, surprising,
601
- inferred, low-confidence, citation-heavy, contested, or Flow-payload-bound
602
- claims, including any count, benchmark, command result, or pass/fail claim a
603
- Flow payload will rely on.
604
- - **Verify strongly**: blocking or release-sensitive claims and claims that
605
- affect user data, security, persistence, permissions, public API behavior,
606
- release behavior, or data loss. Use independent verifier checks, manager-run
607
- commands, or direct artifact inspection strong enough to settle the claim.
608
- - **Do not accept**: claims without concrete evidence, claims outside the
609
- assigned slice, claims contradicted by inspected artifacts, or claims where
610
- the cited evidence supports only the topic rather than the assertion.
611
-
612
- Verifier prompts use stable claim ids, one atomic assertion per id, the cited
613
- source or command for each id, and the exact acceptance question. Do not
614
- include the generator's reasoning unless that reasoning is the thing being
615
- verified, do not say which worker produced the claim, and do not ask a
616
- verifier to redesign the work or review the whole feature.
617
-
618
- ## Stage 7 — Synthesize
619
-
620
- Apply the manager synthesis barrier before presenting or recording anything:
621
-
622
- - Preserve confidence: verified, single-sourced, inferred, and unresolved claims
623
- stay distinct when it matters.
624
- - When workers disagree, inspect the cited artifact or rerun the cited command
625
- instead of arbitrating from summaries. Do not average conflicting claims.
626
- - Run the strongest practical local check for the deliverable.
627
- - For broad implementation sessions, use one verifier worker after manager
628
- synthesis when the risk is medium or high. Ask it whether every planned
629
- feature landed, worker validation claims are supported, final code matches
630
- the audit finding, generated bindings/docs/version metadata stayed
631
- consistent, and changed files have plausible test coverage.
632
- - Re-read critical files or docs that will be cited in the final decision.
633
- - Move only distilled, evidence-backed claims forward; raw handoffs remain
634
- candidate evidence, not a plan, review, completion payload, or final answer.
635
- - Record gaps honestly instead of converting missing evidence into success
636
- language.
637
-
638
- Where accepted evidence goes:
639
-
640
- - Planning evidence becomes \`requirements\`, \`decisions\`, feature \`targets\`,
641
- feature \`validation\`, or plan notes — only when the source and scope are
642
- clear. Unverified broad findings become a review-first feature, not a fix
643
- plan.
644
- - Validation evidence may become \`validationRun\` only when the worker was
645
- explicitly authorized to run the command and reported the exact command,
646
- status, and raw outcome summary.
647
- - Review evidence informs \`featureReviewDepth\` plus \`featureReview\`, or \`finalReview\`, but the manager
648
- owns the pass/fail verdict and must resolve blockers, contradictions, and
649
- coverage gaps before returning the payload.
650
- - Audit evidence becomes findings only after refutation; blocking findings need
651
- guards checked, deployment context, and evidence that the current code
652
- exhibits the behavior.
653
- - Candidate patches are not Flow evidence until the manager inspects, merges or
654
- rejects them, and validates the main Flow-managed workspace.
655
-
656
- When completing a feature, include compact pass accounting in
657
- \`flow_feature_complete.orchestrationPasses\` for any pass or implementation
658
- decision that materially affected the feature:
309
+ Stay serial when any of these apply:
659
310
 
660
- \`\`\`json
661
- {
662
- "id": "feature-id-implementation-decision",
663
- "kind": "implementation-decision",
664
- "decision": "serial",
665
- "decisionReason": "Shared schema and tests made exact path ownership unsafe.",
666
- "candidateEligibility": "not_eligible",
667
- "candidateDecision": "serial_required",
668
- "decisionFactors": ["shared_state", "overlapping_files"],
669
- "modes": [],
670
- "workerCount": 0,
671
- "candidateWorkerCount": 0,
672
- "verifierWorkerCount": 0,
673
- "sliceIds": ["manager-implementation"],
674
- "dependsOn": [],
675
- "writeScope": "manager-serial",
676
- "handoffRefs": [],
677
- "verificationStatus": "not-needed",
678
- "outcome": "accepted",
679
- "synthesisRef": "/tmp/flow-pass-synthesis.md"
680
- }
681
- \`\`\`
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.
682
319
 
683
- For candidate and verifier passes, use \`kind: "candidate"\` or
684
- \`kind: "verification"\`, list the worker modes used, worker counts, slice ids,
685
- handoff refs, dependency ids, verification status, and whether the manager
686
- accepted, rejected, downgraded, or superseded the pass. The runtime aggregates
687
- these compact records into \`session.budget.orchestration\` and stores them on
688
- the feature history entry. Do not store full handoffs, long logs, or scratch
689
- tables in \`.flow/session.json\`.
690
-
691
- Status accounting distinguishes three cases: \`candidateDecision: "used"\` means
692
- candidate execution evidence was recorded, \`candidateDecision:
693
- "serial_required"\` means workers were not safe or useful, and
694
- \`candidateEligibility: "eligible"\` plus \`candidateDecision: "skipped"\`
695
- increments \`skippedCandidateDecisionCount\`. These candidate decision counters
696
- come from \`kind: "implementation-decision"\` records; \`skipped\` and
697
- \`serial_required\` are not valid on discovery, audit, review, validation,
698
- verification, or candidate pass rows. \`candidatePassCount\`
699
- counts actual candidate pass or worker evidence (\`kind: "candidate"\`,
700
- \`modes\` includes \`candidate-implementation\`, or \`candidateWorkerCount > 0\`) —
701
- a candidate-shaped decision label without that evidence is rejected, so decision
702
- labels alone never count. \`verifierPassCount\` similarly counts
703
- actual verifier pass or worker evidence (\`kind: "verification"\`, \`modes\`
704
- includes \`verifier\`, or \`verifierWorkerCount > 0\`).
705
-
706
- Persist the manifest and the synthesis when another pass may follow or the
707
- session is long enough to be compacted or resumed: write the distilled result —
708
- the accounted manifest, accepted claims with evidence and confidence, dropped
709
- claims with one-line reasons, and open gaps — into plan prose fields or a
710
- manager-owned scratch file outside both \`.flow/**\` and the repository worktree,
711
- such as a file in the OS temporary directory. The runtime owns the \`.flow/**\`
712
- layout, and scratch files left in the worktree end up staged or reviewed as if
713
- they were project changes. Follow-up worker prompts cite that path; files are
714
- the only shared memory between passes.
715
-
716
- ## Stage 8 — Extend or stop
717
-
718
- Stop after a pass when:
719
-
720
- - the manifest's coverage rule is satisfied and every row is accounted for.
721
- - accepted claims are evidenced, scoped, and confidence-labeled.
722
- - material single-source, contested, high-stakes, or payload-bound claims have
723
- been verified or downgraded.
724
- - every dependency edge named in the manifest has either a verified upstream
725
- result or an explicit not-covered outcome.
726
- - implementation pass decisions are recorded, including skipped candidate
727
- workers, candidate eligibility, candidate decision, structured factors, and
728
- the reason eligible workers were skipped.
729
- - remaining gaps are explicit and do not block the Flow artifact being produced.
730
-
731
- Start a bounded follow-up pass only when:
732
-
733
- - the original slice map missed material scope.
734
- - workers disagree on a claim that affects the Flow decision.
735
- - a high-stakes or payload-bound claim needs verification.
736
- - a dependency has just become verified and now unlocks a dependent slice.
737
- - a candidate patch was rejected and an isolated alternative is still cheaper
738
- than serial repair.
739
- - a first pass exposes a narrower implementation or validation slice worth
740
- isolating.
741
-
742
- Run at most one routine follow-up pass. Extra passes need an explicit manager
743
- reason, such as a high-stakes verifier check or a newly discovered bounded
744
- slice. Do not recurse by default: if a worker says it needs another worker, the
745
- manager decides whether that is a follow-up pass and writes the next bounded
746
- prompt, starting again from the manifest.
320
+ Do not fan out to keep workers busy. Every worker must reduce a named
321
+ uncertainty.
747
322
 
748
323
  ## Worker count defaults
749
324
 
750
- Use caps, not a fixed feature limit:
325
+ Use bounded caps rather than worker-count targets:
751
326
 
752
- - small implementation: zero or one worker.
753
- - medium independent implementation: two workers.
754
- - broad audit: three to five workers.
755
- - broad implementation: two to four candidate workers, only for
756
- non-overlapping slices.
757
- - final verifier: one worker when risk is medium or high.
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.
758
333
 
759
- The target is not "more workers." The target is explicit accounting: Flow must
760
- justify not using workers when the work was eligible.
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 |
367
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
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 |
370
+
371
+ Use runtime \`writeScope\` values exactly: \`none\`, \`manager-serial\`, \`exact-path\`,
372
+ \`isolated-worktree\`, or \`mixed\`.
373
+
374
+ Before launch:
375
+
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
389
+
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.
761
449
  `;
762
450
 
763
451
  // skills/flow/references/parallel-pass-example.md
764
452
  var parallel_pass_example_default = `# Parallel pass example
765
453
 
766
- Use this example after \`parallel-orchestration.md\` when a broad Flow task needs a
767
- concrete pass shape. The project below is illustrative; derive your own slices
768
- 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.
769
457
 
770
458
  Goal: review whether a web app's API error handling is consistent before
771
459
  planning a refactor.
@@ -851,18 +539,21 @@ keeps only verified or clearly labeled claims, and records one artifact such as
851
539
  a plan decision, review payload, or docs patch. Raw handoffs and unverified
852
540
  suggestions do not move into the next pass or user-facing answer.
853
541
 
854
- 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
855
543
  \`flow_feature_complete.orchestrationPasses\`, such as pass id
856
544
  \`api-error-handling-read\`, kind \`review\`, worker count \`3\`, slice ids
857
545
  \`routes-auth\`, \`routes-billing\`, and \`routes-admin\`, verification status
858
546
  \`mixed\` or \`passed\`, and a synthesis ref pointing to the manager-owned summary.
859
547
  `;
860
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
+
861
552
  // skills/flow/references/recovery-playbook.md
862
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';
863
554
 
864
555
  // skills/flow/SKILL.md
865
- 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";
866
557
 
867
558
  // skills/flow-commit/SKILL.md
868
559
  var SKILL_default2 = `---
@@ -1111,9 +802,13 @@ var parallel_discovery_default = `# Parallel discovery
1111
802
 
1112
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.
1113
804
 
1114
- For broad parallel passes, also load \`../../flow/references/parallel-orchestration.md\`.
1115
- Use its pass manifest as the pre-fan-out coverage gate and
1116
- \`../../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.
1117
812
 
1118
813
  ## Good slices
1119
814
 
@@ -1137,8 +832,8 @@ config, or release surfaces in the pass manifest.
1137
832
 
1138
833
  ## Manifest and prompts
1139
834
 
1140
- Write the pass manifest and the worker prompts exactly as Stages 3 and 4 of
1141
- \`../../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
1142
837
  per slice with expected coverage, dependencies, write scope, and a verification
1143
838
  tier, and a self-contained prompt per worker naming the mode (usually
1144
839
  \`evidence\`), the exact slice, and the expected coverage. Discovery-specific
@@ -1165,7 +860,7 @@ Convert only evidence-backed work into plan fields:
1165
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.
1166
861
 
1167
862
  Apply the manager synthesis barrier from
1168
- \`../../flow/references/parallel-orchestration.md\`: only distilled,
863
+ \`../../flow/references/parallel-synthesis.md\`: only distilled,
1169
864
  evidence-backed claims become plan fields.
1170
865
  `;
1171
866
 
@@ -1174,7 +869,7 @@ var plan_quality_checklist_default = `# Plan quality checklist
1174
869
 
1175
870
  Use this checklist before \`flow_plan_save\` and again before approval if the plan
1176
871
  changed during discussion. The goal is not a long planning artifact; it is a
1177
- compact plan another agent can execute without rediscovering the work.
872
+ concise plan another agent can execute without rediscovering the work.
1178
873
 
1179
874
  ## Must pass
1180
875
 
@@ -1477,14 +1172,19 @@ description: "Use when Flow work needs planning before implementation: a new goa
1477
1172
 
1478
1173
  # Flow Plan
1479
1174
 
1480
- 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
1481
1178
 
1482
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.
1483
1180
 
1484
1181
  ## Inspect first
1485
1182
 
1486
1183
  - Read the files, docs, tests, package scripts, and local conventions that determine the work.
1487
- - 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.
1488
1188
  - Helper rule: when a named helper skill is unavailable, record a planning gap
1489
1189
  and keep the corresponding claims conservative instead of simulating its
1490
1190
  checks.
@@ -1588,6 +1288,65 @@ See \`references/planning-examples.md\` for payload examples and decomposition
1588
1288
  anti-patterns.
1589
1289
  `;
1590
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
+
1591
1350
  // skills/flow-review/references/review-rubric.md
1592
1351
  var review_rubric_default = `# Review rubric
1593
1352
 
@@ -1740,13 +1499,15 @@ These instructions run in two contexts, and only one of them can load helpers:
1740
1499
  subagents. In this context, skip every "load" and "fan out" instruction
1741
1500
  below: judge from the diff, the plan fields, and the recorded validation
1742
1501
  evidence, and record a coverage gap for any judgment that would have needed
1743
- 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\`.
1744
1505
 
1745
1506
  ## Start
1746
1507
 
1747
1508
  - Call \`flow_status\` when available.
1748
1509
  - Identify whether this is a feature review or final review.
1749
- - 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
1750
1511
  packet should name the active feature, minimum \`reviewDepth\`, changed files,
1751
1512
  diff summary, validation evidence, and targeted paths or risk lenses. If the
1752
1513
  packet is missing important scope or evidence, record that as a coverage gap
@@ -1807,14 +1568,15 @@ Use \`status: "failed"\` when any blocking finding remains. Advisory findings ma
1807
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.
1808
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.
1809
1570
  - Audit reports: use \`../flow-run/references/audit-rubric.md\`; findings must survive refutation before they can drive fix features.
1810
- - Large reviews (manager context only): use
1571
+ - Large reviews (manager context only): start with
1811
1572
  \`../flow/references/parallel-orchestration.md\` for read-only slices by
1812
- changed-file group, risk lens, or validation surface. Use the named review,
1813
- audit, evidence, or validation agents from that reference instead of generic
1814
- subagents. Write its pass manifest before fan-out and apply its Stage 6
1815
- handoff acceptance and verification tiers; only the manager
1816
- returns the final \`featureReview\` or \`finalReview\` payload. If that reference
1817
- 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
1818
1580
  command that does not include it), review serially and record the skipped
1819
1581
  fan-out as a coverage gap instead of improvising worker contracts. The hidden
1820
1582
  reviewer cannot spawn workers; it reviews its assigned scope directly and
@@ -1842,7 +1604,7 @@ A finding that survives this pass is worth reporting. A finding you did not try
1842
1604
 
1843
1605
  ## Parallel audit slices
1844
1606
 
1845
- For broad audits, use \`../../flow/references/parallel-orchestration.md\` to split
1607
+ For broad audits, start with \`../../flow/references/parallel-orchestration.md\` to split
1846
1608
  read-only slices by module, data flow, or risk lens. Workers surface candidates;
1847
1609
  the audit author owns the report. Apply its handoff format and verification
1848
1610
  gates. Before blocking severity, dedupe, trace guards, fill cross-layer checks,
@@ -1898,7 +1660,9 @@ Use the strongest practical tier. For risky work, combine tiers.
1898
1660
  - Each \`validationRun\` entry has \`command\`, \`status\`, and \`summary\`.
1899
1661
  - Completion accepts only passing entries. Failed or skipped checks belong in the summary/notes and must be resolved or explained as blockers.
1900
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.
1901
- - 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.
1902
1666
  - Include scope in the summary: what behavior, files, routes, or states the check covered.
1903
1667
  - UI work should include browser or screenshot evidence when the app can run locally.
1904
1668
  - Cleanup/refactor work should show behavior preservation, not only formatting success.
@@ -1940,7 +1704,170 @@ Never trim failing output, relabel a failed command as passed, or use "not run"
1940
1704
  `;
1941
1705
 
1942
1706
  // skills/flow-run/SKILL.md
1943
- 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- Classify `candidateEligibility` (`eligible`, `not_eligible`, or `unknown`)\n and `candidateDecision` (`used`, `skipped`, or `serial_required`) separately;\n implementation decisions must use `eligible` or `not_eligible` and always set\n an explicit `decision`. The valid pairings and the candidate execution\n evidence rules are in `../flow/references/parallel-orchestration.md` under\n "Implementation pass decision" — follow that reference when composing the\n record.\n- Record structured `decisionFactors`: `shared_state`, `overlapping_files`,\n `small_slice`, `needs_manager_judgment`, `independent_surface`, and\n `validation_available`.\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 or rejects, validates, and records Flow state serially. Record whether a\ncandidate was `accepted`, `modified`, or `rejected`.\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 "candidateEligibility": "not_eligible",\n "candidateDecision": "serial_required",\n "decisionFactors": ["shared_state", "overlapping_files"],\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
+ `;
1944
1871
 
1945
1872
  // skills/flow-test/SKILL.md
1946
1873
  var SKILL_default7 = `---
@@ -2226,6 +2153,22 @@ var FLOW_SKILL_DEFINITIONS = [
2226
2153
  relativePath: "references/parallel-orchestration.md",
2227
2154
  content: parallel_orchestration_default
2228
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
+ },
2229
2172
  {
2230
2173
  relativePath: "references/parallel-pass-example.md",
2231
2174
  content: parallel_pass_example_default
@@ -2276,6 +2219,10 @@ var FLOW_SKILL_DEFINITIONS = [
2276
2219
  name: "flow-review",
2277
2220
  files: [
2278
2221
  { relativePath: "SKILL.md", content: SKILL_default5 },
2222
+ {
2223
+ relativePath: "references/hidden-reviewer-contract.md",
2224
+ content: hidden_reviewer_contract_default
2225
+ },
2279
2226
  {
2280
2227
  relativePath: "references/review-rubric.md",
2281
2228
  content: review_rubric_default
@@ -2864,4 +2811,4 @@ main(process.argv).catch((error) => {
2864
2811
  process.exitCode = 1;
2865
2812
  });
2866
2813
 
2867
- //# debugId=6088D1387043CD7A64756E2164756E21
2814
+ //# debugId=62569BF7C9EAD96D64756E2164756E21