opencode-plugin-flow 4.3.8 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,14 +2,18 @@
2
2
  var handoff_format_default = `# Flow worker handoff contract
3
3
 
4
4
  Flow managers merge only the worker's final response. Treat that response as the
5
- worker report of record: it must include the assigned scope, what was actually
6
- covered, the evidence for each useful claim, and the remaining gaps. End worker
7
- prompts with "Return only this Flow handoff."
8
-
9
- Empty or unstructured worker output is a failed handoff. If the worker cannot
10
- cover the assigned scope, verify the evidence, or satisfy the handoff shape, it
11
- must return \`Status: blocked\` with the missing elements, and the manager must
12
- not treat the slice as complete.
5
+ worker report of record. End worker prompts with "Return only this Flow
6
+ handoff."
7
+
8
+ <!-- flow-prompt:worker-integrity:start -->
9
+ Cite or drop every claim. Label single-source, inferred, and unsettled claims.
10
+ When usable evidence exists but named expected coverage could not be checked,
11
+ return the required handoff with \`## Status\` set to \`partial\` and enumerate the
12
+ unchecked items and reasons. If the assignment or required shape is missing,
13
+ or no usable coverage can be produced, return the required handoff with
14
+ \`## Status\` set to \`blocked\` and name the missing elements. Empty or
15
+ unstructured output is a failed handoff.
16
+ <!-- flow-prompt:worker-integrity:end -->
13
17
 
14
18
  Sections: evidence/review/validation/audit worker report, verifier worker report,
15
19
  and candidate implementation worker report.
@@ -25,149 +29,144 @@ Status meanings:
25
29
 
26
30
  ## Evidence, review, validation, or audit worker report
27
31
 
28
- Use this for \`flow-evidence-worker\`, \`flow-reviewer\`,
29
- \`flow-validation-worker\`, and \`flow-audit-worker\`.
32
+ Use the one role-specific block that matches the assigned worker.
30
33
 
31
- \`\`\`markdown
34
+ <!-- flow-prompt:handoff-evidence:start -->
35
+ Return only this Flow handoff:
32
36
  ## Status
33
37
  success | partial | blocked
34
-
35
38
  ## Scope
36
- <owned slice: path set, module, command, risk lens, route, data range, or question set>
37
-
39
+ assigned slice
38
40
  ## Pass metadata
39
- - Pass id: <stable pass id from the manifest>
40
- - Manifest row id: <row id from the manifest>
41
- - Depends on: <upstream row ids or "none">
42
- - Write scope: <none | manager-serial | exact-path | isolated-worktree | mixed>
43
-
41
+ pass id, manifest row id, dependencies, write scope
44
42
  ## Coverage
45
- - Expected: <files, ranges, questions, commands, or findings assigned>
46
- - Checked: <actual coverage, for example "12/12 files" or "command not run">
47
- - Not checked: <items skipped with reason, or "none">
48
-
43
+ expected, checked, not checked with reasons
49
44
  ## Findings or facts
50
- - [high|med|low] <claim>; evidence: <file:line | command summary | screenshot path | URL | metric>; corroboration: <N sources or "single source">
51
- - [high|med|low] <claim>; evidence: <...>; corroboration: <...>
52
-
45
+ confidence, atomic claim, citation, corroboration
53
46
  ## Sources
54
- - <paths read, commands run, docs fetched, data ranges covered, screenshots inspected>
55
-
47
+ paths, commands, documents, screenshots, or data ranges inspected
56
48
  ## Confidence and verification
57
- - Verified: <claims directly re-run, recounted, traced, or cross-checked>
58
- - Single-source: <claims with exactly one supporting source>
59
- - Inferred: <claims derived from surrounding evidence rather than directly observed>
60
- - Unsettled: <claims, sources, or citations that could not be resolved>
61
- - Falsifier or missing input: <what would overturn or materially change the result>
62
-
49
+ verified, single-source, inferred, unsettled, falsifier
63
50
  ## Open questions / gaps
64
- - <ambiguity, missing source, contradiction, skipped item, or out-of-scope dependency>
65
-
66
51
  ## Manager follow-ups
67
- - <concrete next tasks, verifier claims, validation commands, or Flow plan targets>
68
- \`\`\`
52
+ <!-- flow-prompt:handoff-evidence:end -->
69
53
 
70
- Validation workers must include exact command names and raw outcome summaries
71
- for commands they actually ran. Audit workers must include guards checked for
72
- any blocking-severity candidate. Review workers must separate blocking findings
73
- from advisory notes. In the shared \`Findings or facts\` section, review workers
74
- should prefix review items with \`blocking:\` or \`advisory:\` before the claim.
54
+ <!-- flow-prompt:handoff-validation:start -->
55
+ Return only this Flow handoff:
56
+ ## Status
57
+ success | partial | blocked
58
+ ## Scope
59
+ assigned checks or validation question
60
+ ## Pass metadata
61
+ pass id, manifest row id, dependencies, write scope
62
+ ## Coverage
63
+ expected, checked, not checked with reasons
64
+ ## Commands and outcomes
65
+ exact command, status, raw outcome summary, behavior covered
66
+ ## Confidence and verification
67
+ verified, single-source, inferred, unsettled, falsifier
68
+ ## Open questions / gaps
69
+ ## Manager follow-ups
70
+ <!-- flow-prompt:handoff-validation:end -->
75
71
 
76
- Example evidence quality:
72
+ <!-- flow-prompt:handoff-audit:start -->
73
+ Return only this Flow handoff:
74
+ ## Status
75
+ success | partial | blocked
76
+ ## Scope
77
+ assigned paths, risks, or candidate findings
78
+ ## Pass metadata
79
+ pass id, manifest row id, dependencies, write scope
80
+ ## Coverage
81
+ expected, checked, not checked with reasons
82
+ ## Findings
83
+ severity, atomic claim, citation, corroboration, guards checked, refutation result
84
+ ## Sources
85
+ ## Confidence and verification
86
+ verified, single-source, inferred, unsettled, falsifier
87
+ ## Open questions / gaps
88
+ ## Manager follow-ups
89
+ <!-- flow-prompt:handoff-audit:end -->
77
90
 
78
- - Good fact: \`[high] public Flow command prompts include bundled instructions;
79
- evidence: src/config-shared.ts:135; corroboration: single source\`.
80
- - Weak fact: \`[high] prompts look self-contained; evidence: read the config\`.
81
- - Good validation: \`bun test tests/distribution-and-surface.test.ts\`, status
82
- passed, summary \`surface tests passed and covered bundled command prompts\`.
83
- - Weak validation: \`tests pass\`, with no command, status, or raw outcome.
91
+ <!-- flow-prompt:handoff-review-slice:start -->
92
+ For an assigned review slice, return only this Flow handoff:
93
+ ## Status
94
+ success | partial | blocked
95
+ ## Scope
96
+ assigned files, risk lens, or validation surface
97
+ ## Pass metadata
98
+ pass id, manifest row id, dependencies, write scope
99
+ ## Coverage
100
+ expected, checked, not checked with reasons
101
+ ## Findings
102
+ prefix each \`blocking:\` or \`advisory:\`, then severity, claim, citation, and corroboration
103
+ ## Sources
104
+ ## Confidence and verification
105
+ verified, single-source, inferred, unsettled, falsifier
106
+ ## Open questions / gaps
107
+ ## Manager follow-ups
108
+ <!-- flow-prompt:handoff-review-slice:end -->
84
109
 
85
110
  ## Verifier worker report
86
111
 
87
- Use this for \`flow-verifier-worker\`. Give it atomic claims and the cited sources
88
- or commands. Do not include the generator's reasoning unless that reasoning is
89
- the thing being verified, and do not say which worker produced the claim.
112
+ Use this for \`flow-verifier-worker\`.
90
113
 
91
- \`\`\`markdown
114
+ <!-- flow-prompt:handoff-verifier:start -->
115
+ Return only this Flow handoff:
92
116
  ## Status
93
117
  success | partial | blocked
94
-
95
118
  ## Scope
96
- <claim ids, sources or commands checked, and the acceptance question>
97
-
119
+ atomic claim ids, sources or commands checked, acceptance question
98
120
  ## Pass metadata
99
- - Pass id: <stable pass id from the manifest>
100
- - Manifest row id: <row id from the manifest>
101
- - Depends on: <upstream row ids or "none">
102
-
121
+ pass id, manifest row id, dependencies
103
122
  ## Verdict per claim
104
- - <claim id>: verdict=<supported | partly-supported | unsupported | source-not-found>
105
- - claim: <claim text>
106
- - evidence: <supporting snippet, path plus line, measured value, command result, or "none">
107
- - source resolution: <URL, path, or command plus whether it resolved>
108
- - confidence level: high | med | low
109
- - recommended action: <keep, narrow, rewrite, or remove>
110
-
123
+ supported | partly-supported | unsupported | source-not-found; include claim, resolved evidence, confidence, recommended action
111
124
  ## Overall
112
- <accept | revise | reject> because <brief reason>
113
-
125
+ accept | revise | reject with reason
114
126
  ## Gaps
115
- - <unavailable source, ambiguous claim wording, missing oracle, or check not run>
116
-
117
127
  ## Manager follow-ups
118
- - <narrow recheck, plan adjustment, review finding, or none>
119
- \`\`\`
128
+ <!-- flow-prompt:handoff-verifier:end -->
120
129
 
121
130
  ## Candidate implementation worker report
122
131
 
123
- Use this only with explicit user authorization, in an isolated worktree or an
124
- exact non-overlapping path-owned slice assigned by the manager.
132
+ Use this only with explicit user authorization and isolated or exact-path
133
+ ownership.
125
134
 
126
- \`\`\`markdown
135
+ <!-- flow-prompt:handoff-candidate:start -->
136
+ Return only this Flow handoff:
127
137
  ## Status
128
138
  success | partial | blocked
129
-
130
139
  ## Scope
131
- <isolated worktree or exact path-owned slice>
132
-
140
+ isolated worktree or exact path-owned slice
133
141
  ## Pass metadata
134
- - Pass id: <stable pass id from the manifest>
135
- - Manifest row id: <row id from the manifest>
136
- - Depends on: <upstream row ids or "none">
137
- - Write scope: <exact-path | isolated-worktree>
138
-
142
+ pass id, manifest row id, dependencies, exact-path | isolated-worktree
139
143
  ## Changed or proposed patch
140
- - <path>: <what changed and why>
141
-
144
+ paths, change, reason
142
145
  ## Coverage
143
- - Assigned: <owned files/modules>
144
- - Touched: <files changed or proposed>
145
- - Skipped: <anything assigned but not changed and why, or "none">
146
-
146
+ assigned, touched, skipped with reasons
147
147
  ## Verification
148
- live-verified | test-verified | type-check-only | not-verified
149
- - <command, observed outcome, pass/fail counts, or manual check>
150
-
148
+ level, exact command or check, observed outcome
151
149
  ## Confidence and risk
152
- - Checked directly: <behavior, files, or commands verified by the worker>
153
- - Still open: <tests, review paths, or integration points the manager must cover>
154
- - Risk: low | medium | high -- <why>
155
-
150
+ directly checked, still open, risk with reason
156
151
  ## Merge notes
157
- - <conflicts, nearby user changes, assumptions, or deviations>
158
-
152
+ conflicts, user changes, assumptions, deviations
159
153
  ## Manager follow-ups
160
- - <merge, reject, rerun check, verifier pass, or replan task>
161
- \`\`\`
154
+ <!-- flow-prompt:handoff-candidate:end -->
162
155
 
163
156
  The manager must inspect and validate any candidate patch before recording Flow
164
157
  completion.
165
158
 
166
159
  ## Manager pass accounting record
167
160
 
168
- The manager, not the worker, may carry compact records into
161
+ The manager, not the worker, may carry bounded records into
169
162
  \`flow_feature_complete.orchestrationPasses\`. Use one record per material pass or
170
163
  implementation decision; keep handoffs and long artifacts outside \`.flow/**\`.
164
+ The candidate accounting rules — which \`candidateEligibility\`,
165
+ \`candidateDecision\`, and \`decision\` combinations validate, and what counts as
166
+ candidate execution evidence — live in
167
+ [parallel-decision.md](parallel-decision.md) under "Implementation pass
168
+ decision"; note \`decision: "parallel"\` is not valid on
169
+ \`implementation-decision\` records.
171
170
 
172
171
  \`\`\`json
173
172
  {
@@ -175,6 +174,16 @@ implementation decision; keep handoffs and long artifacts outside \`.flow/**\`.
175
174
  "kind": "discovery | audit | review | validation | verification | candidate | implementation-decision",
176
175
  "decision": "serial | parallel | candidate-exact-path | candidate-worktree | tournament | skipped",
177
176
  "decisionReason": "why this pass shape was chosen",
177
+ "candidateEligibility": "eligible | not_eligible | unknown",
178
+ "candidateDecision": "used | skipped | serial_required",
179
+ "decisionFactors": [
180
+ "shared_state",
181
+ "overlapping_files",
182
+ "small_slice",
183
+ "needs_manager_judgment",
184
+ "independent_surface",
185
+ "validation_available"
186
+ ],
178
187
  "modes": ["evidence"],
179
188
  "workerCount": 1,
180
189
  "candidateWorkerCount": 0,
@@ -184,449 +193,258 @@ implementation decision; keep handoffs and long artifacts outside \`.flow/**\`.
184
193
  "writeScope": "none | manager-serial | exact-path | isolated-worktree | mixed",
185
194
  "handoffRefs": ["/tmp/flow-handoff.md"],
186
195
  "verificationStatus": "not-needed | pending | passed | failed | mixed | downgraded",
187
- "outcome": "accepted | rejected | partial | not-covered | superseded",
196
+ "outcome": "accepted | modified | rejected | partial | not-covered | superseded",
188
197
  "synthesisRef": "/tmp/flow-synthesis.md"
189
198
  }
190
199
  \`\`\`
191
200
  `;
192
201
 
193
- // skills/flow/references/parallel-orchestration.md
194
- var parallel_orchestration_default = `# Parallel orchestration
195
-
196
- Use fan-out when Flow work is broad enough that independent workers can gather
197
- evidence faster than one linear pass. The manager still owns the Flow session:
198
- only the manager calls state-changing Flow tools, approves plans, completes
199
- features, records reviews, or closes sessions.
202
+ // skills/flow/references/parallel-decision.md
203
+ var parallel_decision_default = `# Parallel pass decisions
200
204
 
201
- Every parallel pass runs the same loop:
205
+ Read this reference after serial orientation and before creating a pass
206
+ manifest. It decides whether fan-out is worth its coordination cost and records
207
+ why implementation stays serial or uses candidate workers.
202
208
 
203
- **orient slice → manifest → fan out → account → verify → synthesize →
204
- extend or stop.**
209
+ <!-- flow-prompt:manager-parallel-core:start -->
210
+ ## Conditional parallel pass
205
211
 
206
- This file is the whole playbook; read it once and run the pass. Two companions
207
- stay separate:
212
+ Use a parallel pass only when independent coverage is worth its coordination
213
+ cost. Orient serially first. Before fan-out record a stable pass id, purpose,
214
+ bounded worker count, exact non-overlapping slices, expected coverage, named
215
+ Flow worker roles, dependencies, write scope, handoff kind, verification plan,
216
+ and stop condition.
208
217
 
