opencode-plugin-flow 4.1.1 → 4.1.3
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/CHANGELOG.md +8 -0
- package/README.md +13 -1
- package/dist/cli.js +1067 -4
- package/dist/index.js +185 -181
- package/dist/index.js.map +7 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,1070 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createHash as
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import{createHash as xe}from"node:crypto";import{mkdir as xa,readdir as K,readFile as _e,rm as Re,writeFile as _a}from"node:fs/promises";import{createRequire as Ie}from"node:module";import{dirname as Fa,join as l,normalize as Fe,sep as Ce}from"node:path";var F=`# Flow worker handoff contract
|
|
3
|
+
|
|
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
|
+
## Evidence, review, validation, or audit worker report
|
|
10
|
+
|
|
11
|
+
Use this for \`flow-evidence-worker\`, \`flow-reviewer\`,
|
|
12
|
+
\`flow-validation-worker\`, and \`flow-audit-worker\`.
|
|
13
|
+
|
|
14
|
+
\`\`\`markdown
|
|
15
|
+
## Status
|
|
16
|
+
success | partial | blocked
|
|
17
|
+
|
|
18
|
+
## Scope
|
|
19
|
+
<owned slice: path set, module, command, risk lens, route, data range, or question set>
|
|
20
|
+
|
|
21
|
+
## Coverage
|
|
22
|
+
- Expected: <files, ranges, questions, commands, or findings assigned>
|
|
23
|
+
- Checked: <actual coverage, for example "12/12 files" or "command not run">
|
|
24
|
+
- Not checked: <items skipped with reason, or "none">
|
|
25
|
+
|
|
26
|
+
## Findings or facts
|
|
27
|
+
- [high|med|low] <claim>; evidence: <file:line | command summary | screenshot path | URL | metric>; corroboration: <N sources or "single source">
|
|
28
|
+
- [high|med|low] <claim>; evidence: <...>; corroboration: <...>
|
|
29
|
+
|
|
30
|
+
## Sources
|
|
31
|
+
- <paths read, commands run, docs fetched, data ranges covered, screenshots inspected>
|
|
32
|
+
|
|
33
|
+
## Confidence and verification
|
|
34
|
+
- Verified: <claims directly re-run, recounted, traced, or cross-checked>
|
|
35
|
+
- Single-source: <claims with exactly one supporting source>
|
|
36
|
+
- Inferred: <claims derived from surrounding evidence rather than directly observed>
|
|
37
|
+
- Unsettled: <claims, sources, or citations that could not be resolved>
|
|
38
|
+
- Falsifier or missing input: <what would overturn or materially change the result>
|
|
39
|
+
|
|
40
|
+
## Open questions / gaps
|
|
41
|
+
- <ambiguity, missing source, contradiction, skipped item, or out-of-scope dependency>
|
|
42
|
+
|
|
43
|
+
## Manager follow-ups
|
|
44
|
+
- <concrete next tasks, verifier claims, validation commands, or Flow plan targets>
|
|
45
|
+
\`\`\`
|
|
46
|
+
|
|
47
|
+
Validation workers must include exact command names and raw outcome summaries
|
|
48
|
+
for commands they actually ran. Audit workers must include guards checked for
|
|
49
|
+
any blocking-severity candidate. Review workers must separate blocking findings
|
|
50
|
+
from advisory notes.
|
|
51
|
+
|
|
52
|
+
## Verifier worker report
|
|
53
|
+
|
|
54
|
+
Use this for \`flow-verifier-worker\`. Give it atomic claims and the cited sources
|
|
55
|
+
or commands. Do not include the generator's reasoning unless that reasoning is
|
|
56
|
+
the thing being verified.
|
|
57
|
+
|
|
58
|
+
\`\`\`markdown
|
|
59
|
+
## Status
|
|
60
|
+
success | partial | blocked
|
|
61
|
+
|
|
62
|
+
## Scope
|
|
63
|
+
<claim ids, sources or commands checked, and the acceptance question>
|
|
64
|
+
|
|
65
|
+
## Verdict per claim
|
|
66
|
+
- <claim id>: verdict=<supported | partly-supported | unsupported | source-not-found>
|
|
67
|
+
- claim: <claim text>
|
|
68
|
+
- evidence: <supporting snippet, path plus line, measured value, command result, or "none">
|
|
69
|
+
- source resolution: <URL, path, or command plus whether it resolved>
|
|
70
|
+
- confidence level: high | med | low
|
|
71
|
+
- recommended action: <keep, narrow, rewrite, or remove>
|
|
72
|
+
|
|
73
|
+
## Overall
|
|
74
|
+
<accept | revise | reject> because <brief reason>
|
|
75
|
+
|
|
76
|
+
## Gaps
|
|
77
|
+
- <unavailable source, ambiguous claim wording, missing oracle, or check not run>
|
|
78
|
+
|
|
79
|
+
## Manager follow-ups
|
|
80
|
+
- <narrow recheck, plan adjustment, review finding, or none>
|
|
81
|
+
\`\`\`
|
|
82
|
+
|
|
83
|
+
## Candidate implementation worker report
|
|
84
|
+
|
|
85
|
+
Use this only for isolated worktrees or exact non-overlapping path ownership
|
|
86
|
+
authorized by the manager.
|
|
87
|
+
|
|
88
|
+
\`\`\`markdown
|
|
89
|
+
## Status
|
|
90
|
+
success | partial | blocked
|
|
91
|
+
|
|
92
|
+
## Scope
|
|
93
|
+
<isolated worktree or exact path-owned slice>
|
|
94
|
+
|
|
95
|
+
## Changed or proposed patch
|
|
96
|
+
- <path>: <what changed and why>
|
|
97
|
+
|
|
98
|
+
## Coverage
|
|
99
|
+
- Assigned: <owned files/modules>
|
|
100
|
+
- Touched: <files changed or proposed>
|
|
101
|
+
- Skipped: <anything assigned but not changed and why, or "none">
|
|
102
|
+
|
|
103
|
+
## Verification
|
|
104
|
+
live-verified | test-verified | type-check-only | not-verified
|
|
105
|
+
- <command, observed outcome, pass/fail counts, or manual check>
|
|
106
|
+
|
|
107
|
+
## Confidence and risk
|
|
108
|
+
- Checked directly: <behavior, files, or commands verified by the worker>
|
|
109
|
+
- Still open: <tests, review paths, or integration points the manager must cover>
|
|
110
|
+
- Risk: low | medium | high -- <why>
|
|
111
|
+
|
|
112
|
+
## Merge notes
|
|
113
|
+
- <conflicts, nearby user changes, assumptions, or deviations>
|
|
114
|
+
|
|
115
|
+
## Manager follow-ups
|
|
116
|
+
- <merge, reject, rerun check, verifier pass, or replan task>
|
|
117
|
+
\`\`\`
|
|
118
|
+
|
|
119
|
+
The manager must inspect and validate any candidate patch before recording Flow
|
|
120
|
+
completion.
|
|
121
|
+
`;var C=`# Parallel orchestration
|
|
122
|
+
|
|
123
|
+
Use fan-out when Flow work is broad enough that independent workers can gather
|
|
124
|
+
evidence faster than one linear pass. The manager still owns the Flow session:
|
|
125
|
+
only the manager calls state-changing Flow tools, approves plans, completes
|
|
126
|
+
features, records reviews, or closes sessions.
|
|
127
|
+
|
|
128
|
+
Read these companion references before a broad wave:
|
|
129
|
+
|
|
130
|
+
- \`handoff-format.md\` for the exact worker response shapes.
|
|
131
|
+
- \`verification-gates.md\` for coverage checks, handoff acceptance, verifier
|
|
132
|
+
triggers, and synthesis rules.
|
|
133
|
+
|
|
134
|
+
## Manager sequence
|
|
135
|
+
|
|
136
|
+
1. Call \`flow_status\` if a Flow session may already exist.
|
|
137
|
+
2. Do a serial orientation pass. Read enough files, schemas, docs, tests,
|
|
138
|
+
commands, or artifacts to identify real slices.
|
|
139
|
+
3. Define the local manager task. Do not delegate the immediate blocker that
|
|
140
|
+
determines whether fan-out is even valid.
|
|
141
|
+
4. Build a pre-fan-out coverage gate:
|
|
142
|
+
- total files, modules, routes, commands, findings, rows, or claims in scope.
|
|
143
|
+
- one line per slice with path/range/lens and expected count.
|
|
144
|
+
- partition check showing slices add back to the total when the work is
|
|
145
|
+
countable.
|
|
146
|
+
- overlap/gap check showing no duplicate ownership, empty slices, or missing
|
|
147
|
+
target areas.
|
|
148
|
+
5. Spawn only named Flow workers. Use exact slices and the required handoff
|
|
149
|
+
shape. Keep each prompt self-contained.
|
|
150
|
+
6. Continue non-overlapping manager work while workers run.
|
|
151
|
+
7. Read every handoff. Keep only claims that have evidence, match the assigned
|
|
152
|
+
scope, and carry confidence labels.
|
|
153
|
+
8. Send important low-confidence, single-source, contested, or citation-heavy
|
|
154
|
+
claims to \`flow-verifier-worker\`.
|
|
155
|
+
9. Run second waves only for material gaps, conflicts, narrowed scope, or
|
|
156
|
+
verification needs.
|
|
157
|
+
10. Synthesize one Flow artifact: plan fields, completion evidence, review
|
|
158
|
+
payload, audit report, or candidate patch decision. Do not paste worker
|
|
159
|
+
handoffs as the user-facing result.
|
|
160
|
+
|
|
161
|
+
## Modes
|
|
162
|
+
|
|
163
|
+
When fanning out Flow work, select the matching hidden Flow agent by name. These
|
|
164
|
+
workers are injected by the plugin config; invoke the named worker when it is
|
|
165
|
+
available. Do not use generic subagents for Flow slices because Flow workers
|
|
166
|
+
carry the permission boundaries for each mode.
|
|
167
|
+
|
|
168
|
+
| Mode | Use agent | Worker output | Write access | Flow tools |
|
|
169
|
+
| --- | --- | --- | --- | --- |
|
|
170
|
+
| \`evidence\` | \`flow-evidence-worker\` | Coverage, facts, files inspected, confidence, gaps, suggested plan targets | No | \`flow_status\` only if needed |
|
|
171
|
+
| \`review\` | \`flow-reviewer\` | Coverage, candidate findings or review slice summary, confidence, gaps | No | \`flow_status\` only if needed |
|
|
172
|
+
| \`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 |
|
|
173
|
+
| \`audit\` | \`flow-audit-worker\` | Refuted or surviving finding candidates, guards checked, confidence, gaps | No | \`flow_status\` only if needed |
|
|
174
|
+
| \`verifier\` | \`flow-verifier-worker\` | Per-claim verdicts against cited evidence or commands | No | \`flow_status\` only if needed |
|
|
175
|
+
| \`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 |
|
|
176
|
+
|
|
177
|
+
Do not fan out parallel \`flow_plan_save\`, \`flow_plan_approve\`,
|
|
178
|
+
\`flow_run_start\`, \`flow_feature_complete\`, \`flow_feature_reset\`, or
|
|
179
|
+
\`flow_session_close\` calls. Runtime locking protects files, but Flow accepts only
|
|
180
|
+
one active feature result at a time.
|
|
181
|
+
|
|
182
|
+
## Worker rules
|
|
183
|
+
|
|
184
|
+
Workers may read files, inspect docs, run authorized read-only commands, and
|
|
185
|
+
summarize evidence. Candidate implementation workers may edit only when the
|
|
186
|
+
manager assigned an isolated worktree or exact path ownership that does not
|
|
187
|
+
overlap sibling workers or manager edits.
|
|
188
|
+
|
|
189
|
+
Workers must not edit \`.flow/**\` and must not call:
|
|
190
|
+
|
|
191
|
+
- \`flow_plan_save\`
|
|
192
|
+
- \`flow_plan_approve\`
|
|
193
|
+
- \`flow_run_start\`
|
|
194
|
+
- \`flow_feature_complete\`
|
|
195
|
+
- \`flow_feature_reset\`
|
|
196
|
+
- \`flow_session_close\`
|
|
197
|
+
|
|
198
|
+
Workers also must not approve work, close sessions, record Flow validation, or
|
|
199
|
+
claim validation they did not run. A worker may report raw validation output it
|
|
200
|
+
actually ran; the manager decides whether it is strong enough to record.
|
|
201
|
+
|
|
202
|
+
## Prompt contract
|
|
203
|
+
|
|
204
|
+
Every worker prompt includes:
|
|
205
|
+
|
|
206
|
+
\`\`\`text
|
|
207
|
+
Overall goal, context only: <goal>
|
|
208
|
+
Mode: evidence | review | validation | audit | verifier | candidate-implementation
|
|
209
|
+
Your exact slice: <paths, modules, command, claim ids, risk lens, or worktree>
|
|
210
|
+
Expected coverage: <count, paths, range, or complete question set>
|
|
211
|
+
Do: <bounded actions>
|
|
212
|
+
Do not: call Flow state tools, edit .flow/**, own sibling slices, or make the final Flow verdict.
|
|
213
|
+
Return exactly the matching handoff shape from handoff-format.md.
|
|
214
|
+
\`\`\`
|
|
215
|
+
|
|
216
|
+
For research or current-doc slices, require source checks for versioned or
|
|
217
|
+
time-sensitive facts. For implementation candidates, remind workers that other
|
|
218
|
+
work may be active and that they must not revert unrelated changes.
|
|
219
|
+
|
|
220
|
+
## Where handoffs go
|
|
221
|
+
|
|
222
|
+
- Planning evidence becomes \`requirements\`, \`decisions\`, feature \`targets\`,
|
|
223
|
+
feature \`validation\`, or plan notes in prose fields.
|
|
224
|
+
- Execution evidence informs the active feature, but \`flow_feature_complete\` is
|
|
225
|
+
manager-owned.
|
|
226
|
+
- Validation evidence may become \`validationRun\` only when the command, status,
|
|
227
|
+
and raw outcome are concrete enough to trust.
|
|
228
|
+
- Review evidence informs \`featureReview\` or \`finalReview\`, but the manager owns
|
|
229
|
+
the pass/fail verdict.
|
|
230
|
+
- Audit evidence becomes findings only after refutation and verification rules
|
|
231
|
+
in \`verification-gates.md\`.
|
|
232
|
+
- Candidate patches are inspected, merged, and validated by the manager before
|
|
233
|
+
any Flow completion call.
|
|
234
|
+
|
|
235
|
+
When worker results conflict, inspect the underlying artifact directly and rerun
|
|
236
|
+
the smallest check that can settle the disagreement.
|
|
237
|
+
|
|
238
|
+
## Second waves
|
|
239
|
+
|
|
240
|
+
Start a follow-up wave when first-wave handoffs reveal:
|
|
241
|
+
|
|
242
|
+
- missing coverage in the original slice map.
|
|
243
|
+
- conflicting findings that matter to the Flow decision.
|
|
244
|
+
- a specialized follow-up that was intentionally out of scope.
|
|
245
|
+
- high-stakes, low-confidence, or single-source claims needing verification.
|
|
246
|
+
- bounded implementation candidates after research converges.
|
|
247
|
+
|
|
248
|
+
Do not recurse by default. If a worker says it needs another worker, the manager
|
|
249
|
+
decides whether that is a second wave and writes the next bounded prompt.
|
|
250
|
+
`;var U='# 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- `Completion requires a passing featureReview`: run or request a real review and include a passing `featureReview` only when there are no blocking findings.\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';var A=`# Verification gates
|
|
251
|
+
|
|
252
|
+
Verification is how Flow keeps parallel work from turning into parallel
|
|
253
|
+
guesswork. Worker handoffs are candidate evidence; the manager decides what can
|
|
254
|
+
enter the plan, validation record, review payload, audit report, or final
|
|
255
|
+
answer.
|
|
256
|
+
|
|
257
|
+
## Before fan-out
|
|
258
|
+
|
|
259
|
+
Run a pre-fan-out gate after serial orientation and before spawning workers:
|
|
260
|
+
|
|
261
|
+
- Count the total work items when countable: files, modules, routes, commands,
|
|
262
|
+
rows, findings, screenshots, or claims.
|
|
263
|
+
- List every slice with path/range/lens and expected count.
|
|
264
|
+
- Check that countable slices add back to the total.
|
|
265
|
+
- Check for overlapping ownership, missing areas, empty slices, and ambiguous
|
|
266
|
+
shared contracts.
|
|
267
|
+
- Fix the slice map centrally before spawning if the gate does not reconcile.
|
|
268
|
+
|
|
269
|
+
If the scope cannot be counted, state the completeness rule instead, such as
|
|
270
|
+
"all changed files plus callers" or "all public commands plus release docs."
|
|
271
|
+
|
|
272
|
+
## Every handoff
|
|
273
|
+
|
|
274
|
+
Accept a handoff only after a cheap manager-side pass:
|
|
275
|
+
|
|
276
|
+
- \`Status\` is terminal: \`success\`, \`partial\`, or \`blocked\`.
|
|
277
|
+
- Coverage matches the assigned slice, or skips are explicit.
|
|
278
|
+
- Important claims have concrete evidence and confidence tags.
|
|
279
|
+
- Cited paths, commands, screenshots, URLs, or metrics resolve.
|
|
280
|
+
- The evidence supports the claim, not just the topic.
|
|
281
|
+
- Findings stay inside the worker's slice.
|
|
282
|
+
- Headline counts can be recounted or traced.
|
|
283
|
+
- Contradictions between workers are either resolved or explicitly marked as
|
|
284
|
+
contested.
|
|
285
|
+
|
|
286
|
+
Demote, drop, re-task, or verify claims that fail this pass.
|
|
287
|
+
|
|
288
|
+
## Verifier triggers
|
|
289
|
+
|
|
290
|
+
Use \`flow-verifier-worker\` when a claim is:
|
|
291
|
+
|
|
292
|
+
- blocking or release-sensitive.
|
|
293
|
+
- high-stakes for user data, security, persistence, permissions, or public API
|
|
294
|
+
behavior.
|
|
295
|
+
- low-confidence, inferred, surprising, or single-sourced.
|
|
296
|
+
- citation-heavy enough that source drift would change the conclusion.
|
|
297
|
+
- contradicted by another worker or by manager inspection.
|
|
298
|
+
- a count, benchmark, command result, or pass/fail claim that a Flow payload will
|
|
299
|
+
rely on.
|
|
300
|
+
|
|
301
|
+
Give the verifier atomic claims, cited sources or commands, and the acceptance
|
|
302
|
+
question. Do not ask it to redesign the work or review the whole feature.
|
|
303
|
+
|
|
304
|
+
## Flow payload acceptance
|
|
305
|
+
|
|
306
|
+
Planning fields may use worker evidence only when the source and scope are clear.
|
|
307
|
+
Unverified broad findings should become a review-first feature, not a fix plan.
|
|
308
|
+
|
|
309
|
+
\`validationRun\` entries may use worker-reported commands only when the worker
|
|
310
|
+
was explicitly authorized to run the command and reported the exact command,
|
|
311
|
+
status, and raw outcome summary.
|
|
312
|
+
|
|
313
|
+
\`featureReview\` and \`finalReview\` may use worker review slices, but the manager
|
|
314
|
+
owns the pass/fail decision and must resolve blockers, contradictions, and
|
|
315
|
+
coverage gaps before returning the payload.
|
|
316
|
+
|
|
317
|
+
Audit reports may include only findings that survived refutation. Blocking audit
|
|
318
|
+
findings need guards checked, deployment context, and evidence that the current
|
|
319
|
+
code exhibits the behavior.
|
|
320
|
+
|
|
321
|
+
Candidate implementation patches are not Flow evidence until the manager
|
|
322
|
+
inspects, merges or rejects them, and runs suitable validation in the main
|
|
323
|
+
Flow-managed workspace.
|
|
324
|
+
|
|
325
|
+
## Final synthesis
|
|
326
|
+
|
|
327
|
+
Before presenting or recording the result:
|
|
328
|
+
|
|
329
|
+
- Preserve confidence: verified, single-sourced, inferred, and unresolved claims
|
|
330
|
+
stay distinct when it matters.
|
|
331
|
+
- When workers disagree, inspect the cited artifact or rerun the cited command
|
|
332
|
+
instead of arbitrating from summaries.
|
|
333
|
+
- Run the strongest practical local check for the deliverable.
|
|
334
|
+
- Re-read critical files or docs that will be cited in the final decision.
|
|
335
|
+
- Record gaps honestly instead of converting missing evidence into success
|
|
336
|
+
language.
|
|
337
|
+
|
|
338
|
+
\`Status: success\` only says the worker believes its slice is done. The manager
|
|
339
|
+
still checks coverage and evidence before trusting the result.
|
|
340
|
+
`;var q="---\nname: flow\ndescription: Main Flow loop for skills-first OpenCode work. Use when a user asks for Flow-guided planning, autonomous execution, resumable implementation, session status, or end-to-end delivery with validation and review gates.\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\n## Loop\n\n1. Call `flow_status` first. Trust its active session and next action over conversation memory.\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.\n4. Load `flow-review` for the required feature review. The reviewer reports a `featureReview` payload; the manager records it inside `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 waves. Hidden Flow workers are injected by plugin config; invoke the named worker when it is available. Its `references/handoff-format.md` and `references/verification-gates.md` companions define the worker contracts. The manager owns every `flow_*` state change.\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 or skills 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- 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- `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";var T=`# Safe refactor workflow
|
|
341
|
+
|
|
342
|
+
Refactoring is a behavior-preserving sequence of small changes. This workflow keeps cleanup from becoming an unreviewable rewrite.
|
|
343
|
+
|
|
344
|
+
## Before editing
|
|
345
|
+
|
|
346
|
+
- Define the invariant: what behavior, API, schema, command, state path, or visual output must remain unchanged.
|
|
347
|
+
- Locate callers and tests before changing the target. If there is no test coverage, add or run the narrowest check that proves current behavior.
|
|
348
|
+
- Identify the smallest reversible move: remove dead code, rename, extract, inline, move, consolidate, or split phase.
|
|
349
|
+
- Choose a validation command that can fail for the behavior you might break.
|
|
350
|
+
|
|
351
|
+
## During editing
|
|
352
|
+
|
|
353
|
+
- Make one structural move at a time, then re-run the relevant check when risk is non-trivial.
|
|
354
|
+
- Prefer deleting or inlining a useless layer before introducing a new one.
|
|
355
|
+
- Keep names domain-specific. Generic names like \`manager\`, \`processor\`, \`utils\`, and \`helper\` are suspect unless the repo already owns that vocabulary.
|
|
356
|
+
- Avoid mixed commits inside a feature: no unrelated formatting, package churn, comment rewrites, or style sweeps.
|
|
357
|
+
- If the refactor uncovers a behavior bug, stop and replan unless the approved feature already includes fixing that bug.
|
|
358
|
+
|
|
359
|
+
## Validation evidence
|
|
360
|
+
|
|
361
|
+
Good cleanup evidence includes:
|
|
362
|
+
|
|
363
|
+
- focused tests for behavior touched by the refactor.
|
|
364
|
+
- typecheck/lint/build output for mechanical structure changes.
|
|
365
|
+
- before/after references for deleted exports, commands, generated files, and docs when static search is not enough.
|
|
366
|
+
- broad validation when shared abstractions, public APIs, persistence, or cross-feature integration changed.
|
|
367
|
+
|
|
368
|
+
Weak evidence includes:
|
|
369
|
+
|
|
370
|
+
- "No tests needed" for behavior-adjacent refactors.
|
|
371
|
+
- tests that were edited to match the new shape but do not prove the old behavior.
|
|
372
|
+
- scanner metrics without human inspection.
|
|
373
|
+
- green tests after changing unrelated surfaces not covered by those tests.
|
|
374
|
+
|
|
375
|
+
## Review checklist
|
|
376
|
+
|
|
377
|
+
- Every changed artifact maps to the approved cleanup scope.
|
|
378
|
+
- The new structure has fewer reasons to change, not just fewer lines.
|
|
379
|
+
- Public contracts and compatibility shims remain intact or were explicitly planned.
|
|
380
|
+
- Deleted code is actually unreachable or obsolete.
|
|
381
|
+
- Validation can catch a realistic mistake in the refactor.
|
|
382
|
+
`;var P=`# Deslop smell rubric
|
|
383
|
+
|
|
384
|
+
Use this rubric to turn vague cleanup instincts into reviewable findings.
|
|
385
|
+
|
|
386
|
+
## Actionable smell classes
|
|
387
|
+
|
|
388
|
+
- **duplication** — repeated logic or conditionals that must change together. Confirm whether small repetition is clearer than abstraction.
|
|
389
|
+
- **bloat** — long function, large class/module, or oversized component whose responsibilities are mixed enough to hide behavior.
|
|
390
|
+
- **speculative generality** — unused extension points, factories, options, interfaces, or configuration added for imagined futures.
|
|
391
|
+
- **dead code** — unreachable branches, unused exports, stale flags, abandoned helpers, obsolete tests, or comments describing code that no longer exists.
|
|
392
|
+
- **primitive obsession** — stringly typed modes, loosely shaped objects, or magic literals that obscure a domain constraint already present elsewhere.
|
|
393
|
+
- **shotgun surgery** — one conceptual change requires scattered edits across unrelated modules.
|
|
394
|
+
- **feature envy / misplaced responsibility** — code repeatedly reaches into another module's internals instead of using the owning boundary.
|
|
395
|
+
- **message chains / excessive delegation** — call chains or wrappers that add no policy and make behavior harder to locate.
|
|
396
|
+
- **agent slop** — verbose scaffolding, duplicate defensive branches, generic helper layers, temporary flags, commented-out code, debug output, or invented patterns that do not match the repo.
|
|
397
|
+
- **test-oracle slop** — tests that assert implementation trivia, snapshots of noisy markup, or mocks that make broken behavior pass.
|
|
398
|
+
|
|
399
|
+
## Non-smells until proven
|
|
400
|
+
|
|
401
|
+
- Repetition that makes two workflows intentionally independent.
|
|
402
|
+
- Framework-required shape, generated code, migration history, compatibility shims, or public API affordances.
|
|
403
|
+
- Verbose guards protecting data loss, security, lifecycle ordering, or error observability.
|
|
404
|
+
- Logging/metrics that operators or tests rely on.
|
|
405
|
+
- Local style differences already accepted by the repo and not hurting changeability.
|
|
406
|
+
|
|
407
|
+
## Finding shape
|
|
408
|
+
|
|
409
|
+
Each blocking cleanup finding should carry:
|
|
410
|
+
|
|
411
|
+
\`\`\`text
|
|
412
|
+
class; severity; location; evidence read; refutation checked; why it matters; safe fix shape; validation command
|
|
413
|
+
\`\`\`
|
|
414
|
+
|
|
415
|
+
Rate as blocking only when the smell materially raises defect risk, blocks planned work, hides behavior, or makes the success claim unverifiable. Style-only cleanup is advisory.
|
|
416
|
+
`;var D=`---
|
|
417
|
+
name: flow-deslop
|
|
418
|
+
description: Flow guidance for evidence-backed code smell cleanup, AI-slop removal, overengineering reduction, maintainability refactors, and behavior-preserving cleanup. Use when planning, executing, or reviewing broad cleanup/refactor work, code smell findings, duplicated or bloated code, speculative abstractions, dead code, or agent-introduced mess.
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
# Flow deslop
|
|
422
|
+
|
|
423
|
+
Use this skill when the Flow work is about improving code quality rather than adding a new user-visible feature. The job is to make the code easier to change without changing behavior unless the approved plan explicitly says behavior changes.
|
|
424
|
+
|
|
425
|
+
## Ground the cleanup
|
|
426
|
+
|
|
427
|
+
- Start from concrete evidence: duplicated code, unnecessary abstraction, long or tangled functions, dead branches, confusing ownership, repeated conditionals, excessive coupling, or validation gaps that hide maintainability risk.
|
|
428
|
+
- Load \`references/smell-rubric.md\` when classifying findings or deciding what is worth fixing.
|
|
429
|
+
- Load \`references/refactor-workflow.md\` before implementing or reviewing non-trivial cleanup.
|
|
430
|
+
- Treat scanner output, metrics, and model impressions as candidates only. A smell becomes actionable after reading the surrounding code, callers, tests, and relevant contracts.
|
|
431
|
+
- Record cleanup context in existing Flow plan fields: \`requirements\`, \`decisions\`, feature \`targets\`, and feature \`validation\`. Do not invent new Flow payload fields.
|
|
432
|
+
|
|
433
|
+
## Plan cleanup work
|
|
434
|
+
|
|
435
|
+
- Prefer one feature per validated cleanup theme with a clear validation story. "Clean the whole repo" starts with a review-first feature that produces evidence-backed findings, then fix features for confirmed clusters.
|
|
436
|
+
- Keep refactors small and behavior-preserving. If a cleanup requires behavior change, surface it as product scope and replan.
|
|
437
|
+
- State what will not be cleaned. Broad cleanup without boundaries invites churn and makes review impossible.
|
|
438
|
+
- Choose validation before editing: focused tests for affected behavior, typecheck/lint for mechanical changes, and a broad gate when cleanup spans shared abstractions.
|
|
439
|
+
|
|
440
|
+
## Execute cleanup safely
|
|
441
|
+
|
|
442
|
+
- Preserve public APIs, persisted data, command names, tool names, and observable behavior unless the approved plan explicitly changes them.
|
|
443
|
+
- Prefer removal, consolidation, naming, and local extraction before new abstractions. New abstractions must reduce real duplication or clarify an existing boundary.
|
|
444
|
+
- Delete dead code only after checking references, exports, generated entrypoints, docs, tests, and runtime/distribution paths that static search may miss.
|
|
445
|
+
- Keep every change tied to a finding or plan target. Opportunistic style edits are out of scope.
|
|
446
|
+
|
|
447
|
+
## Review cleanup claims
|
|
448
|
+
|
|
449
|
+
For each claimed smell removal, verify:
|
|
450
|
+
|
|
451
|
+
- **location** — the changed code and the original smell were actually read.
|
|
452
|
+
- **impact** — the change reduces duplication, coupling, complexity, or future-change risk in a concrete way.
|
|
453
|
+
- **refutation checked** — apparent smell was not intentional compatibility, performance, generated code, framework convention, or a safety guard.
|
|
454
|
+
- **behavior preserved** — tests or other evidence cover the behavior touched.
|
|
455
|
+
- **blast radius** — public contracts and downstream callers still work.
|
|
456
|
+
|
|
457
|
+
Never approve cleanup because it "looks cleaner" without evidence. Tests passing is necessary but not sufficient when the refactor changes structure across files.
|
|
458
|
+
`;var j=`# Parallel discovery
|
|
459
|
+
|
|
460
|
+
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.
|
|
461
|
+
|
|
462
|
+
For broad waves, also load \`../../flow/references/parallel-orchestration.md\`.
|
|
463
|
+
Use its pre-fan-out coverage gate and
|
|
464
|
+
\`../../flow/references/handoff-format.md\` response shapes.
|
|
465
|
+
|
|
466
|
+
## Good slices
|
|
467
|
+
|
|
468
|
+
- Independent modules or packages.
|
|
469
|
+
- Frontend route and backend endpoint pairs.
|
|
470
|
+
- Test, CI, and release surfaces.
|
|
471
|
+
- Risk lenses such as security, persistence, accessibility, migration, or performance.
|
|
472
|
+
- Documentation and operator-contract checks.
|
|
473
|
+
|
|
474
|
+
## Flow repo default slices
|
|
475
|
+
|
|
476
|
+
For this repository, good first-wave slices are:
|
|
477
|
+
|
|
478
|
+
- Runtime gates: \`src/runtime/schema.ts\`, \`src/runtime/transitions.ts\`,
|
|
479
|
+
\`src/runtime/api.ts\`, and \`tests/runtime-gates.test.ts\`.
|
|
480
|
+
- Workspace persistence: \`src/runtime/workspace.ts\`,
|
|
481
|
+
\`src/runtime/json/strict-object.ts\`, and
|
|
482
|
+
\`tests/workspace-persistence.test.ts\`.
|
|
483
|
+
- OpenCode adapter surface: \`src/adapters/opencode/**\`, \`src/config-shared.ts\`,
|
|
484
|
+
\`src/config.ts\`, \`src/index.ts\`, and surface tests.
|
|
485
|
+
- Distribution and synced skills: \`src/distribution/**\`, \`src/cli.ts\`,
|
|
486
|
+
\`skills/**\`, and distribution tests.
|
|
487
|
+
- CI, package, and release contract: \`.github/workflows/**\`, \`package.json\`,
|
|
488
|
+
\`bun.lock\`, \`README.md\`, and \`CHANGELOG.md\`.
|
|
489
|
+
- Docs and operator contract: \`docs/**\`, \`README.md\`, and skill references.
|
|
490
|
+
|
|
491
|
+
## Coverage gate
|
|
492
|
+
|
|
493
|
+
Before spawning workers, state the total discovery scope and one line per slice.
|
|
494
|
+
For countable scopes, confirm that slice counts add back to the total and that
|
|
495
|
+
there are no overlaps, gaps, or empty slices. If the scope is not countable,
|
|
496
|
+
state the completeness rule, such as "all changed files plus callers."
|
|
497
|
+
|
|
498
|
+
## Worker prompt
|
|
499
|
+
|
|
500
|
+
\`\`\`text
|
|
501
|
+
Inspect <slice> for <goal>. Read-only. Do not edit files or call Flow tools.
|
|
502
|
+
Return the evidence/review/validation/audit handoff shape from ../../flow/references/handoff-format.md.
|
|
503
|
+
\`\`\`
|
|
504
|
+
|
|
505
|
+
For validation-oriented discovery:
|
|
506
|
+
|
|
507
|
+
\`\`\`text
|
|
508
|
+
Inspect <slice> for validation risk. Read-only. Do not edit files or call Flow
|
|
509
|
+
tools. You may report commands that should be run, and include raw output only
|
|
510
|
+
for commands you actually ran. Return the evidence/review/validation/audit
|
|
511
|
+
handoff shape from ../../flow/references/handoff-format.md.
|
|
512
|
+
\`\`\`
|
|
513
|
+
|
|
514
|
+
## Synthesis
|
|
515
|
+
|
|
516
|
+
Convert only evidence-backed work into plan fields:
|
|
517
|
+
|
|
518
|
+
- \`requirements\`: user promises and externally visible acceptance criteria.
|
|
519
|
+
- \`decisions\`: architecture boundaries, rejected approaches, and scope cuts.
|
|
520
|
+
- feature \`targets\`: files, modules, routes, commands, docs, or workflows the feature owns.
|
|
521
|
+
- feature \`validation\`: checks expected to prove the feature.
|
|
522
|
+
|
|
523
|
+
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.
|
|
524
|
+
`;var W=`# Planning examples
|
|
525
|
+
|
|
526
|
+
## Rate limiting feature set
|
|
527
|
+
|
|
528
|
+
Human summary:
|
|
529
|
+
|
|
530
|
+
1. **In-memory rate limit middleware** - add request counting and response headers for one-process deployments.
|
|
531
|
+
2. **Redis-backed limiter** - add shared store adapter for multi-instance deployments.
|
|
532
|
+
3. **Operator docs** - document configuration and rollout notes.
|
|
533
|
+
|
|
534
|
+
Payload:
|
|
535
|
+
|
|
536
|
+
\`\`\`json
|
|
537
|
+
{
|
|
538
|
+
"goal": "Add API rate limiting with local and Redis-backed stores",
|
|
539
|
+
"plan": {
|
|
540
|
+
"summary": "Add configurable rate limiting for API routes.",
|
|
541
|
+
"overview": "Implement middleware first, then a Redis store, then document rollout.",
|
|
542
|
+
"requirements": [
|
|
543
|
+
"Preserve existing route behavior except rate-limit responses.",
|
|
544
|
+
"Expose deterministic headers for limit, remaining, and reset time."
|
|
545
|
+
],
|
|
546
|
+
"decisions": [
|
|
547
|
+
"Start with an in-memory store for single-process deployments.",
|
|
548
|
+
"Keep Redis behind a store interface so tests can use a mock."
|
|
549
|
+
],
|
|
550
|
+
"finalReviewPolicy": "detailed",
|
|
551
|
+
"features": [
|
|
552
|
+
{
|
|
553
|
+
"id": "rate-limit-middleware",
|
|
554
|
+
"title": "In-memory limiter",
|
|
555
|
+
"summary": "Add middleware, config, and tests for single-process rate limiting.",
|
|
556
|
+
"targets": ["src/middleware/rate-limit.ts", "src/app.ts", "src/config.ts"],
|
|
557
|
+
"validation": ["route tests for limit/reset/header behavior", "typecheck"],
|
|
558
|
+
"dependsOn": []
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
"id": "redis-store",
|
|
562
|
+
"title": "Redis store",
|
|
563
|
+
"summary": "Add a Redis-backed rate limit store without changing middleware behavior.",
|
|
564
|
+
"targets": ["src/middleware/stores/redis.ts", "src/middleware/rate-limit.ts"],
|
|
565
|
+
"validation": ["store tests with Redis mock", "manual two-process recipe if practical"],
|
|
566
|
+
"dependsOn": ["rate-limit-middleware"]
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"id": "operator-docs",
|
|
570
|
+
"title": "Operator docs",
|
|
571
|
+
"summary": "Document configuration, headers, and rollout guidance.",
|
|
572
|
+
"targets": ["README.md", "docs/operations.md"],
|
|
573
|
+
"validation": ["lint docs if available", "review examples against implemented config"],
|
|
574
|
+
"dependsOn": ["redis-store"]
|
|
575
|
+
}
|
|
576
|
+
]
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
\`\`\`
|
|
580
|
+
|
|
581
|
+
## Review-first cleanup
|
|
582
|
+
|
|
583
|
+
Bad plan:
|
|
584
|
+
|
|
585
|
+
\`\`\`text
|
|
586
|
+
1. Simplify services
|
|
587
|
+
2. Remove duplication
|
|
588
|
+
3. Improve tests
|
|
589
|
+
\`\`\`
|
|
590
|
+
|
|
591
|
+
Why it is bad: no evidence names which services are actually tangled, what duplication exists, or which behavior needs test coverage.
|
|
592
|
+
|
|
593
|
+
Better plan:
|
|
594
|
+
|
|
595
|
+
\`\`\`text
|
|
596
|
+
1. Audit service layer - produce evidence-backed findings with file:line citations, guards checked, and follow-up order.
|
|
597
|
+
2. Consolidate confirmed config parsing duplication - only if the audit proves the duplication exists and is safe to merge.
|
|
598
|
+
3. Add behavior-preservation tests for the changed service paths.
|
|
599
|
+
\`\`\`
|
|
600
|
+
|
|
601
|
+
## Decomposition anti-patterns
|
|
602
|
+
|
|
603
|
+
- Feature per file when behavior crosses files.
|
|
604
|
+
- Feature per implementation step with no user-visible or reviewable outcome.
|
|
605
|
+
- Plan fixes for findings not yet verified.
|
|
606
|
+
- Validation that only says "manual testing".
|
|
607
|
+
- Targets that name the entire repo.
|
|
608
|
+
- Features with hidden dependencies instead of \`dependsOn\`.
|
|
609
|
+
`;var z=`---
|
|
610
|
+
name: flow-plan
|
|
611
|
+
description: Plan Flow work for the v4 skills-first runtime: inspect the repo, decompose a user goal into right-sized features, save a draft with flow_plan_save, and approve it with flow_plan_approve.
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
# Flow Plan
|
|
615
|
+
|
|
616
|
+
Use this skill before implementation. The output is a compact plan the runtime can enforce and future agents can execute without rediscovering the goal.
|
|
617
|
+
|
|
618
|
+
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.
|
|
619
|
+
|
|
620
|
+
## Inspect first
|
|
621
|
+
|
|
622
|
+
- Read the files, docs, tests, package scripts, and local conventions that determine the work.
|
|
623
|
+
- 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 apply its coverage gate before fan-out.
|
|
624
|
+
- For cleanup/refactor goals, load \`flow-deslop\`.
|
|
625
|
+
- For UI/frontend goals, load \`flow-ui-quality\`.
|
|
626
|
+
- Do not invent findings. Broad "review and fix" goals start with a review-first feature whose deliverable is evidence-backed findings.
|
|
627
|
+
|
|
628
|
+
## Plan shape
|
|
629
|
+
|
|
630
|
+
Call \`flow_plan_save\` with:
|
|
631
|
+
|
|
632
|
+
\`\`\`json
|
|
633
|
+
{
|
|
634
|
+
"goal": "user-visible goal",
|
|
635
|
+
"plan": {
|
|
636
|
+
"summary": "one-sentence outcome",
|
|
637
|
+
"overview": "implementation strategy and boundaries",
|
|
638
|
+
"requirements": ["constraints, acceptance criteria, user promises"],
|
|
639
|
+
"decisions": ["architecture or scope decisions already made"],
|
|
640
|
+
"finalReviewPolicy": "detailed",
|
|
641
|
+
"features": [
|
|
642
|
+
{
|
|
643
|
+
"id": "lowercase-kebab-case",
|
|
644
|
+
"title": "Short title",
|
|
645
|
+
"summary": "Outcome this feature delivers",
|
|
646
|
+
"targets": ["files, modules, routes, commands, or docs in scope"],
|
|
647
|
+
"validation": ["focused checks expected before completion"],
|
|
648
|
+
"dependsOn": []
|
|
649
|
+
}
|
|
650
|
+
]
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
\`\`\`
|
|
654
|
+
|
|
655
|
+
Use only \`finalReviewPolicy: "broad"\` or \`"detailed"\`. These are the canonical final-review policy and \`reviewDepth\` enum values. Use \`"broad"\` only for low-risk, narrow work. Use \`"detailed"\` for behavioral changes, cross-module edits, migrations, releases, security-sensitive code, or large refactors.
|
|
656
|
+
|
|
657
|
+
## Feature sizing
|
|
658
|
+
|
|
659
|
+
- Each feature should have one owner, one coherent outcome, and a validation story.
|
|
660
|
+
- Split by dependency order: foundations before callers, schema before consumers, implementation before docs when docs depend on behavior.
|
|
661
|
+
- Avoid "misc cleanup" features. Tie cleanup to evidence and targets.
|
|
662
|
+
- Keep feature ids stable once the plan is approved.
|
|
663
|
+
- Put scope boundaries in \`targets\` and expected checks in \`validation\`.
|
|
664
|
+
|
|
665
|
+
## Approval
|
|
666
|
+
|
|
667
|
+
After saving, summarize the plan to the user. Call \`flow_plan_approve\` only after explicit user approval, unless the user already authorized autonomous implementation. Approved plans are immutable; changing them later requires reset/closure rather than silent edits.
|
|
668
|
+
|
|
669
|
+
See \`references/planning-examples.md\` for payload examples and decomposition anti-patterns.
|
|
670
|
+
`;var B=`# Review rubric
|
|
671
|
+
|
|
672
|
+
Use this to decide whether a \`featureReview\` or \`finalReview\` payload may pass.
|
|
673
|
+
|
|
674
|
+
## Finding classes
|
|
675
|
+
|
|
676
|
+
- **correctness**: wrong result, broken state transition, bad edge case, race, data loss, or crash.
|
|
677
|
+
- **contract**: public API, CLI, config, persisted data, or documented behavior changed without plan approval.
|
|
678
|
+
- **security/privacy**: unsafe input handling, secret exposure, permission bypass, or insecure default.
|
|
679
|
+
- **test-coverage**: behavioral change lacks a check strong enough for the risk.
|
|
680
|
+
- **maintainability**: complexity or coupling creates concrete future-change risk.
|
|
681
|
+
- **ui/accessibility**: user cannot complete the workflow, layout breaks, accessibility basics fail, or visual claims lack evidence.
|
|
682
|
+
|
|
683
|
+
## Severity
|
|
684
|
+
|
|
685
|
+
- **blocking**: must fail the review. Includes incorrect behavior, data loss, security risk, unverifiable completion claims, missing validation for behavioral work, or unresolved scope drift.
|
|
686
|
+
- **advisory**: worth noting but does not block the current goal.
|
|
687
|
+
|
|
688
|
+
If unsure whether a finding is real, read more or downgrade it. Do not promote guesses to blockers.
|
|
689
|
+
|
|
690
|
+
## Feature review checklist
|
|
691
|
+
|
|
692
|
+
- The work matches the active feature's \`summary\`, \`targets\`, and dependencies.
|
|
693
|
+
- Plan \`requirements\` and \`decisions\` are still honored.
|
|
694
|
+
- Changed files were read, not just summarized.
|
|
695
|
+
- Validation evidence covers the behavior touched.
|
|
696
|
+
- New tests or manual checks would fail or visibly differ without the change where practical.
|
|
697
|
+
- No unrelated scope slipped in.
|
|
698
|
+
- Public contracts and downstream callers still work.
|
|
699
|
+
|
|
700
|
+
## Final review checklist
|
|
701
|
+
|
|
702
|
+
- Every feature is complete and together they satisfy the original goal.
|
|
703
|
+
- Broad validation ran and passed.
|
|
704
|
+
- The final \`reviewDepth\` equals the approved \`finalReviewPolicy\`; the only final-review enum values are \`broad\` and \`detailed\`.
|
|
705
|
+
- Feature-level reviews have no unresolved blocking findings.
|
|
706
|
+
- Docs, commands, package metadata, and release surfaces match the delivered behavior.
|
|
707
|
+
- Remaining gaps are explicit and do not contradict \`kind: "completed"\`.
|
|
708
|
+
|
|
709
|
+
## Payloads
|
|
710
|
+
|
|
711
|
+
Feature review:
|
|
712
|
+
|
|
713
|
+
\`\`\`json
|
|
714
|
+
{
|
|
715
|
+
"status": "passed",
|
|
716
|
+
"summary": "Reviewed changed runtime files and focused tests; validation covers the new gate.",
|
|
717
|
+
"blockingFindings": []
|
|
718
|
+
}
|
|
719
|
+
\`\`\`
|
|
720
|
+
|
|
721
|
+
Failed feature review:
|
|
722
|
+
|
|
723
|
+
\`\`\`json
|
|
724
|
+
{
|
|
725
|
+
"status": "failed",
|
|
726
|
+
"summary": "Validation does not exercise the changed persistence path.",
|
|
727
|
+
"blockingFindings": [
|
|
728
|
+
{
|
|
729
|
+
"summary": "No test covers archive removal of .flow/session.json after close.",
|
|
730
|
+
"severity": "blocking"
|
|
731
|
+
}
|
|
732
|
+
]
|
|
733
|
+
}
|
|
734
|
+
\`\`\`
|
|
735
|
+
|
|
736
|
+
Final review:
|
|
737
|
+
|
|
738
|
+
\`\`\`json
|
|
739
|
+
{
|
|
740
|
+
"status": "passed",
|
|
741
|
+
"summary": "Reviewed plan scope, all changed files, broad validation, and release metadata.",
|
|
742
|
+
"blockingFindings": [],
|
|
743
|
+
"reviewDepth": "detailed"
|
|
744
|
+
}
|
|
745
|
+
\`\`\`
|
|
746
|
+
|
|
747
|
+
## Audit report reviews
|
|
748
|
+
|
|
749
|
+
When reviewing a findings report, verify findings adversarially:
|
|
750
|
+
|
|
751
|
+
- Check the cited file and surrounding code.
|
|
752
|
+
- Trace mitigating paths before accepting blocking severity.
|
|
753
|
+
- Confirm the deployment model used for severity.
|
|
754
|
+
- Dedupe overlapping findings.
|
|
755
|
+
- Downgrade or reject findings that do not survive refutation.
|
|
756
|
+
|
|
757
|
+
Approve only on evidence actually inspected. A review is a claim of coverage, not a courtesy stamp.
|
|
758
|
+
`;var O=`---
|
|
759
|
+
name: flow-review
|
|
760
|
+
description: Review Flow work in the v4 runtime: inspect feature or final-session changes, classify findings, and return featureReview or finalReview payloads for flow_feature_complete.
|
|
761
|
+
---
|
|
762
|
+
|
|
763
|
+
# Flow Review
|
|
764
|
+
|
|
765
|
+
Use this skill for review. The reviewer is usually read-only and does not mutate Flow state. The manager records the returned review payload inside \`flow_feature_complete\`.
|
|
766
|
+
|
|
767
|
+
If Flow tools or required Flow skills are unavailable or stale, perform an advisory review and say that no Flow-gated review payload was recorded.
|
|
768
|
+
|
|
769
|
+
## Start
|
|
770
|
+
|
|
771
|
+
- Call \`flow_status\` when available.
|
|
772
|
+
- Identify whether this is a feature review or final review.
|
|
773
|
+
- Read the approved plan fields relevant to the work: \`requirements\`, \`decisions\`, feature \`targets\`, feature \`validation\`, and dependencies.
|
|
774
|
+
- Inspect the actual diff, changed files, tests, and validation output. Do not review only the completion summary.
|
|
775
|
+
- Load \`references/review-rubric.md\` for severity, depth, and payload shape.
|
|
776
|
+
|
|
777
|
+
## Feature Review Depth
|
|
778
|
+
|
|
779
|
+
- **quick**: docs, comments, config-only changes, or mechanical changes fully covered by tooling.
|
|
780
|
+
- **standard**: default feature review. Read every changed file and relevant tests.
|
|
781
|
+
- **detailed**: risky behavior, persistence, security, cross-module refactors, migrations, releases, or weak validation.
|
|
782
|
+
|
|
783
|
+
\`quick\` and \`standard\` are feature-review depth descriptions only. Final reviews use \`reviewDepth: "broad"\` or \`"detailed"\` to match the plan's \`finalReviewPolicy\`; these runtime enum values are the canonical final-review terms. Claim only the depth actually performed. Missing evidence is a finding, not a nuisance.
|
|
784
|
+
|
|
785
|
+
## Output
|
|
786
|
+
|
|
787
|
+
For a feature review, return:
|
|
788
|
+
|
|
789
|
+
\`\`\`json
|
|
790
|
+
{
|
|
791
|
+
"status": "passed",
|
|
792
|
+
"summary": "what was reviewed and why it is acceptable",
|
|
793
|
+
"blockingFindings": []
|
|
794
|
+
}
|
|
795
|
+
\`\`\`
|
|
796
|
+
|
|
797
|
+
For a final review, return:
|
|
798
|
+
|
|
799
|
+
\`\`\`json
|
|
800
|
+
{
|
|
801
|
+
"status": "passed",
|
|
802
|
+
"summary": "session-level review summary",
|
|
803
|
+
"blockingFindings": [],
|
|
804
|
+
"reviewDepth": "detailed"
|
|
805
|
+
}
|
|
806
|
+
\`\`\`
|
|
807
|
+
|
|
808
|
+
Use \`status: "failed"\` when any blocking finding remains. Advisory findings may be included in the prose summary, but \`blockingFindings\` contains only blockers.
|
|
809
|
+
|
|
810
|
+
## Special cases
|
|
811
|
+
|
|
812
|
+
- Cleanup/refactor: load \`flow-deslop\`; verify the smell was real, refutation paths were checked, and behavior was preserved.
|
|
813
|
+
- UI/frontend: load \`flow-ui-quality\`; verify state coverage and visual evidence when a local target was available.
|
|
814
|
+
- Audit reports: use \`flow-run/references/audit-rubric.md\`; findings must survive refutation before they can drive fix features.
|
|
815
|
+
- Large reviews: use \`../flow/references/parallel-orchestration.md\` for
|
|
816
|
+
read-only slices by changed-file group, risk lens, or validation surface.
|
|
817
|
+
Use the named review, audit, evidence, or validation agents from that
|
|
818
|
+
reference instead of generic subagents. Apply its handoff format and
|
|
819
|
+
verification gates; only the manager returns the final \`featureReview\` or
|
|
820
|
+
\`finalReview\` payload.
|
|
821
|
+
|
|
822
|
+
Never approve to unblock completion, fix findings in the review pass, or vouch for validation you did not inspect.
|
|
823
|
+
`;var N=`# Audit findings rubric
|
|
824
|
+
|
|
825
|
+
What counts as a valid finding when the feature's deliverable is a findings report: a codebase audit, a review-first feature, or any report whose findings a later feature will fix. The commands you run are still governed by \`validation-rubric.md\`; this rubric governs the findings themselves.
|
|
826
|
+
|
|
827
|
+
A findings report is a set of claims about code you did not write. Its failure mode is not "missed something" — it is the confident, accurately-cited finding that is wrong because the mitigating code path was never read. Accurate citations are necessary, never sufficient: a citation proves you found the suspicious site, not that the suspicion survives contact with the rest of the codebase.
|
|
828
|
+
|
|
829
|
+
## Refute before you report
|
|
830
|
+
|
|
831
|
+
Before any finding earns blocking severity (P1/P2 or equivalent), actively try to kill it:
|
|
832
|
+
|
|
833
|
+
- **Trace the mitigating paths.** Read the callers of the suspicious site and the code it delegates to. The question is never "could this line misbehave?" but "does anything between input and this line already prevent that?"
|
|
834
|
+
- **Cross the layer boundary.** In a multi-layer repo, a finding in one layer is unverified until you have read its counterpart in the other. A frontend finding requires reading the backend handler it calls (it may already validate or dedupe); a library-internals finding requires checking what validation real callers pass through; an API finding requires checking what the client can actually send.
|
|
835
|
+
- **Check the surrounding lifecycle.** State that "leaks" or "goes stale" may already be reset by an effect, a guard clause, or an invalidation a few lines away from where you stopped reading.
|
|
836
|
+
|
|
837
|
+
A finding that survives this pass is worth reporting. A finding you did not try to refute is a guess with a citation.
|
|
838
|
+
|
|
839
|
+
## Parallel audit slices
|
|
840
|
+
|
|
841
|
+
For broad audits, use \`../../flow/references/parallel-orchestration.md\` to split
|
|
842
|
+
read-only slices by module, data flow, or risk lens. Workers surface candidates;
|
|
843
|
+
the audit author owns the report. Apply its handoff format and verification
|
|
844
|
+
gates. Before blocking severity, dedupe, trace guards, fill cross-layer checks,
|
|
845
|
+
verify contested or high-stakes claims, and downgrade missing context.
|
|
846
|
+
|
|
847
|
+
## Every blocking finding records "guards checked"
|
|
848
|
+
|
|
849
|
+
In addition to evidence, why-it-matters, and fix shape, every blocking finding names the mitigating paths you traced and why they do not cover this case ("\`suggest_mappings()\` enforces one-to-one via \`used_a\`/\`used_b\` — but nothing dedupes after the frontend re-sorts" reads very differently from silence). No guards-checked line means the finding is unverified: downgrade it to advisory and say what you did not trace.
|
|
850
|
+
|
|
851
|
+
## Observed, not hypothesized
|
|
852
|
+
|
|
853
|
+
- A blocking finding describes behavior the current code exhibits, with the input that triggers it. "If the backend ever returns X" is a hypothesis about code you chose not to read — either read it and confirm, or record the item as a defense-in-depth note (advisory at most).
|
|
854
|
+
- Uncertainty after tracing is honest — state it and rate by the realistic worst case. Uncertainty instead of tracing is padding.
|
|
855
|
+
|
|
856
|
+
## Severity is rated in deployment context
|
|
857
|
+
|
|
858
|
+
- The report header states the deployment model the product actually has: desktop app, shared server, library consumed by others, CLI, and so on.
|
|
859
|
+
- Rate impact within that model. Unbounded memory in a single-user desktop process whose lifetime is one window is not the severity it would be in a long-running shared service. When a finding only matters under a deployment the product does not have, say so explicitly ("becomes blocking if this ships as a shared service") instead of rating for the imagined deployment.
|
|
860
|
+
|
|
861
|
+
## Report shape
|
|
862
|
+
|
|
863
|
+
\`\`\`
|
|
864
|
+
header: scope audited; deployment context; validation commands actually run
|
|
865
|
+
findings, strongest first, each with:
|
|
866
|
+
- class and severity
|
|
867
|
+
- evidence — file:line actually read
|
|
868
|
+
- guards checked — mitigating paths traced and why they fall short (blocking findings)
|
|
869
|
+
- why it matters — the concrete failure, with triggering input
|
|
870
|
+
- fix shape — one sentence, not an implementation
|
|
871
|
+
positive findings — what is genuinely solid, so fixes do not regress it
|
|
872
|
+
follow-up order — correctness and persisted/user-input surfaces first
|
|
873
|
+
\`\`\`
|
|
874
|
+
|
|
875
|
+
Never: promote a hypothesis to blocking severity; cite a line you did not read in context; rate severity against a deployment model the product does not have; pad the report to look thorough — six verified findings outrank nine where three die on first contact.
|
|
876
|
+
`;var V=`# Validation evidence rubric
|
|
877
|
+
|
|
878
|
+
Use this before recording \`flow_feature_complete\`.
|
|
879
|
+
|
|
880
|
+
## Evidence tiers
|
|
881
|
+
|
|
882
|
+
1. **Behavioral automated test**: a targeted unit/integration/e2e test exercises the changed behavior and fails without the change.
|
|
883
|
+
2. **Manual reproducible check**: you ran the app, CLI, endpoint, or workflow and recorded exact steps plus observed result.
|
|
884
|
+
3. **Indirect automated check**: typecheck, lint, build, or compile proves shape but not behavior. Acceptable alone only for docs, comments, renames fully covered by tooling, or purely mechanical changes.
|
|
885
|
+
4. **Static inspection**: reading code without running anything. This is a gap, not completion evidence for behavioral work.
|
|
886
|
+
|
|
887
|
+
Use the strongest practical tier. For risky work, combine tiers.
|
|
888
|
+
|
|
889
|
+
## Recording rules
|
|
890
|
+
|
|
891
|
+
- Each \`validationRun\` entry has \`command\`, \`status\`, and \`summary\`.
|
|
892
|
+
- Completion accepts only passing entries. Failed or skipped checks belong in the summary/notes and must be resolved or explained as blockers.
|
|
893
|
+
- Do not claim a command was run unless it was run in this session or directly reported by a trusted worker with raw output.
|
|
894
|
+
- Worker-reported command output must satisfy \`../../flow/references/verification-gates.md\`: exact command, status, raw outcome summary, coverage, and manager acceptance.
|
|
895
|
+
- Include scope in the summary: what behavior, files, routes, or states the check covered.
|
|
896
|
+
- UI work should include browser or screenshot evidence when the app can run locally.
|
|
897
|
+
- Cleanup/refactor work should show behavior preservation, not only formatting success.
|
|
898
|
+
|
|
899
|
+
## Scope
|
|
900
|
+
|
|
901
|
+
- Use \`validationScope: "targeted"\` for ordinary feature completion.
|
|
902
|
+
- Use \`validationScope: "broad"\` only when the session is on its final feature and the project-level gate was run.
|
|
903
|
+
|
|
904
|
+
Broad validation usually means the repo's full check command, full relevant test suite, build, or equivalent release gate. If the broad gate cannot run, do not mark the final feature complete; report \`needs_input\` or fix the blocker.
|
|
905
|
+
|
|
906
|
+
## Good payload fragment
|
|
907
|
+
|
|
908
|
+
\`\`\`json
|
|
909
|
+
{
|
|
910
|
+
"validationRun": [
|
|
911
|
+
{
|
|
912
|
+
"command": "bun test tests/runtime-gates.test.ts",
|
|
913
|
+
"status": "passed",
|
|
914
|
+
"summary": "12 pass; covered approval immutability, active feature, and completion gates"
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
"command": "bun run typecheck",
|
|
918
|
+
"status": "passed",
|
|
919
|
+
"summary": "TypeScript accepted runtime and adapter changes"
|
|
920
|
+
}
|
|
921
|
+
],
|
|
922
|
+
"validationScope": "broad"
|
|
923
|
+
}
|
|
924
|
+
\`\`\`
|
|
925
|
+
|
|
926
|
+
## Blockers and resets
|
|
927
|
+
|
|
928
|
+
- If validation fails due to a code bug, fix it and rerun.
|
|
929
|
+
- If validation reveals a wrong design or interface assumption, call \`flow_feature_reset\` and rerun from the corrected approach.
|
|
930
|
+
- If validation needs external access, missing credentials, or ambiguous user input, record \`status: "needs_input"\` with an honest \`outcome\`.
|
|
931
|
+
|
|
932
|
+
Never trim failing output, relabel a failed command as passed, or use "not run" as completion evidence.
|
|
933
|
+
`;var E="---\nname: flow-run\ndescription: Execute one approved Flow feature in the v4 runtime: start a feature with flow_run_start, make scoped changes, gather real validation evidence, obtain review payloads, and complete with flow_feature_complete.\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- 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- 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- 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\n## Validate\n\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.\nWorkers must use the handoff format and verification gates from that reference.\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.\n\n## Review and complete\n\nBefore `flow_feature_complete`, obtain a `featureReview` payload. Load `flow-review`; for read-only subagent reviews, the manager receives the payload and records it.\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 \"featureReview\": { \"status\": \"passed\", \"summary\": \"review summary\", \"blockingFindings\": [] }\n}\n```\n\nIf genuinely blocked, call `flow_feature_complete` with `status: \"needs_input\"` and an `outcome` that explains the blocker and next step. Never fabricate validation or review evidence to force progress.\n";var G=`# UI quality rubric
|
|
934
|
+
|
|
935
|
+
Use this rubric for frontend planning, implementation, and review.
|
|
936
|
+
|
|
937
|
+
## Product fit
|
|
938
|
+
|
|
939
|
+
- The screen solves the user's actual task, not a generic demo of components.
|
|
940
|
+
- The first viewport shows the product, data, object, or workflow the user came for.
|
|
941
|
+
- The information density matches use: operational tools favor scannable, compact structure; expressive pages need stronger visual identity and media.
|
|
942
|
+
- Navigation and primary actions are obvious without explanatory helper text.
|
|
943
|
+
|
|
944
|
+
## Visual design
|
|
945
|
+
|
|
946
|
+
- **Typography**: hierarchy is clear; font choices fit the product; body text remains readable; compact surfaces do not use hero-scale type.
|
|
947
|
+
- **Color**: palette has a coherent role system; contrast is sufficient; accent colors guide attention; avoid one-note palettes and generic purple-blue gradients unless the brand requires them.
|
|
948
|
+
- **Composition**: alignment, spacing, and grouping make comparison easy; repeated items are consistent; page sections are not nested decorative cards.
|
|
949
|
+
- **Controls**: use familiar controls for the job: icons for common tools, toggles for binary settings, segmented controls for modes, sliders/inputs for numbers, menus for option sets.
|
|
950
|
+
- **Motion**: animation clarifies state or creates a focused moment; it does not hide latency, distract from work, or ignore reduced-motion needs.
|
|
951
|
+
- **Imagery/media**: when the subject matters, show the actual product/place/object/state rather than atmospheric filler.
|
|
952
|
+
|
|
953
|
+
## Interaction and states
|
|
954
|
+
|
|
955
|
+
- Loading, empty, error, disabled, hover, focus, selected, and validation states exist for the changed workflow.
|
|
956
|
+
- Long strings, missing data, large numbers, and small screens do not break layout.
|
|
957
|
+
- Destructive actions have appropriate confirmation or undo patterns.
|
|
958
|
+
- Form errors are close to the field and clear enough to fix.
|
|
959
|
+
- Async state cannot double-submit, lose edits, or leave stale UI behind.
|
|
960
|
+
|
|
961
|
+
## Accessibility baseline
|
|
962
|
+
|
|
963
|
+
- Interactive elements are semantic or have correct roles and labels.
|
|
964
|
+
- Keyboard users can reach and operate controls in a logical order.
|
|
965
|
+
- Focus indicators are visible.
|
|
966
|
+
- Text and essential UI meet contrast expectations.
|
|
967
|
+
- Status, error, and progress messages are not conveyed by color alone.
|
|
968
|
+
- Motion respects reduced-motion preferences when substantial.
|
|
969
|
+
|
|
970
|
+
## Review finding shape
|
|
971
|
+
|
|
972
|
+
\`\`\`text
|
|
973
|
+
class; severity; location or screenshot area; evidence inspected; user impact; fix shape; visual/validation evidence needed
|
|
974
|
+
\`\`\`
|
|
975
|
+
|
|
976
|
+
Blocking UI findings are issues that prevent task completion, hide required information, break accessibility basics, create incoherent layout at supported sizes, or make the visual success claim unverifiable.
|
|
977
|
+
`;var L=`# Visual verification workflow
|
|
978
|
+
|
|
979
|
+
Use this workflow when UI changes can be run locally. Flow execution may create visual evidence; Flow review usually assesses recorded evidence because the reviewer is read-only.
|
|
980
|
+
|
|
981
|
+
## Execution lane
|
|
982
|
+
|
|
983
|
+
- Identify the target route, state, viewport sizes, and any required seed data.
|
|
984
|
+
- Start the repo's normal dev server or storybook command from the recorded repo profile.
|
|
985
|
+
- Prefer existing browser or Playwright tooling when available. Do not add heavy visual tooling just to inspect a small change.
|
|
986
|
+
- Capture at least one desktop viewport and one mobile viewport for user-facing layout changes.
|
|
987
|
+
- Exercise the primary interaction changed by the feature.
|
|
988
|
+
- Inspect loading, empty, and error states when they are part of the changed workflow or easy to reach.
|
|
989
|
+
- Check browser console output when the tooling exposes it.
|
|
990
|
+
- For canvas/3D/media-heavy UI, verify rendered pixels are nonblank and the subject is framed.
|
|
991
|
+
|
|
992
|
+
## Review lane
|
|
993
|
+
|
|
994
|
+
- Inspect the screenshots, browser notes, console output, or visual artifacts recorded by execution.
|
|
995
|
+
- Compare recorded evidence against the plan's design intent, supported viewports, state coverage, and the UI rubric.
|
|
996
|
+
- If the current reviewer has browser/shell tools and permissions, it may perform additional read-only visual checks.
|
|
997
|
+
- If the reviewer is read-only without browser or shell access, do not try to recreate evidence. Treat missing or insufficient visual evidence as a finding or coverage gap.
|
|
998
|
+
|
|
999
|
+
## What to look for
|
|
1000
|
+
|
|
1001
|
+
- Text overlap, clipped labels, unintended wrapping, and controls resizing on hover.
|
|
1002
|
+
- Incoherent spacing, nested cards, generic placeholder visuals, and decorative elements that compete with the task.
|
|
1003
|
+
- Missing focus states, low contrast, unreachable controls, and color-only status.
|
|
1004
|
+
- Broken responsive behavior: horizontal scroll, collapsed controls, hidden primary actions, or unreadable tables.
|
|
1005
|
+
- State bugs: stale loading indicators, duplicate submissions, lost input, or errors that cannot be recovered.
|
|
1006
|
+
|
|
1007
|
+
## If visual verification is unavailable
|
|
1008
|
+
|
|
1009
|
+
Record the reason and use the strongest available substitute:
|
|
1010
|
+
|
|
1011
|
+
- build/typecheck/lint for changed frontend code.
|
|
1012
|
+
- component or interaction tests.
|
|
1013
|
+
- Storybook/static render output.
|
|
1014
|
+
- code inspection against existing component patterns.
|
|
1015
|
+
|
|
1016
|
+
Do not claim visual polish was verified if no visual artifact was inspected.
|
|
1017
|
+
`;var M=`---
|
|
1018
|
+
name: flow-ui-quality
|
|
1019
|
+
description: Flow guidance for UX/UI design, frontend polish, visual quality review, responsive and accessible interfaces, and avoiding generic AI-generated UI. Use when planning, executing, or reviewing frontend pages, components, dashboards, visual redesigns, interaction states, screenshots, or browser-verified UI work.
|
|
1020
|
+
---
|
|
1021
|
+
|
|
1022
|
+
# Flow UI quality
|
|
1023
|
+
|
|
1024
|
+
Use this skill when Flow work changes what a user sees or how they interact with an interface. The goal is production UI quality: useful, coherent, accessible, responsive, and visually intentional.
|
|
1025
|
+
|
|
1026
|
+
## Establish the interface intent
|
|
1027
|
+
|
|
1028
|
+
- Identify the user, job-to-be-done, primary workflow, density needs, device constraints, and brand/product tone before choosing visuals.
|
|
1029
|
+
- Choose a clear design direction that fits the product context. Distinctive does not mean decorative; utilitarian tools can be excellent through restraint, hierarchy, and speed.
|
|
1030
|
+
- Load \`references/ui-rubric.md\` for design and UX review criteria.
|
|
1031
|
+
- Load \`references/visual-verification.md\` before completing meaningful UI changes to capture visual evidence. During review, use it to assess recorded evidence; only run browser checks yourself if the current agent and tools permit it.
|
|
1032
|
+
- Record design constraints and verification expectations in Flow plan fields: \`requirements\`, \`decisions\`, feature \`targets\`, and feature \`validation\`. Do not add new Flow payload fields.
|
|
1033
|
+
|
|
1034
|
+
## Build with visual intent
|
|
1035
|
+
|
|
1036
|
+
- Use existing design systems, component libraries, tokens, icons, and layout conventions before inventing new primitives.
|
|
1037
|
+
- Make typography, spacing, color, motion, and hierarchy deliberate. Avoid default-looking AI output: centered everything, purple gradients, generic cards, uniform oversized radii, stock SaaS layouts, and unexamined Inter/system-font sameness.
|
|
1038
|
+
- Match composition to domain: operational apps need scanability, alignment, predictable controls, efficient density, and clear states; marketing or editorial surfaces can carry more expressive imagery and motion.
|
|
1039
|
+
- Include states a real user will hit: loading, empty, error, disabled, hover, focus, selected, validation, and long content.
|
|
1040
|
+
- Protect accessibility: semantic controls, labels, focus order, keyboard reachability, contrast, reduced-motion behavior, and non-color-only status.
|
|
1041
|
+
|
|
1042
|
+
## Verify visually
|
|
1043
|
+
|
|
1044
|
+
- For meaningful UI changes, run the app and capture screenshots when a local browser target is available.
|
|
1045
|
+
- Check desktop and mobile breakpoints, not only the viewport you developed in.
|
|
1046
|
+
- Verify text does not overlap, truncate unintentionally, or escape controls; long labels and empty/error states must fit.
|
|
1047
|
+
- Compare against provided screenshots, design references, or the stated product intent. List meaningful differences and fix the ones that violate the goal.
|
|
1048
|
+
- If browser verification cannot run, record the gap and the next-best evidence such as component tests, Storybook snapshots, build output, or static inspection.
|
|
1049
|
+
|
|
1050
|
+
## Review UI work
|
|
1051
|
+
|
|
1052
|
+
Approve only when the interface is both useful and inspectable:
|
|
1053
|
+
|
|
1054
|
+
- The main workflow is visible and efficient.
|
|
1055
|
+
- Visual hierarchy makes the next action obvious.
|
|
1056
|
+
- Responsive behavior is deliberate.
|
|
1057
|
+
- Accessibility basics are covered.
|
|
1058
|
+
- State coverage is present or the gaps are explicit.
|
|
1059
|
+
- Screenshot/browser evidence supports the claim whenever feasible.
|
|
1060
|
+
|
|
1061
|
+
Never approve a UI change based only on code shape. If users will judge it visually, Flow evidence should include visual inspection.
|
|
1062
|
+
`;var x=[{name:"flow",files:[{relativePath:"SKILL.md",content:q},{relativePath:"references/recovery-playbook.md",content:U},{relativePath:"references/parallel-orchestration.md",content:C},{relativePath:"references/handoff-format.md",content:F},{relativePath:"references/verification-gates.md",content:A}]},{name:"flow-plan",files:[{relativePath:"SKILL.md",content:z},{relativePath:"references/planning-examples.md",content:W},{relativePath:"references/parallel-discovery.md",content:j}]},{name:"flow-run",files:[{relativePath:"SKILL.md",content:E},{relativePath:"references/validation-rubric.md",content:V},{relativePath:"references/audit-rubric.md",content:N}]},{name:"flow-review",files:[{relativePath:"SKILL.md",content:O},{relativePath:"references/review-rubric.md",content:B}]},{name:"flow-deslop",files:[{relativePath:"SKILL.md",content:D},{relativePath:"references/smell-rubric.md",content:P},{relativePath:"references/refactor-workflow.md",content:T}]},{name:"flow-ui-quality",files:[{relativePath:"SKILL.md",content:M},{relativePath:"references/ui-rubric.md",content:G},{relativePath:"references/visual-verification.md",content:L}]}];var X=".flow-skill-version";function _(){return process.env.HOME??process.env.USERPROFILE??""}function $(e=_()){return l(e,".config","opencode","skills")}function R(e){return xe("sha256").update(e).digest("hex")}function Ue(e,t){return[`version=${t}`,...e.files.map((a)=>`file=${a.relativePath} sha256=${R(a.content)}`),""].join(`
|
|
1063
|
+
`)}async function p(e){try{return await _e(e,"utf8")}catch(t){if(t.code==="ENOENT")return null;throw t}}function Y(e){let t=new Map;if(!e)return t;for(let a of e.split(/\r?\n/)){let r=/^file=(.+) sha256=([a-f0-9]{64})$/.exec(a)??/^file=(.+)=sha256:([a-f0-9]{64})$/.exec(a);if(r?.[1]&&r[2])t.set(r[1],r[2]);let n=/^hash=sha256:([a-f0-9]{64})$/.exec(a);if(n?.[1]&&!t.has("SKILL.md"))t.set("SKILL.md",n[1])}return t}function Ae(e){if(!e)return null;for(let t of e.split(/\r?\n/)){let a=/^version=(.+)$/.exec(t);if(a?.[1])return a[1]}return null}function J(e,t){let a=Fe(l(e,...t.split("/")));if(a!==e&&a.startsWith(`${e}${Ce}`))return a;throw Error(`Unsafe skill file path '${t}'.`)}function qe(){return x.map((e)=>e.name)}function Te(e){return`npx -y opencode-plugin-flow@${e} doctor`}function Pe(){if(process.env.npm_package_version)return process.env.npm_package_version;try{let e=Ie(import.meta.url);for(let t of["../package.json","../../package.json"])try{let a=e(t);if(a.version)return a.version}catch{}}catch{}return"0.0.0"}async function Z(e=Pe(),t=_()){let a=$(t),r=new Set(qe()),n=await Promise.all(x.map(async(o)=>{let i=l(a,o.name),m=await p(l(i,X)),g=Ae(m),ee=Y(m);if(await p(l(i,"SKILL.md"))===null)return{name:o.name,path:i,status:"missing",markerVersion:g,missingFiles:o.files.map((d)=>d.relativePath),editedFiles:[],outdatedFiles:[]};if(m===null)return{name:o.name,path:i,status:"foreign",markerVersion:g,missingFiles:[],editedFiles:[],outdatedFiles:[]};let w=[],y=[],b=[];for(let d of o.files){let k=await p(J(i,d.relativePath));if(k===null){w.push(d.relativePath);continue}if(k===d.content)continue;let I=ee.get(d.relativePath);if(I&&R(k)!==I){y.push(d.relativePath);continue}b.push(d.relativePath)}let ae=m!==Ue(o,e),te=w.length>0?"incomplete":y.length>0?"edited":ae||b.length>0?"outdated":"ok";return{name:o.name,path:i,status:te,markerVersion:g,missingFiles:w,editedFiles:y,outdatedFiles:b}})),s=[];try{s=await K(a)}catch(o){if(o.code!=="ENOENT")throw o}let c=s.filter((o)=>(o==="flow"||o.startsWith("flow-"))&&!r.has(o)).map((o)=>l(a,o)),u=n.filter((o)=>["missing","incomplete","outdated"].includes(o.status)).map((o)=>o.name),h=n.filter((o)=>["foreign","edited"].includes(o.status)).map((o)=>o.name),f=h.length>0,v=u.length>0;return{status:f?"action_required":v?"sync_required":"ok",version:e,root:a,expectedSkills:[...r],skills:n,syncRequiredSkills:u,actionRequiredSkills:h,unmanagedFlowSkills:c}}function S(e,t,a){if(a.length===0)return;e.push(`- ${t}: ${a.join(", ")}`)}function Q(e){let t=["Flow doctor",`- status: ${e.status}`,`- plugin version: ${e.version}`,`- skills root: ${e.root}`,`- expected skills: ${e.expectedSkills.join(", ")}`];S(t,"startup sync can install/update",e.syncRequiredSkills),S(t,"needs user decision",e.actionRequiredSkills),t.push("","Skills:");for(let a of e.skills){if(t.push(`- ${a.name}: ${a.status} (${a.path})${a.markerVersion?` marker=${a.markerVersion}`:""}`),a.missingFiles.length>0)t.push(` missing: ${a.missingFiles.join(", ")}`);if(a.editedFiles.length>0)t.push(` edited: ${a.editedFiles.join(", ")}`);if(a.outdatedFiles.length>0)t.push(` outdated: ${a.outdatedFiles.join(", ")}`)}if(e.unmanagedFlowSkills.length>0){t.push("","Unmanaged Flow-like skill folders:");for(let a of e.unmanagedFlowSkills)t.push(`- ${a}`)}if(t.push("","Recommendation:"),e.status==="ok")t.push("- Flow skills are present and current.");else if(e.status==="sync_required")t.push("- Start or restart OpenCode with opencode-plugin-flow enabled so startup sync can install or update the listed skills. If Flow then reports restart_required, restart OpenCode once more so the refreshed skill registry is used.");else t.push("- Resolve user-owned or edited managed skill folders, then restart OpenCode. Move a folder aside to let Flow recreate it, or keep it intentionally as a local override.");return t.push(`- Details command: ${Te(e.version)}`),`${t.join(`
|
|
1064
|
+
`)}
|
|
1065
|
+
`}async function H(e=_()){let t=$(e),a=[],r=[],n;try{n=await K(t)}catch(s){if(s.code==="ENOENT")return{removed:a,kept:r};throw s}for(let s of n){if(s!=="flow"&&!s.startsWith("flow-"))continue;let c=l(t,s),u=await p(l(c,X));if(u===null){r.push(c);continue}let h=Y(u),f=!1;for(let[v,o]of h){let i=await p(J(c,v));if(i!==null&&R(i)!==o){f=!0;break}}if(f){r.push(c);continue}await Re(c,{recursive:!0,force:!0}),a.push(c)}return{removed:a,kept:r}}async function De(e){let t=e[2];if(t!=="uninstall"&&t!=="doctor"){process.stderr.write(`usage: opencode-plugin-flow <doctor|uninstall>
|
|
1066
|
+
`),process.exitCode=2;return}if(t==="doctor"){process.stdout.write(Q(await Z()));return}let a=await H();for(let r of a.removed)process.stdout.write(`Removed Flow skill: ${r}
|
|
1067
|
+
`);for(let r of a.kept)process.stdout.write(`Kept non-Flow or user-edited skill: ${r}
|
|
5
1068
|
`);process.stdout.write(`Remove "opencode-plugin-flow" from opencode.json and restart OpenCode.
|
|
6
|
-
`)}
|
|
1069
|
+
`)}De(process.argv).catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
7
1070
|
`),process.exitCode=1});
|