devflow-kit 3.1.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +2 -2
  3. package/dist/cli/agents-view/render.js +69 -15
  4. package/dist/cli/agents-view/state.js +40 -14
  5. package/dist/cli/commands/agents.js +135 -45
  6. package/dist/cli/commands/init.js +128 -53
  7. package/dist/cli/commands/learning.js +61 -13
  8. package/dist/cli/commands/memory.js +35 -14
  9. package/dist/cli/commands/uninstall.js +163 -39
  10. package/dist/commands/code-review.md +1 -3
  11. package/dist/commands/debug.md +15 -12
  12. package/dist/commands/dynamic-build.md +172 -135
  13. package/dist/commands/dynamic-plan.md +9 -3
  14. package/dist/commands/explore.md +10 -4
  15. package/dist/commands/implement.md +149 -145
  16. package/dist/commands/plan.md +13 -9
  17. package/dist/commands/release.md +8 -2
  18. package/dist/commands/research.md +8 -2
  19. package/dist/commands/resolve.md +28 -19
  20. package/dist/commands/self-review.md +16 -13
  21. package/dist/core/agent-frontmatter.js +25 -0
  22. package/dist/core/agent-models.js +201 -36
  23. package/dist/core/agent-state.js +27 -5
  24. package/dist/core/assets.js +1 -1
  25. package/dist/core/feature-config.js +68 -10
  26. package/dist/core/flags.js +24 -0
  27. package/dist/core/learning-queue-cleanup.js +10 -11
  28. package/dist/core/learning-tuning-config.js +8 -0
  29. package/dist/core/linked-path.js +46 -0
  30. package/dist/core/plugins.js +16 -5
  31. package/dist/core/queue-drain.js +31 -0
  32. package/dist/hud/components/learning-counts.js +54 -8
  33. package/dist/skills/git/references/tracker/github/create-release.md +2 -2
  34. package/dist/skills/git/references/tracker/github/gather-release-evidence.md +1 -1
  35. package/dist/skills/git/references/tracker/jira/create-release.md +2 -2
  36. package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +1 -1
  37. package/dist/skills/git/references/tracker/linear/create-release.md +2 -2
  38. package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +1 -1
  39. package/dist/targets/claude-code/installer.js +36 -9
  40. package/dist/targets/claude-code/post-install.js +128 -38
  41. package/package.json +1 -1
  42. package/src/assets/agents/code.md +85 -35
  43. package/src/assets/agents/design.md +12 -0
  44. package/src/assets/agents/diagnose.md +18 -11
  45. package/src/assets/agents/evaluate.md +17 -24
  46. package/src/assets/agents/knowledge.md +7 -3
  47. package/src/assets/agents/learning.md +4 -6
  48. package/src/assets/agents/research.md +21 -0
  49. package/src/assets/agents/review.md +12 -0
  50. package/src/assets/agents/scrutinize.md +37 -9
  51. package/src/assets/agents/simplify.md +24 -0
  52. package/src/assets/agents/skim.md +6 -2
  53. package/src/assets/agents/synthesize.md +18 -0
  54. package/src/assets/agents/test.md +19 -11
  55. package/src/assets/agents/triage.md +8 -0
  56. package/src/assets/agents/validate.md +20 -11
  57. package/src/assets/commands/_partials/_engine.mds +36 -55
  58. package/src/assets/commands/_partials/_knowledge.mds +1 -3
  59. package/src/assets/commands/_partials/_plan_contract.mds +1 -1
  60. package/src/assets/commands/_partials/_tracker.mds +1 -1
  61. package/src/assets/commands/_partials/_wave.mds +8 -6
  62. package/src/assets/commands/code-review.mds +1 -3
  63. package/src/assets/commands/debug.mds +13 -8
  64. package/src/assets/commands/dynamic-build.mds +126 -72
  65. package/src/assets/commands/dynamic-plan.mds +7 -1
  66. package/src/assets/commands/explore.mds +9 -1
  67. package/src/assets/commands/implement.mds +147 -141
  68. package/src/assets/commands/plan.mds +12 -8
  69. package/src/assets/commands/release.md +8 -2
  70. package/src/assets/commands/research.mds +8 -2
  71. package/src/assets/commands/resolve.mds +27 -16
  72. package/src/assets/commands/self-review.mds +15 -10
  73. package/src/assets/mds/tracker/_common.mds +1 -1
  74. package/src/assets/mds/tracker/_github.mds +2 -2
  75. package/src/assets/mds/tracker/_jira.mds +2 -2
  76. package/src/assets/mds/tracker/_linear.mds +2 -2
  77. package/src/assets/scripts/ci-wait.cjs +636 -0
  78. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +4 -3
  79. package/src/assets/scripts/hooks/background-memory-update +356 -17
  80. package/src/assets/scripts/hooks/capture-prompt +4 -3
  81. package/src/assets/scripts/hooks/capture-question +4 -3
  82. package/src/assets/scripts/hooks/capture-turn +4 -3
  83. package/src/assets/scripts/hooks/ensure-devflow-init +13 -1
  84. package/src/assets/scripts/hooks/ensure-root-gitignore +122 -10
  85. package/src/assets/scripts/hooks/git-marker +71 -0
  86. package/src/assets/scripts/hooks/json-helper.cjs +12 -145
  87. package/src/assets/scripts/hooks/json-parse +24 -129
  88. package/src/assets/scripts/hooks/lib/learning-store.cjs +169 -64
  89. package/src/assets/scripts/hooks/lib/render-decisions.cjs +1 -1
  90. package/src/assets/scripts/hooks/memory-worker +10 -0
  91. package/src/assets/scripts/hooks/pre-compact-memory +66 -14
  92. package/src/assets/scripts/hooks/preamble +9 -1
  93. package/src/assets/scripts/hooks/queue-append +53 -21
  94. package/src/assets/scripts/hooks/session-start-context +108 -29
  95. package/src/assets/scripts/hooks/session-start-memory +33 -11
  96. package/src/assets/scripts/release-trace.cjs +27 -10
  97. package/src/assets/skills/accessibility/SKILL.md +1 -1
  98. package/src/assets/skills/apply-decisions/SKILL.md +12 -82
  99. package/src/assets/skills/apply-feature-knowledge/SKILL.md +8 -42
  100. package/src/assets/skills/architecture/SKILL.md +1 -1
  101. package/src/assets/skills/boundary-validation/SKILL.md +1 -1
  102. package/src/assets/skills/complexity/SKILL.md +1 -1
  103. package/src/assets/skills/compliance/SKILL.md +1 -1
  104. package/src/assets/skills/consistency/SKILL.md +1 -1
  105. package/src/assets/skills/database/SKILL.md +1 -1
  106. package/src/assets/skills/dependencies/SKILL.md +1 -1
  107. package/src/assets/skills/dependency-research/SKILL.md +3 -6
  108. package/src/assets/skills/design-review/SKILL.md +1 -1
  109. package/src/assets/skills/docs-framework/SKILL.md +1 -1
  110. package/src/assets/skills/documentation/SKILL.md +1 -1
  111. package/src/assets/skills/gap-analysis/SKILL.md +1 -1
  112. package/src/assets/skills/git/SKILL.md +1 -1
  113. package/src/assets/skills/go/SKILL.md +1 -1
  114. package/src/assets/skills/java/SKILL.md +1 -1
  115. package/src/assets/skills/patterns/SKILL.md +1 -1
  116. package/src/assets/skills/performance/SKILL.md +1 -1
  117. package/src/assets/skills/python/SKILL.md +1 -1
  118. package/src/assets/skills/qa/SKILL.md +1 -3
  119. package/src/assets/skills/quality-gates/SKILL.md +9 -12
  120. package/src/assets/skills/quality-gates/references/report-template.md +20 -20
  121. package/src/assets/skills/react/SKILL.md +1 -1
  122. package/src/assets/skills/regression/SKILL.md +1 -1
  123. package/src/assets/skills/reliability/SKILL.md +1 -1
  124. package/src/assets/skills/research-codebase/SKILL.md +1 -1
  125. package/src/assets/skills/research-competitor/SKILL.md +1 -1
  126. package/src/assets/skills/research-external/SKILL.md +1 -1
  127. package/src/assets/skills/research-technology/SKILL.md +1 -1
  128. package/src/assets/skills/review-methodology/SKILL.md +1 -1
  129. package/src/assets/skills/rust/SKILL.md +1 -1
  130. package/src/assets/skills/security/SKILL.md +1 -1
  131. package/src/assets/skills/software-design/SKILL.md +1 -1
  132. package/src/assets/skills/test-driven-development/SKILL.md +15 -33
  133. package/src/assets/skills/testing/SKILL.md +1 -1
  134. package/src/assets/skills/typescript/SKILL.md +1 -1
  135. package/src/assets/skills/ui-design/SKILL.md +1 -1
  136. package/src/assets/skills/worktree-support/SKILL.md +3 -55
  137. package/src/assets/skills/worktree-support/references/discovery.md +48 -0
  138. package/src/assets/skills/worktree-support/references/roots.md +2 -2