209
- - \`handoff-format.md\` holds the worker response templates. The manager pastes
210
- the matching template verbatim into every worker prompt.
211
- - \`parallel-pass-example.md\` walks one concrete end-to-end pass (synced with
212
- the \`flow\` skill; not bundled into commands).
218
+ Use \`flow-evidence-worker\` for discovery, \`flow-validation-worker\` for commands,
219
+ \`flow-audit-worker\` for adversarial findings, \`flow-verifier-worker\` for
220
+ high-impact claim checks, and \`flow-reviewer\` for independent review. Account
221
+ for every manifest row. A missing, empty, malformed, partial, or blocked
222
+ handoff is a coverage gap, not success. Verify high-impact or single-source
223
+ claims, then let only the manager synthesize the result and mutate Flow state.
224
+ <!-- flow-prompt:manager-parallel-core:end -->
213
225
 
214
226
  ## Choose a pass
215
227
 
216
- | Situation | Flow pass | Output the manager may synthesize |
228
+ | Situation | Flow pass | Manager-owned result |
217
229
  | --- | --- | --- |
218
- | Repo shape is unclear before planning | Discovery pass | Requirements, decisions, targets, validation entries, or a review-first feature |
219
- | A broad finding set needs refutation | Audit pass | Surviving findings with guards checked and gaps named |
220
- | 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 |
221
- | Test strategy or route coverage is unclear | Validation pass | Candidate commands or authorized raw command evidence |
222
- | A claim is single-source, surprising, high-stakes, or payload-bound | Verification pass | Per-claim keep, narrow, rewrite, or remove decisions |
223
- | Multiple implementation paths are plausible | Candidate pass | Candidate patches inspected and validated by the manager before use |
224
-
225
- Pass notes:
226
-
227
- - **Discovery**: workers read specific modules, routes, docs, commands, or risk
228
- lenses; only evidenced claims become plan fields.
229
- - **Audit**: workers actively look for guards, lifecycle resets, deployment
230
- constraints, and counterexamples before reporting a finding. A finding
231
- without refutation work stays advisory or becomes a follow-up question.
232
- - **Review**: workers separate blocking findings from advisory notes; the
233
- manager resolves conflicts and returns one review payload.
234
- - **Validation**: workers run only manager-authorized commands and report the
235
- exact command, status, and raw outcome summary.
236
- - **Verification**: verifiers judge atomic claims against cited sources or
237
- commands; do not ask a verifier to redesign the work or review the whole
238
- feature.
239
- - **Candidate**: only with explicit user authorization plus isolated worktrees
240
- or exact non-overlapping path ownership. Patches stay proposals until the
241
- manager inspects, merges or rejects, and validates.
230
+ | Repo shape is unclear before planning | Discovery | Evidenced requirements, decisions, targets, validation, or a review-first feature |
231
+ | A broad finding set needs refutation | Audit | Findings that survive guard and counterexample checks |
232
+ | Changed files or risk lenses exceed one review pass | Review | One feature review or final review payload |
233
+ | Test strategy or route coverage is unclear | Validation | Candidate commands or authorized raw command evidence |
234
+ | A claim is surprising, high-stakes, single-source, or payload-bound | Verification | Per-claim keep, narrow, rewrite, or remove decisions |
235
+ | Multiple independent implementation paths are plausible | Candidate | Inspected candidate patches, never direct Flow completion |
236
+
237
+ Discovery, audit, review, validation, and verification passes are read-only.
238
+ Validation workers run only manager-authorized commands. Verification workers
239
+ judge atomic claims rather than redesigning the work. Candidate passes require
240
+ explicit user authorization plus an isolated worktree or exact non-overlapping
241
+ path ownership; patches remain proposals until manager inspection and
242
+ validation.
242
243
 
243
244
  ## Implementation pass decision
244
245
 
245
- Before implementing a broad, risky, or multi-target feature, record one manager
246
- decision. This is required even when the answer is "stay serial"; the point is
247
- to make the skipped parallelism visible instead of relying on memory.
248
-
249
- Use one of these decisions:
250
-
251
- - \`serial\`: the manager implements directly because slices overlap, the next
252
- edit depends on one shared contract, or prompt/merge overhead would exceed the
253
- value.
254
- - \`candidate-exact-path\`: one or more candidate workers may edit exact
255
- non-overlapping paths or modules named by the manager.
256
- - \`candidate-worktree\`: one or more candidate workers may edit in isolated
257
- worktrees, then the manager inspects and merges or rejects.
258
- - \`tournament\`: several isolated candidate implementations compete for the same
259
- outcome; the manager filters by tests, review, and source inspection before
260
- accepting one.
261
- - \`skipped\`: candidate workers were considered but rejected; include the reason,
262
- such as shared fixtures, shared API contracts, unclear ownership, or no user
263
- authorization for worker edits.
264
-
265
- Record the decision in the pass manifest with a stable pass id,
266
- \`decisionReason\`, \`writeScope\`, expected verification, and where any handoff or
267
- synthesis artifact will live. If the feature completes, include the compact
268
- record in the \`orchestrationPasses\` array of the \`flow_feature_complete\`
269
- payload. The runtime stores only compact accounting; full worker handoffs stay
270
- in manager-owned scratch files or the conversation.
271
-
272
- ## When to stay serial
273
-
274
- - One file, command, or design question determines the next step.
275
- - Slices would share the same contracts, fixtures, or edit targets.
276
- - The manager can inspect the full scope faster than writing and checking
277
- worker prompts.
278
- - The result would still need the same manual synthesis with no time saved.
279
-
280
- Do not fan out to keep agents busy. Every worker should reduce a named
281
- planning, validation, review, audit, or implementation uncertainty. A normal
282
- first pass is two to five workers with independent slices; use more only when
283
- the manifest stays countable and non-overlapping.
284
-
285
- ## Modes
286
-
287
- When fanning out Flow work, select the matching hidden Flow agent by name. These
288
- workers are injected by the plugin config; invoke the named worker when it is
289
- available. Do not use generic subagents for Flow slices because Flow workers
290
- carry the permission boundaries for each mode.
291
-
292
- | Mode | Use agent | Worker output | Write access | Flow tools |
293
- | --- | --- | --- | --- | --- |
294
- | \`evidence\` | \`flow-evidence-worker\` | Coverage, facts, files inspected, confidence, gaps, suggested plan targets | No | \`flow_status\` only if needed |
295
- | \`review\` | \`flow-reviewer\` | Coverage, candidate findings or review slice summary, confidence, gaps | No | \`flow_status\` only if needed |
296
- | \`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 |
297
- | \`audit\` | \`flow-audit-worker\` | Refuted or surviving finding candidates, guards checked, confidence, gaps | No | \`flow_status\` only if needed |
298
- | \`verifier\` | \`flow-verifier-worker\` | Per-claim verdicts against cited evidence or commands | No | \`flow_status\` only if needed |
299
- | \`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 |
300
-
301
- Use worker-specific model routing where the installation can support it:
302
- \`OPENCODE_FLOW_READONLY_WORKER_MODEL\` for evidence, validation, and audit
303
- workers; \`OPENCODE_FLOW_REVIEW_WORKER_MODEL\` for reviewer and verifier workers;
304
- \`OPENCODE_FLOW_CANDIDATE_WORKER_MODEL\` for candidate implementation workers; and
305
- \`OPENCODE_FLOW_WORKER_MODEL\` as a fallback for all hidden Flow workers. Model IDs
306
- are OpenCode installation-specific (\`provider/model\`), so leave these unset when
307
- the configured provider is unknown. Spend stronger models where being wrong is
308
- expensive; read-heavy discovery slices tolerate the cheapest configured option,
309
- while verifier and review slices deserve the strongest.
310
-
311
- ## Permission contract
312
-
313
- The plugin injects these hidden workers with the following permission values.
314
- \`Flow state tools\` means the \`flow_*\` rule, while \`Flow status\` documents the
315
- explicit \`flow_status\` exception.
316
-
317
- | Worker | Edit | Bash | Task | Skill | Flow state tools | Flow status |
318
- | --- | --- | --- | --- | --- | --- | --- |
319
- | \`flow-reviewer\` | deny | deny | deny | deny | deny | allow |
320
- | \`flow-evidence-worker\` | deny | deny | deny | deny | deny | allow |
321
- | \`flow-validation-worker\` | deny | ask | deny | deny | deny | allow |
322
- | \`flow-audit-worker\` | deny | ask | deny | deny | deny | allow |
323
- | \`flow-candidate-worker\` | ask | ask | deny | deny | deny | allow |
324
- | \`flow-verifier-worker\` | deny | ask | deny | deny | deny | allow |
325
-
326
- Do not fan out parallel \`flow_plan_save\`, \`flow_plan_approve\`,
327
- \`flow_run_start\`, \`flow_feature_complete\`, \`flow_feature_reset\`, or
328
- \`flow_session_close\` calls. Runtime locking protects files, but Flow accepts only
329
- one active feature result at a time.
330
-
331
- Workers may read files, inspect docs, run authorized read-only commands, and
332
- summarize evidence. Candidate implementation workers may edit only when the
333
- manager assigned an isolated worktree or exact path ownership that does not
334
- overlap sibling workers or manager edits. Workers must not edit \`.flow/**\`,
335
- must not call state-changing Flow tools, and must not approve work, close
336
- sessions, record Flow validation, or claim validation they did not run. A
337
- worker may report raw validation output it actually ran; the manager decides
338
- whether it is strong enough to record.
339
-
340
- ## Stage 1 — Orient (serial)
341
-
342
- Call \`flow_status\` if a Flow session may already exist. Read enough files,
343
- schemas, docs, tests, commands, or artifacts to identify real slices. Keep the
344
- immediate blocker local: do not delegate the question that determines whether
345
- fan-out is even valid.
346
-
347
- Treat orientation as uncertainty reduction. Resolve environment uncertainty by
348
- inspecting the repo, running cheap commands, or assigning evidence workers; ask
349
- the user only when the remaining specification uncertainty would make a wrong
350
- slice expensive to undo. Do not split a vague goal into workers until the
351
- candidate slices have concrete targets, dependencies, and verification signals.
352
-
353
- ## Stage 2 — Slice
354
-
355
- Split along whichever axis keeps slices independent: modules or path sets,
356
- route or endpoint groups, risk lenses, command surfaces, data ranges, or claim
357
- sets. Each slice needs a one-line scope, expected coverage, and a defined
358
- output the manager can check.
359
-
360
- For implementation slices, also name dependencies and write ownership before
361
- spawning. A real dependency edge means the later slice waits for a verified
362
- handoff or manager synthesis from the earlier slice; a shared file, fixture,
363
- schema, or public contract usually means the work should stay serial unless an
364
- isolated worktree is used. The manifest owns those edges through \`dependsOn\`
365
- and \`writeScope\`.
366
-
367
- ## Stage 3 — Manifest (the pre-fan-out coverage gate)
368
-
369
- Before spawning, write a pass manifest: one row per slice, plus a totals check.
370
- Give the pass a stable id so later handoffs, verifier claims, and completion
371
- payloads can refer to the same work without replaying chat.
246
+ Before editing a broad, risky, or multi-target feature, record one manager
247
+ decision even when implementation stays serial. Keep \`candidateEligibility\`,
248
+ \`candidateDecision\`, and \`decision\` as distinct fields.
372
249
 
373
- | Row id | Slice scope | Expected coverage | Mode | Depends on | Write scope | Verification tier | Handoff ref | Verification status | Synthesis ref |
250
+ Classify candidate eligibility separately from the decision:
251
+
252
+ | Eligibility | Meaning |
253
+ | --- | --- |
254
+ | \`eligible\` | At least one slice has independent ownership and practical validation. |
255
+ | \`not_eligible\` | Shared state, files, tests, or judgment make isolation unsafe or wasteful. |
256
+ | \`unknown\` | Orientation is incomplete; never use this on an \`implementation-decision\` record. |
257
+
258
+ Use only these pairings on \`implementation-decision\` records:
259
+
260
+ | Eligibility | Candidate decision | Implementation decision |
261
+ | --- | --- | --- |
262
+ | \`eligible\` | \`used\` | \`candidate-exact-path\`, \`candidate-worktree\`, or \`tournament\` |
263
+ | \`eligible\` | \`skipped\` | \`skipped\` |
264
+ | \`not_eligible\` | \`serial_required\` | \`serial\` |
265
+
266
+ Candidate-shaped decisions and \`candidateDecision: "used"\` require execution
267
+ evidence on the same record: \`kind: "candidate"\`, \`modes\` containing
268
+ \`candidate-implementation\`, or \`candidateWorkerCount > 0\`. Keep
269
+ \`candidateWorkerCount <= workerCount\` and
270
+ \`verifierWorkerCount <= workerCount\`; one worker may fill both subtype counts.
271
+ Never use \`parallel\` as an implementation decision. Reserve \`parallel\` for
272
+ multi-worker read, audit, review, validation, or verification passes.
273
+
274
+ Implementation decision meanings:
275
+
276
+ - \`serial\`: the manager implements directly because work overlaps or depends on
277
+ one shared contract or mental model.
278
+ - \`candidate-exact-path\`: workers own exact, disjoint path sets in one checkout.
279
+ - \`candidate-worktree\`: isolated workers propose patches for manager integration.
280
+ - \`tournament\`: isolated candidates compete; the manager selects using source
281
+ inspection, validation, and review.
282
+ - \`skipped\`: candidate work was eligible, but coordination cost outweighed its
283
+ value. Do not use it for unsafe ownership; those cases are \`serial\`.
284
+
285
+ Record \`decisionReason\` plus the applicable structured \`decisionFactors\`:
286
+ \`shared_state\`, \`overlapping_files\`, \`small_slice\`,
287
+ \`needs_manager_judgment\`, \`independent_surface\`, and
288
+ \`validation_available\`. Also record a stable pass id, write scope, expected
289
+ verification, and the handoff or synthesis location. Carry the bounded record
290
+ into \`flow_feature_complete.orchestrationPasses\` when it materially shaped the
291
+ feature; keep full handoffs and logs outside Flow state.
292
+
293
+ ## Candidate judgment
294
+
295
+ Consider candidate workers when ownership is additive or localized, validation
296
+ can run per slice, and the manager can safely inspect or reject the result.
297
+ Separate frontend, core, docs, release, test, or binding surfaces are useful
298
+ signals, but the actual path and contract boundaries decide eligibility.
299
+
300
+ Stay serial when any of these apply:
301
+
302
+ - One file, command, contract, migration, or design question determines the
303
+ next step.
304
+ - Slices share state, callers, fixtures, generated output, lockfiles, tests, or
305
+ edit targets.
306
+ - Persistence or lifecycle behavior requires one mental model.
307
+ - Iterative debugging must happen in one checkout.
308
+ - Prompt, handoff, merge, and verification cost exceeds direct work.
309
+ - The manager would still need the same full synthesis with no coverage gain.
310
+
311
+ Do not fan out to keep workers busy. Every worker must reduce a named
312
+ uncertainty.
313
+
314
+ ## Worker count defaults
315
+
316
+ Use bounded caps rather than worker-count targets:
317
+
318
+ - Small implementation: zero or one worker.
319
+ - Medium independent implementation: at most two workers.
320
+ - Broad audit: three to five workers.
321
+ - Broad implementation: two to four candidate workers with non-overlapping
322
+ ownership.
323
+ - Medium- or high-risk final verification: one verifier.
324
+
325
+ Use more only when the manifest remains countable and non-overlapping.
326
+ `;
327
+
328
+ // skills/flow/references/parallel-execution.md
329
+ 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";
330
+
331
+ // skills/flow/references/parallel-manifest.md
332
+ var parallel_manifest_default = `# Parallel pass manifest
333
+
334
+ Read this only after \`parallel-decision.md\` selects a parallel or candidate
335
+ pass. The manifest is the pre-fan-out coverage gate and the accounting contract
336
+ for every worker result.
337
+
338
+ ## Orient and slice
339
+
340
+ Call \`flow_status\` when a Flow session may exist. Read enough code, schemas,
341
+ docs, tests, commands, or artifacts to identify real slices. Keep the question
342
+ that determines whether fan-out is valid in manager context.
343
+
344
+ Split by an axis that keeps work independent: modules or paths, routes or
345
+ endpoints, risk lenses, commands, data ranges, or atomic claims. Give each slice
346
+ a one-line scope, expected coverage, checkable output, dependencies, write
347
+ scope, and verification tier. Shared files, fixtures, schemas, and public
348
+ contracts normally stay serial unless candidate work uses isolated worktrees.
349
+
350
+ ## Write the manifest
351
+
352
+ Before spawning, write one row per slice plus a totals or completeness check.
353
+ Use stable pass and row ids so later handoffs, verification, synthesis, and
354
+ completion accounting refer to the same work without replaying conversation
355
+ history.
356
+
357
+ | Row id | Slice | Expected coverage | Mode | Depends on | Write scope | Verification tier | Handoff ref | Verification status | Synthesis ref |
374
358
  | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
375
- | \`runtime-read\` | \`src/core/**\` plus its tests | 14 files | \`evidence\` | none | none | accept locally | pending | pending | pending |
376
- | \`release-read\` | release contract: CI workflows, \`package.json\`, changelog | 6 files | \`evidence\` | none | none | verify once | pending | pending | pending |
377
-
378
- \`writeScope\` values in runtime accounting are \`none\`, \`manager-serial\`,
379
- \`exact-path\`, \`isolated-worktree\`, or \`mixed\`. Use \`manager-serial\` for a
380
- recorded serial implementation decision, \`exact-path\` for disjoint candidate
381
- edits in one checkout, and \`isolated-worktree\` for candidate work that must be
382
- merged back by the manager.
383
-
384
- - Count the total work items when countable: files, modules, routes, commands,
385
- rows, findings, screenshots, or claims. Confirm slice counts add back to the
386
- total, with no overlaps, gaps, empty slices, or ambiguous shared contracts.
387
- - If the scope cannot be counted, state the completeness rule instead, such as
388
- "all changed files plus callers" or "all public commands plus release docs."
389
- - Assign each slice's verification tier now (see Stage 6). Deciding where a
390
- wrong claim is expensive belongs before handoffs arrive, not after.
391
- - Record dependency edges now. A row may be spawned only after every \`depends on\`
392
- row it names has returned a verified handoff or a manager synthesis that
393
- explicitly settles the dependency.
394
- - Fix the slice map centrally before spawning if the gate does not reconcile.
395
-
396
- The manifest is also the accounting contract for the pass: N rows spawned means
397
- N handoffs collected and checked in Stage 5 before anything is synthesized.
398
-
399
- For implementation decisions, add a manifest row even when no worker is spawned:
400
- \`kind=implementation-decision\`, \`decision=serial\` or \`decision=skipped\`,
401
- \`workerCount=0\`, \`writeScope=manager-serial\`, and a concrete \`decisionReason\`.
402
- This is how Flow distinguishes deliberate serial work from forgotten candidate
403
- or verifier passes.
404
-
405
- Write the manifest where it survives the pass: the conversation is enough for a
406
- single bounded pass, but when a follow-up pass or a session resume is
407
- plausible, persist it with the synthesis (Stage 7) so the accounting can be
408
- reconstructed.
409
-
410
- ## Stage 4 — Fan out
411
-
412
- Every worker prompt includes:
359
+ | \`runtime-read\` | \`src/core/**\` plus tests | 14 files | \`evidence\` | none | none | accept locally | pending | pending | pending |
360
+ | \`release-read\` | CI, package metadata, changelog | 6 files | \`audit\` | none | none | verify once | pending | pending | pending |
413
361
 
414
- \`\`\`text
415
- Overall goal, context only: <goal>
416
- Mode: evidence | review | validation | audit | verifier | candidate-implementation
417
- Pass id and manifest row id: <stable ids from the manifest>
418
- Your exact slice: <paths, modules, command, claim ids, risk lens, or worktree>
419
- Expected coverage: <count, paths, range, or complete question set>
420
- Dependencies and write scope: <verified dependencies, if any; none | manager-serial | exact-path | isolated-worktree>
421
- Do: <bounded actions>
422
- Do not: call state-changing Flow tools, edit .flow/**, own sibling slices, or make the final Flow verdict.
423
- Return only the Flow handoff in this exact shape:
424
- <matching handoff template copied verbatim from handoff-format.md>
425
- \`\`\`
362
+ Use runtime \`writeScope\` values exactly: \`none\`, \`manager-serial\`, \`exact-path\`,
363
+ \`isolated-worktree\`, or \`mixed\`.
426
364
 
427
- Hidden workers cannot load skills or read \`handoff-format.md\` themselves. The
428
- manager copies the matching handoff template into every worker prompt; a bare
429
- filename reference is not enough. Workers also cannot read the conversation, so
430
- prompts cite file paths — including any synthesis file from an earlier pass —
431
- instead of restating chat history.
432
-
433
- For research or current-doc slices, require source checks for versioned or
434
- time-sensitive facts. For implementation candidates, remind workers that other
435
- work may be active and that they must not revert unrelated changes.
436
-
437
- Continue non-overlapping manager work while workers run.
438
-
439
- ## Stage 5 — Account
440
-
441
- Check every manifest row off against a returned handoff before synthesis. A
442
- worker that never returns, errors out, returns empty or unstructured output, or
443
- reports \`partial\` or \`blocked\` is a hole in the pass, and synthesizing around it
444
- silently drops a slice.
445
-
446
- For each row, fill in:
447
-
448
- - \`handoffRefs\`: worker ids, handoff file paths, command output artifacts, or
449
- review packet location that the manager can re-open.
450
- - \`verificationStatus\`: \`not-needed\`, \`pending\`, \`passed\`, \`failed\`, \`mixed\`,
451
- or \`downgraded\`.
452
- - \`outcome\`: \`accepted\`, \`rejected\`, \`partial\`, \`not-covered\`, or \`superseded\`.
453
- - \`synthesisRef\`: the manager-owned synthesis file or plan field that carries
454
- the accepted result forward.
455
-
456
- Rows with no worker, such as serial or skipped implementation decisions, still
457
- need a row id, decision, reason, and outcome. They are not handoffs, but they
458
- are accounting.
459
-
460
- Worker failure ladder:
461
-
462
- 1. Re-spawn once with a narrower slice and a note about what the first attempt
463
- returned.
464
- 2. If it fails again, cover the slice directly in the manager session.
465
- 3. If it stays blocked, carry the slice into the synthesis explicitly as
466
- not-covered. Never present results as if coverage were complete.
467
-
468
- ## Stage 6 — Verify
469
-
470
- \`Status: success\` only says the worker believes its slice is done. Accept a
471
- handoff only after a cheap manager-side pass:
472
-
473
- - \`Status\` is present and terminal: \`success\`, \`partial\`, or \`blocked\`; empty or
474
- unstructured output fails this check.
475
- - Coverage matches the assigned slice, or skips are explicit.
476
- - Important claims have concrete evidence and confidence tags.
477
- - Cited paths, commands, screenshots, URLs, or metrics resolve.
478
- - The evidence supports the claim, not just the topic.
479
- - Findings stay inside the worker's slice.
480
- - Headline counts can be recounted or traced.
481
- - Dependency claims cite the verified upstream handoff, synthesis, or source
482
- artifact they depend on.
483
- - Candidate implementation claims identify whether they came from exact path
484
- ownership or an isolated worktree, and whether the manager inspected the
485
- resulting patch.
486
- - Contradictions between workers are either resolved or explicitly marked as
487
- contested.
488
-
489
- Demote, drop, re-task, or verify claims that fail this pass.
490
-
491
- ### Verification tiers
492
-
493
- One taxonomy decides how much verification a claim gets: the manifest assigns
494
- a default tier per slice, and this stage applies it per claim. Use the cheapest
495
- check that matches the risk:
496
-
497
- - **Accept locally**: low-risk claims with direct evidence that the manager can
498
- cheaply inspect or recount.
499
- - **Verify once** with \`flow-verifier-worker\`: single-source, surprising,
500
- inferred, low-confidence, citation-heavy, contested, or Flow-payload-bound
501
- claims, including any count, benchmark, command result, or pass/fail claim a
502
- Flow payload will rely on.
503
- - **Verify strongly**: blocking or release-sensitive claims and claims that
504
- affect user data, security, persistence, permissions, public API behavior,
505
- release behavior, or data loss. Use independent verifier checks, manager-run
506
- commands, or direct artifact inspection strong enough to settle the claim.
507
- - **Do not accept**: claims without concrete evidence, claims outside the
508
- assigned slice, claims contradicted by inspected artifacts, or claims where
509
- the cited evidence supports only the topic rather than the assertion.
510
-
511
- Verifier prompts use stable claim ids, one atomic assertion per id, the cited
512
- source or command for each id, and the exact acceptance question. Do not
513
- include the generator's reasoning unless that reasoning is the thing being
514
- verified, do not say which worker produced the claim, and do not ask a
515
- verifier to redesign the work or review the whole feature.
516
-
517
- ## Stage 7 — Synthesize
518
-
519
- Apply the manager synthesis barrier before presenting or recording anything:
520
-
521
- - Preserve confidence: verified, single-sourced, inferred, and unresolved claims
522
- stay distinct when it matters.
523
- - When workers disagree, inspect the cited artifact or rerun the cited command
524
- instead of arbitrating from summaries. Do not average conflicting claims.
525
- - Run the strongest practical local check for the deliverable.
526
- - Re-read critical files or docs that will be cited in the final decision.
527
- - Move only distilled, evidence-backed claims forward; raw handoffs remain
528
- candidate evidence, not a plan, review, completion payload, or final answer.
529
- - Record gaps honestly instead of converting missing evidence into success
530
- language.
531
-
532
- Where accepted evidence goes:
533
-
534
- - Planning evidence becomes \`requirements\`, \`decisions\`, feature \`targets\`,
535
- feature \`validation\`, or plan notes — only when the source and scope are
536
- clear. Unverified broad findings become a review-first feature, not a fix
537
- plan.
538
- - Validation evidence may become \`validationRun\` only when the worker was
539
- explicitly authorized to run the command and reported the exact command,
540
- status, and raw outcome summary.
541
- - Review evidence informs \`featureReviewDepth\` plus \`featureReview\`, or \`finalReview\`, but the manager
542
- owns the pass/fail verdict and must resolve blockers, contradictions, and
543
- coverage gaps before returning the payload.
544
- - Audit evidence becomes findings only after refutation; blocking findings need
545
- guards checked, deployment context, and evidence that the current code
546
- exhibits the behavior.
547
- - Candidate patches are not Flow evidence until the manager inspects, merges or
548
- rejects them, and validates the main Flow-managed workspace.
549
-
550
- When completing a feature, include compact pass accounting in
551
- \`flow_feature_complete.orchestrationPasses\` for any pass or implementation
552
- decision that materially affected the feature:
365
+ Before launch:
553
366
 
554
- \`\`\`json
555
- {
556
- "id": "feature-id-implementation-decision",
557
- "kind": "implementation-decision",
558
- "decision": "serial",
559
- "decisionReason": "Shared schema and tests made exact path ownership unsafe.",
560
- "modes": [],
561
- "workerCount": 0,
562
- "candidateWorkerCount": 0,
563
- "verifierWorkerCount": 0,
564
- "sliceIds": ["manager-implementation"],
565
- "dependsOn": [],
566
- "writeScope": "manager-serial",
567
- "handoffRefs": [],
568
- "verificationStatus": "not-needed",
569
- "outcome": "accepted",
570
- "synthesisRef": "/tmp/flow-pass-synthesis.md"
571
- }
572
- \`\`\`
367
+ - Reconcile countable work such as files, routes, commands, rows, findings,
368
+ screenshots, or claims. Slice totals must have no overlaps, gaps, or empty
369
+ rows.
370
+ - When scope is not countable, state a completeness rule such as "all changed
371
+ files plus callers" or "all public commands plus release docs."
372
+ - Assign a verification tier before handoffs arrive.
373
+ - Record dependency edges. Spawn a dependent row only after its prerequisite
374
+ has a verified handoff or manager synthesis that settles the dependency.
375
+ - Fix an unreconciled slice map centrally before fan-out.
376
+
377
+ N spawned rows require N collected and checked handoffs before synthesis.
378
+
379
+ ## Implementation decision rows
380
+
381
+ Add an implementation decision row even when no worker is spawned. Record:
573
382
 
574
- For candidate and verifier passes, use \`kind: "candidate"\` or
575
- \`kind: "verification"\`, list the worker modes used, worker counts, slice ids,
576
- handoff refs, dependency ids, verification status, and whether the manager
577
- accepted, rejected, downgraded, or superseded the pass. The runtime aggregates
578
- these compact records into \`session.budget.orchestration\` and stores them on
579
- the feature history entry. Do not store full handoffs, long logs, or scratch
580
- tables in \`.flow/session.json\`.
581
-
582
- Persist the manifest and the synthesis when another pass may follow or the
583
- session is long enough to be compacted or resumed: write the distilled result —
584
- the accounted manifest, accepted claims with evidence and confidence, dropped
585
- claims with one-line reasons, and open gaps — into plan prose fields or a
586
- manager-owned scratch file outside both \`.flow/**\` and the repository worktree,
587
- such as a file in the OS temporary directory. The runtime owns the \`.flow/**\`
588
- layout, and scratch files left in the worktree end up staged or reviewed as if
589
- they were project changes. Follow-up worker prompts cite that path; files are
590
- the only shared memory between passes.
591
-
592
- ## Stage 8 — Extend or stop
593
-
594
- Stop after a pass when:
595
-
596
- - the manifest's coverage rule is satisfied and every row is accounted for.
597
- - accepted claims are evidenced, scoped, and confidence-labeled.
598
- - material single-source, contested, high-stakes, or payload-bound claims have
599
- been verified or downgraded.
600
- - every dependency edge named in the manifest has either a verified upstream
601
- result or an explicit not-covered outcome.
602
- - implementation pass decisions are recorded, including skipped candidate
603
- workers and the reason they were skipped.
604
- - remaining gaps are explicit and do not block the Flow artifact being produced.
605
-
606
- Start a bounded follow-up pass only when:
607
-
608
- - the original slice map missed material scope.
609
- - workers disagree on a claim that affects the Flow decision.
610
- - a high-stakes or payload-bound claim needs verification.
611
- - a dependency has just become verified and now unlocks a dependent slice.
612
- - a candidate patch was rejected and an isolated alternative is still cheaper
613
- than serial repair.
614
- - a first pass exposes a narrower implementation or validation slice worth
615
- isolating.
616
-
617
- Run at most one routine follow-up pass. Extra passes need an explicit manager
618
- reason, such as a high-stakes verifier check or a newly discovered bounded
619
- slice. Do not recurse by default: if a worker says it needs another worker, the
620
- manager decides whether that is a follow-up pass and writes the next bounded
621
- prompt, starting again from the manifest.
383
+ - \`kind: "implementation-decision"\`
384
+ - the valid decision, eligibility, and candidate-decision pairing from
385
+ \`parallel-decision.md\`
386
+ - \`decisionFactors\`, \`decisionReason\`, and \`writeScope: "manager-serial"\`
387
+ - \`workerCount: 0\`, a stable row id, verification status, and outcome
388
+
389
+ When \`candidateDecision\` is \`used\`, record actual candidate execution evidence
390
+ and raise worker counts accordingly. A zero-worker record cannot claim candidate
391
+ use. Subtype counts may not exceed total worker count.
392
+
393
+ ## Persistence
394
+
395
+ The conversation is sufficient for one bounded pass. When a follow-up pass or
396
+ session resume is plausible, persist the accounted manifest with the synthesis
397
+ in a manager-owned temporary artifact outside \`.flow/**\` and outside the repo
398
+ worktree. The runtime stores bounded accounting, not complete worker handoffs.
399
+ `;
400
+
401
+ // skills/flow/references/parallel-orchestration.md
402
+ var parallel_orchestration_default = `# Parallel orchestration
403
+
404
+ Use this index after a serial orientation pass shows that independent slices
405
+ may reduce a named discovery, validation, review, audit, verification, or
406
+ implementation uncertainty. The root manager owns the Flow session and every
407
+ state-changing \`flow_*\` call throughout the pass.
408
+
409
+ ## Load only the selected branch
410
+
411
+ 1. Read \`parallel-decision.md\` whenever deciding whether work should fan out.
412
+ 2. Stop loading parallel references when the decision is serial. Record the
413
+ implementation decision when the active feature requires one.
414
+ 3. After selecting a parallel or candidate pass, read
415
+ \`parallel-manifest.md\`, then \`parallel-execution.md\`.
416
+ 4. When handoffs return, read \`parallel-synthesis.md\` before accepting claims,
417
+ recording evidence, or presenting a result.
418
+ 5. Copy exactly one matching worker response template from \`handoff-format.md\`
419
+ into each worker prompt. Hidden workers cannot load skills or references.
420
+ 6. Read \`parallel-pass-example.md\` only when a concrete end-to-end example is
421
+ needed.
422
+
423
+ Do not preload the manifest, worker, and synthesis runbooks merely because a
424
+ task could be parallel. The decision reference is enough to keep serial work
425
+ serial.
426
+
427
+ ## Pass routing
428
+
429
+ | Situation | Pass | Typical worker |
430
+ | --- | --- | --- |
431
+ | Repo shape is unclear before planning | Discovery | \`flow-evidence-worker\` |
432
+ | A broad finding set needs refutation | Audit | \`flow-audit-worker\` |
433
+ | Changed files or risk lenses exceed one review pass | Review | \`flow-reviewer\` |
434
+ | Test strategy or route coverage is unclear | Validation | \`flow-validation-worker\` |
435
+ | A claim is surprising, high-stakes, single-source, or payload-bound | Verification | \`flow-verifier-worker\` |
436
+ | An authorized independent implementation slice exists | Candidate | \`flow-candidate-worker\` |
437
+
438
+ Only the manager synthesizes the pass, decides whether evidence is sufficient,
439
+ integrates candidate patches, records Flow state, or returns the final verdict.
622
440
  `;
