claude-mcp-workflow 0.1.8 → 0.1.10
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/.claude-plugin/plugin.json +4 -2
- package/README.md +38 -1
- package/build/engine.d.ts +13 -1
- package/build/engine.d.ts.map +1 -1
- package/build/engine.js +42 -3
- package/build/engine.js.map +1 -1
- package/build/executor.d.ts +6 -0
- package/build/executor.d.ts.map +1 -1
- package/build/executor.js +19 -8
- package/build/executor.js.map +1 -1
- package/build/loader.d.ts.map +1 -1
- package/build/loader.js +4 -0
- package/build/loader.js.map +1 -1
- package/build/tools.d.ts +9 -1
- package/build/tools.d.ts.map +1 -1
- package/build/tools.js +21 -2
- package/build/tools.js.map +1 -1
- package/build/types.d.ts +40 -20
- package/build/types.d.ts.map +1 -1
- package/build/types.js +5 -1
- package/build/types.js.map +1 -1
- package/hooks/hooks.json +4 -2
- package/hooks/workflow-cleanup.sh +8 -4
- package/hooks/workflow-start.sh +60 -32
- package/package.json +2 -1
- package/scripts/check-skill-sync.sh +45 -0
- package/scripts/hxq-lint-file.sh +44 -0
- package/scripts/scan-project.sh +34 -0
- package/templates/batch.yaml +191 -0
- package/templates/bug-fix.yaml +168 -34
- package/templates/code-review.yaml +94 -32
- package/templates/coding.yaml +123 -21
- package/templates/debugging.yaml +43 -14
- package/templates/explore.yaml +53 -14
- package/templates/file-code.yaml +13 -4
- package/templates/file-review.yaml +115 -10
- package/templates/github-init.yaml +24 -8
- package/templates/investigate.yaml +13 -4
- package/templates/lint-review.yaml +53 -0
- package/templates/master.yaml +80 -13
- package/templates/new-feature.yaml +24 -26
- package/templates/planning.yaml +39 -8
- package/templates/reflection.yaml +62 -6
- package/templates/review-push.yaml +26 -7
- package/templates/skills/architecture/SKILL.md +93 -36
- package/templates/skills/aws-lambda/SKILL.md +9 -9
- package/templates/skills/browser-verify/SKILL.md +117 -0
- package/templates/skills/build-cmake/SKILL.md +33 -8
- package/templates/skills/ci-github-actions/SKILL.md +63 -18
- package/templates/skills/claude-code-config/SKILL.md +65 -19
- package/templates/skills/cleanup/SKILL.md +57 -0
- package/templates/skills/coding-skill-selector/SKILL.md +32 -6
- package/templates/skills/debug-bridge-scaffold/SKILL.md +98 -0
- package/templates/skills/debugging/SKILL.md +82 -0
- package/templates/skills/domain-gamedev/SKILL.md +74 -6
- package/templates/skills/domain-pixi/SKILL.md +297 -7
- package/templates/skills/domain-reid/SKILL.md +39 -5
- package/templates/skills/domain-ui/SKILL.md +35 -0
- package/templates/skills/domain-yolo/SKILL.md +39 -7
- package/templates/skills/hxq/SKILL.md +241 -0
- package/templates/skills/hxq/references/lint.md +7 -0
- package/templates/skills/hxq/references/ops.md +92 -0
- package/templates/skills/hxq/references/parser-dev.md +103 -0
- package/templates/skills/hxq/references/queries.md +90 -0
- package/templates/skills/ide-zed/SKILL.md +23 -0
- package/templates/skills/lang-as3/SKILL.md +19 -6
- package/templates/skills/lang-haxe/SKILL.md +99 -732
- package/templates/skills/lang-haxe/references/abstracts.md +219 -0
- package/templates/skills/lang-haxe/references/compile-traps.md +328 -0
- package/templates/skills/lang-haxe/references/macros.md +475 -0
- package/templates/skills/lang-haxe/references/null-safety.md +128 -0
- package/templates/skills/lang-haxe/references/targets-runtime.md +113 -0
- package/templates/skills/lang-python/SKILL.md +6 -2
- package/templates/skills/math/SKILL.md +64 -2
- package/templates/skills/mcp-setup/SKILL.md +14 -2
- package/templates/skills/preferences/SKILL.md +67 -31
- package/templates/skills/skill-manager/SKILL.md +287 -0
- package/templates/skills/target-openfl-native/SKILL.md +58 -17
- package/templates/skills/target-openfl-native/references/build-and-versions.md +7 -4
- package/templates/skills/task-delegation/SKILL.md +168 -4
- package/templates/skills/web-reading/SKILL.md +33 -25
- package/templates/skills/workflow-authoring/SKILL.md +87 -11
- package/templates/subagent.yaml +32 -8
- package/templates/testing.yaml +145 -12
- package/templates/web-research.yaml +26 -14
package/templates/bug-fix.yaml
CHANGED
|
@@ -13,16 +13,28 @@ states:
|
|
|
13
13
|
- Does it include a screenshot or describe a VISUAL problem (layout, overlap, wrong color, missing element)?
|
|
14
14
|
- Or is it a LOGIC problem (wrong data, crash, incorrect calculation, serialization error)?
|
|
15
15
|
|
|
16
|
+
Persist the classification for verify_route:
|
|
17
|
+
`context_set({ key: "bug_type", value: "visual" })` (or `"logic"`)
|
|
18
|
+
|
|
16
19
|
Choose:
|
|
17
20
|
- `visual` → UI/layout bug — requires debug bridge, screenshots, visual reproduction
|
|
18
21
|
- `logic` → data/logic bug — reproducible via unit tests or logs
|
|
19
22
|
transitions:
|
|
20
23
|
visual: load_skills_visual
|
|
21
|
-
logic:
|
|
24
|
+
logic: load_skills_logic
|
|
25
|
+
|
|
26
|
+
load_skills_logic:
|
|
27
|
+
skills:
|
|
28
|
+
- coding-skill-selector
|
|
29
|
+
- "?debugging"
|
|
30
|
+
- ?project-skill-selector
|
|
31
|
+
transitions:
|
|
32
|
+
continue: reproduce_logic
|
|
22
33
|
|
|
23
34
|
load_skills_visual:
|
|
24
35
|
skills:
|
|
25
36
|
- coding-skill-selector
|
|
37
|
+
- "?debugging"
|
|
26
38
|
- ?debug-bridge
|
|
27
39
|
- ?project-skill-selector
|
|
28
40
|
transitions:
|
|
@@ -34,7 +46,7 @@ states:
|
|
|
34
46
|
Reproduce the bug VISUALLY before proceeding — reading code is NOT reproduction.
|
|
35
47
|
|
|
36
48
|
DO NOT fix the bug here. You may add trace/log statements to help reproduce,
|
|
37
|
-
but do NOT modify production logic. The fix
|
|
49
|
+
but do NOT modify production logic. The fix comes later, after diagnosis.
|
|
38
50
|
|
|
39
51
|
REPRODUCTION TOOLING — find the right tool:
|
|
40
52
|
1. Check available MCP tools for browser/screenshot/debug-bridge capabilities.
|
|
@@ -64,9 +76,8 @@ states:
|
|
|
64
76
|
`cant_reproduce` = you tried but can't see it. This leads to asking the user for help.
|
|
65
77
|
NEVER use `reproduced` when you haven't seen the bug yourself.
|
|
66
78
|
|
|
67
|
-
If the bug requires simulated input or file operations, use the chosen
|
|
68
|
-
|
|
69
|
-
tm-interactive-debug for native.
|
|
79
|
+
If the bug requires simulated input or file operations, use the chosen
|
|
80
|
+
tool's input-simulation capabilities.
|
|
70
81
|
transitions:
|
|
71
82
|
reproduced: diagnose
|
|
72
83
|
cant_reproduce: clarify
|
|
@@ -76,8 +87,9 @@ states:
|
|
|
76
87
|
prompt: |
|
|
77
88
|
Reproduce the bug by EXECUTING code — reading source is NOT reproduction.
|
|
78
89
|
|
|
79
|
-
DO NOT fix the bug here
|
|
80
|
-
|
|
90
|
+
DO NOT fix the bug here, and do NOT touch production code at all — not even
|
|
91
|
+
trace/log statements. Write test code to reproduce. The fix comes later,
|
|
92
|
+
after diagnosis.
|
|
81
93
|
|
|
82
94
|
FILE RESTRICTION: You may ONLY create or edit test files.
|
|
83
95
|
Any edit to production code is a workflow violation.
|
|
@@ -88,18 +100,35 @@ states:
|
|
|
88
100
|
3. BUILD and RUN the test — show the actual output
|
|
89
101
|
4. Describe: EXPECTED vs ACTUAL — what should happen vs what does happen
|
|
90
102
|
|
|
103
|
+
Delegate the build+run to a flat `general-purpose` subagent
|
|
104
|
+
(build/run/report — no workflow, no skills) to keep build output
|
|
105
|
+
out of main context.
|
|
106
|
+
A flat subagent inherits none of this project's skills or env
|
|
107
|
+
rules — it only knows what YOU put in its spawn prompt. So include
|
|
108
|
+
VERBATIM in that prompt: (a) any tooling/hook constraints that
|
|
109
|
+
apply in this project (required CLIs, blocked commands), and
|
|
110
|
+
(b) "Strip noise, but quote every error, failing assertion, and
|
|
111
|
+
number VERBATIM — don't paraphrase the signal or replace it with
|
|
112
|
+
a verdict; the parent judges.", and (c) "Bash: run commands
|
|
113
|
+
FOREGROUND with an explicit timeout sized to the command;
|
|
114
|
+
background ONLY for never-exiting processes (servers, watchers)
|
|
115
|
+
or runs over the 10-min foreground ceiling."
|
|
116
|
+
Spawn with `run_in_background: false` — you need the result before transitioning.
|
|
117
|
+
|
|
91
118
|
STOP — self-check before transitioning:
|
|
92
119
|
- Did you EXECUTE something (build + run)? Reading code ≠ reproduction.
|
|
93
120
|
- Can you paste the failing output? If not, you haven't reproduced yet.
|
|
94
121
|
- "I can see from the code that..." is NOT evidence. Run the code.
|
|
95
122
|
- Run `git diff --name-only` — if ANY file outside test directories was modified,
|
|
96
|
-
you violated the workflow. Revert
|
|
123
|
+
you violated the workflow. Revert before transitioning: revert only the hunks
|
|
124
|
+
you added, and verify the file was clean before your first edit.
|
|
97
125
|
|
|
98
126
|
DO NOT transition to `reproduced` without concrete executed evidence
|
|
99
127
|
(test failure output, wrong runtime output, crash log).
|
|
100
128
|
|
|
101
129
|
If the bug is hard to cover with a unit test (UI state, complex setup, timing),
|
|
102
130
|
transition `try_visual` to reproduce via debug bridge instead.
|
|
131
|
+
If you genuinely cannot reproduce at all → `cant_reproduce` (asks the user for help).
|
|
103
132
|
transitions:
|
|
104
133
|
reproduced: diagnose
|
|
105
134
|
try_visual: load_skills_visual
|
|
@@ -111,19 +140,38 @@ states:
|
|
|
111
140
|
Find the root cause of the bug.
|
|
112
141
|
|
|
113
142
|
DO NOT fix the bug here. You may add trace/log statements to narrow down
|
|
114
|
-
the cause, but do NOT modify production logic. The fix
|
|
143
|
+
the cause, but do NOT modify production logic. The fix comes later, after diagnosis.
|
|
115
144
|
|
|
116
145
|
FILE RESTRICTION: Do NOT add new methods, fields, or change signatures.
|
|
117
146
|
Only trace/log statements are allowed. Any structural code change is a workflow violation.
|
|
118
147
|
|
|
119
148
|
STOP — self-check before transitioning:
|
|
120
|
-
- Run `git diff --name-only` — if any production file was modified beyond trace
|
|
121
|
-
revert
|
|
149
|
+
- Run `git diff --name-only` — if any production file was modified beyond trace
|
|
150
|
+
statements, revert before transitioning: revert only the hunks you added, and
|
|
151
|
+
verify the file was clean before your first edit.
|
|
152
|
+
|
|
153
|
+
Delegating root-cause analysis to a subagent (it reads code to judge —
|
|
154
|
+
ANALYTICAL)? Include in the agent prompt VERBATIM:
|
|
155
|
+
---
|
|
156
|
+
IMPORTANT: Override the default CLAUDE.md rule about start().
|
|
157
|
+
Do NOT call start() without arguments.
|
|
158
|
+
Instead, your FIRST action must be:
|
|
159
|
+
mcp__plugin_workflow_wf__start({ workflow: "subagent", parent_session_id: "<SESSION_ID>" })
|
|
160
|
+
where <SESSION_ID> is the current session ID (substitute it before sending).
|
|
161
|
+
Then follow the subagent workflow until completion — its `route` state
|
|
162
|
+
self-classifies (analytical → skill-loaded sub-workflow; trivial → execute).
|
|
163
|
+
start() returns `SESSION: <id>` — pass that session_id explicitly in every subsequent workflow tool call (transition, context_set); parallel siblings share the same ppid.
|
|
164
|
+
---
|
|
165
|
+
After collecting reports: `sessions` → `abort` orphaned child `subagent`
|
|
166
|
+
sessions. NEVER spawn an analytical subagent flat (no workflow = no skills).
|
|
167
|
+
Its report gates your diagnosis → spawn with `run_in_background: false`.
|
|
122
168
|
|
|
123
169
|
After diagnosing, assess the fix scope:
|
|
124
|
-
- 1 file → `single`
|
|
170
|
+
- 1 file → `single` (top-tier session AND >~30 lines → treat as a
|
|
171
|
+
coupled set of one: route `multi_coupled`, which delegates)
|
|
125
172
|
- 2+ files, tightly coupled (one logical chain, shared context) → `multi_coupled`
|
|
126
173
|
- 2+ files, independent (can be done in parallel with clear interfaces) → `multi_independent`
|
|
174
|
+
- root cause still unclear → `unclear` (add diagnostic logging and retry)
|
|
127
175
|
transitions:
|
|
128
176
|
single: fix_single
|
|
129
177
|
multi_coupled: load_skills_coupled
|
|
@@ -132,8 +180,22 @@ states:
|
|
|
132
180
|
|
|
133
181
|
add_logging:
|
|
134
182
|
task: "Add diagnostic logging"
|
|
135
|
-
prompt: "Add logging for diagnostics, run again."
|
|
136
183
|
max_visits: 3
|
|
184
|
+
prompt: |
|
|
185
|
+
Root cause is still unclear. Gather more evidence:
|
|
186
|
+
|
|
187
|
+
1. Add targeted log/trace statements with unique prefixes (`[DBG1]`, `[DBG2]`)
|
|
188
|
+
at the locations you suspect — trace statements only, no structural changes
|
|
189
|
+
2. Re-run the reproduction and read the output
|
|
190
|
+
3. Analyze: does the output confirm or rule out a suspected location?
|
|
191
|
+
|
|
192
|
+
Budget: 3 visits to this state (engine-enforced); when nearly exhausted, choose `still_unclear` instead of retrying.
|
|
193
|
+
|
|
194
|
+
After analyzing, assess the fix scope (same as diagnose):
|
|
195
|
+
- 1 file → `single`
|
|
196
|
+
- 2+ files, tightly coupled → `multi_coupled`
|
|
197
|
+
- 2+ files, independent → `multi_independent`
|
|
198
|
+
- still no root cause → `still_unclear` (escalate to the user)
|
|
137
199
|
transitions:
|
|
138
200
|
single: fix_single
|
|
139
201
|
multi_coupled: load_skills_coupled
|
|
@@ -156,7 +218,14 @@ states:
|
|
|
156
218
|
task: "Fix tightly coupled multi-file changes"
|
|
157
219
|
prompt: |
|
|
158
220
|
The fix spans multiple tightly coupled files (one logical chain, shared context).
|
|
159
|
-
|
|
221
|
+
|
|
222
|
+
Top-tier session AND >~30 changed lines expected → do NOT write inline:
|
|
223
|
+
write the fix plan + interface contracts here, spawn ONE implementer
|
|
224
|
+
agent carrying the whole plan (model per task-delegation: sonnet for a
|
|
225
|
+
detailed plan + linter/tests net, opus otherwise — never per-file
|
|
226
|
+
fan-out of a coupled set), collect its report, verify integration.
|
|
227
|
+
Otherwise (small fix, or non-top-tier session) do it yourself
|
|
228
|
+
sequentially — delegation overhead exceeds benefit:
|
|
160
229
|
|
|
161
230
|
1. Plan the order: start from the innermost change, work outward to callers
|
|
162
231
|
2. For each file: read → edit → self-review against loaded skills
|
|
@@ -178,7 +247,10 @@ states:
|
|
|
178
247
|
prompt: |
|
|
179
248
|
The fix spans multiple files. Produce a per-file plan with interface contracts,
|
|
180
249
|
then spawn one Agent per file for parallel implementation.
|
|
181
|
-
Use `subagent_type="general-purpose"`.
|
|
250
|
+
Use `subagent_type="general-purpose"`. ALWAYS pass an explicit `model`
|
|
251
|
+
(task-delegation's model table): `opus` for non-trivial fix logic,
|
|
252
|
+
`sonnet` for mechanical edits from the plan. Never haiku, never silent
|
|
253
|
+
session-model inheritance.
|
|
182
254
|
|
|
183
255
|
For each file, include in the agent prompt VERBATIM:
|
|
184
256
|
---
|
|
@@ -188,6 +260,7 @@ states:
|
|
|
188
260
|
mcp__plugin_workflow_wf__start({ workflow: "file-code", parent_session_id: "<SESSION_ID>" })
|
|
189
261
|
where <SESSION_ID> is the current session ID (substitute it before sending).
|
|
190
262
|
Then follow the file-code workflow states until completion.
|
|
263
|
+
start() returns `SESSION: <id>` — pass that session_id explicitly in every subsequent workflow tool call (transition, context_set); parallel siblings share the same ppid.
|
|
191
264
|
---
|
|
192
265
|
Also include:
|
|
193
266
|
- The file path
|
|
@@ -195,7 +268,10 @@ states:
|
|
|
195
268
|
- The per-file fix plan
|
|
196
269
|
- Interface contracts with other files
|
|
197
270
|
|
|
198
|
-
Launch ALL file agents in
|
|
271
|
+
Launch ALL file agents in ONE message, each with `run_in_background:
|
|
272
|
+
false` — their reports gate integration; a "batch" of ONE file is
|
|
273
|
+
still a gating single, not a background task.
|
|
274
|
+
Wait for all to complete. Collect reports.
|
|
199
275
|
|
|
200
276
|
After ALL reports are collected:
|
|
201
277
|
1. Abort orphaned child workflow sessions.
|
|
@@ -220,25 +296,47 @@ states:
|
|
|
220
296
|
review:
|
|
221
297
|
task: "Route review by scope"
|
|
222
298
|
prompt: |
|
|
223
|
-
Route
|
|
224
|
-
- `single` →
|
|
225
|
-
|
|
299
|
+
Route by SIZE of the change, not file count (`git diff HEAD --numstat`):
|
|
300
|
+
- `single` → TRIVIAL change: ≤2 files AND ≤~50 changed lines total —
|
|
301
|
+
the linter IS the review (lint-review sub-workflow: engine-run lint
|
|
302
|
+
+ act on findings + one intent re-read); tests follow anyway.
|
|
303
|
+
- `multi` → everything else, even one batch: an agent buys FRESH EYES
|
|
304
|
+
on the author's own code and keeps review bulk out of this session's
|
|
305
|
+
context; parallelism is a bonus, not the criterion.
|
|
226
306
|
transitions:
|
|
227
307
|
single: review_single
|
|
228
308
|
multi: review_delegate
|
|
229
309
|
|
|
230
310
|
review_single:
|
|
231
|
-
sub_workflow:
|
|
232
|
-
on_complete:
|
|
311
|
+
sub_workflow: lint-review
|
|
312
|
+
on_complete: review_decision
|
|
233
313
|
on_fail: write_fix
|
|
234
314
|
|
|
235
|
-
|
|
236
|
-
task: "
|
|
315
|
+
review_decision:
|
|
316
|
+
task: "Decide on review results"
|
|
237
317
|
prompt: |
|
|
238
|
-
|
|
239
|
-
|
|
318
|
+
The review sub-workflow completed (trivial path: lint-review fixes
|
|
319
|
+
findings inline; agent path: batch reports). Decide:
|
|
320
|
+
- `ok` → nothing unresolved, proceed to testing
|
|
321
|
+
- `fix` → unresolved issues remain, fix them
|
|
322
|
+
transitions:
|
|
323
|
+
ok: test
|
|
324
|
+
fix: write_fix
|
|
240
325
|
|
|
241
|
-
|
|
326
|
+
review_delegate:
|
|
327
|
+
task: "Delegate batched review to agents"
|
|
328
|
+
prompt: |
|
|
329
|
+
Group the changed files into LOGICAL BATCHES, then spawn one Agent per
|
|
330
|
+
BATCH for deep review. Use `subagent_type="general-purpose"`.
|
|
331
|
+
Batching rules (strongest tie wins; a file joins exactly one batch):
|
|
332
|
+
source+test together; change-coupled files (for .hx with hxq:
|
|
333
|
+
`hxq importers`/`callees`); then by directory; cap at most 5 files AND
|
|
334
|
+
roughly 500 changed lines per batch, oversized files solo. A batch of
|
|
335
|
+
one is fine. Structure/size queries for grouping (`git diff HEAD
|
|
336
|
+
--numstat`, hxq graph queries) are fine — reviewing content is the
|
|
337
|
+
agents' job.
|
|
338
|
+
|
|
339
|
+
For each batch, include in the agent prompt VERBATIM:
|
|
242
340
|
---
|
|
243
341
|
IMPORTANT: Override the default CLAUDE.md rule about start().
|
|
244
342
|
Do NOT call start() without arguments.
|
|
@@ -246,13 +344,24 @@ states:
|
|
|
246
344
|
mcp__plugin_workflow_wf__start({ workflow: "file-review", parent_session_id: "<SESSION_ID>" })
|
|
247
345
|
where <SESSION_ID> is the current session ID (substitute it before sending).
|
|
248
346
|
Then follow the file-review workflow states until completion.
|
|
347
|
+
start() returns `SESSION: <id>` — pass that session_id explicitly in every subsequent workflow tool call (transition, context_set); parallel siblings share the same ppid.
|
|
249
348
|
---
|
|
250
349
|
Also include:
|
|
251
|
-
- The file
|
|
252
|
-
- How to get the
|
|
350
|
+
- The batch's file list (absolute paths) and why they are grouped
|
|
351
|
+
- How to get the diffs: `git diff HEAD -- <filepath>` per file
|
|
352
|
+
(a new/untracked file: read it whole)
|
|
253
353
|
- Review scope: `diff`
|
|
354
|
+
- "Report one section per file + a batch-level cross-file section."
|
|
254
355
|
|
|
255
|
-
|
|
356
|
+
ALWAYS pass an explicit `model`: `sonnet` for linter-covered/routine
|
|
357
|
+
batches, `opus` for macro-heavy / concurrency / engine-critical /
|
|
358
|
+
no-linter ones (opus wins on overlap). Never haiku, never silent
|
|
359
|
+
inheritance of the session model.
|
|
360
|
+
|
|
361
|
+
Launch up to 8 batch agents in ONE message, each with
|
|
362
|
+
`run_in_background: false` — reports gate the merge; a single batch
|
|
363
|
+
is still a gating single, not a background task. More batches →
|
|
364
|
+
next wave. Collect reports.
|
|
256
365
|
|
|
257
366
|
After ALL reports are collected:
|
|
258
367
|
1. Abort orphaned child workflow sessions.
|
|
@@ -263,7 +372,10 @@ states:
|
|
|
263
372
|
cross_file:
|
|
264
373
|
task: "Cross-file review analysis"
|
|
265
374
|
prompt: |
|
|
266
|
-
Review the big picture
|
|
375
|
+
Review the big picture. Seams WITHIN a batch are already covered by
|
|
376
|
+
that batch agent's cross-file section — do not re-derive them; focus
|
|
377
|
+
on seams BETWEEN batches and on set-wide patterns (these apply even
|
|
378
|
+
when there was only one batch):
|
|
267
379
|
- [ ] Duplication across files
|
|
268
380
|
- [ ] Missing updates to consumers of changed interfaces
|
|
269
381
|
- [ ] Consistency across files
|
|
@@ -279,7 +391,9 @@ states:
|
|
|
279
391
|
write_fix:
|
|
280
392
|
task: "Fix review issues"
|
|
281
393
|
prompt: |
|
|
282
|
-
Fix the issues found
|
|
394
|
+
Fix the issues found — review findings or test failures reported by the
|
|
395
|
+
testing workflow (read the failure report for what broke).
|
|
396
|
+
After fixing → transition `done` (returns to review for re-verification).
|
|
283
397
|
transitions:
|
|
284
398
|
done: review
|
|
285
399
|
|
|
@@ -291,7 +405,10 @@ states:
|
|
|
291
405
|
verify_route:
|
|
292
406
|
task: "Route to correct verification"
|
|
293
407
|
prompt: |
|
|
294
|
-
|
|
408
|
+
Bug type classified at the start: {{context.bug_type}}
|
|
409
|
+
(If empty — context was lost. Re-classify now: was the original report a
|
|
410
|
+
visual problem or a logic problem?)
|
|
411
|
+
|
|
295
412
|
- Visual bug → `visual` (needs screenshot verification)
|
|
296
413
|
- Logic bug → `logic` (tests already passed in testing workflow)
|
|
297
414
|
transitions:
|
|
@@ -324,20 +441,37 @@ states:
|
|
|
324
441
|
5. Compare before/after — describe the visual difference
|
|
325
442
|
|
|
326
443
|
DO NOT transition to `confirmed` without a screenshot proving the fix works.
|
|
444
|
+
|
|
445
|
+
Choose transition:
|
|
446
|
+
- `confirmed` → your screenshot proves the bug is gone
|
|
447
|
+
- `still_broken` → bug still visible, back to diagnosis
|
|
327
448
|
transitions:
|
|
328
449
|
confirmed: done
|
|
329
450
|
still_broken: diagnose
|
|
330
451
|
|
|
331
452
|
clarify:
|
|
332
453
|
task: "Clarify bug details"
|
|
333
|
-
prompt:
|
|
454
|
+
prompt: |
|
|
455
|
+
You could not reproduce the bug. Ask the user for more details:
|
|
456
|
+
- Exact steps to reproduce
|
|
457
|
+
- Error messages, logs, or screenshots
|
|
458
|
+
- Environment (platform, version, configuration)
|
|
459
|
+
|
|
460
|
+
If there is no interactive user (you are running as a subagent), do NOT ask — state your assumptions and continue, or take the failure path.
|
|
461
|
+
|
|
462
|
+
Choose transition:
|
|
463
|
+
- `got_info_visual` → new details point to a visual reproduction attempt
|
|
464
|
+
- `got_info_logic` → new details point to a test/log reproduction attempt
|
|
465
|
+
- `escalate` → no way to get more information; give up
|
|
334
466
|
transitions:
|
|
335
467
|
got_info_visual: load_skills_visual
|
|
336
468
|
got_info_logic: reproduce_logic
|
|
469
|
+
escalate: escalate
|
|
337
470
|
|
|
338
471
|
escalate:
|
|
339
|
-
prompt: "Could not diagnose. Report to the user."
|
|
472
|
+
prompt: "Could not reproduce or diagnose the bug. Report to the user: what was tried, what was ruled out, what information would help."
|
|
340
473
|
terminal: true
|
|
474
|
+
outcome: fail
|
|
341
475
|
|
|
342
476
|
done:
|
|
343
477
|
prompt: "Bug fixed and verified."
|
|
@@ -14,7 +14,7 @@ states:
|
|
|
14
14
|
1. **User specified files** — user named concrete file paths → use those.
|
|
15
15
|
Do NOT touch git.
|
|
16
16
|
2. **User specified directories** — user named directories or patterns
|
|
17
|
-
(e.g. "src/api/", "src/
|
|
17
|
+
(e.g. "src/api/", "src/ without editor", "src/*.hx, src/api/, src/drill/").
|
|
18
18
|
Parse the request in natural language:
|
|
19
19
|
- `"src/"` → all source files recursively, auto-group by first-level subdirectories
|
|
20
20
|
- `"src/api/, src/drill/"` → only these dirs recursively, each = one package
|
|
@@ -34,17 +34,21 @@ states:
|
|
|
34
34
|
**Step 2 — Determine review depth:**
|
|
35
35
|
- Coming from testing/coding / "check changes" / "review diff" / default
|
|
36
36
|
→ `scope: diff` (only review changed lines)
|
|
37
|
-
- "review file" / "
|
|
38
|
-
→ `scope: full` (review entire file)
|
|
37
|
+
- "review file" / "check whole file" / "bring to order" (or equivalent
|
|
38
|
+
phrases in the user's language) → `scope: full` (review entire file)
|
|
39
39
|
- Directory mode → always `scope: full`
|
|
40
40
|
Save the scope via `context_set(key: "review_scope", value: "diff" or "full")`.
|
|
41
41
|
|
|
42
42
|
**Step 3 — Get file names:**
|
|
43
43
|
- If source is user-specified files or directories → already have the list.
|
|
44
44
|
- If source is git → get ALL changed file names (modified AND new/untracked):
|
|
45
|
-
- Modified/staged: `git diff HEAD --name-only`
|
|
45
|
+
- Modified/staged: `git diff HEAD --name-only --diff-filter=d`
|
|
46
|
+
(lowercase `d` excludes deleted files)
|
|
46
47
|
- New untracked: `git ls-files --others --exclude-standard`
|
|
47
48
|
Combine both lists. Do NOT read full diffs yet — names only.
|
|
49
|
+
Deleted files (`git diff HEAD --name-only --diff-filter=D`) get NO
|
|
50
|
+
per-file review — note them for the cross-file step instead
|
|
51
|
+
(their callers/imports may break).
|
|
48
52
|
**Git pathspec gotcha (zsh):** to exclude paths, use `-- . ':(exclude)path'`,
|
|
49
53
|
NOT `-- ':!path'` — the latter silently returns empty results in zsh.
|
|
50
54
|
|
|
@@ -65,16 +69,23 @@ states:
|
|
|
65
69
|
Check context key `review_mode`:
|
|
66
70
|
- If `review_mode` is `"directory"` → `directory`
|
|
67
71
|
|
|
68
|
-
Otherwise route
|
|
69
|
-
- `
|
|
70
|
-
|
|
72
|
+
Otherwise route by SIZE of what will actually be REVIEWED:
|
|
73
|
+
- `diff` scope → size = changed lines (`git diff HEAD --numstat`);
|
|
74
|
+
`full` scope → size = the whole file (`wc -l`), since that is what
|
|
75
|
+
gets read.
|
|
76
|
+
- `single` → TRIVIAL: ≤2 files AND ≤~50 lines to review — the linter
|
|
77
|
+
IS the review (lint-review sub-workflow: engine-run lint + act on
|
|
78
|
+
findings + one intent re-read).
|
|
79
|
+
- `multi` → everything else, EVEN a single batch: an agent buys fresh
|
|
80
|
+
eyes and keeps review bulk out of this session's context;
|
|
81
|
+
parallelism is a bonus, not the criterion.
|
|
71
82
|
transitions:
|
|
72
83
|
single: review_single
|
|
73
84
|
multi: review_delegate
|
|
74
85
|
directory: package_review
|
|
75
86
|
|
|
76
87
|
review_single:
|
|
77
|
-
sub_workflow:
|
|
88
|
+
sub_workflow: lint-review
|
|
78
89
|
on_complete: cross_file
|
|
79
90
|
on_fail: cross_file
|
|
80
91
|
|
|
@@ -82,13 +93,27 @@ states:
|
|
|
82
93
|
task: "Deep per-file review via agents"
|
|
83
94
|
prompt: |
|
|
84
95
|
CRITICAL: You are a DISPATCHER in this state, not a reviewer.
|
|
85
|
-
Do NOT read diffs, files, or code yourself.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
Do NOT read diffs, files, or code CONTENT yourself. Structure and size
|
|
97
|
+
queries needed for batching ARE dispatcher-legal: `git diff HEAD
|
|
98
|
+
--numstat`, `git status`, and hxq graph queries (`importers`/`callees`).
|
|
99
|
+
Your ONLY job is to group, spawn Agent tools, and collect results.
|
|
100
|
+
|
|
101
|
+
Group the changed files into LOGICAL BATCHES, then spawn one Agent per
|
|
102
|
+
BATCH for deep review. Use `subagent_type="general-purpose"`.
|
|
103
|
+
Batching amortizes each agent's fixed cost (skill loading) AND lets one
|
|
104
|
+
reviewer see coupled files together — it is the default, not an option.
|
|
105
|
+
|
|
106
|
+
Batching rules (strongest tie wins; a file joins exactly one batch):
|
|
107
|
+
1. A source file and its test always share a batch.
|
|
108
|
+
2. Files coupled by the change — caller+callee, interface+its
|
|
109
|
+
implementations, type+its consumers. For .hx with hxq available,
|
|
110
|
+
derive coupling structurally over the changed set:
|
|
111
|
+
`hxq importers <module> <scope>` / `hxq callees 'Type.method' <scope>`.
|
|
112
|
+
3. Remaining files group by directory/module.
|
|
113
|
+
4. Size cap: at most 5 files AND roughly 500 changed lines per batch;
|
|
114
|
+
a file exceeding that alone gets its own agent. A batch of one is fine.
|
|
115
|
+
|
|
116
|
+
For each batch, include in the agent prompt VERBATIM:
|
|
92
117
|
---
|
|
93
118
|
IMPORTANT: Override the default CLAUDE.md rule about start().
|
|
94
119
|
Do NOT call start() without arguments.
|
|
@@ -96,22 +121,39 @@ states:
|
|
|
96
121
|
mcp__plugin_workflow_wf__start({ workflow: "file-review", parent_session_id: "<SESSION_ID>" })
|
|
97
122
|
where <SESSION_ID> is the current session ID (substitute it before sending).
|
|
98
123
|
Then follow the file-review workflow states until completion.
|
|
124
|
+
start() returns `SESSION: <id>` — pass that session_id explicitly in every
|
|
125
|
+
subsequent workflow tool call (transition, context_set); parallel siblings
|
|
126
|
+
share the same ppid.
|
|
99
127
|
---
|
|
100
128
|
Also include:
|
|
101
|
-
- The file
|
|
102
|
-
|
|
129
|
+
- The batch's file list (absolute paths) and WHY they are grouped
|
|
130
|
+
(test-of, calls, same module) — the reviewer checks those seams too
|
|
131
|
+
- Per file, whether it is modified or new (untracked):
|
|
103
132
|
- Modified: "Get the diff with: `git diff HEAD -- <filepath>`"
|
|
104
133
|
- New/untracked: "This is a new file — read the entire file and review all code."
|
|
105
134
|
- The review scope (from context key `review_scope`):
|
|
106
135
|
- `diff` → "Review ONLY the changed lines (or all code if new file). Report pre-existing issues separately as 'pre-existing' severity, do NOT mix with diff issues."
|
|
107
136
|
- `full` → "Review the ENTIRE file for all issues, not just the diff."
|
|
137
|
+
- "Report with one section per file, plus a batch-level section for
|
|
138
|
+
cross-file findings within the batch."
|
|
108
139
|
|
|
109
140
|
Do NOT include style rules, review checklists, or coding preferences in the agent prompt.
|
|
110
141
|
The file-review workflow has its own skill-loading state — agents will load all
|
|
111
142
|
relevant skills themselves. Manual rule lists are lossy and cause missed issues.
|
|
112
143
|
|
|
113
|
-
|
|
114
|
-
|
|
144
|
+
ALWAYS pass an explicit `model` to the Agent tool — never let a spawn
|
|
145
|
+
silently inherit the session model: `sonnet` for batches whose
|
|
146
|
+
mechanics the linter covers (.hx with hxq) and routine code; `opus`
|
|
147
|
+
for macro-heavy / engine-critical / no-linter batches. Never haiku.
|
|
148
|
+
|
|
149
|
+
Launch up to 8 batch agents in ONE message, each with
|
|
150
|
+
`run_in_background: false` — reports gate the merge; a single batch
|
|
151
|
+
is still a gating single, not a background task. More batches →
|
|
152
|
+
next wave after the current one completes.
|
|
153
|
+
Collect their reports.
|
|
154
|
+
|
|
155
|
+
If a child agent fails or returns no report — re-spawn it once;
|
|
156
|
+
if it fails again, mark that batch's files as unreviewed in the summary.
|
|
115
157
|
|
|
116
158
|
After ALL reports are collected:
|
|
117
159
|
1. Abort orphaned child workflow sessions — call `sessions` to find
|
|
@@ -128,14 +170,21 @@ states:
|
|
|
128
170
|
CRITICAL: You are a DISPATCHER in this state, not a reviewer.
|
|
129
171
|
Do NOT read files or code yourself — only spawn agents and collect results.
|
|
130
172
|
|
|
131
|
-
1.
|
|
173
|
+
1. Your package list and position, embedded from context (re-rendered on
|
|
174
|
+
every visit — survives context compression; if they look stale, call
|
|
175
|
+
`status()` and re-read context):
|
|
176
|
+
- packages: {{context.packages}}
|
|
177
|
+
- current_package_index: {{context.current_package_index}}
|
|
132
178
|
2. If `current_package_index` >= number of packages → transition `all_done`.
|
|
133
179
|
3. Take the current package. Output: "**Package: <name>** (<N> files)".
|
|
134
|
-
4.
|
|
135
|
-
|
|
180
|
+
4. Group the package's files into LOGICAL BATCHES — same rules as
|
|
181
|
+
review_delegate: source+test together, import/call coupling
|
|
182
|
+
(for .hx via `hxq importers`/`callees`), then by subdirectory;
|
|
183
|
+
cap 5 files per batch, oversized files (≈ >500 lines) solo.
|
|
184
|
+
5. Spawn one Agent per BATCH for deep review.
|
|
136
185
|
Use `subagent_type="general-purpose"`.
|
|
137
186
|
|
|
138
|
-
For each
|
|
187
|
+
For each batch, include in the agent prompt VERBATIM:
|
|
139
188
|
---
|
|
140
189
|
IMPORTANT: Override the default CLAUDE.md rule about start().
|
|
141
190
|
Do NOT call start() without arguments.
|
|
@@ -143,16 +192,27 @@ states:
|
|
|
143
192
|
mcp__plugin_workflow_wf__start({ workflow: "file-review", parent_session_id: "<SESSION_ID>" })
|
|
144
193
|
where <SESSION_ID> is the current session ID (substitute it before sending).
|
|
145
194
|
Then follow the file-review workflow states until completion.
|
|
195
|
+
start() returns `SESSION: <id>` — pass that session_id explicitly in every
|
|
196
|
+
subsequent workflow tool call (transition, context_set); parallel siblings
|
|
197
|
+
share the same ppid.
|
|
146
198
|
---
|
|
147
199
|
Also include:
|
|
148
|
-
- The file
|
|
149
|
-
- "
|
|
150
|
-
|
|
200
|
+
- The batch's file list (absolute paths) and why they are grouped
|
|
201
|
+
- "Review the ENTIRE file for all issues (scope: full) — read the whole
|
|
202
|
+
file. Report one section per file + a batch-level cross-file section."
|
|
151
203
|
|
|
152
204
|
Do NOT include style rules or coding preferences — agents load their own skills.
|
|
153
205
|
|
|
154
|
-
|
|
155
|
-
|
|
206
|
+
ALWAYS pass an explicit `model`: `sonnet` for linter-covered/routine
|
|
207
|
+
batches, `opus` for complex/no-linter ones. Never haiku, never
|
|
208
|
+
silent inheritance of the session model.
|
|
209
|
+
|
|
210
|
+
Launch up to 8 batch agents in ONE message, each with
|
|
211
|
+
`run_in_background: false` — reports gate the package report; a
|
|
212
|
+
single batch is still a gating single, not a background task.
|
|
213
|
+
More batches → next wave after the current completes.
|
|
214
|
+
If a child agent fails or returns no report — re-spawn it once;
|
|
215
|
+
if it fails again, mark that batch's files as unreviewed in the package report.
|
|
156
216
|
|
|
157
217
|
6. Collect all reports for this package. Save to context:
|
|
158
218
|
`context_set(key: "package_<index>_report", value: "<aggregated report>")`
|
|
@@ -166,7 +226,10 @@ states:
|
|
|
166
226
|
cross_file:
|
|
167
227
|
task: "Cross-file analysis"
|
|
168
228
|
prompt: |
|
|
169
|
-
Now look at the big picture
|
|
229
|
+
Now look at the big picture. Seams WITHIN a batch are already covered
|
|
230
|
+
by that batch agent's cross-file section — do not re-derive them;
|
|
231
|
+
focus on seams BETWEEN batches and on set-wide patterns (these apply
|
|
232
|
+
even when there was only one batch):
|
|
170
233
|
|
|
171
234
|
**Cross-file consistency:**
|
|
172
235
|
- [ ] Duplication across files: did different files introduce similar code?
|
|
@@ -183,7 +246,7 @@ states:
|
|
|
183
246
|
- [ ] Classes to merge: tiny classes that always appear together and share state
|
|
184
247
|
- [ ] Layer violations: data flowing through unnecessary intermediary layers
|
|
185
248
|
|
|
186
|
-
Add any cross-file findings to the review.
|
|
249
|
+
Add any cross-file findings to the review. Then → transition `done`.
|
|
187
250
|
transitions:
|
|
188
251
|
done: summarize
|
|
189
252
|
|
|
@@ -301,8 +364,7 @@ states:
|
|
|
301
364
|
consumers of what changed.
|
|
302
365
|
|
|
303
366
|
After verification, transition `complete`. The coding sub-workflow already
|
|
304
|
-
reviewed the files it modified.
|
|
305
|
-
happens later when the plan is executed via the coding workflow.
|
|
367
|
+
reviewed the files it modified.
|
|
306
368
|
transitions:
|
|
307
369
|
complete: done
|
|
308
370
|
|