@@ -25,7 +25,13 @@ Orchestrate a single task through implementation by spawning specialized agents.
25
25
 
26
26
  ## Input
27
27
 
28
- `$ARGUMENTS` contains whatever follows `/implement`:
28
+ What follows `/implement` is bound once, here. Every later step names it `COMMAND_INPUT` and never restates it:
29
+
30
+ <command-input>
31
+ $ARGUMENTS
32
+ </command-input>
33
+
34
+ `COMMAND_INPUT` is one of:
29
35
  - Plan document path: `.devflow/docs/design/42-jwt-auth.2026-04-07_1430.md` (path to an existing `.md` file)
30
36
  - Issue reference: `#42`
31
37
  - Task description: "implement JWT auth"
@@ -44,7 +50,7 @@ When the user explicitly asks to re-validate, re-check, or re-run quality gates
44
50
  1. **Branch safety check**: If on a protected branch (main, master, develop, etc.), run Phase 1 to create/switch to a work branch. If already on a work branch, skip Phase 1.
45
51
  2. **Skip Phase 2** — no Code agent needed, user already made changes.
46
52
  3. **Detect FILES_CHANGED**: `git diff --name-only {base_branch}...HEAD`
47
- 4. **Run Phases 3-8** — full quality gate pipeline on detected changes.
53
+ 4. **Run Phases 3-8** — Simplify, Self-Review, Alignment, the one full Validate, QA Testing and the conditional Re-Validate, on the detected changes.
48
54
  5. **Proceed to Phase 10** (Create PR), **Phase 10b** (Evidence) and **Phase 11** (Report).
49
55
 
50
56
  If the user prompt does NOT match re-validation, proceed with the full pipeline below.
@@ -53,15 +59,13 @@ If the user prompt does NOT match re-validation, proceed with the full pipeline
53
59
 
54
60
  **Produces:** TASK_ID, BASE_BRANCH, EXECUTION_PLAN, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PR_DESCRIPTION_GUIDANCE, ISSUE_NUMBER, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, PR_EXCEPTIONS, TEST_PLAN, EVIDENCE_FILE, PR_TEST_PLAN_BLOCK, REVIEW_PUBLICATION
55
61
 
56
- **Load Companion Skills** — Load via Skill tool: `devflow:test-driven-development`, `devflow:patterns`, `devflow:dependency-research`. If a skill fails to load, continue without it.
57
-
58
62
  Record the current branch name as `BASE_BRANCH` - this will be the PR target.
59
63
 
60
64
  {{docs_root()}}
61
65
 
62
66
  {{evidence_policy()}}
63
67
 
64
- **Plan Document Handling** (when $ARGUMENTS is a path ending in `.md`):
68
+ **Plan Document Handling** (when `COMMAND_INPUT` is a path ending in `.md`):
65
69
  1. Read the plan document from the path provided
66
70
  2. Extract from YAML frontmatter: `execution-strategy`, `context-risk`, `issue` number
67
71
  3. Extract from body: Subtask Breakdown, Implementation Plan, Patterns to Follow, Acceptance Criteria
@@ -72,23 +76,25 @@ Record the current branch name as `BASE_BRANCH` - this will be the PR target.
72
76
 
73
77
  If `PR_DESCRIPTION_GUIDANCE` was not set above (non-plan paths: issue input or task description), set it to `(none)`.
74
78
 
79
+ **Empty input.** When `COMMAND_INPUT` is empty — a plan handoff arrives this way, with the plan already in the conversation — there is no argument to name the branch from, and the Git agent sees none of this conversation. Write the description yourself: one line, taken from the plan's title or, with no plan, from the conversation. Send it as the setup-task `TASK_DESCRIPTION` below.
80
+
75
81
  Spawn Git agent to set up task environment. The Git agent derives the branch name automatically from the issue or task description:
76
82
 