623
441
 
624
442
  // skills/flow/references/parallel-pass-example.md
625
443
  var parallel_pass_example_default = `# Parallel pass example
626
444
 
627
- Use this example after \`parallel-orchestration.md\` when a broad Flow task needs a
628
- concrete pass shape. The project below is illustrative; derive your own slices
629
- from the actual repo during serial orientation.
445
+ Use this example only after \`parallel-orchestration.md\` routes a broad Flow task
446
+ to fan-out. It illustrates the manifest, execution, and synthesis references;
447
+ derive real slices from the actual repo during serial orientation.
630
448
 
631
449
  Goal: review whether a web app's API error handling is consistent before
632
450
  planning a refactor.
@@ -712,18 +530,21 @@ keeps only verified or clearly labeled claims, and records one artifact such as
712
530
  a plan decision, review payload, or docs patch. Raw handoffs and unverified
713
531
  suggestions do not move into the next pass or user-facing answer.
714
532
 
715
- If the pass shaped feature execution, the manager records compact accounting in
533
+ If the pass shaped feature execution, the manager records bounded accounting in
716
534
  \`flow_feature_complete.orchestrationPasses\`, such as pass id
717
535
  \`api-error-handling-read\`, kind \`review\`, worker count \`3\`, slice ids
718
536
  \`routes-auth\`, \`routes-billing\`, and \`routes-admin\`, verification status
719
537
  \`mixed\` or \`passed\`, and a synthesis ref pointing to the manager-owned summary.
720
538
  `;
721
539
 
540
+ // skills/flow/references/parallel-synthesis.md
541
+ 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";
542
+
722
543
  // skills/flow/references/recovery-playbook.md
723
544
  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';
724
545
 
725
546
  // skills/flow/SKILL.md
726
- 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";
547
+ 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";
727
548
 
728
549
  // skills/flow-commit/SKILL.md
729
550
  var SKILL_default2 = `---
@@ -972,9 +793,13 @@ var parallel_discovery_default = `# Parallel discovery
972
793
 
973
794
  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.
974
795
 
975
- For broad parallel passes, also load \`../../flow/references/parallel-orchestration.md\`.
976
- Use its pass manifest as the pre-fan-out coverage gate and
977
- \`../../flow/references/handoff-format.md\` response shapes.
796
+ For broad parallel passes, start with
797
+ \`../../flow/references/parallel-orchestration.md\`. If it selects fan-out, use
798
+ \`../../flow/references/parallel-manifest.md\` as the coverage gate,
799
+ \`../../flow/references/parallel-execution.md\` for worker prompts, and
800
+ \`../../flow/references/parallel-synthesis.md\` when handoffs return. Copy the
801
+ matching \`../../flow/references/handoff-format.md\` response shape into each
802
+ prompt.
978
803
 
979
804
  ## Good slices
980
805
 
@@ -998,8 +823,8 @@ config, or release surfaces in the pass manifest.
998
823
 
999
824
  ## Manifest and prompts
1000
825
 
1001
- Write the pass manifest and the worker prompts exactly as Stages 3 and 4 of
1002
- \`../../flow/references/parallel-orchestration.md\` define them: one manifest row
826
+ Write the pass manifest and worker prompts as \`parallel-manifest.md\` and
827
+ \`parallel-execution.md\` define them: one manifest row
1003
828
  per slice with expected coverage, dependencies, write scope, and a verification
1004
829
  tier, and a self-contained prompt per worker naming the mode (usually
1005
830
  \`evidence\`), the exact slice, and the expected coverage. Discovery-specific
@@ -1026,7 +851,7 @@ Convert only evidence-backed work into plan fields:
1026
851
  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.
1027
852
 
1028
853
  Apply the manager synthesis barrier from
1029
- \`../../flow/references/parallel-orchestration.md\`: only distilled,
854
+ \`../../flow/references/parallel-synthesis.md\`: only distilled,
1030
855
  evidence-backed claims become plan fields.
1031
856
  `;
1032
857
 
@@ -1035,7 +860,7 @@ var plan_quality_checklist_default = `# Plan quality checklist
1035
860
 
1036
861
  Use this checklist before \`flow_plan_save\` and again before approval if the plan
1037
862
  changed during discussion. The goal is not a long planning artifact; it is a
1038
- compact plan another agent can execute without rediscovering the work.
863
+ concise plan another agent can execute without rediscovering the work.
1039
864
 
1040
865
  ## Must pass
1041
866
 
@@ -1338,14 +1163,19 @@ description: "Use when Flow work needs planning before implementation: a new goa
1338
1163
 
1339
1164
  # Flow Plan
1340
1165
 
1341
- Use this skill before implementation. The output is a compact plan the runtime can enforce and future agents can execute without rediscovering the goal.
1166
+ Use this skill before implementation. The output is a concise plan the runtime can enforce and future agents can execute without rediscovering the goal.
1167
+
1168
+ ## Planning runtime availability
1342
1169
 
1343
1170
  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.
1344
1171
 
1345
1172
  ## Inspect first
1346
1173
 
1347
1174
  - Read the files, docs, tests, package scripts, and local conventions that determine the work.
1348
- - 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.
1175
+ - For broad discovery, read \`references/parallel-discovery.md\` after a serial
1176
+ orientation pass. When multiple workers may help, start with
1177
+ \`../flow/references/parallel-orchestration.md\` and load only the branch it
1178
+ selects.
1349
1179
  - Helper rule: when a named helper skill is unavailable, record a planning gap
1350
1180
  and keep the corresponding claims conservative instead of simulating its
1351
1181
  checks.
@@ -1449,6 +1279,65 @@ See \`references/planning-examples.md\` for payload examples and decomposition
1449
1279
  anti-patterns.
1450
1280
  `;
1451
1281
 
1282
+ // skills/flow-review/references/hidden-reviewer-contract.md
1283
+ var hidden_reviewer_contract_default = `# Hidden Flow reviewer contract
1284
+
1285
+ This is the canonical role-safe contract bundled into \`flow-reviewer\`. It does
1286
+ not grant manager capabilities and does not tell the hidden reviewer to load
1287
+ skills, run commands, edit files, or launch workers.
1288
+
1289
+ ## Role and availability
1290
+
1291
+ You are an independent read-only reviewer. Call \`flow_status\` when available,
1292
+ prefer the manager's bounded review packet, and inspect the actual changed
1293
+ artifacts and supplied validation evidence. Only the root manager may mutate
1294
+ Flow state; return findings without fixing them. Your permissions intentionally
1295
+ exclude edits, shell commands, skill loading, and nested workers. Record missing
1296
+ evidence as a gap or blocker instead of claiming coverage.
1297
+
1298
+ If Flow setup or required evidence is stale or unavailable, label the result
1299
+ advisory and do not present it as Flow-gated evidence.
1300
+
1301
+ ## Feature review depths
1302
+
1303
+ - \`quick\`: docs, comments, config-only changes, generated output, or mechanical
1304
+ changes fully covered by tooling.
1305
+ - \`standard\`: read every changed file and relevant test; this is the default for
1306
+ ordinary implementation work.
1307
+ - \`detailed\`: inspect risky behavior, persistence, security, cross-module
1308
+ refactors, migrations, releases, weak validation, and expensive edge cases.
1309
+
1310
+ The actual feature-review depth must meet or exceed the approved feature's
1311
+ \`reviewDepth\`. Final reviews use \`reviewDepth: "broad"\` or \`"detailed"\` and must
1312
+ match the plan's \`finalReviewPolicy\`. Claim only the depth actually performed.
1313
+
1314
+ ## Direct review outputs
1315
+
1316
+ For a direct feature review, return only \`featureReviewDepth\` plus
1317
+ \`featureReview\`. For a direct final review, return only \`status\`, \`summary\`,
1318
+ \`blockingFindings\`, and \`reviewDepth\`. Use \`status: "failed"\` whenever a
1319
+ blocking finding remains. Advisory notes belong in the summary, while
1320
+ \`blockingFindings\` contains only blockers.
1321
+
1322
+ ## Special-case evidence
1323
+
1324
+ - Cleanup/refactor: verify that the smell was real, refutation paths were
1325
+ checked, and behavior was preserved. If helper evidence is unavailable,
1326
+ record a coverage gap instead of approving the cleanup claim.
1327
+ - UI/frontend: verify relevant states and supplied visual evidence. When visual
1328
+ evidence is missing, record a coverage gap and do not claim visual polish was
1329
+ verified.
1330
+ - Audit reports: findings must survive refutation against cited code, guards,
1331
+ and mitigating paths before they can drive fixes.
1332
+
1333
+ ## Completion checkpoint
1334
+
1335
+ Before returning, confirm that the stated depth matches work actually
1336
+ inspected, every blocker has concrete evidence, missing coverage is explicit,
1337
+ and the response uses exactly the direct-review payload or assigned-slice
1338
+ handoff requested.
1339
+ `;
1340
+
1452
1341
  // skills/flow-review/references/review-rubric.md
1453
1342
  var review_rubric_default = `# Review rubric
1454
1343
 
@@ -1601,13 +1490,15 @@ These instructions run in two contexts, and only one of them can load helpers:
1601
1490
  subagents. In this context, skip every "load" and "fan out" instruction
1602
1491
  below: judge from the diff, the plan fields, and the recorded validation
1603
1492
  evidence, and record a coverage gap for any judgment that would have needed
1604
- a helper skill or a command run.
1493
+ a helper skill or a command run. The bundled hidden reviewer prompt uses the
1494
+ canonical role-safe contract in
1495
+ \`references/hidden-reviewer-contract.md\`.
1605
1496
 
1606
1497
  ## Start
1607
1498
 
1608
1499
  - Call \`flow_status\` when available.
1609
1500
  - Identify whether this is a feature review or final review.
1610
- - Prefer the manager's compact review packet over parent-session memory. The
1501
+ - Prefer the manager's bounded review packet over parent-session memory. The
1611
1502
  packet should name the active feature, minimum \`reviewDepth\`, changed files,
1612
1503
  diff summary, validation evidence, and targeted paths or risk lenses. If the
1613
1504
  packet is missing important scope or evidence, record that as a coverage gap
@@ -1668,14 +1559,15 @@ Use \`status: "failed"\` when any blocking finding remains. Advisory findings ma
1668
1559
  - 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.
1669
1560
  - 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.
1670
1561
  - Audit reports: use \`../flow-run/references/audit-rubric.md\`; findings must survive refutation before they can drive fix features.
1671
- - Large reviews (manager context only): use
1562
+ - Large reviews (manager context only): start with
1672
1563
  \`../flow/references/parallel-orchestration.md\` for read-only slices by
1673
- changed-file group, risk lens, or validation surface. Use the named review,
1674
- audit, evidence, or validation agents from that reference instead of generic
1675
- subagents. Write its pass manifest before fan-out and apply its Stage 6
1676
- handoff acceptance and verification tiers; only the manager
1677
- returns the final \`featureReview\` or \`finalReview\` payload. If that reference
1678
- is unavailable in the current context (for example in a bundled public Flow
1564
+ changed-file group, risk lens, or validation surface. If fan-out is selected,
1565
+ use \`../flow/references/parallel-manifest.md\`,
1566
+ \`../flow/references/parallel-execution.md\`, and
1567
+ \`../flow/references/parallel-synthesis.md\` with the named review, audit,
1568
+ evidence, or validation workers; only the manager returns the final
1569
+ \`featureReview\` or \`finalReview\` payload. If those references are unavailable
1570
+ in the current context (for example in a bundled public Flow
1679
1571
  command that does not include it), review serially and record the skipped
1680
1572
  fan-out as a coverage gap instead of improvising worker contracts. The hidden
1681
1573
  reviewer cannot spawn workers; it reviews its assigned scope directly and
@@ -1703,7 +1595,7 @@ A finding that survives this pass is worth reporting. A finding you did not try
1703
1595
 
1704
1596
  ## Parallel audit slices
1705
1597
 
1706
- For broad audits, use \`../../flow/references/parallel-orchestration.md\` to split
1598
+ For broad audits, start with \`../../flow/references/parallel-orchestration.md\` to split
1707
1599
  read-only slices by module, data flow, or risk lens. Workers surface candidates;
1708
1600
  the audit author owns the report. Apply its handoff format and verification
1709
1601
  gates. Before blocking severity, dedupe, trace guards, fill cross-layer checks,
@@ -1759,7 +1651,9 @@ Use the strongest practical tier. For risky work, combine tiers.
1759
1651
  - Each \`validationRun\` entry has \`command\`, \`status\`, and \`summary\`.
1760
1652
  - Completion accepts only passing entries. Failed or skipped checks belong in the summary/notes and must be resolved or explained as blockers.
1761
1653
  - Do not claim a command was run unless it was run in this session or directly reported by a trusted worker with raw output.
1762
- - 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.
1654
+ - Worker-reported command output must satisfy the acceptance and verification
1655
+ rules in \`../../flow/references/parallel-synthesis.md\`: exact command, status,
1656
+ raw outcome summary, coverage, and manager acceptance.
1763
1657
  - Include scope in the summary: what behavior, files, routes, or states the check covered.
1764
1658
  - UI work should include browser or screenshot evidence when the app can run locally.
1765
1659
  - Cleanup/refactor work should show behavior preservation, not only formatting success.
@@ -1801,7 +1695,170 @@ Never trim failing output, relabel a failed command as passed, or use "not run"
1801
1695
  `;
1802
1696
 
1803
1697
  // skills/flow-run/SKILL.md
1804
- var SKILL_default6 = '---\nname: flow-run\ndescription: "Use when an approved Flow plan has a feature to implement, validate, or complete in the v4 runtime, and the work is scoped to one active feature. For planning a goal first use flow-plan; for the full goal-to-completion loop or resuming a session use flow."\n---\n\n# Flow Run\n\nUse this skill for implementation after a Flow plan is approved. Work one feature at a time.\n\nIf `flow_run_start` is unavailable, stop and tell the user to check that `opencode-plugin-flow` is loaded in OpenCode.\n\n## Start\n\n- Call `flow_status`.\n- If `flow_status` returns a `session.resumePacket` or\n `session.budget.phaseBoundary`, stop the current autonomous loop and report\n the resume instructions. Only call `flow_run_start` with\n `phaseBoundaryAck: true` at the start of a fresh user invocation that is\n explicitly resuming the Flow session; do not acknowledge a boundary inside\n the same uninterrupted loop that created it.\n- Call `flow_run_start` with no `featureId` unless the user or plan requires a specific runnable feature.\n- Treat the returned feature as the sole scope until it is completed, blocked, or reset.\n- Helper rule: when a named helper skill is unavailable, record the gap and\n keep the corresponding claims conservative instead of simulating its checks.\n- Load `flow-deslop` for cleanup/refactor features.\n- Load `flow-ui-quality` for frontend, UX, responsive, accessibility, or visual work.\n\n## Implement\n\n- Read the feature `targets`, `summary`, `validation`, dependencies, and plan `requirements`/`decisions`.\n- Treat the feature\'s `reviewDepth` as the minimum feature-review depth that\n must be recorded in `flow_feature_complete`.\n- For broad, risky, or multi-target work, record an implementation pass\n decision before editing: `serial`, `candidate-exact-path`,\n `candidate-worktree`, `tournament`, or `skipped`. Use\n `../flow/references/parallel-orchestration.md` for the decision rules,\n manifest fields, and compact `orchestrationPasses` record.\n- If candidate workers are skipped, record the reason, such as overlapping\n targets, shared contracts, missing isolation, or no explicit authorization\n for worker edits.\n- Keep edits scoped to the active feature. If new scope appears, stop and replan or defer it to another feature.\n- Preserve unrelated user changes in the worktree.\n- When a wrong assumption invalidates the feature, use `flow_feature_reset`; do not pile patches onto a bad path.\n- Do not stage, commit, push, amend, rebase, publish, or mutate releases as part\n of feature execution. If the user explicitly asks for commit preparation, load\n `flow-commit` only after `flow_feature_complete` has been recorded, unless the\n user explicitly asks for a WIP commit path. Keep Git boundaries separate from\n Flow state recording.\n\n## Validate\n\n- For complex validation, regression-sensitive changes, browser QA, route QA,\n failure-prone checks, unclear coverage, exploratory QA, or\n `validationRun` summarization, load `flow-test` (helper rule applies).\n- Read `references/validation-rubric.md` before completing.\n- Run the strongest practical checks for the changed behavior.\n- Record concrete command names, status, and observed results. "Tests pass" is not evidence.\n- Non-final features complete with `validationScope: "targeted"`.\n- The final feature must run a broad project-level gate and use `validationScope: "broad"`.\n\nFor broad validation research, risky changes, or unclear coverage, use\n`../flow/references/parallel-orchestration.md` to fan out named Flow workers.\nUse the mode-to-agent mapping in that reference instead of generic subagents.\nWrite its pass manifest before fan-out, paste the matching handoff template\nfrom `../flow/references/handoff-format.md` into every worker prompt, and\napply its verification tiers to the handoffs that come back.\nThey may report command output they actually ran or propose focused checks; the\nmanager decides what is strong enough to record.\n\nFor independent implementation attempts, use candidate workers only with\nexplicit user authorization plus isolated worktrees or exact non-overlapping\npath ownership. Treat their output as candidate patches. The manager inspects,\nmerges, validates, and records Flow state serially.\nWhen a candidate pass or serial/skipped implementation decision materially\nshaped the feature, include its compact record in\n`flow_feature_complete.orchestrationPasses`. Do not paste full worker handoffs\nor long logs into the runtime payload.\n\n## Review and complete\n\nBefore `flow_feature_complete`, obtain a `featureReview` payload. Load\n`flow-review`; for read-only subagent reviews, the manager receives the review\npacket and records both `featureReviewDepth` and `featureReview`.\n\nSend reviewers a compact review packet. Do not rely on the accumulated parent\nconversation. Include only:\n\n- active feature id, title, summary, `reviewDepth`, targets, validation, and dependencies\n- relevant plan requirements, decisions, and final review policy\n- changed files and a short diff summary\n- validation evidence with exact commands, status, and observed result\n- targeted paths or risk lenses the reviewer must inspect\n\nIf the review returns `status: "failed"`, do not fix inside the review pass.\nRecord the failed attempt by calling `flow_feature_complete` with the otherwise\nprepared completion payload, the failed `featureReview`, and the attempted\n`featureReviewDepth`; the runtime will reject completion and update the retry\nbudget. Default to stopping and reporting the blocker. When the user already\nauthorized autonomous implementation, make at most one repair and run one retry\nreview. If the retry fails or the runtime reports review retry budget\nexhausted, stop with the blocker.\n\nIf `flow_status` reports `setup.skills` or `flow-review` cannot be loaded, do\nnot record a Flow-gated `featureReview` or `finalReview`. You may perform an\nadvisory review using available context or the bundled review fallback provided\nby plugin config, then complete with `status: "needs_input"` if review evidence\nis required to proceed.\n\nFor the final feature, also obtain a `finalReview` payload whose `reviewDepth` equals the approved plan\'s `finalReviewPolicy`.\n\nComplete with:\n\n```json\n{\n "status": "ok",\n "featureId": "active-feature-id",\n "summary": "what changed",\n "artifactsChanged": [{ "path": "src/file.ts" }],\n "validationRun": [\n { "command": "bun test tests/foo.test.ts", "status": "passed", "summary": "3 pass, exercised foo behavior" }\n ],\n "validationScope": "targeted",\n "featureReviewDepth": "standard",\n "featureReview": { "status": "passed", "summary": "review summary", "blockingFindings": [] },\n "orchestrationPasses": [\n {\n "id": "active-feature-id-implementation-decision",\n "kind": "implementation-decision",\n "decision": "serial",\n "decisionReason": "Shared contract edits made worker ownership unsafe.",\n "writeScope": "manager-serial",\n "verificationStatus": "not-needed",\n "outcome": "accepted"\n }\n ]\n}\n```\n\nIf `flow_feature_complete` returns a `session.resumePacket` or\n`session.budget.phaseBoundary`, stop after reporting the compact handoff. If\ngenuinely blocked, call `flow_feature_complete` with `status: "needs_input"` and\nan `outcome` that explains the blocker and next step. Never fabricate validation\nor review evidence to force progress.\n';
1698
+ var SKILL_default6 = `---
1699
+ name: flow-run
1700
+ 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."
1701
+ ---
1702
+
1703
+ # Flow Run
1704
+
1705
+ Use this skill for implementation after a Flow plan is approved. Work one feature at a time.
1706
+
1707
+ ## Execution runtime availability
1708
+
1709
+ If \`flow_run_start\` is unavailable, stop and tell the user to check that \`opencode-plugin-flow\` is loaded in OpenCode.
1710
+
1711
+ ## Start
1712
+
1713
+ - Call \`flow_status\`.
1714
+ - If \`flow_status\` returns a \`session.resumePacket\` or
1715
+ \`session.budget.phaseBoundary\`, stop the current autonomous loop and report
1716
+ the resume instructions. Only call \`flow_run_start\` with
1717
+ \`phaseBoundaryAck: true\` at the start of a fresh user invocation that is
1718
+ explicitly resuming the Flow session; do not acknowledge a boundary inside
1719
+ the same uninterrupted loop that created it.
1720
+ - Call \`flow_run_start\` with no \`featureId\` unless the user or plan requires a specific runnable feature.
1721
+ - Treat the returned feature as the sole scope until it is completed, blocked, or reset.
1722
+ - Helper rule: when a named helper skill is unavailable, record the gap and
1723
+ keep the corresponding claims conservative instead of simulating its checks.
1724
+ - Load \`flow-deslop\` for cleanup/refactor features.
1725
+ - Load \`flow-ui-quality\` for frontend, UX, responsive, accessibility, or visual work.
1726
+
1727
+ ## Implement
1728
+
1729
+ - Read the feature \`targets\`, \`summary\`, \`validation\`, dependencies, and plan \`requirements\`/\`decisions\`.
1730
+ - Treat the feature's \`reviewDepth\` as the minimum feature-review depth that
1731
+ must be recorded in \`flow_feature_complete\`.
1732
+ - Keep edits scoped to the active feature. If new scope appears, stop and replan or defer it to another feature.
1733
+ - Preserve unrelated user changes in the worktree.
1734
+ - When a wrong assumption invalidates the feature, use \`flow_feature_reset\`; do not pile patches onto a bad path.
1735
+ - Do not stage, commit, push, amend, rebase, publish, or mutate releases as part
1736
+ of feature execution. If the user explicitly asks for commit preparation, load
1737
+ \`flow-commit\` only after \`flow_feature_complete\` has been recorded, unless the
1738
+ user explicitly asks for a WIP commit path. Keep Git boundaries separate from
1739
+ Flow state recording.
1740
+
1741
+ ## Candidate implementation
1742
+
1743
+ \`flow-run\` remains the candidate-implementation manager entry route. Invoke the
1744
+ hidden \`flow-candidate-worker\` only after feature start and a complete pass
1745
+ manifest; never route the user's feature request directly to it.
1746
+
1747
+ For broad, risky, or multi-target work, record an implementation pass decision
1748
+ before editing: \`serial\`, \`candidate-exact-path\`, \`candidate-worktree\`,
1749
+ \`tournament\`, or \`skipped\`. Candidate implementation requires explicit user
1750
+ authorization and either an isolated worktree or exact non-overlapping path
1751
+ ownership. It is eligible only when the slice has an independent surface and
1752
+ practical validation, with no shared state, overlapping files, or unresolved
1753
+ manager judgment. Shared contracts, migrations, lockfiles, generated outputs,
1754
+ tightly coupled callers, unclear ownership, and small slices remain serial.
1755
+
1756
+ Classify \`candidateEligibility\` (\`eligible\`, \`not_eligible\`, or \`unknown\`) and
1757
+ \`candidateDecision\` (\`used\`, \`skipped\`, or \`serial_required\`) separately. Read
1758
+ \`../flow/references/parallel-decision.md\` for valid pairings and factors. After
1759
+ selecting fan-out, read \`../flow/references/parallel-manifest.md\` and
1760
+ \`../flow/references/parallel-execution.md\`, then
1761
+ \`../flow/references/parallel-synthesis.md\` when handoffs return.
1762
+ Set \`decision\`, \`decisionReason\`, \`decisionFactors\`, and \`writeScope\`.
1763
+
1764
+ Candidate workers return patches for manager inspection. The manager accepts,
1765
+ modifies, or rejects them, integrates accepted work, validates, reviews, and
1766
+ records Flow state serially. Record the candidate outcome as \`accepted\`,
1767
+ \`modified\`, or \`rejected\`. When a candidate pass or serial/skipped decision
1768
+ materially shaped the feature, include its bounded record in
1769
+ \`flow_feature_complete.orchestrationPasses\`; keep full handoffs and long logs
1770
+ outside the runtime payload.
1771
+
1772
+ ## Validate
1773
+
1774
+ - For complex validation, regression-sensitive changes, browser QA, route QA,
1775
+ failure-prone checks, unclear coverage, exploratory QA, or
1776
+ \`validationRun\` summarization, load \`flow-test\` (helper rule applies).
1777
+ - Read \`references/validation-rubric.md\` before completing.
1778
+ - Run the strongest practical checks for the changed behavior.
1779
+ - Record concrete command names, status, and observed results. "Tests pass" is not evidence.
1780
+ - Non-final features complete with \`validationScope: "targeted"\`.
1781
+ - The final feature must run a broad project-level gate and use \`validationScope: "broad"\`.
1782
+
1783
+ For broad validation research, risky changes, or unclear coverage, start with
1784
+ \`../flow/references/parallel-orchestration.md\`. If it routes to fan-out, write
1785
+ the manifest from \`../flow/references/parallel-manifest.md\`, use the named Flow
1786
+ workers and prompt contract in \`../flow/references/parallel-execution.md\`, paste
1787
+ the matching handoff template from \`../flow/references/handoff-format.md\`, and
1788
+ apply \`../flow/references/parallel-synthesis.md\` when the handoffs return.
1789
+ They may report command output they actually ran or propose focused checks; the
1790
+ manager decides what is strong enough to record.
1791
+
1792
+ ## Review and complete
1793
+
1794
+ Before \`flow_feature_complete\`, obtain a \`featureReview\` payload. Load
1795
+ \`flow-review\`; for read-only subagent reviews, the manager receives the review
1796
+ packet and records both \`featureReviewDepth\` and \`featureReview\`.
1797
+
1798
+ Send reviewers a bounded review packet. Do not rely on the accumulated parent
1799
+ conversation. Include only:
1800
+
1801
+ - active feature id, title, summary, \`reviewDepth\`, targets, validation, and dependencies
1802
+ - relevant plan requirements, decisions, and final review policy
1803
+ - changed files and a short diff summary
1804
+ - validation evidence with exact commands, status, and observed result
1805
+ - targeted paths or risk lenses the reviewer must inspect
1806
+
1807
+ If the review returns \`status: "failed"\`, do not fix inside the review pass.
1808
+ Record the failed attempt by calling \`flow_feature_complete\` with the otherwise
1809
+ prepared completion payload, the failed \`featureReview\`, and the attempted
1810
+ \`featureReviewDepth\`; the runtime will reject completion and update the retry
1811
+ budget. Default to stopping and reporting the blocker. When the user already
1812
+ authorized autonomous implementation, make at most one repair and run one retry
1813
+ review. If the retry fails or the runtime reports review retry budget
1814
+ exhausted, stop with the blocker.
1815
+
1816
+ If \`flow_status\` reports \`setup.skills\` or \`flow-review\` cannot be loaded, do
1817
+ not record a Flow-gated \`featureReview\` or \`finalReview\`. You may perform an
1818
+ advisory review using available context or the bundled review fallback provided
1819
+ by plugin config, then complete with \`status: "needs_input"\` if review evidence
1820
+ is required to proceed.
1821
+
1822
+ For the final feature, also obtain a \`finalReview\` payload whose \`reviewDepth\` equals the approved plan's \`finalReviewPolicy\`.
1823
+
1824
+ Complete with:
1825
+
1826
+ \`\`\`json
1827
+ {
1828
+ "status": "ok",
1829
+ "featureId": "active-feature-id",
1830
+ "summary": "what changed",
1831
+ "artifactsChanged": [{ "path": "src/file.ts" }],
1832
+ "validationRun": [
1833
+ { "command": "bun test tests/foo.test.ts", "status": "passed", "summary": "3 pass, exercised foo behavior" }
1834
+ ],
1835
+ "validationScope": "targeted",
1836
+ "featureReviewDepth": "standard",
1837
+ "featureReview": { "status": "passed", "summary": "review summary", "blockingFindings": [] },
1838
+ "orchestrationPasses": [
1839
+ {
1840
+ "id": "active-feature-id-implementation-decision",
1841
+ "kind": "implementation-decision",
1842
+ "decision": "serial",
1843
+ "decisionReason": "Shared contract edits made worker ownership unsafe.",
1844
+ "candidateEligibility": "not_eligible",
1845
+ "candidateDecision": "serial_required",
1846
+ "decisionFactors": ["shared_state", "overlapping_files"],
1847
+ "writeScope": "manager-serial",
1848
+ "verificationStatus": "not-needed",
1849
+ "outcome": "accepted"
1850
+ }
1851
+ ]
1852
+ }
1853
+ \`\`\`
1854
+
1855
+ If \`flow_feature_complete\` returns a \`session.resumePacket\` or
1856
+ \`session.budget.phaseBoundary\`, stop after reporting the runtime-provided resume
1857
+ packet. If
1858
+ genuinely blocked, call \`flow_feature_complete\` with \`status: "needs_input"\` and
1859
+ an \`outcome\` that explains the blocker and next step. Never fabricate validation
1860
+ or review evidence to force progress.
1861
+ `;
1805
1862
 