77
83
  ```
78
84
  Agent(subagent_type="Git"):
79
85
  "OPERATION: setup-task
80
86
  BASE_BRANCH: {current branch name}
81
- ISSUE_INPUT: {$ARGUMENTS verbatim, when it is a single whitespace-delimited token that does not end in .md; when it ends in .md, the plan frontmatter's issue value verbatim unless absent or pending — otherwise omit}
82
- TASK_DESCRIPTION: {$ARGUMENTS verbatim, when it is two or more whitespace-delimited tokens — otherwise omit}
87
+ ISSUE_INPUT: {COMMAND_INPUT verbatim, when it is a single whitespace-delimited token that does not end in .md; when it ends in .md, the plan frontmatter's issue value verbatim unless absent or pending — otherwise omit}
88
+ TASK_DESCRIPTION: {COMMAND_INPUT verbatim, when it is two or more whitespace-delimited tokens; when COMMAND_INPUT is empty, the one-line description you wrote above — otherwise omit}
83
89
  ISSUE_REQUIRED: {ISSUE_REQUIRED}
84
90
  APPLY_CONVENTIONS: {APPLY_CONVENTIONS}
85
- PLAN_ARTIFACT_PATH: {path to plan document if $ARGUMENTS ends in .md, otherwise (none)}
91
+ PLAN_ARTIFACT_PATH: {path to plan document if COMMAND_INPUT ends in .md, otherwise (none)}
86
92
  Derive branch name from issue or description, create feature branch, and fetch issue if specified.
87
93
  Return the branch setup summary."
88
94
  ```
89
95
 
90
96
  The issue token is forwarded **unclassified**, and the routing is decided by
91
- SHAPE alone — how many tokens `$ARGUMENTS` has, and whether it ends in `.md`.
97
+ SHAPE alone — how many tokens `COMMAND_INPUT` has, and whether it ends in `.md`.
92
98
 
93
99
  `setup-task` is the one step that has resolved a provider, and therefore the only
94
100
  one that knows what an issue reference looks like on this machine: `#123`,
@@ -133,7 +139,7 @@ visible, a silently discarded request is not.
133
139
 
134
140
  **Test plan.** Before any Code spawn, give the task a test plan in the evidence file `{worktree}/.devflow/docs/evidence-{branch_slug}.md` (`EVIDENCE_FILE`) — unlike the handoff file, it stays after the PR exists. It holds up to three sections, in this order and nothing else: `## Test Plan`; `## Evidence Exceptions`, a byte copy of `PR_EXCEPTIONS` present only while that is not `(none)`; and `## Claims`, always last, so every claim is appended at the end of the file. Create the file if absent; if it exists, replace its `## Test Plan` and `## Evidence Exceptions` sections and keep `## Claims` byte-identical.
135
141
 
136
- Write the `## Test Plan` section: when `$ARGUMENTS` is a plan document with a `## Test Plan` section, copy that section's lines verbatim; otherwise write one TP line per acceptance criterion the plan, the issue or the task text states, numbered from `TP-1`. Never invent a criterion, and word every scenario yourself in plain words: the lines reach the PR body, so a scenario holds no `#`, `@` or `/` — no issue reference, mention, closing keyword target or URL — and the files a TP covers go in its `files:` field. Each line follows the TP-line contract:
142
+ Write the `## Test Plan` section: when `COMMAND_INPUT` is a plan document with a `## Test Plan` section, copy that section's lines verbatim; otherwise write one TP line per acceptance criterion the plan, the issue or the task text states, numbered from `TP-1`. Never invent a criterion, and word every scenario yourself in plain words: the lines reach the PR body, so a scenario holds no `#`, `@` or `/` — no issue reference, mention, closing keyword target or URL — and the files a TP covers go in its `files:` field. Each line follows the TP-line contract:
137
143
 
138
144
  {{test_plan_line()}}
139
145
 
@@ -166,7 +172,7 @@ Phase 10b passes the resolved value to `update-pr-evidence`, which decides what
166
172
 
167
173
  {{decisions_load()}}
168
174
 
169
- Pass to Code agent (Phase 2) and Scrutinize agent (Phase 5).
175
+ Pass to Code agent (Phase 2) and Scrutinize agent (Phase 4).
170
176
 
171
177
  {{knowledge_load()}}
172
178
 
@@ -193,7 +199,8 @@ Based on Setup context (plan document, issue body, or conversation context), use
193
199
 
194
200
  ```
195
201
  Agent(subagent_type="Code"):
196
- "TASK_ID: {task-id}
202
+ "OPERATION: implement
203
+ TASK_ID: {task-id}
197
204
  TASK_DESCRIPTION: {description}
198
205
  BASE_BRANCH: {base branch}
199
206
  EXECUTION_PLAN: {full plan from setup context}
@@ -219,7 +226,8 @@ Spawn Code agents one at a time, passing handoff summaries between phases:
219
226
  **Phase 1 Code agent:**
220
227
  ```
221
228
  Agent(subagent_type="Code"):
222
- "TASK_ID: {task-id}
229
+ "OPERATION: implement
230
+ TASK_ID: {task-id}
223
231
  TASK_DESCRIPTION: {phase 1 description}
224
232
  BASE_BRANCH: {base branch}
225
233
  EXECUTION_PLAN: {phase 1 steps}
@@ -239,7 +247,8 @@ HANDOFF_FILE: {worktree}/.devflow/docs/handoff-{branch_slug}.md"
239
247
  **Phase 2+ Code agents** (after prior phase completes):
240
248
  ```
241
249
  Agent(subagent_type="Code"):
242
- "TASK_ID: {task-id}
250
+ "OPERATION: implement
251
+ TASK_ID: {task-id}
243
252
  TASK_DESCRIPTION: {phase N description}
244
253
  BASE_BRANCH: {base branch}
245
254
  EXECUTION_PLAN: {phase N steps}
@@ -270,7 +279,8 @@ Spawn multiple Code agents **in a single message**, each with independent subtas
270
279
 
271
280
  ```
272
281
  Agent(subagent_type="Code"): # Code agent 1
273
- "TASK_ID: {task-id}-part1
282
+ "OPERATION: implement
283
+ TASK_ID: {task-id}-part1
274
284
  TASK_DESCRIPTION: {independent subtask 1}
275
285
  BASE_BRANCH: {base branch}
276
286
  EXECUTION_PLAN: {subtask 1 steps}
@@ -285,7 +295,8 @@ ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
285
295
  ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}"
286
296
 
287
297
  Agent(subagent_type="Code"): # Code agent 2 (same message)
288
- "TASK_ID: {task-id}-part2
298
+ "OPERATION: implement
299
+ TASK_ID: {task-id}-part2
289
300
  TASK_DESCRIPTION: {independent subtask 2}
290
301
  BASE_BRANCH: {base branch}
291
302
  EXECUTION_PLAN: {subtask 2 steps}
@@ -306,74 +317,28 @@ ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}"
306
317
  - Different files/modules with no imports between them
307
318
  - Each subtask is self-contained
308
319
 
309
- ### Phase 3: Validate
310
-
311
- **Produces:** VALIDATION_RESULT
312
- **Requires:** FILES_CHANGED
313
-
314
- After Code agent completes, spawn Validate agent to verify correctness:
315
-
316
- ```
317
- Agent(subagent_type="Validate", model="haiku"):
318
- "FILES_CHANGED: {list of files from Code agent output}
319
- VALIDATION_SCOPE: full
320
- Run build, typecheck, lint, test. Report pass/fail with failure details."
321
- ```
322
-
323
- **If FAIL:**
324
- 1. Extract failure details from Validate agent output
325
- 2. Increment `validation_retry_count`
326
- 3. If `validation_retry_count <= 2`:
327
- - Spawn Code agent with fix context:
328
- ```
329
- Agent(subagent_type="Code"):
330
- "TASK_ID: {task-id}
331
- TASK_DESCRIPTION: Fix validation failures
332
- OPERATION: validation-fix
333
- VALIDATION_FAILURES: {parsed failures from Validate agent}
334
- SCOPE: Fix only the listed failures, no other changes
335
- CREATE_PR: false
336
- ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
337
- ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
338
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
339
- ```
340
- - Loop back to Phase 3 (re-validate)
341
- 4. If `validation_retry_count > 2`: Report failures to user and halt
342
-
343
- **If PASS:** append a `gate:validate` claim, then continue to Phase 4.
344
-
345
- **Evidence claims** are lines appended to the `## Claims` section of `EVIDENCE_FILE` — the file's last section, created when absent. Append only: never edit or remove a claim; the last valid one per target wins. Each line takes exactly one of these shapes, where `<head>` is the 40-hex `HEAD:` the agent's report shows:
346
-
347
- ```
348
- - gate:validate PASS sha:<head> by:validate
349
- - TP-<n> <PASS|FAIL|SKIP> sha:<head> by:test exit:<0-255>
350
- ```
351
-
352
- - `gate:validate` — after a Phase 3 or Phase 6 PASS.
353
- - `TP-<n>` — after every Phase 8 run, one line per `### Test Plan Evidence` row whose TP is in `TEST_PLAN`, with the row's outcome; the line ends at `by:test` when the row's Exit is not a number from 0 to 255.
354
- - Append nothing from a report whose `HEAD:` is not a single 40-hex SHA — a reported before/after change included — and say so in the Phase 11 report.
355
-
356
- ### Phase 4: Simplify
320
+ ### Phase 3: Simplify
357
321
 
358
322
  **Produces:** SIMPLIFY_OUTPUT
359
323
  **Requires:** FILES_CHANGED
360
324
 
361
- After validation passes, spawn Simplify agent to polish the code:
325
+ After the Code agent completes, spawn Simplify agent to polish the code. The Phase 6 Validate covers its commits.
362
326
 
363
327
  ```
364
328
  Agent(subagent_type="Simplify"):
365
329
  "Simplify recently implemented code
366
330
  Task: {task description}
367
331
  FILES_CHANGED: {list of files from Code agent output}
368
- Focus on code modified by Code agent, apply project standards, enhance clarity"
332
+ Focus on code modified by Code agent, apply project standards, enhance clarity
333
+ Commit any improvements with a conventional-commit message."
369
334
  ```
370
335
 
371
- ### Phase 5: Self-Review
336
+ ### Phase 4: Self-Review
372
337
 
373
338
  **Produces:** SCRUTINIZE_OUTPUT
374
339
  **Requires:** FILES_CHANGED
375
340
 
376
- After Simplify agent completes, spawn Scrutinize agent as final quality gate:
341
+ After Simplify agent completes, spawn Scrutinize agent as the quality gate:
377
342
 
378
343
  ```
379
344
  Agent(subagent_type="Scrutinize"):
@@ -384,32 +349,14 @@ FEATURE_KNOWLEDGE: {feature_knowledge}
384
349
  Evaluate 9 pillars, fix P0/P1 issues, report status"
385
350
  ```
386
351
 
387
- If Scrutinize agent returns BLOCKED, report to user and halt.
352
+ Scrutinize agent reports `### Status: PASS | FIXED | BLOCKED`. **If BLOCKED:** report to user and halt. **If PASS or FIXED:** continue to Phase 5. A FIXED status commits fixes and starts no Validate of its own: the Phase 6 run covers them.
388
353
 