1806
1863
  // skills/flow-test/SKILL.md
1807
1864
  var SKILL_default7 = `---
@@ -2087,6 +2144,22 @@ var FLOW_SKILL_DEFINITIONS = [
2087
2144
  relativePath: "references/parallel-orchestration.md",
2088
2145
  content: parallel_orchestration_default
2089
2146
  },
2147
+ {
2148
+ relativePath: "references/parallel-decision.md",
2149
+ content: parallel_decision_default
2150
+ },
2151
+ {
2152
+ relativePath: "references/parallel-manifest.md",
2153
+ content: parallel_manifest_default
2154
+ },
2155
+ {
2156
+ relativePath: "references/parallel-execution.md",
2157
+ content: parallel_execution_default
2158
+ },
2159
+ {
2160
+ relativePath: "references/parallel-synthesis.md",
2161
+ content: parallel_synthesis_default
2162
+ },
2090
2163
  {
2091
2164
  relativePath: "references/parallel-pass-example.md",
2092
2165
  content: parallel_pass_example_default
@@ -2137,6 +2210,10 @@ var FLOW_SKILL_DEFINITIONS = [
2137
2210
  name: "flow-review",
2138
2211
  files: [
2139
2212
  { relativePath: "SKILL.md", content: SKILL_default5 },
2213
+ {
2214
+ relativePath: "references/hidden-reviewer-contract.md",
2215
+ content: hidden_reviewer_contract_default
2216
+ },
2140
2217
  {
2141
2218
  relativePath: "references/review-rubric.md",
2142
2219
  content: review_rubric_default
@@ -2177,7 +2254,54 @@ var FLOW_SKILL_DEFINITIONS = [
2177
2254
  }
2178
2255
  ];
2179
2256
 
2180
- // src/config-shared.ts
2257
+ // src/prompt-baseline-fixtures.ts
2258
+ var LEGACY_WORKER_HANDOFF = "Return only the assigned Flow handoff. Cite or drop every claim, label single-source, inferred, and unsettled claims, and report blocked if the assigned scope, expected coverage, or handoff shape is missing. Empty or unstructured output is a failed handoff; return blocked with the missing elements instead.";
2259
+ var LEGACY_PROMPT_BASELINE = Object.freeze({
2260
+ publicCommandPreflight: [
2261
+ "Call `flow_status` first. If the result includes `setup.skills`, report the setup status and continue with the bundled public Flow command instructions below.",
2262
+ "If `flow_status` includes `session.resumePacket` or `session.budget.phaseBoundary`, stop the current autonomous loop and report the resume instructions unless this is a fresh user invocation explicitly resuming the session; only then may `flow_run_start` use `phaseBoundaryAck: true`.",
2263
+ "After `flow_status`, briefly state which bundled Flow command is running and for what goal, then continue.",
2264
+ "Do not call native Flow skills for `flow`, `flow-plan`, `flow-run`, or `flow-review` from public Flow commands. In bundled sections, `load` means read and use the corresponding bundled section in this command, and missing native public Flow skills are not blockers.",
2265
+ "Optional helper skills (`flow-test`, `flow-deslop`, `flow-ui-quality`, and user-triggered `flow-commit`) are not bundled fallbacks. If one is unavailable, record the coverage gap exactly as the bundled instructions require."
2266
+ ].join(" "),
2267
+ workerPrompts: Object.freeze({
2268
+ "flow-evidence-worker": `Use Flow evidence mode. Inspect only the assigned slice, do not edit files, do not call state-changing Flow tools, and return coverage, evidence inspected, confidence-tagged findings or facts, gaps, and manager follow-ups. ${LEGACY_WORKER_HANDOFF}`,
2269
+ "flow-validation-worker": `Use Flow validation mode. Run only manager-specified commands or propose focused checks, do not edit files, do not call state-changing Flow tools, and report exact command, status, raw outcome summary, coverage, confidence, gaps, and manager follow-ups. ${LEGACY_WORKER_HANDOFF}`,
2270
+ "flow-audit-worker": `Use Flow audit mode. Inspect only the assigned slice, actively refute candidate findings before reporting them, do not edit files, do not call state-changing Flow tools, and return coverage, evidence, guards checked, confidence, gaps, and manager follow-ups. ${LEGACY_WORKER_HANDOFF}`,
2271
+ "flow-candidate-worker": `Use Flow candidate-implementation mode only when the manager assigned an isolated worktree or exact non-overlapping path ownership. Do not edit .flow/**, do not call state-changing Flow tools, do not complete Flow state, and return changed or proposed patch, verification run, coverage, confidence, merge risks, and manager follow-ups. ${LEGACY_WORKER_HANDOFF}`,
2272
+ "flow-verifier-worker": `Use Flow verifier mode. Verify only the assigned claims against the provided sources, commands, counts, or current docs. Do not generate new scope, do not edit files, do not call state-changing Flow tools, and return supported, partly-supported, unsupported, or source-not-found per claim with evidence, confidence, gaps, and manager follow-ups. ${LEGACY_WORKER_HANDOFF}`
2273
+ }),
2274
+ reviewerSections: Object.freeze([
2275
+ "Use Flow review mode. Call `flow_status` first. Do not call the native skill tool for `flow-review`; the canonical Flow review instructions and rubric are already embedded below. If Flow setup reports stale/unavailable skills, continue as advisory review only and do not present advisory review as Flow-gated `featureReview` or `finalReview` evidence.",
2276
+ "Prefer the manager's bounded review packet over the accumulated root transcript. Return feature review packets with `featureReviewDepth` plus `featureReview`; final reviews still return `finalReview` with `reviewDepth`.",
2277
+ `When the manager assigns a parallel review slice instead of a direct Flow review command, ${LEGACY_WORKER_HANDOFF}`,
2278
+ "## Bundled Flow review instructions"
2279
+ ])
2280
+ });
2281
+
2282
+ // src/prompt-surfaces.ts
2283
+ var MANAGER_ROLE = ["manager"];
2284
+ var REVIEWER_ROLE = ["reviewer"];
2285
+ var SURFACE_ROLES = {
2286
+ "flow-auto": "manager",
2287
+ "flow-plan": "manager",
2288
+ "flow-run": "manager",
2289
+ "flow-review": "reviewer",
2290
+ "flow-status": "manager",
2291
+ "flow-reviewer": "reviewer",
2292
+ "flow-evidence-worker": "evidence-worker",
2293
+ "flow-validation-worker": "validation-worker",
2294
+ "flow-audit-worker": "audit-worker",
2295
+ "flow-candidate-worker": "candidate-worker",
2296
+ "flow-verifier-worker": "verifier-worker"
2297
+ };
2298
+ var COMMAND_ACTIONS = {
2299
+ "flow-auto": "Drive the Flow loop until completion or a real blocker: $ARGUMENTS",
2300
+ "flow-plan": "Create or revise the Flow plan for: $ARGUMENTS",
2301
+ "flow-run": "Execute the next approved feature. $ARGUMENTS",
2302
+ "flow-review": "Review the assigned work: $ARGUMENTS",
2303
+ "flow-status": "Call flow_status and report the session state and next action."
2304
+ };
2181
2305
  function flowSkillFileContent(skillName, relativePath) {
2182
2306
  const definition = FLOW_SKILL_DEFINITIONS.find((candidate) => candidate.name === skillName);
2183
2307
  const file = definition?.files.find((candidate) => candidate.relativePath === relativePath);
@@ -2186,91 +2310,693 @@ function flowSkillFileContent(skillName, relativePath) {
2186
2310
  }
2187
2311
  return file.content;
2188
2312
  }
2189
- function bundledFlowInstructions(sections) {
2190
- return sections.map(([skillName, relativePath]) => `## Bundled ${skillName}/${relativePath}
2313
+ function markdownSection(content, heading) {
2314
+ const lines = content.replace(/\r\n/g, `
2315
+ `).split(`
2316
+ `);
2317
+ const start = lines.indexOf(`## ${heading}`);
2318
+ if (start === -1)
2319
+ throw new Error(`Missing markdown section '${heading}'.`);
2320
+ let end = lines.length;
2321
+ for (let index = start + 1;index < lines.length; index += 1) {
2322
+ if (/^## /.test(lines[index] ?? "")) {
2323
+ end = index;
2324
+ break;
2325
+ }
2326
+ }
2327
+ return lines.slice(start, end).join(`
2328
+ `).trim();
2329
+ }
2330
+ function sourceFragment(options) {
2331
+ const content = flowSkillFileContent(options.skill, options.path);
2332
+ const source = `${options.skill}/${options.path}`;
2333
+ return {
2334
+ id: options.id,
2335
+ source: `skills/${source}#${options.headings.join(", #")}`,
2336
+ origin: "skill-source",
2337
+ kind: options.kind ?? "reference",
2338
+ roles: options.roles ?? MANAGER_ROLE,
2339
+ ...options.conditional === undefined ? {} : { conditional: options.conditional },
2340
+ text: [
2341
+ `## Bundled ${source} (selected sections)`,
2342
+ ...options.headings.map((heading) => markdownSection(content, heading))
2343
+ ].join(`
2344
+
2345
+ `)
2346
+ };
2347
+ }
2348
+ function wholeSourceFragment(options) {
2349
+ const source = `${options.skill}/${options.path}`;
2350
+ return {
2351
+ id: options.id,
2352
+ source: `skills/${source}`,
2353
+ origin: "skill-source",
2354
+ kind: "reference",
2355
+ roles: options.roles,
2356
+ ...options.conditional === undefined ? {} : { conditional: options.conditional },
2357
+ text: `## Bundled ${source}
2358
+
2359
+ ${flowSkillFileContent(options.skill, options.path)}`
2360
+ };
2361
+ }
2362
+ function markedPromptBlock(content, marker) {
2363
+ const startMarker = `<!-- flow-prompt:${marker}:start -->`;
2364
+ const endMarker = `<!-- flow-prompt:${marker}:end -->`;
2365
+ const start = content.indexOf(startMarker);
2366
+ const end = content.indexOf(endMarker);
2367
+ if (start === -1 || end === -1 || end <= start) {
2368
+ throw new Error(`Missing or invalid Flow prompt marker '${marker}'.`);
2369
+ }
2370
+ if (content.indexOf(startMarker, start + startMarker.length) !== -1 || content.indexOf(endMarker, end + endMarker.length) !== -1) {
2371
+ throw new Error(`Duplicate Flow prompt marker '${marker}'.`);
2372
+ }
2373
+ return content.slice(start + startMarker.length, end).trim();
2374
+ }
2375
+ function markedSourceFragment(options) {
2376
+ return {
2377
+ id: options.id,
2378
+ source: `skills/${options.skill}/${options.path}#flow-prompt:${options.marker}`,
2379
+ origin: "skill-source",
2380
+ kind: options.kind,
2381
+ roles: options.roles,
2382
+ ...options.conditional === undefined ? {} : { conditional: options.conditional },
2383
+ text: markedPromptBlock(flowSkillFileContent(options.skill, options.path), options.marker)
2384
+ };
2385
+ }
2386
+ function literalFragment(options) {
2387
+ return { ...options, origin: "compiler" };
2388
+ }
2389
+ var BASELINE_COMMAND_SOURCES = {
2390
+ "flow-auto": [
2391
+ ["flow", "SKILL.md"],
2392
+ ["flow", "references/recovery-playbook.md"],
2393
+ ["flow", "references/parallel-orchestration.md"],
2394
+ ["flow", "references/parallel-decision.md"],
2395
+ ["flow", "references/parallel-manifest.md"],
2396
+ ["flow", "references/parallel-execution.md"],
2397
+ ["flow", "references/parallel-synthesis.md"],
2398
+ ["flow", "references/handoff-format.md"],
2399
+ ["flow-plan", "SKILL.md"],
2400
+ ["flow-plan", "references/planning-examples.md"],
2401
+ ["flow-plan", "references/plan-quality-checklist.md"],
2402
+ ["flow-plan", "references/parallel-discovery.md"],
2403
+ ["flow-run", "SKILL.md"],
2404
+ ["flow-run", "references/validation-rubric.md"],
2405
+ ["flow-run", "references/audit-rubric.md"],
2406
+ ["flow-review", "SKILL.md"],
2407
+ ["flow-review", "references/review-rubric.md"]
2408
+ ],
2409
+ "flow-plan": [
2410
+ ["flow-plan", "SKILL.md"],
2411
+ ["flow-plan", "references/planning-examples.md"],
2412
+ ["flow-plan", "references/plan-quality-checklist.md"],
2413
+ ["flow-plan", "references/parallel-discovery.md"],
2414
+ ["flow", "references/parallel-orchestration.md"],
2415
+ ["flow", "references/parallel-decision.md"],
2416
+ ["flow", "references/parallel-manifest.md"],
2417
+ ["flow", "references/parallel-execution.md"],
2418
+ ["flow", "references/parallel-synthesis.md"],
2419
+ ["flow", "references/handoff-format.md"]
2420
+ ],
2421
+ "flow-run": [
2422
+ ["flow-run", "SKILL.md"],
2423
+ ["flow-run", "references/validation-rubric.md"],
2424
+ ["flow-run", "references/audit-rubric.md"],
2425
+ ["flow", "references/parallel-orchestration.md"],
2426
+ ["flow", "references/parallel-decision.md"],
2427
+ ["flow", "references/parallel-manifest.md"],
2428
+ ["flow", "references/parallel-execution.md"],
2429
+ ["flow", "references/parallel-synthesis.md"],
2430
+ ["flow", "references/handoff-format.md"],
2431
+ ["flow-review", "SKILL.md"],
2432
+ ["flow-review", "references/review-rubric.md"]
2433
+ ],
2434
+ "flow-review": [
2435
+ ["flow-review", "SKILL.md"],
2436
+ ["flow-review", "references/review-rubric.md"],
2437
+ ["flow-run", "references/audit-rubric.md"]
2438
+ ]
2439
+ };
2440
+ var MANAGER_OPENINGS = {
2441
+ "flow-auto": [
2442
+ "# Flow auto command contract",
2443
+ "",
2444
+ "Purpose: manage the approved Flow lifecycle from planning through validated, independently reviewed completion.",
2445
+ "",
2446
+ "Non-negotiable invariants:",
2447
+ "- Call `flow_status` first and trust its state and `nextAction` over conversation memory.",
2448
+ "- Only the root manager may call state-changing `flow_*` tools or synthesize final results.",
2449
+ "- Approved plans are immutable, only one feature may be active, and completion requires real validation plus independent review evidence.",
2450
+ "- A phase boundary ends the current root session; acknowledge it only in a fresh invocation explicitly resuming the session."
2451
+ ].join(`
2452
+ `),
2453
+ "flow-plan": [
2454
+ "# Flow plan command contract",
2455
+ "",
2456
+ "Purpose: produce an evidence-backed, executable Flow plan without beginning implementation.",
2457
+ "",
2458
+ "Non-negotiable invariants:",
2459
+ "- Call `flow_status` first and trust its state and `nextAction` over conversation memory.",
2460
+ "- Only the root manager may call state-changing `flow_*` tools.",
2461
+ "- Inspect environment facts before decomposing; do not invent findings.",
2462
+ "- Save a complete draft before approval, and approve only with explicit user approval or prior autonomous authorization."
2463
+ ].join(`
2464
+ `),
2465
+ "flow-run": [
2466
+ "# Flow run command contract",
2467
+ "",
2468
+ "Purpose: execute exactly one approved Flow feature and record honest completion or a real blocker.",
2469
+ "",
2470
+ "Non-negotiable invariants:",
2471
+ "- Call `flow_status` first and trust its state and `nextAction` over conversation memory.",
2472
+ "- Only the root manager may call state-changing `flow_*` tools or synthesize final results.",
2473
+ "- Keep edits within the active feature and preserve unrelated user changes.",
2474
+ "- Completion requires passing validation and an independent review at least as deep as the approved plan requires."
2475
+ ].join(`
2476
+ `)
2477
+ };
2478
+ var PUBLIC_COMMAND_SETUP = literalFragment({
2479
+ id: "public-command.setup-and-resume",
2480
+ source: "src/prompt-surfaces.ts#PUBLIC_COMMAND_SETUP",
2481
+ kind: "procedure",
2482
+ roles: MANAGER_ROLE,
2483
+ text: [
2484
+ "## Public command startup",
2485
+ "",
2486
+ "If `flow_status` reports `setup.skills`, report it and continue with the compiled core instructions in this command. The compiled sections are the public command's core Flow contract: references inside them to loading `flow`, `flow-plan`, `flow-run`, or `flow-review` mean use the matching compiled section, not a native skill call. A missing optional helper becomes an explicit coverage gap, never simulated coverage.",
2487
+ "",
2488
+ "If status includes `session.resumePacket` or `session.budget.phaseBoundary`, stop and report its resume instructions unless this fresh user invocation explicitly resumes that session. Only that fresh invocation may pass `phaseBoundaryAck: true` to `flow_run_start`."
2489
+ ].join(`
2490
+ `)
2491
+ });
2492
+ var MANAGER_PARALLEL_CORE = markedSourceFragment({
2493
+ id: "manager.parallel-pass-core",
2494
+ skill: "flow",
2495
+ path: "references/parallel-decision.md",
2496
+ marker: "manager-parallel-core",
2497
+ kind: "procedure",
2498
+ roles: MANAGER_ROLE,
2499
+ conditional: true
2500
+ });
2501
+ var PUBLIC_REVIEWER_ROUTE = literalFragment({
2502
+ id: "public-command.reviewer-route",
2503
+ source: "src/prompt-surfaces.ts#PUBLIC_REVIEWER_ROUTE",
2504
+ kind: "procedure",
2505
+ roles: MANAGER_ROLE,
2506
+ text: [
2507
+ "## Public reviewer routing",
2508
+ "",
2509
+ "When a compiled source section says to load `flow-review`, route the bounded review packet to the reserved `flow-reviewer`; do not invoke a native core skill or perform the independent review in manager context."
2510
+ ].join(`
2511
+ `)
2512
+ });
2513
+ var SURFACE_SPECIFIC_COMMAND_FRAGMENTS = {
2514
+ "flow-auto": [
2515
+ PUBLIC_COMMAND_SETUP,
2516
+ sourceFragment({
2517
+ id: "manager.flow-loop",
2518
+ skill: "flow",
2519
+ path: "SKILL.md",
2520
+ headings: [
2521
+ "Loop",
2522
+ "Skill Availability",
2523
+ "Runtime Surface",
2524
+ "Hard Gates",
2525
+ "Recovery"
2526
+ ]
2527
+ }),
2528
+ sourceFragment({
2529
+ id: "manager.plan-core",
2530
+ skill: "flow-plan",
2531
+ path: "SKILL.md",
2532
+ headings: [
2533
+ "Planning runtime availability",
2534
+ "Inspect first",
2535
+ "Reduce uncertainty before decomposing",
2536
+ "Plan shape",
2537
+ "Plan quality gate",
2538
+ "Feature sizing",
2539
+ "Approval"
2540
+ ]
2541
+ }),
2542
+ sourceFragment({
2543
+ id: "manager.plan-quality-checklist",
2544
+ skill: "flow-plan",
2545
+ path: "references/plan-quality-checklist.md",
2546
+ headings: ["Must pass", "Revise when you see this", "Approval summary"]
2547
+ }),
2548
+ sourceFragment({
2549
+ id: "manager.run-core",
2550
+ skill: "flow-run",
2551
+ path: "SKILL.md",
2552
+ headings: [
2553
+ "Execution runtime availability",
2554
+ "Start",
2555
+ "Implement",
2556
+ "Candidate implementation",
2557
+ "Validate",
2558
+ "Review and complete"
2559
+ ]
2560
+ }),
2561
+ sourceFragment({
2562
+ id: "manager.validation-rubric",
2563
+ skill: "flow-run",
2564
+ path: "references/validation-rubric.md",
2565
+ headings: [
2566
+ "Evidence tiers",
2567
+ "Recording rules",
2568
+ "Scope",
2569
+ "Blockers and resets"
2570
+ ]
2571
+ }),
2572
+ MANAGER_PARALLEL_CORE,
2573
+ PUBLIC_REVIEWER_ROUTE
2574
+ ],
2575
+ "flow-plan": [
2576
+ PUBLIC_COMMAND_SETUP,
2577
+ sourceFragment({
2578
+ id: "manager.plan-core",
2579
+ skill: "flow-plan",
2580
+ path: "SKILL.md",
2581
+ headings: [
2582
+ "Planning runtime availability",
2583
+ "Inspect first",
2584
+ "Reduce uncertainty before decomposing",
2585
+ "Plan shape",
2586
+ "Plan quality gate",
2587
+ "Feature sizing",
2588
+ "Approval"
2589
+ ]
2590
+ }),
2591
+ sourceFragment({
2592
+ id: "manager.plan-quality-checklist",
2593
+ skill: "flow-plan",
2594
+ path: "references/plan-quality-checklist.md",
2595
+ headings: ["Must pass", "Revise when you see this", "Approval summary"]
2596
+ }),
2597
+ MANAGER_PARALLEL_CORE
2598
+ ],
2599
+ "flow-run": [
2600
+ PUBLIC_COMMAND_SETUP,
2601
+ sourceFragment({
2602
+ id: "manager.run-core",
2603
+ skill: "flow-run",
2604
+ path: "SKILL.md",
2605
+ headings: [
2606
+ "Execution runtime availability",
2607
+ "Start",
2608
+ "Implement",
2609
+ "Candidate implementation",
2610
+ "Validate",
2611
+ "Review and complete"
2612
+ ]
2613
+ }),
2614
+ sourceFragment({
2615
+ id: "manager.validation-rubric",
2616
+ skill: "flow-run",
2617
+ path: "references/validation-rubric.md",
2618
+ headings: [
2619
+ "Evidence tiers",
2620
+ "Recording rules",
2621
+ "Scope",
2622
+ "Blockers and resets"
2623
+ ]
2624
+ }),
2625
+ MANAGER_PARALLEL_CORE,
2626
+ PUBLIC_REVIEWER_ROUTE
2627
+ ]
2628
+ };
2629
+ var MANAGER_CHECKPOINTS = {
2630
+ "flow-auto": "Before stopping: confirm the runtime state matches the report; every completed feature has real validation and independent review evidence; the final feature has broad validation and final review; otherwise report the exact blocker or resume packet.",
2631
+ "flow-plan": "Before returning: confirm the plan is evidence-backed, executable by another agent, explicit about requirements/decisions/targets/validation/dependencies/review depth, saved as a draft, and not approved without authorization.",
2632
+ "flow-run": "Before completion: confirm scope stayed within the active feature, commands and observed results are exact, review is independent and deep enough, no blocking finding remains unresolved, and the runtime—not prose—accepted the completion payload."
2633
+ };
2634
+ var REVIEW_INVOCATION_FRAGMENT = literalFragment({
2635
+ id: "reviewer.command-invocation",
2636
+ source: "src/prompt-surfaces.ts#REVIEW_INVOCATION_FRAGMENT",
2637
+ kind: "purpose",
2638
+ roles: REVIEWER_ROLE,
2639
+ text: [
2640
+ "# Flow review request",
2641
+ "",
2642
+ "Call `flow_status` first when available, then review the assigned packet and actual changed artifacts under the `flow-reviewer` contract. Prefer the bounded packet over parent-session memory. If setup or required evidence is stale or unavailable, return an advisory result and state why it cannot be used as Flow-gated review evidence."
2643
+ ].join(`
2644
+ `)
2645
+ });
2646
+ var WORKER_INTEGRITY = markedSourceFragment({
2647
+ id: "worker.handoff-integrity",
2648
+ skill: "flow",
2649
+ path: "references/handoff-format.md",
2650
+ marker: "worker-integrity",
2651
+ kind: "invariant",
2652
+ roles: [
2653
+ "reviewer",
2654
+ "evidence-worker",
2655
+ "validation-worker",
2656
+ "audit-worker",
2657
+ "candidate-worker",
2658
+ "verifier-worker"
2659
+ ]
2660
+ });
2661
+ var EVIDENCE_HANDOFF_SCHEMA = markedSourceFragment({
2662
+ id: "handoff.evidence-schema",
2663
+ skill: "flow",
2664
+ path: "references/handoff-format.md",
2665
+ marker: "handoff-evidence",
2666
+ kind: "schema",
2667
+ roles: ["evidence-worker"]
2668
+ });
2669
+ var VALIDATION_HANDOFF_SCHEMA = markedSourceFragment({
2670
+ id: "handoff.validation-schema",
2671
+ skill: "flow",
2672
+ path: "references/handoff-format.md",
2673
+ marker: "handoff-validation",
2674
+ kind: "schema",
2675
+ roles: ["validation-worker"]
2676
+ });
2677
+ var AUDIT_HANDOFF_SCHEMA = markedSourceFragment({
2678
+ id: "handoff.audit-schema",
2679
+ skill: "flow",
2680
+ path: "references/handoff-format.md",
2681
+ marker: "handoff-audit",
2682
+ kind: "schema",
2683
+ roles: ["audit-worker"]
2684
+ });
2685
+ var REVIEW_SLICE_HANDOFF_SCHEMA = markedSourceFragment({
2686
+ id: "handoff.review-slice-schema",
2687
+ skill: "flow",
2688
+ path: "references/handoff-format.md",
2689
+ marker: "handoff-review-slice",
2690
+ kind: "schema",
2691
+ roles: ["reviewer"]
2692
+ });
2693
+ var VERIFIER_HANDOFF_SCHEMA = markedSourceFragment({
2694
+ id: "handoff.verifier-schema",
2695
+ skill: "flow",
2696
+ path: "references/handoff-format.md",
2697
+ marker: "handoff-verifier",
2698
+ kind: "schema",
2699
+ roles: ["verifier-worker"]
2700
+ });
2701
+ var CANDIDATE_HANDOFF_SCHEMA = markedSourceFragment({
2702
+ id: "handoff.candidate-schema",
2703
+ skill: "flow",
2704
+ path: "references/handoff-format.md",
2705
+ marker: "handoff-candidate",
2706
+ kind: "schema",
2707
+ roles: ["candidate-worker"]
2708
+ });
2709
+ var REVIEWER_FRAGMENTS = [
2710
+ sourceFragment({
2711
+ id: "reviewer.hidden-core",
2712
+ skill: "flow-review",
2713
+ path: "references/hidden-reviewer-contract.md",
2714
+ headings: [
2715
+ "Role and availability",
2716
+ "Feature review depths",
2717
+ "Direct review outputs",
2718
+ "Special-case evidence",
2719
+ "Completion checkpoint"
2720
+ ],
2721
+ kind: "purpose",
2722
+ roles: REVIEWER_ROLE
2723
+ }),
2724
+ sourceFragment({
2725
+ id: "reviewer.review-rubric",
2726
+ skill: "flow-review",
2727
+ path: "references/review-rubric.md",
2728
+ headings: [
2729
+ "Finding classes",
2730
+ "Severity",
2731
+ "Feature review checklist",
2732
+ "Final review checklist",
2733
+ "Final convergence scan",
2734
+ "Payloads",
2735
+ "Audit report reviews"
2736
+ ],
2737
+ roles: REVIEWER_ROLE
2738
+ }),
2739
+ REVIEW_SLICE_HANDOFF_SCHEMA,
2740
+ WORKER_INTEGRITY
2741
+ ];
2742
+ function workerRoleFragment(options) {
2743
+ return markedSourceFragment({
2744
+ id: options.id,
2745
+ skill: "flow",
2746
+ path: "references/parallel-execution.md",
2747
+ marker: options.marker,
2748
+ kind: "purpose",
2749
+ roles: [options.role]
2750
+ });
2751
+ }
2752
+ var EVIDENCE_WORKER_ROLE = workerRoleFragment({
2753
+ id: "evidence-worker.role-contract",
2754
+ marker: "worker-role-evidence",
2755
+ role: "evidence-worker"
2756
+ });
2757
+ var VALIDATION_WORKER_ROLE = workerRoleFragment({
2758
+ id: "validation-worker.role-contract",
2759
+ marker: "worker-role-validation",
2760
+ role: "validation-worker"
2761
+ });
2762
+ var AUDIT_WORKER_ROLE = workerRoleFragment({
2763
+ id: "audit-worker.role-contract",
2764
+ marker: "worker-role-audit",
2765
+ role: "audit-worker"
2766
+ });
2767
+ var CANDIDATE_WORKER_ROLE = workerRoleFragment({
2768
+ id: "candidate-worker.role-contract",
2769
+ marker: "worker-role-candidate",
2770
+ role: "candidate-worker"
2771
+ });
2772
+ var VERIFIER_WORKER_ROLE = workerRoleFragment({
2773
+ id: "verifier-worker.role-contract",
2774
+ marker: "worker-role-verifier",
2775
+ role: "verifier-worker"
2776
+ });
2777
+ var WORKER_FRAGMENTS = {
2778
+ "flow-evidence-worker": [
2779
+ EVIDENCE_WORKER_ROLE,
2780
+ EVIDENCE_HANDOFF_SCHEMA,
2781
+ WORKER_INTEGRITY
2782
+ ],
2783
+ "flow-validation-worker": [
2784
+ VALIDATION_WORKER_ROLE,
2785
+ VALIDATION_HANDOFF_SCHEMA,
2786
+ WORKER_INTEGRITY
2787
+ ],
2788
+ "flow-audit-worker": [
2789
+ AUDIT_WORKER_ROLE,
2790
+ AUDIT_HANDOFF_SCHEMA,
2791
+ WORKER_INTEGRITY
2792
+ ],
2793
+ "flow-candidate-worker": [
2794
+ CANDIDATE_WORKER_ROLE,
2795
+ CANDIDATE_HANDOFF_SCHEMA,
2796
+ WORKER_INTEGRITY
2797
+ ],
2798
+ "flow-verifier-worker": [
2799
+ VERIFIER_WORKER_ROLE,
2800
+ VERIFIER_HANDOFF_SCHEMA,
2801
+ WORKER_INTEGRITY
2802
+ ]
2803
+ };
2804
+ function assertUniqueFragmentIds(surface, fragments) {
2805
+ const seen = new Set;
2806
+ for (const fragment of fragments) {
2807
+ if (seen.has(fragment.id)) {
2808
+ throw new Error(`Prompt surface '${surface}' includes duplicate canonical fragment id '${fragment.id}'.`);
2809
+ }
2810
+ seen.add(fragment.id);
2811
+ }
2812
+ }
2813
+ function renderFragments(fragments) {
2814
+ return fragments.map((fragment) => fragment.text.trim()).join(`
2191
2815
 
2192
- ${flowSkillFileContent(skillName, relativePath)}`).join(`
2816
+ `);
2817
+ }
2818
+ function deduplicateExactParagraphs(text) {
2819
+ const seen = new Set;
2820
+ return text.split(/\n{2,}/).filter((paragraph) => {
2821
+ const key = paragraph.trim().replace(/\s+/g, " ").toLowerCase();
2822
+ if (!key || seen.has(key))
2823
+ return false;
2824
+ seen.add(key);
2825
+ return true;
2826
+ }).join(`
2193
2827
 
2194
2828
  `);
2195
2829
  }
2196
- var FLOW_REVIEW_BUNDLED_INSTRUCTIONS = bundledFlowInstructions([
2197
- ["flow-review", "SKILL.md"],
2198
- ["flow-review", "references/review-rubric.md"],
2199
- ["flow-run", "references/audit-rubric.md"]
2200
- ]);
2201
- var FLOW_PLAN_BUNDLED_INSTRUCTIONS = bundledFlowInstructions([
2202
- ["flow-plan", "SKILL.md"],
2203
- ["flow-plan", "references/planning-examples.md"],
2204
- ["flow-plan", "references/plan-quality-checklist.md"],
2205
- ["flow-plan", "references/parallel-discovery.md"],
2206
- ["flow", "references/parallel-orchestration.md"],
2207
- ["flow", "references/handoff-format.md"]
2208
- ]);
2209
- var FLOW_RUN_BUNDLED_INSTRUCTIONS = bundledFlowInstructions([
2210
- ["flow-run", "SKILL.md"],
2211
- ["flow-run", "references/validation-rubric.md"],
2212
- ["flow-run", "references/audit-rubric.md"],
2213
- ["flow", "references/parallel-orchestration.md"],
2214
- ["flow", "references/handoff-format.md"],
2215
- ["flow-review", "SKILL.md"],
2216
- ["flow-review", "references/review-rubric.md"]
2217
- ]);
2218
- var FLOW_AUTO_BUNDLED_INSTRUCTIONS = bundledFlowInstructions([
2219
- ["flow", "SKILL.md"],
2220
- ["flow", "references/recovery-playbook.md"],
2221
- ["flow", "references/parallel-orchestration.md"],
2222
- ["flow", "references/handoff-format.md"],
2223
- ["flow-plan", "SKILL.md"],
2224
- ["flow-plan", "references/planning-examples.md"],
2225
- ["flow-plan", "references/plan-quality-checklist.md"],
2226
- ["flow-plan", "references/parallel-discovery.md"],
2227
- ["flow-run", "SKILL.md"],
2228
- ["flow-run", "references/validation-rubric.md"],
2229
- ["flow-run", "references/audit-rubric.md"],
2230
- ["flow-review", "SKILL.md"],
2231
- ["flow-review", "references/review-rubric.md"]
2232
- ]);
2233
- var FLOW_SELF_CONTAINED_COMMAND_PREFLIGHT = [
2234
- "Call `flow_status` first. If the result includes `setup.skills`, report the setup status and continue with the bundled public Flow command instructions below.",
2235
- "If `flow_status` includes `session.resumePacket` or `session.budget.phaseBoundary`, stop the current autonomous loop and report the resume instructions unless this is a fresh user invocation explicitly resuming the session; only then may `flow_run_start` use `phaseBoundaryAck: true`.",
2236
- "After `flow_status`, briefly state which bundled Flow command is running and for what goal, then continue.",
2237
- "Do not call native Flow skills for `flow`, `flow-plan`, `flow-run`, or `flow-review` from public Flow commands. In bundled sections, `load` means read and use the corresponding bundled section in this command, and missing native public Flow skills are not blockers.",
2238
- "Optional helper skills (`flow-test`, `flow-deslop`, `flow-ui-quality`, and user-triggered `flow-commit`) are not bundled fallbacks. If one is unavailable, record the coverage gap exactly as the bundled instructions require."
2239
- ].join(" ");
2240
- function flowBundledCommandTemplate(commandLabel, action, bundledInstructions) {
2241
- return [
2242
- FLOW_SELF_CONTAINED_COMMAND_PREFLIGHT,
2243
- `Run the bundled ${commandLabel} instructions below. ${action}`,
2830
+ function compileBaselineCommand(surface) {
2831
+ const fragments = BASELINE_COMMAND_SOURCES[surface].map(([skill, path], index) => wholeSourceFragment({
2832
+ id: `baseline.${surface}.${index}.${skill}.${path}`,
2833
+ skill,
2834
+ path,
2835
+ roles: MANAGER_ROLE,
2836
+ conditional: path.includes("parallel") || path.includes("handoff") || path.includes("example") || path.includes("recovery")
2837
+ }));
2838
+ const text = [
2839
+ LEGACY_PROMPT_BASELINE.publicCommandPreflight,
2840
+ `Run the bundled ${surface} instructions below. ${COMMAND_ACTIONS[surface]}`,
2244
2841
  "",
2245
- bundledInstructions
2842
+ renderFragments(fragments)
2246
2843
  ].join(`
2247
2844
 
2248
2845
  `);
2846
+ return {
2847
+ surface,
2848
+ variant: "baseline",
2849
+ role: surface === "flow-review" ? "reviewer" : "manager",
2850
+ text,
2851
+ fragments
2852
+ };
2249
2853
  }
2250
- var FLOW_AUTO_COMMAND_TEMPLATE = flowBundledCommandTemplate("Flow auto", "Drive the Flow loop until completion or a real blocker: $ARGUMENTS", FLOW_AUTO_BUNDLED_INSTRUCTIONS);
2251
- var FLOW_PLAN_COMMAND_TEMPLATE = flowBundledCommandTemplate("Flow plan", "Plan: $ARGUMENTS", FLOW_PLAN_BUNDLED_INSTRUCTIONS);
2252
- var FLOW_RUN_COMMAND_TEMPLATE = flowBundledCommandTemplate("Flow run", "Execute the next approved feature. $ARGUMENTS", FLOW_RUN_BUNDLED_INSTRUCTIONS);
2253
- var FLOW_REVIEW_COMMAND_TEMPLATE = flowBundledCommandTemplate("Flow review", "Review: $ARGUMENTS", FLOW_REVIEW_BUNDLED_INSTRUCTIONS);
2254
- var FLOW_REVIEW_AGENT_INSTRUCTIONS = [
2255
- "Use Flow review mode. Call `flow_status` first. Do not call the native skill tool for `flow-review`; the canonical Flow review instructions and rubric are already embedded below. If Flow setup reports stale/unavailable skills, continue as advisory review only and do not present advisory review as Flow-gated `featureReview` or `finalReview` evidence.",
2256
- "Prefer the manager's compact review packet over the accumulated root transcript. Return feature review packets with `featureReviewDepth` plus `featureReview`; final reviews still return `finalReview` with `reviewDepth`.",
2257
- "When the manager assigns a parallel review slice instead of a direct Flow review command, cite or drop every claim, label single-source, inferred, and unsettled claims, and return only the assigned Flow handoff. Report blocked if the assigned scope, expected coverage, or handoff shape is missing. Empty or unstructured output is a failed handoff; return blocked with the missing elements instead.",
2258
- "",
2259
- "## Bundled Flow review instructions",
2260
- "",
2261
- FLOW_REVIEW_BUNDLED_INSTRUCTIONS
2262
- ].join(`
2854
+ function compileBaselineWorker(surface) {
2855
+ if (surface === "flow-reviewer") {
2856
+ const reviewBundle = BASELINE_COMMAND_SOURCES["flow-review"].map(([skill, path], index) => wholeSourceFragment({
2857
+ id: `baseline.flow-reviewer.${index}.${skill}.${path}`,
2858
+ skill,
2859
+ path,
2860
+ roles: REVIEWER_ROLE
2861
+ }));
2862
+ return {
2863
+ surface,
2864
+ variant: "baseline",
2865
+ role: "reviewer",
2866
+ fragments: reviewBundle,
2867
+ text: [
2868
+ ...LEGACY_PROMPT_BASELINE.reviewerSections,
2869
+ renderFragments(reviewBundle)
2870
+ ].join(`
2263
2871
 
2264
- `);
2265
- var FLOW_STATUS_COMMAND_TEMPLATE = "Call flow_status and report the session state and next action.";
2872
+ `)
2873
+ };
2874
+ }
2875
+ const text = LEGACY_PROMPT_BASELINE.workerPrompts[surface];
2876
+ if (!text)
2877
+ throw new Error(`No baseline worker prompt for '${surface}'.`);
2878
+ return {
2879
+ surface,
2880
+ variant: "baseline",
2881
+ role: SURFACE_ROLES[surface],
2882
+ text,
2883
+ fragments: []
2884
+ };
2885
+ }
2886
+ function compileSurfaceSpecific(surface, bookended) {
2887
+ if (surface === "flow-status") {
2888
+ return {
2889
+ surface,
2890
+ variant: bookended ? "surface-specific-bookended" : "surface-specific",
2891
+ role: "manager",
2892
+ text: COMMAND_ACTIONS["flow-status"],
2893
+ fragments: []
2894
+ };
2895
+ }
2896
+ if (surface === "flow-review") {
2897
+ const fragments2 = [REVIEW_INVOCATION_FRAGMENT];
2898
+ return {
2899
+ surface,
2900
+ variant: bookended ? "surface-specific-bookended" : "surface-specific",
2901
+ role: "reviewer",
2902
+ text: `${renderFragments(fragments2)}
2903
+
2904
+ ${COMMAND_ACTIONS[surface]}`,
2905
+ fragments: fragments2
2906
+ };
2907
+ }
2908
+ if (surface === "flow-reviewer") {
2909
+ assertUniqueFragmentIds(surface, REVIEWER_FRAGMENTS);
2910
+ return {
2911
+ surface,
2912
+ variant: bookended ? "surface-specific-bookended" : "surface-specific",
2913
+ role: "reviewer",
2914
+ text: renderFragments(REVIEWER_FRAGMENTS),
2915
+ fragments: REVIEWER_FRAGMENTS
2916
+ };
2917
+ }
2918
+ if (surface in WORKER_FRAGMENTS) {
2919
+ const fragments2 = WORKER_FRAGMENTS[surface];
2920
+ assertUniqueFragmentIds(surface, fragments2);
2921
+ return {
2922
+ surface,
2923
+ variant: bookended ? "surface-specific-bookended" : "surface-specific",
2924
+ role: SURFACE_ROLES[surface],
2925
+ text: renderFragments(fragments2),
2926
+ fragments: fragments2
2927
+ };
2928
+ }
2929
+ const command = surface;
2930
+ const coreFragments = SURFACE_SPECIFIC_COMMAND_FRAGMENTS[command];
2931
+ const action = literalFragment({
2932
+ id: `${surface}.action`,
2933
+ source: "src/prompt-surfaces.ts#COMMAND_ACTIONS",
2934
+ kind: "purpose",
2935
+ roles: MANAGER_ROLE,
2936
+ text: COMMAND_ACTIONS[command]
2937
+ });
2938
+ const opening = literalFragment({
2939
+ id: `${surface}.critical-opening`,
2940
+ source: "src/prompt-surfaces.ts#MANAGER_OPENINGS",
2941
+ kind: "invariant",
2942
+ roles: MANAGER_ROLE,
2943
+ text: MANAGER_OPENINGS[command]
2944
+ });
2945
+ const checkpoint = literalFragment({
2946
+ id: `${surface}.completion-checkpoint`,
2947
+ source: "src/prompt-surfaces.ts#MANAGER_CHECKPOINTS",
2948
+ kind: "checkpoint",
2949
+ roles: MANAGER_ROLE,
2950
+ text: `## Completion checkpoint
2951
+
2952
+ ${MANAGER_CHECKPOINTS[command]}`
2953
+ });
2954
+ const fragments = bookended ? [opening, action, ...coreFragments, checkpoint] : [action, ...coreFragments];
2955
+ assertUniqueFragmentIds(surface, fragments);
2956
+ return {
2957
+ surface,
2958
+ variant: bookended ? "surface-specific-bookended" : "surface-specific",
2959
+ role: "manager",
2960
+ text: renderFragments(fragments),
2961
+ fragments
2962
+ };
2963
+ }
2964
+ function compileFlowPromptSurface(surface, variant = "surface-specific-bookended") {
2965
+ if (variant === "baseline" || variant === "lexically-deduplicated") {
2966
+ let baseline;
2967
+ if (surface === "flow-status") {
2968
+ baseline = {
2969
+ surface,
2970
+ variant: "baseline",
2971
+ role: "manager",
2972
+ text: "Call flow_status and report the session state and next action.",
2973
+ fragments: []
2974
+ };
2975
+ } else if (surface in BASELINE_COMMAND_SOURCES) {
2976
+ baseline = compileBaselineCommand(surface);
2977
+ } else {
2978
+ baseline = compileBaselineWorker(surface);
2979
+ }
2980
+ if (variant === "baseline")
2981
+ return baseline;
2982
+ return {
2983
+ ...baseline,
2984
+ variant,
2985
+ text: deduplicateExactParagraphs(baseline.text)
2986
+ };
2987
+ }
2988
+ return compileSurfaceSpecific(surface, variant === "surface-specific-bookended");
2989
+ }
2990
+
2991
+ // src/config-shared.ts
2266
2992
  var FLOW_PUBLIC_COMMAND_TEMPLATES = {
2267
- "flow-auto": FLOW_AUTO_COMMAND_TEMPLATE,
2268
- "flow-plan": FLOW_PLAN_COMMAND_TEMPLATE,
2269
- "flow-run": FLOW_RUN_COMMAND_TEMPLATE,
2270
- "flow-review": FLOW_REVIEW_COMMAND_TEMPLATE,
2271
- "flow-status": FLOW_STATUS_COMMAND_TEMPLATE
2993
+ "flow-auto": compileFlowPromptSurface("flow-auto").text,
2994
+ "flow-plan": compileFlowPromptSurface("flow-plan").text,
2995
+ "flow-run": compileFlowPromptSurface("flow-run").text,
2996
+ "flow-review": compileFlowPromptSurface("flow-review").text,
2997
+ "flow-status": compileFlowPromptSurface("flow-status").text
2272
2998
  };
2273
- var FLOW_WORKER_HANDOFF_CONTRACT = "Return only the assigned Flow handoff. Cite or drop every claim, label single-source, inferred, and unsettled claims, and report blocked if the assigned scope, expected coverage, or handoff shape is missing. Empty or unstructured output is a failed handoff; return blocked with the missing elements instead.";
2999
+ var FLOW_REVIEW_AGENT_INSTRUCTIONS = compileFlowPromptSurface("flow-reviewer").text;
2274
3000
  function envModel(name) {
2275
3001
  const value = process.env[name]?.trim();
2276
3002
  return value ? value : undefined;
@@ -2304,7 +3030,7 @@ var FLOW_CORE_AGENTS = {
2304
3030
  mode: "subagent",
2305
3031
  hidden: true,
2306
3032
  description: "Internal read-only evidence worker for Flow planning and execution support.",
2307
- prompt: `Use Flow evidence mode. Inspect only the assigned slice, do not edit files, do not call state-changing Flow tools, and return coverage, evidence inspected, confidence-tagged findings or facts, gaps, and manager follow-ups. ${FLOW_WORKER_HANDOFF_CONTRACT}`,
3033
+ prompt: compileFlowPromptSurface("flow-evidence-worker").text,
2308
3034
  permission: {
2309
3035
  edit: "deny",
2310
3036
  bash: "deny",
@@ -2318,7 +3044,7 @@ var FLOW_CORE_AGENTS = {
2318
3044
  mode: "subagent",
2319
3045
  hidden: true,
2320
3046
  description: "Internal validation worker for Flow check selection and command evidence.",
2321
- prompt: `Use Flow validation mode. Run only manager-specified commands or propose focused checks, do not edit files, do not call state-changing Flow tools, and report exact command, status, raw outcome summary, coverage, confidence, gaps, and manager follow-ups. ${FLOW_WORKER_HANDOFF_CONTRACT}`,
3047
+ prompt: compileFlowPromptSurface("flow-validation-worker").text,
2322
3048
  permission: {
2323
3049
  edit: "deny",
2324
3050
  bash: "ask",
@@ -2332,7 +3058,7 @@ var FLOW_CORE_AGENTS = {
2332
3058
  mode: "subagent",
2333
3059
  hidden: true,
2334
3060
  description: "Internal read-only audit worker for refuted or surviving finding candidates.",
2335
- prompt: `Use Flow audit mode. Inspect only the assigned slice, actively refute candidate findings before reporting them, do not edit files, do not call state-changing Flow tools, and return coverage, evidence, guards checked, confidence, gaps, and manager follow-ups. ${FLOW_WORKER_HANDOFF_CONTRACT}`,
3061
+ prompt: compileFlowPromptSurface("flow-audit-worker").text,
2336
3062
  permission: {
2337
3063
  edit: "deny",
2338
3064
  bash: "ask",
@@ -2346,7 +3072,7 @@ var FLOW_CORE_AGENTS = {
2346
3072
  mode: "subagent",
2347
3073
  hidden: true,
2348
3074
  description: "Internal candidate implementation worker for isolated Flow worktrees or exact non-overlapping path ownership.",
2349
- prompt: `Use Flow candidate-implementation mode only when the manager assigned an isolated worktree or exact non-overlapping path ownership. Do not edit .flow/**, do not call state-changing Flow tools, do not complete Flow state, and return changed or proposed patch, verification run, coverage, confidence, merge risks, and manager follow-ups. ${FLOW_WORKER_HANDOFF_CONTRACT}`,
3075
+ prompt: compileFlowPromptSurface("flow-candidate-worker").text,
2350
3076
  permission: {
2351
3077
  edit: "ask",
2352
3078
  bash: "ask",
@@ -2360,7 +3086,7 @@ var FLOW_CORE_AGENTS = {
2360
3086
  mode: "subagent",
2361
3087
  hidden: true,
2362
3088
  description: "Internal verifier worker for checking Flow worker claims against cited evidence.",
2363
- prompt: `Use Flow verifier mode. Verify only the assigned claims against the provided sources, commands, counts, or current docs. Do not generate new scope, do not edit files, do not call state-changing Flow tools, and return supported, partly-supported, unsupported, or source-not-found per claim with evidence, confidence, gaps, and manager follow-ups. ${FLOW_WORKER_HANDOFF_CONTRACT}`,
3089
+ prompt: compileFlowPromptSurface("flow-verifier-worker").text,
2364
3090
  permission: {
2365
3091
  edit: "deny",
2366
3092
  bash: "ask",
@@ -2847,6 +3573,24 @@ var OrchestrationDecisionSchema = z.enum([
2847
3573
  "tournament",
2848
3574
  "skipped"
2849
3575
  ]);
3576
+ var OrchestrationCandidateEligibilitySchema = z.enum([
3577
+ "eligible",
3578
+ "not_eligible",
3579
+ "unknown"
3580
+ ]);
3581
+ var OrchestrationCandidateDecisionSchema = z.enum([
3582
+ "used",
3583
+ "skipped",
3584
+ "serial_required"
3585
+ ]);
3586
+ var OrchestrationDecisionFactorSchema = z.enum([
3587
+ "shared_state",
3588
+ "overlapping_files",
3589
+ "small_slice",
3590
+ "needs_manager_judgment",
3591
+ "independent_surface",
3592
+ "validation_available"
3593
+ ]);
2850
3594
  var OrchestrationWriteScopeSchema = z.enum([
2851
3595
  "none",
2852
3596
  "manager-serial",
@@ -2864,16 +3608,34 @@ var OrchestrationVerificationStatusSchema = z.enum([
2864
3608
  ]);
2865
3609
  var OrchestrationOutcomeSchema = z.enum([
2866
3610
  "accepted",
3611
+ "modified",
2867
3612
  "rejected",
2868
3613
  "partial",
2869
3614
  "not-covered",
2870
3615
  "superseded"
2871
3616
  ]);
3617
+ var CANDIDATE_SHAPED_DECISIONS = new Set([
3618
+ "candidate-exact-path",
3619
+ "candidate-worktree",
3620
+ "tournament"
3621
+ ]);
3622
+ function isCandidateShapedDecision(decision) {
3623
+ return decision !== undefined && CANDIDATE_SHAPED_DECISIONS.has(decision);
3624
+ }
3625
+ function hasCandidateExecutionEvidence(pass) {
3626
+ return pass.kind === "candidate" || pass.modes.includes("candidate-implementation") || pass.candidateWorkerCount > 0;
3627
+ }
3628
+ function hasVerifierExecutionEvidence(pass) {
3629
+ return pass.kind === "verification" || pass.modes.includes("verifier") || pass.verifierWorkerCount > 0;
3630
+ }
2872
3631
  var OrchestrationPassRecordSchema = z.object({
2873
3632
  id: z.string().min(1),
2874
3633
  kind: OrchestrationPassKindSchema,
2875
3634
  decision: OrchestrationDecisionSchema.optional(),
2876
3635
  decisionReason: z.string().min(1).optional(),
3636
+ candidateEligibility: OrchestrationCandidateEligibilitySchema.default("unknown"),
3637
+ candidateDecision: OrchestrationCandidateDecisionSchema.optional(),
3638
+ decisionFactors: z.array(OrchestrationDecisionFactorSchema).default([]),
2877
3639
  modes: z.array(OrchestrationModeSchema).default([]),
2878
3640
  workerCount: z.number().int().nonnegative().default(0),
2879
3641
  candidateWorkerCount: z.number().int().nonnegative().default(0),
@@ -2885,13 +3647,81 @@ var OrchestrationPassRecordSchema = z.object({
2885
3647
  verificationStatus: OrchestrationVerificationStatusSchema.default("not-needed"),
2886
3648
  outcome: OrchestrationOutcomeSchema.default("accepted"),
2887
3649
  synthesisRef: z.string().min(1).optional()
2888
- }).strict();
3650
+ }).strict().superRefine((value, ctx) => {
3651
+ const issue = (path, message) => ctx.addIssue({ code: "custom", path: [path], message });
3652
+ const isImplementationDecision = value.kind === "implementation-decision";
3653
+ const candidateEligibilityIsUnknown = value.candidateEligibility === "unknown";
3654
+ if (value.candidateWorkerCount > value.workerCount) {
3655
+ issue("candidateWorkerCount", "candidateWorkerCount cannot exceed total workerCount.");
3656
+ }
3657
+ if (value.verifierWorkerCount > value.workerCount) {
3658
+ issue("verifierWorkerCount", "verifierWorkerCount cannot exceed total workerCount.");
3659
+ }
3660
+ if (isCandidateShapedDecision(value.decision) && !hasCandidateExecutionEvidence(value)) {
3661
+ issue("decision", "Candidate-shaped decisions require candidate execution evidence: a candidate pass, candidate-implementation mode, or candidateWorkerCount > 0.");
3662
+ }
3663
+ if (isImplementationDecision) {
3664
+ if (value.decision === "parallel") {
3665
+ issue("decision", "Implementation decisions cannot use decision 'parallel'; use 'serial', 'skipped', or a candidate-shaped decision.");
3666
+ }
3667
+ if (candidateEligibilityIsUnknown) {
3668
+ issue("candidateEligibility", "Implementation decisions must include explicit candidateEligibility.");
3669
+ }
3670
+ if (!value.candidateDecision) {
3671
+ issue("candidateDecision", "Implementation decisions must include explicit candidateDecision.");
3672
+ }
3673
+ if (!value.decision) {
3674
+ issue("decision", "Implementation decisions must include explicit decision.");
3675
+ }
3676
+ if (value.decisionFactors.length === 0) {
3677
+ issue("decisionFactors", "Implementation decisions must include at least one decisionFactor.");
3678
+ }
3679
+ }
3680
+ if (!value.candidateDecision)
3681
+ return;
3682
+ if (!isImplementationDecision && candidateEligibilityIsUnknown) {
3683
+ issue("candidateEligibility", "Candidate eligibility must be explicit when candidateDecision is set.");
3684
+ }
3685
+ if (!isImplementationDecision && (value.candidateDecision === "skipped" || value.candidateDecision === "serial_required")) {
3686
+ issue("candidateDecision", "Candidate decisions 'skipped' and 'serial_required' are only valid on implementation-decision records.");
3687
+ }
3688
+ if (value.candidateEligibility === "not_eligible" && value.candidateDecision === "used") {
3689
+ issue("candidateDecision", "Candidate decision 'used' requires eligible candidate work.");
3690
+ }
3691
+ if (value.candidateEligibility === "eligible" && value.candidateDecision === "serial_required") {
3692
+ issue("candidateDecision", "Candidate decision 'serial_required' requires not_eligible candidate work.");
3693
+ }
3694
+ if (value.candidateDecision === "skipped" && value.candidateEligibility !== "eligible") {
3695
+ issue("candidateDecision", "Candidate decision 'skipped' requires eligible candidate work.");
3696
+ }
3697
+ if (isImplementationDecision && value.decision === "skipped" && value.candidateDecision !== "skipped") {
3698
+ issue("decision", "Implementation decision 'skipped' requires candidateDecision 'skipped'.");
3699
+ }
3700
+ if (isImplementationDecision && value.candidateDecision === "skipped" && value.decision && value.decision !== "skipped") {
3701
+ issue("candidateDecision", "Candidate decision 'skipped' requires implementation decision 'skipped'.");
3702
+ }
3703
+ if (isImplementationDecision && value.candidateDecision === "serial_required" && value.decision && value.decision !== "serial") {
3704
+ issue("candidateDecision", "Candidate decision 'serial_required' requires implementation decision 'serial'.");
3705
+ }
3706
+ if (value.candidateDecision === "used") {
3707
+ if (!hasCandidateExecutionEvidence(value)) {
3708
+ issue("candidateDecision", "Candidate decision 'used' requires a candidate pass, candidate mode, or candidate worker count.");
3709
+ }
3710
+ if (value.decision && !isCandidateShapedDecision(value.decision)) {
3711
+ issue("decision", "Candidate decision 'used' requires an omitted or candidate-shaped decision.");
3712
+ }
3713
+ }
3714
+ });
2889
3715
  var OrchestrationTelemetrySchema = z.object({
2890
3716
  passCount: z.number().int().nonnegative().default(0),
2891
3717
  workerCount: z.number().int().nonnegative().default(0),
2892
3718
  candidatePassCount: z.number().int().nonnegative().default(0),
2893
3719
  verifierPassCount: z.number().int().nonnegative().default(0),
3720
+ candidateEligibleCount: z.number().int().nonnegative().default(0),
3721
+ candidateUsedDecisionCount: z.number().int().nonnegative().default(0),
3722
+ candidateSerialRequiredDecisionCount: z.number().int().nonnegative().default(0),
2894
3723
  skippedCandidateDecisionCount: z.number().int().nonnegative().default(0),
3724
+ recordedPassIds: z.array(z.string().min(1)).default([]),
2895
3725
  latestPasses: z.array(OrchestrationPassRecordSchema).default([])
2896
3726
  }).strict();
2897
3727
  var ReviewFindingSchema = z.object({
@@ -3026,14 +3856,7 @@ var BudgetTelemetrySchema = z.object({
3026
3856
  cacheReadTokens: null,
3027
3857
  nonCacheTokens: null
3028
3858
  }),
3029
- orchestration: OrchestrationTelemetrySchema.default({
3030
- passCount: 0,
3031
- workerCount: 0,
3032
- candidatePassCount: 0,
3033
- verifierPassCount: 0,
3034
- skippedCandidateDecisionCount: 0,
3035
- latestPasses: []
3036
- }),
3859
+ orchestration: OrchestrationTelemetrySchema.prefault({}),
3037
3860
  phaseBoundary: PhaseBoundarySchema.nullable().default(null)
3038
3861
  }).strict();
3039
3862
  var SessionSchema = z.object({
@@ -3045,28 +3868,7 @@ var SessionSchema = z.object({
3045
3868
  plan: PlanSchema.nullable(),
3046
3869
  activeFeatureId: z.string().regex(FEATURE_ID_PATTERN, FEATURE_ID_MESSAGE).nullable(),
3047
3870
  history: z.array(ExecutionHistoryEntrySchema).default([]),
3048
- budget: BudgetTelemetrySchema.default({
3049
- phaseStartedAt: "unknown",
3050
- completedFeaturesSinceBoundary: 0,
3051
- reviewCount: 0,
3052
- failedReviewCount: 0,
3053
- failedReviewAttemptsByFeature: {},
3054
- tokenTelemetry: {
3055
- source: "host_unavailable",
3056
- visibleTokens: null,
3057
- cacheReadTokens: null,
3058
- nonCacheTokens: null
3059
- },
3060
- orchestration: {
3061
- passCount: 0,
3062
- workerCount: 0,
3063
- candidatePassCount: 0,
3064
- verifierPassCount: 0,
3065
- skippedCandidateDecisionCount: 0,
3066
- latestPasses: []
3067
- },
3068
- phaseBoundary: null
3069
- }),
3871
+ budget: BudgetTelemetrySchema.prefault({}),
3070
3872
  closure: z.object({
3071
3873
  kind: z.enum(["completed", "deferred", "abandoned"]),
3072
3874
  summary: z.string().min(1),
@@ -3532,28 +4334,7 @@ function historyEntryFor(worker, status) {
3532
4334
  };
3533
4335
  }
3534
4336
  function initialBudgetTelemetry() {
3535
- return {
3536
- phaseStartedAt: nowIso(),
3537
- completedFeaturesSinceBoundary: 0,
3538
- reviewCount: 0,
3539
- failedReviewCount: 0,
3540
- failedReviewAttemptsByFeature: {},
3541
- tokenTelemetry: {
3542
- source: "host_unavailable",
3543
- visibleTokens: null,
3544
- cacheReadTokens: null,
3545
- nonCacheTokens: null
3546
- },
3547
- orchestration: {
3548
- passCount: 0,
3549
- workerCount: 0,
3550
- candidatePassCount: 0,
3551
- verifierPassCount: 0,
3552
- skippedCandidateDecisionCount: 0,
3553
- latestPasses: []
3554
- },
3555
- phaseBoundary: null
3556
- };
4337
+ return { ...BudgetTelemetrySchema.parse({}), phaseStartedAt: nowIso() };
3557
4338
  }
3558
4339
  function normalizeBudgetTelemetry(session) {
3559
4340
  const defaults = initialBudgetTelemetry();
@@ -3570,20 +4351,20 @@ function normalizeBudgetTelemetry(session) {
3570
4351
  orchestration: {
3571
4352
  ...defaults.orchestration,
3572
4353
  ...session.budget.orchestration,
4354
+ recordedPassIds: [
4355
+ ...session.budget.orchestration?.recordedPassIds ?? []
4356
+ ],
3573
4357
  latestPasses: [...session.budget.orchestration?.latestPasses ?? []]
3574
4358
  }
3575
4359
  };
3576
4360
  }
3577
- function passUsesCandidate(pass) {
3578
- return pass.kind === "candidate" || pass.modes.includes("candidate-implementation") || pass.decision === "candidate-exact-path" || pass.decision === "candidate-worktree" || pass.decision === "tournament";
3579
- }
3580
- function passUsesVerifier(pass) {
3581
- return pass.kind === "verification" || pass.modes.includes("verifier");
3582
- }
3583
4361
  function recordOrchestrationPasses(budget, passes) {
3584
4362
  if (passes.length === 0)
3585
4363
  return budget;
3586
- const seenPassIds = new Set(budget.orchestration.latestPasses.map((pass) => pass.id));
4364
+ const seenPassIds = new Set([
4365
+ ...budget.orchestration.recordedPassIds,
4366
+ ...budget.orchestration.latestPasses.map((pass) => pass.id)
4367
+ ]);
3587
4368
  const newPasses = [];
3588
4369
  for (const pass of passes) {
3589
4370
  if (seenPassIds.has(pass.id))
@@ -3593,15 +4374,52 @@ function recordOrchestrationPasses(budget, passes) {
3593
4374
  }
3594
4375
  if (newPasses.length === 0)
3595
4376
  return budget;
4377
+ const tally = {
4378
+ workerCount: 0,
4379
+ candidatePassCount: 0,
4380
+ verifierPassCount: 0,
4381
+ candidateEligibleCount: 0,
4382
+ candidateUsedDecisionCount: 0,
4383
+ candidateSerialRequiredDecisionCount: 0,
4384
+ skippedCandidateDecisionCount: 0
4385
+ };
4386
+ for (const pass of newPasses) {
4387
+ tally.workerCount += pass.workerCount;
4388
+ if (hasCandidateExecutionEvidence(pass))
4389
+ tally.candidatePassCount += 1;
4390
+ if (hasVerifierExecutionEvidence(pass))
4391
+ tally.verifierPassCount += 1;
4392
+ if (pass.kind !== "implementation-decision")
4393
+ continue;
4394
+ if (pass.candidateEligibility === "eligible") {
4395
+ tally.candidateEligibleCount += 1;
4396
+ }
4397
+ if (pass.candidateDecision === "used") {
4398
+ tally.candidateUsedDecisionCount += 1;
4399
+ }
4400
+ if (pass.candidateDecision === "serial_required") {
4401
+ tally.candidateSerialRequiredDecisionCount += 1;
4402
+ }
4403
+ if (pass.candidateDecision === "skipped") {
4404
+ tally.skippedCandidateDecisionCount += 1;
4405
+ }
4406
+ }
3596
4407
  const latestPasses = [...budget.orchestration.latestPasses, ...newPasses];
3597
4408
  return {
3598
4409
  ...budget,
3599
4410
  orchestration: {
3600
4411
  passCount: budget.orchestration.passCount + newPasses.length,
3601
- workerCount: budget.orchestration.workerCount + newPasses.reduce((total, pass) => total + pass.workerCount, 0),
3602
- candidatePassCount: budget.orchestration.candidatePassCount + newPasses.filter(passUsesCandidate).length,
3603
- verifierPassCount: budget.orchestration.verifierPassCount + newPasses.filter(passUsesVerifier).length,
3604
- skippedCandidateDecisionCount: budget.orchestration.skippedCandidateDecisionCount + newPasses.filter((pass) => pass.kind === "implementation-decision" && pass.decision === "skipped").length,
4412
+ workerCount: budget.orchestration.workerCount + tally.workerCount,
4413
+ candidatePassCount: budget.orchestration.candidatePassCount + tally.candidatePassCount,
4414
+ verifierPassCount: budget.orchestration.verifierPassCount + tally.verifierPassCount,
4415
+ candidateEligibleCount: budget.orchestration.candidateEligibleCount + tally.candidateEligibleCount,
4416
+ candidateUsedDecisionCount: budget.orchestration.candidateUsedDecisionCount + tally.candidateUsedDecisionCount,
4417
+ candidateSerialRequiredDecisionCount: budget.orchestration.candidateSerialRequiredDecisionCount + tally.candidateSerialRequiredDecisionCount,
4418
+ skippedCandidateDecisionCount: budget.orchestration.skippedCandidateDecisionCount + tally.skippedCandidateDecisionCount,
4419
+ recordedPassIds: [
4420
+ ...budget.orchestration.recordedPassIds,
4421
+ ...newPasses.map((pass) => pass.id)
4422
+ ],
3605
4423
  latestPasses: latestPasses.length > MAX_LATEST_ORCHESTRATION_PASSES ? latestPasses.slice(latestPasses.length - MAX_LATEST_ORCHESTRATION_PASSES) : latestPasses
3606
4424
  }
3607
4425
  };
@@ -4539,28 +5357,6 @@ function createCommandPreflightHook() {
4539
5357
  replaceFlowCommandParts(output, renderFlowCommandTitleSeed(command, input.arguments), renderFlowCommandPreflight(command, input.arguments));
4540
5358
  };
4541
5359
  }
4542
- function createCompactionHook(ctx) {
4543
- return async (_input, output) => {
4544
- try {
4545
- const root = resolveWorkspaceRoot(ctx);
4546
- const session = await loadSession(root);
4547
- if (!session)
4548
- return;
4549
- const { completed: completedFeatures, total: totalFeatures } = flowSessionProgress(session);
4550
- output.context.push([
4551
- "## Flow session context",
4552
- "An active Flow session exists in this workspace (`.flow/session.json`).",
4553
- `- goal: ${JSON.stringify(session.goal)}`,
4554
- `- status: ${JSON.stringify(session.status)}`,
4555
- `- approval: ${JSON.stringify(session.approval)}`,
4556
- `- activeFeatureId: ${JSON.stringify(session.activeFeatureId)}`,
4557
- `- progress: ${completedFeatures}/${totalFeatures} features completed`,
4558
- "After compaction, call `flow_status` before any Flow action and follow its `nextAction`."
4559
- ].join(`
4560
- `));
4561
- } catch {}
4562
- };
4563
- }
4564
5360
  var FlowPlugin = async (ctx) => {
4565
5361
  const log = createFlowLog(ctx);
4566
5362
  log("info", "Flow v4 plugin initialized.");
@@ -4570,10 +5366,6 @@ var FlowPlugin = async (ctx) => {
4570
5366
  tool: createTools(ctx),
4571
5367
  "command.execute.before": createCommandPreflightHook()
4572
5368
  };
4573
- if (process.env.FLOW_EXPERIMENTAL_COMPACTION === "1") {
4574
- hooks["experimental.session.compacting"] = createCompactionHook(ctx);
4575
- log("info", "Flow experimental compaction context enabled.");
4576
- }
4577
5369
  return hooks;
4578
5370
  };
4579
5371
  var plugin_default = FlowPlugin;
@@ -4581,4 +5373,4 @@ export {
4581
5373
  plugin_default as default
4582
5374
  };
4583
5375
 
4584
- //# debugId=283DE939C516DF8064756E2164756E21
5376
+ //# debugId=9075F9EB5AD041BE64756E2164756E21