389
- ### Phase 6: Re-Validate (if Scrutinize agent made changes)
390
-
391
- **Produces:** REVALIDATION_RESULT
392
- **Requires:** SCRUTINIZE_OUTPUT
393
-
394
- If Scrutinize agent made code changes (status: FIXED), spawn Validate agent to verify:
395
-
396
- ```
397
- Agent(subagent_type="Validate", model="haiku"):
398
- "FILES_CHANGED: {files modified by Scrutinize agent}
399
- VALIDATION_SCOPE: changed-only
400
- Verify Scrutinize agent's fixes didn't break anything."
401
- ```
402
-
403
- **If FAIL:** Report to user - Scrutinize agent broke tests, needs manual intervention.
404
-
405
- **If PASS:** append a `gate:validate` claim (Phase 3's **Evidence claims**), then continue to Phase 7.
406
-
407
- ### Phase 7: Alignment Check
354
+ ### Phase 5: Alignment Check
408
355
 
409
356
  **Produces:** ALIGNMENT_RESULT
410
357
  **Requires:** FILES_CHANGED, EXECUTION_PLAN
411
358
 
412
- After Scrutinize agent passes (and re-validation if needed), spawn Evaluate agent to validate alignment:
359
+ After Scrutinize agent passes, spawn Evaluate agent to validate alignment. Evaluate agent receives `FEATURE_KNOWLEDGE` as acceptance context only; pattern and anti-pattern judgments belong to Scrutinize agent:
413
360
 
414
361
  ```
415
362
  Agent(subagent_type="Evaluate"):
@@ -421,7 +368,7 @@ FEATURE_KNOWLEDGE: {feature_knowledge}
421
368
  Validate alignment with request and plan. Report ALIGNED or MISALIGNED with details."
422
369
  ```
423
370
 
424
- **If ALIGNED:** Continue to Phase 8
371
+ **If ALIGNED:** Continue to Phase 6
425
372
 
426
373
  **If MISALIGNED:**
427
374
  1. Extract misalignment details from Evaluate agent output
@@ -430,9 +377,9 @@ Validate alignment with request and plan. Report ALIGNED or MISALIGNED with deta
430
377
  - Spawn Code agent to fix misalignments:
431
378
  ```
432
379
  Agent(subagent_type="Code"):
433
- "TASK_ID: {task-id}
380
+ "OPERATION: alignment-fix
381
+ TASK_ID: {task-id}
434
382
  TASK_DESCRIPTION: Fix alignment issues
435
- OPERATION: alignment-fix
436
383
  MISALIGNMENTS: {structured misalignments from Evaluate agent}
437
384
  SCOPE: Fix only the listed misalignments, no other changes
438
385
  CREATE_PR: false
@@ -440,22 +387,62 @@ Validate alignment with request and plan. Report ALIGNED or MISALIGNED with deta
440
387
  ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
441
388
  COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
442
389
  ```
443
- - Spawn Validate agent to verify fix didn't break tests:
390
+ - Loop back to Phase 5 (re-check alignment). The fix is not validated here: the Phase 6 run covers it.
391
+ 4. If `alignment_fix_count > 2`: Report misalignments to user for decision
392
+
393
+ ### Phase 6: Validate
394
+
395
+ **Produces:** VALIDATION_RESULT, VALIDATED_HEAD
396
+ **Requires:** BASE_BRANCH
397
+
398
+ Validate takes the one full-suite slot, after every commit it must cover: Code, Simplify, Scrutinize and the alignment fixes. After Evaluate agent passes, spawn Validate agent. `FILES_CHANGED` is the branch diff, because the Code agent's own list misses the Simplify, Scrutinize and fix commits (`{base}` is `BASE_BRANCH`):
399
+
400
+ ```
401
+ Agent(subagent_type="Validate"):
402
+ "FILES_CHANGED: {output of `git diff --name-only {base}...HEAD`}
403
+ VALIDATION_SCOPE: full
404
+ Run build, typecheck, lint, test. Report pass/fail with failure details."
405
+ ```
406
+
407
+ **If FAIL:**
408
+ 1. Extract failure details from Validate agent output
409
+ 2. Increment `validation_retry_count`
410
+ 3. If `validation_retry_count <= 2`:
411
+ - Spawn Code agent with fix context:
444
412
  ```
445
- Agent(subagent_type="Validate", model="haiku"):
446
- "FILES_CHANGED: {files modified by fix Code agent}
447
- VALIDATION_SCOPE: changed-only"
413
+ Agent(subagent_type="Code"):
414
+ "OPERATION: validation-fix
415
+ TASK_ID: {task-id}
416
+ TASK_DESCRIPTION: Fix validation failures
417
+ VALIDATION_FAILURES: {parsed failures from Validate agent}
418
+ SCOPE: Fix only the listed failures, no other changes
419
+ CREATE_PR: false
420
+ ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
421
+ ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
422
+ COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
448
423
  ```
449
- - If Validate agent FAIL: Report to user
450
- - If Validate agent PASS: Loop back to Phase 7 (re-check alignment)
451
- 4. If `alignment_fix_count > 2`: Report misalignments to user for decision
424
+ - Loop back to Phase 6 (re-validate at the new HEAD, full scope)
425
+ 4. If `validation_retry_count > 2`: Report failures to user and halt
452
426
 
453
- ### Phase 8: QA Testing
427
+ **If PASS:** append a `gate:validate` claim, run `git rev-parse HEAD` and record the result as `VALIDATED_HEAD`, then continue to Phase 7.
428
+
429
+ **Evidence claims** are lines appended to the `## Claims` section of `EVIDENCE_FILE` — the file's last section, created when absent. Append only: never edit or remove a claim; the last valid one per target wins. Each line takes exactly one of these shapes, where `<head>` is the 40-hex `HEAD:` the agent's report shows:
430
+
431
+ ```
432
+ - gate:validate PASS sha:<head> by:validate
433
+ - TP-<n> <PASS|FAIL|SKIP> sha:<head> by:test exit:<0-255>
434
+ ```
435
+
436
+ - `gate:validate` — after a Phase 6 or Phase 8 PASS.
437
+ - `TP-<n>` — after every Phase 7 run, one line per `### Test Plan Evidence` row whose TP is in `TEST_PLAN`, with the row's outcome; the line ends at `by:test` when the row's Exit is not a number from 0 to 255.
438
+ - Append nothing from a report whose `HEAD:` is not a single 40-hex SHA — a reported before/after change included — and say so in the Phase 11 report.
439
+
440
+ ### Phase 7: QA Testing
454
441
 
455
442
  **Produces:** QA_RESULT
456
- **Requires:** FILES_CHANGED, EXECUTION_PLAN, TEST_PLAN
443
+ **Requires:** FILES_CHANGED, EXECUTION_PLAN, TEST_PLAN, VALIDATED_HEAD
457
444
 
458
- After Evaluate agent passes, spawn Test agent for scenario-based acceptance testing:
445
+ After Phase 6 passes, spawn Test agent for scenario-based acceptance testing:
459
446
 
460
447
  ```
461
448
  Agent(subagent_type="Test"):
@@ -467,9 +454,9 @@ TEST_PLAN: {the TP lines of the evidence file's ## Test Plan section, or (none)}
467
454
  Design and execute scenario-based acceptance tests. Report PASS or FAIL with evidence."
468
455
  ```
469
456
 
470
- After every Test agent run — PASS or FAIL, first run or retry — append its TP claims (Phase 3's **Evidence claims**).
457
+ After every Test agent run — PASS or FAIL, first run or retry — append its TP claims (Phase 6's **Evidence claims**).
471
458
 
472
- **If PASS:** Continue to Phase 9
459
+ **If PASS:** Continue to Phase 8
473
460
 
474
461
  **If FAIL:**
475
462
  1. Extract failure details from Test agent output
@@ -478,9 +465,9 @@ After every Test agent run — PASS or FAIL, first run or retry — append its T
478
465
  - Spawn Code agent to fix QA failures:
479
466
  ```
480
467
  Agent(subagent_type="Code"):
481
- "TASK_ID: {task-id}
468
+ "OPERATION: qa-fix
469
+ TASK_ID: {task-id}
482
470
  TASK_DESCRIPTION: Fix QA test failures
483
- OPERATION: qa-fix
484
471
  QA_FAILURES: {structured failures from Test agent}
485
472
  SCOPE: Fix only the listed failures, no other changes
486
473
  CREATE_PR: false
@@ -488,15 +475,26 @@ After every Test agent run — PASS or FAIL, first run or retry — append its T
488
475
  ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
489
476
  COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
490
477
  ```
491
- - Spawn Validate agent to verify fix didn't break tests:
492
- ```
493
- Agent(subagent_type="Validate", model="haiku"):
494
- "FILES_CHANGED: {files modified by fix Code agent}
495
- VALIDATION_SCOPE: changed-only"
496
- ```
497
- - If Validate agent FAIL: Report to user
498
- - If Validate agent PASS: Loop back to Phase 8 (re-run Test agent)
499
- 4. If `qa_retry_count > 2`: Report QA failures to user for decision
478
+ - Loop back to Phase 7 (re-run Test agent). The fix is not validated here: Phase 8 covers it.
479
+ 4. If `qa_retry_count > 2`: Report QA failures to user for decision. The run stops at the report (Phase 11), so Phases 8 and 9 do not run.
480
+
481
+ ### Phase 8: Re-Validate (only if a qa-fix committed)
482
+
483
+ **Produces:** REVALIDATION_RESULT
484
+ **Requires:** QA_RESULT, VALIDATED_HEAD
485
+
486
+ Run this phase only if a qa-fix committed (`git rev-parse HEAD` differs from `VALIDATED_HEAD`); otherwise skip it and continue to Phase 9. Spawn Validate agent over what changed since the Phase 6 run:
487
+
488
+ ```
489
+ Agent(subagent_type="Validate"):
490
+ "FILES_CHANGED: {output of `git diff --name-only VALIDATED_HEAD..HEAD`}
491
+ VALIDATION_SCOPE: changed-only
492
+ Verify the qa-fix commits did not break anything."
493
+ ```
494
+
495
+ **If FAIL:** Report the failures to user and halt.
496
+
497
+ **If PASS:** append a `gate:validate` claim (Phase 6's **Evidence claims**), then continue to Phase 9.
500
498
 
501
499
  ### Phase 9: CI Status Gate
502
500
 
@@ -505,14 +503,22 @@ After every Test agent run — PASS or FAIL, first run or retry — append its T
505
503
 
506
504
  Strategy-conditional: run when the PR already exists — **SINGLE_CODE_AGENT** and **SEQUENTIAL_CODE_AGENTS** (the Phase 2 Code agent with `CREATE_PR: true` creates it); skip for **PARALLEL_CODE_AGENTS** (its unified PR is created in Phase 10).
507
505
 
506
+ **Push first, outside the gate block.** The gate reads CI for the pushed head, and the Simplify, Scrutinize and fix commits reach the PR only by a push. Push once — never force, and no retry:
507
+
508
+ ```bash
509
+ git push origin HEAD; echo "exit=$?"
510
+ ```
511
+
512
+ `exit=0` continues to the gate. Any other result, a rejected non-fast-forward push included, records `TRACEABILITY: DEGRADED (ci push failed)` for the Phase 11 report, reports "CI status unknown — verify manually before merging" and proceeds to Phase 10 without waiting. `PR_NUMBER` is the number in `PR_URL`.
513
+
508
514
  <!-- PATTERN: ci-status-gate -->
509
- 1. Spawn `Agent(subagent_type="Git")` with `OPERATION: check-ci-status` and `PR_NUMBER` from PR_URL.
515
+ 1. Wait: run `cd {worktree} && HEAD_SHA=$(git rev-parse HEAD) && node "$HOME/.devflow/scripts/ci-wait.cjs" --pr {PR_NUMBER} --head "$HEAD_SHA"` through the Bash tool with `timeout: 600000`. Each run is one wait of at most 570 seconds and prints one line, `CI <STATUS> pr=… head=… failing=… pending=… waited=…` (INDETERMINATE adds `reason=…`). A missing or unparseable line, a status outside the six below, or a non-zero exit is INDETERMINATE.
510
516
  2. **If PASSING** → proceed to Phase 10.
511
517
  3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to Phase 10.
512
- 4. **If PENDING** → poll every 60 seconds (global budget, see step 7). Re-spawn Git agent each poll. If PASSING → proceed. If still PENDING after budget exhausted → report "CI still running — verify manually before merging" and proceed.
513
- 5. **If INDETERMINATE** → poll as PENDING within the same budget. If still INDETERMINATE after budget exhausted → report "CI status unknown — verify manually before merging" and proceed.
514
- 6. **If FAILING** → report failing checks. Spawn `Agent(subagent_type="Code")` with `COMPLIANCE_FRAMEWORKS` to fix CI failures based on check names and failure context. After fix, push and re-check. Max 2 fix attempts. If still failing → report failures and proceed.
515
- 7. **Total budget**: max 10 polls and max 2 fix attempts across all check/fix cycles combined. If budget exhausted, report current status and proceed.
518
+ 4. **If PENDING** and fewer than 3 waits have run → wait again (step 1). After the third wait → report "CI still running — verify manually before merging" and proceed.
519
+ 5. **If INDETERMINATE** and fewer than 3 waits have run → wait again (step 1). After the third wait → report "CI status unknown — verify manually before merging" and proceed.
520
+ 6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Code")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_FRAMEWORKS`, `CI_FAILURES` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the Code agent fetches the full names and reads the logs itself and this command reads none. After a fix, push with the command above and, if a wait remains, wait again (step 1); a failed push records `TRACEABILITY: DEGRADED (ci push failed)`, reports "CI status unknown — verify manually before merging" and stops waiting. After the second fix still FAILING → report the failing checks and proceed.
521
+ 7. **Budget**: at most 3 waits and 2 fixes in all. When one is spent, report the current status and proceed.
516
522
  <!-- /PATTERN: ci-status-gate -->
517
523
 
518
524
  ### Phase 10: Create PR
@@ -526,9 +532,9 @@ Strategy-conditional: run when the PR already exists — **SINGLE_CODE_AGENT** a
526
532
 
527
533
  ```
528
534
  Agent(subagent_type="Code"):
529
- "TASK_ID: {task-id}
535
+ "OPERATION: pr-create
536
+ TASK_ID: {task-id}
530
537
  TASK_DESCRIPTION: Create the unified PR for the parallel implementation
531
- OPERATION: pr-create
532
538
  BASE_BRANCH: {base branch}
533
539
  CREATE_PR: true
534
540
  PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
@@ -578,7 +584,7 @@ Display completion summary with phase status, PR info, and next steps.
578
584
 
579
585
  Show the test plan's evidence from Phase 10b: `Test plan: {VERIFIED-CI + ATTESTED-LOCAL}/{total} verified (VERIFIED-CI {n}, ATTESTED-LOCAL {n})`, read from the `EVIDENCE` line and never inferred, then its `**Body**:` / `**Comment**:` line verbatim. Without an `EVIDENCE` line, show `Test plan: evidence unavailable`; with no test plan, `Test plan: missing`.
580
586
 
581
- If any Git agent output emitted `TRACEABILITY: DEGRADED ({reason})` lines during the run, or Phase 10b's push recorded one, surface them verbatim in the report under a `### Traceability` subsection so the user can act on them.
587
+ If any Git agent output emitted `TRACEABILITY: DEGRADED ({reason})` lines during the run, or Phase 9's push or Phase 10b's push recorded one, surface them verbatim in the report under a `### Traceability` subsection so the user can act on them.
582
588
 
583
589
  If Phase 1 recorded an evidence exception, show its `## Evidence Exceptions` lines in the report.
584
590
 
@@ -603,30 +609,30 @@ If Phase 1 recorded an evidence exception, show its `## Evidence Exceptions` lin
603
609
  │ ├─ SEQUENTIAL_CODE_AGENTS (15%): N Code agents with handoff summaries
604
610
  │ └─ PARALLEL_CODE_AGENTS (5%): N Code agents in single message (rare)
605
611
  │
606
- ├─ Phase 3: Validate
607
- │ └─ Validate agent (build, typecheck, lint, test)
608
- │ └─ If FAIL: Code agent fix loop (max 2 retries) → re-validate
609
- │ └─ If PASS: gate:validate claim → evidence file
610
- │
611
- ├─ Phase 4: Simplify
612
+ ├─ Phase 3: Simplify
612
613
  │ └─ Simplify agent (refines code clarity and consistency)
613
614
  │
614
- ├─ Phase 5: Self-Review
615
- │ └─ Scrutinize agent (final quality gate, fixes P0/P1)
615
+ ├─ Phase 4: Self-Review
616
+ │ └─ Scrutinize agent (quality gate, fixes P0/P1; status PASS | FIXED | BLOCKED)
616
617
  │
617
- ├─ Phase 6: Re-Validate (if Scrutinize agent made changes)
618
- │ └─ Validate agent (verify Scrutinize agent fixes)
619
- │
620
- ├─ Phase 7: Alignment Check
618
+ ├─ Phase 5: Alignment Check
621
619
  │ └─ Evaluate agent (validates alignment - reports only, no fixes)
622
- │ └─ If MISALIGNED: Code agent fix loop (max 2 iterations) → Validate agent → re-check
620
+ │ └─ If MISALIGNED: Code agent fix loop (max 2 iterations) → re-check alignment
621
+ │
622
+ ├─ Phase 6: Validate (the one full-suite slot)
623
+ │ └─ Validate agent (build, typecheck, lint, test over the branch diff)
624
+ │ └─ If FAIL: Code agent fix loop (max 2 retries) → re-validate at the new HEAD
625
+ │ └─ If PASS: record VALIDATED_HEAD, gate:validate claim → evidence file
623
626
  │
624
- ├─ Phase 8: QA Testing
627
+ ├─ Phase 7: QA Testing
625
628
  │ └─ Test agent (scenario-based acceptance tests, TEST_PLAN) → one claim per TP row → evidence file
626
- │ └─ If FAIL: Code agent fix loop (max 2 retries) → Validate agent → re-test
629
+ │ └─ If FAIL: Code agent fix loop (max 2 retries) → re-test
630
+ │
631
+ ├─ Phase 8: Re-Validate (only if a qa-fix committed)
632
+ │ └─ Validate agent (changed-only over VALIDATED_HEAD..HEAD) → gate:validate claim
627
633
  │
628
634
  ├─ Phase 9: CI Status Gate (SINGLE_CODE_AGENT + SEQUENTIAL_CODE_AGENTS; skipped for PARALLEL_CODE_AGENTS)
629
- │ └─ Git agent (check-ci-status) → poll/fix cycle (10 polls + 2 fix budget)
635
+ │ └─ Push the branch, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code agent on FAILING (3 waits + 2 fixes)
630
636
  │
631
637
  ├─ Phase 10: Create PR (if needed)
632
638
  │ └─ SINGLE_CODE_AGENT: already created by the Phase 2 Code agent
@@ -645,7 +651,7 @@ If Phase 1 recorded an evidence exception, show its `## Evidence Exceptions` lin
645
651
 
646
652
  ## Principles
647
653
 
648
- 1. **Orchestration only** - Command spawns agents, never does work itself
654
+ 1. **Orchestration only** - Command spawns agents, never does work itself; the inline calls are the bounded plumbing the charter allows: the Phase 9 and Phase 10b pushes, the Phase 9 ci-wait call and the evidence script checks
649
655
  2. **Plan-first** - Plan documents from `/plan` skip exploration/planning overhead entirely
650
656
  3. **Coherence-first** - Single Code agent produces more consistent code (default ~80% of tasks)
651
657
  4. **Agent ownership** - Each agent owns its output completely
@@ -655,7 +661,7 @@ If Phase 1 recorded an evidence exception, show its `## Evidence Exceptions` lin
655
661
  8. **Strict delegation** - Never perform agent work in main session. "Spawn X" means call Agent tool with X, not do X's work yourself
656
662
  9. **Validate agent owns validation** - Never run `npm test`, `npm run build`, or similar in main session; always delegate to Validate agent
657
663
  10. **Code agent owns fixes** - Never implement fixes in main session; spawn Code agent for validation failures and alignment fixes
658
- 11. **Loop limits** - Max 2 validation retries, max 2 alignment fix iterations before escalating to user
664
+ 11. **Loop limits** - Max 2 validation retries, max 2 alignment fix iterations, max 2 QA retries before escalating to user; the CI gate allows at most 3 waits and 2 fixes
659
665
  12. **CI awareness** - CI status is checked before merge for SINGLE_CODE_AGENT and SEQUENTIAL_CODE_AGENTS, whose PR exists from Phase 2; skipped for PARALLEL_CODE_AGENTS, whose PR is created in Phase 10; test-plan evidence (Phase 10b) is recorded under every strategy once the PR exists
660
666
 
661
667
  ## Error Handling
@@ -26,7 +26,13 @@ The orchestrator only spawns agents and gates — all analytical work is done by
26
26
 
27
27
  ## Input
28
28
 
29
- `$ARGUMENTS` contains whatever follows `/plan`:
29
+ What follows `/plan` is bound once, here. Every later step names it `COMMAND_INPUT` and never restates it:
30
+
31
+ <command-input>
32
+ $ARGUMENTS
33
+ </command-input>
34
+
35
+ `COMMAND_INPUT` is one of:
30
36
  - Opens with a candidate issue reference → issue mode (one candidate = single-ref, more than one = multi-issue)
31
37
  - Path to existing `.md` file → **error**: "Use /implement with plan documents"
32
38
  - Other text → feature description
@@ -66,7 +72,7 @@ Explore the user's intent through focused Socratic questioning before spawning a
66
72
 
67
73
  **Step 0 — Fetch issue(s)** (issue mode only; skip for feature-description and empty modes):
68
74
 
69
- - **Single-ref** (one candidate ref in `$ARGUMENTS`):
75
+ - **Single-ref** (one candidate ref in `COMMAND_INPUT`):
70
76
 
71
77
  ```
72
78
  Agent(subagent_type="Git"):
@@ -106,8 +112,6 @@ If the user says "skip" or "just proceed" — skip remaining questions, present
106
112
  **Produces:** SKIM_CONTEXT, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE
107
113
  **Requires:** CONFIRMED_SCOPE
108
114
 
109
- **Load Companion Skills** — Load via Skill tool: `devflow:test-driven-development`, `devflow:patterns`, `devflow:software-design`, `devflow:security`, `devflow:design-review`. If a skill fails to load, continue without it.
110
-
111
115
  Spawn Skim agent for codebase context:
112
116
 
113
117
  ```
@@ -136,7 +140,7 @@ Pass `FEATURE_KNOWLEDGE` alongside `DECISIONS_CONTEXT` to Explore and Design age
136
140
  **Produces:** EXPLORE_OUTPUTS
137
141
  **Requires:** SKIM_CONTEXT, DECISIONS_CONTEXT
138
142
 
139
- Spawn 4 Explore agents **in a single message**, each with Skim agent context, `DECISIONS_CONTEXT` (from Phase 2), and `FEATURE_KNOWLEDGE` (from Phase 2). Include instructions: "follow `devflow:apply-decisions` for DECISIONS_CONTEXT" and "The FEATURE_KNOWLEDGE is a baseline — VALIDATE, EXTEND, and CORRECT it, don't repeat it. Focus on areas the feature knowledge doesn't cover and changes since it was last updated."
143
+ Spawn 4 Explore agents **in a single message**, each with Skim agent context, `DECISIONS_CONTEXT` (from Phase 2), and `FEATURE_KNOWLEDGE` (from Phase 2). Include instructions: "follow `devflow:apply-decisions` for DECISIONS_CONTEXT" and "The FEATURE_KNOWLEDGE is a baseline — VALIDATE, EXTEND, and CORRECT it, don't repeat it. Focus on areas the feature knowledge doesn't cover and changes since it was last updated." Ask each agent for a final report of at most about 1,500 tokens: findings with file:line references, not file dumps.
140
144
 
141
145
  | Focus | Thoroughness | Find |
142
146
  |-------|-------------|------|
@@ -265,7 +269,7 @@ User can:
265
269
  **Produces:** IMPL_EXPLORE_OUTPUTS
266
270
  **Requires:** SKIM_CONTEXT, ACCEPTED_SCOPE
267
271
 
268
- Spawn 4 Explore agents **in a single message**, each with Skim agent context + accepted scope:
272
+ Spawn 4 Explore agents **in a single message**, each with Skim agent context + accepted scope. Ask each agent for a final report of at most about 1,500 tokens: findings with file:line references, not file dumps.
269
273
 
270
274
  | Focus | Thoroughness | Find |
271
275
  |-------|-------------|------|
@@ -294,7 +298,7 @@ Combine into: patterns to follow, integration points, reusable code, edge cases"
294
298
  **Produces:** PLAN_OUTPUTS
295
299
  **Requires:** IMPL_EXPLORATION_SYNTHESIS, GAP_SYNTHESIS, DECISIONS_CONTEXT
296
300
 
297
- Spawn 3 Plan agents **in a single message**, each with implementation exploration synthesis:
301
+ Spawn 3 Plan agents **in a single message**, each with implementation exploration synthesis. Ask each agent for a final report of at most about 1,500 tokens: the plan itself, not a restatement of the exploration.
298
302
 
299
303
  | Focus | Output |
300
304
  |-------|--------|
@@ -470,7 +474,7 @@ Spawn a Git agent with `OPERATION: ensure-traceable-issue`:
470
474
  ```
471
475
  Agent(subagent_type="Git"):
472
476
  "OPERATION: ensure-traceable-issue
473
- ISSUE_INPUT: {the raw candidate token from $ARGUMENTS if /plan was invoked with an issue reference, else omit}
477
+ ISSUE_INPUT: {the raw candidate token from COMMAND_INPUT if /plan was invoked with an issue reference, else omit}
474
478
  TASK_DESCRIPTION: {Gate 0 confirmed scope — one-line title}
475
479
  INITIAL_REQUEST: {the Gate 0 confirmed scope statement}
476
480
  REQUIREMENTS: {discovered requirements summary from Phase 6 gap synthesis}
@@ -17,13 +17,19 @@ Release the project using adaptive learned configuration. On first run, scans th
17
17
 
18
18
  ## Input
19
19
 
20
- `$ARGUMENTS` contains whatever follows `/release`:
20
+ What follows `/release` is bound once, here. Every later step names it `COMMAND_INPUT` and never restates it:
21
+
22
+ <command-input>
23
+ $ARGUMENTS
24
+ </command-input>
25
+
26
+ `COMMAND_INPUT` is one of:
21
27
  - Explicit version: `v1.2.3` or `1.2.3`
22
28
  - Bump type: `patch`, `minor`, `major`
23
29
  - Flag: `--dry-run`
24
30
  - Empty: interactive mode (will ask for version)
25
31
 
26
- Parse from $ARGUMENTS:
32
+ Parse from `COMMAND_INPUT`:
27
33
  - `VERSION`: explicit version string if present (strip leading `v`)
28
34
  - `BUMP_TYPE`: `patch | minor | major` if bump type provided
29
35
  - `DRY_RUN`: true if `--dry-run` present, false otherwise
@@ -20,7 +20,13 @@ Research a topic by spawning parallel Research agents across multiple research t
20
20
 
21
21
  ## Input
22
22
 
23
- `$ARGUMENTS` contains whatever follows `/research`:
23
+ What follows `/research` is bound once, here. Every later step names it `COMMAND_INPUT` and never restates it:
24
+
25
+ <command-input>
26
+ $ARGUMENTS
27
+ </command-input>
28
+
29
+ `COMMAND_INPUT` is one of:
24
30
  - Research question: "best caching strategies"
25
31
  - Comparison question: "compare React vs Svelte for our use case"
26
32
  - Empty: use conversation context
@@ -111,7 +117,7 @@ If external research was skipped due to tool unavailability: inform user.
111
117
  1. If `codebase` type was not in RESEARCH_PLAN → skip
112
118
  2. Check if matching feature knowledge already exists by reading `{worktree}/.devflow/features/index.md` (or globbing frontmatter if absent). If covered → skip
113
119
  3. Use AskUserQuestion: "No feature knowledge exists for {researched area}. Create one?"
114
- 4. If user accepts: spawn `Agent(subagent_type="Knowledge")` with researched area context + worktree root, instructing it to load `devflow:feature-knowledge`, write `KNOWLEDGE.md`, and update `index.md` directly
120
+ 4. If user accepts: spawn `Agent(subagent_type="Knowledge")` with researched area context + worktree root, instructing it to write `KNOWLEDGE.md` and update `index.md` directly
115
121
  5. Set FEATURE_KNOWLEDGE_STATUS = created or skipped
116
122
 
117
123
  **Failure handling**: Non-blocking. If Knowledge agent fails, log and continue.