maestro-flow 0.4.11 → 0.4.13

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 (253) hide show
  1. package/.agents/agents/cli-explore-agent.md +1 -3
  2. package/.agents/agents/cross-role-reviewer.md +173 -0
  3. package/.agents/agents/role-design-author.md +220 -0
  4. package/.agents/agents/ui-design-agent.md +1 -18
  5. package/.agents/agents/workflow-analyzer.md +1 -1
  6. package/.agents/agents/workflow-external-researcher.md +1 -1
  7. package/.agents/skills/learn-decompose/SKILL.md +6 -6
  8. package/.agents/skills/learn-follow/SKILL.md +4 -4
  9. package/.agents/skills/learn-investigate/SKILL.md +6 -6
  10. package/.agents/skills/learn-retro/SKILL.md +7 -7
  11. package/.agents/skills/learn-second-opinion/SKILL.md +4 -4
  12. package/.agents/skills/maestro/SKILL.md +61 -27
  13. package/.agents/skills/maestro-amend/SKILL.md +1 -0
  14. package/.agents/skills/maestro-analyze/SKILL.md +37 -4
  15. package/.agents/skills/maestro-blueprint/SKILL.md +133 -0
  16. package/.agents/skills/maestro-brainstorm/SKILL.md +120 -103
  17. package/.agents/skills/maestro-fork/SKILL.md +1 -1
  18. package/.agents/skills/maestro-guard/SKILL.md +3 -2
  19. package/.agents/skills/maestro-help/SKILL.md +48 -14
  20. package/.agents/skills/maestro-help/index/catalog.json +29 -11
  21. package/.agents/skills/maestro-help/phases/01-parse-intent.md +1 -1
  22. package/.agents/skills/maestro-help/phases/02-search-present.md +6 -4
  23. package/.agents/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  24. package/.agents/skills/maestro-impeccable/SKILL.md +13 -11
  25. package/.agents/skills/maestro-init/SKILL.md +3 -3
  26. package/.agents/skills/maestro-milestone-audit/SKILL.md +5 -3
  27. package/.agents/skills/maestro-milestone-complete/SKILL.md +7 -5
  28. package/.agents/skills/maestro-milestone-release/SKILL.md +1 -1
  29. package/.agents/skills/maestro-plan/SKILL.md +16 -4
  30. package/.agents/skills/maestro-ralph/SKILL.md +297 -226
  31. package/.agents/skills/maestro-ralph-execute/SKILL.md +82 -67
  32. package/.agents/skills/maestro-roadmap/SKILL.md +43 -81
  33. package/.agents/skills/manage-harvest/SKILL.md +1 -0
  34. package/.agents/skills/manage-issue-discover/SKILL.md +1 -1
  35. package/.agents/skills/manage-knowhow/SKILL.md +1 -1
  36. package/.agents/skills/manage-learn/SKILL.md +4 -4
  37. package/.agents/skills/quality-auto-test/SKILL.md +6 -6
  38. package/.agents/skills/quality-refactor/SKILL.md +1 -1
  39. package/.agents/skills/quality-retrospective/SKILL.md +2 -2
  40. package/.agents/skills/security-audit/SKILL.md +24 -0
  41. package/.agents/skills/spec-remove/SKILL.md +6 -2
  42. package/.agents/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  43. package/.agents/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  44. package/.agents/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  45. package/.agents/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  46. package/.agents/skills/team-lifecycle-v4/templates/epics.md +2 -2
  47. package/.agents/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  48. package/.agents/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  49. package/.agy/agents/cli-explore-agent.md +1 -3
  50. package/.agy/agents/cross-role-reviewer.md +170 -0
  51. package/.agy/agents/role-design-author.md +217 -0
  52. package/.agy/agents/ui-design-agent.md +1 -18
  53. package/.agy/agents/workflow-analyzer.md +1 -1
  54. package/.agy/agents/workflow-external-researcher.md +1 -1
  55. package/.agy/skills/learn-decompose/SKILL.md +6 -6
  56. package/.agy/skills/learn-follow/SKILL.md +4 -4
  57. package/.agy/skills/learn-investigate/SKILL.md +6 -6
  58. package/.agy/skills/learn-retro/SKILL.md +7 -7
  59. package/.agy/skills/learn-second-opinion/SKILL.md +4 -4
  60. package/.agy/skills/maestro/SKILL.md +61 -27
  61. package/.agy/skills/maestro-amend/SKILL.md +1 -0
  62. package/.agy/skills/maestro-analyze/SKILL.md +37 -4
  63. package/.agy/skills/maestro-blueprint/SKILL.md +133 -0
  64. package/.agy/skills/maestro-brainstorm/SKILL.md +120 -103
  65. package/.agy/skills/maestro-fork/SKILL.md +1 -1
  66. package/.agy/skills/maestro-guard/SKILL.md +3 -2
  67. package/.agy/skills/maestro-help/SKILL.md +48 -14
  68. package/.agy/skills/maestro-help/index/catalog.json +29 -11
  69. package/.agy/skills/maestro-help/phases/01-parse-intent.md +1 -1
  70. package/.agy/skills/maestro-help/phases/02-search-present.md +6 -4
  71. package/.agy/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  72. package/.agy/skills/maestro-impeccable/SKILL.md +13 -11
  73. package/.agy/skills/maestro-init/SKILL.md +3 -3
  74. package/.agy/skills/maestro-milestone-audit/SKILL.md +5 -3
  75. package/.agy/skills/maestro-milestone-complete/SKILL.md +7 -5
  76. package/.agy/skills/maestro-milestone-release/SKILL.md +1 -1
  77. package/.agy/skills/maestro-plan/SKILL.md +16 -4
  78. package/.agy/skills/maestro-ralph/SKILL.md +297 -226
  79. package/.agy/skills/maestro-ralph-execute/SKILL.md +82 -67
  80. package/.agy/skills/maestro-roadmap/SKILL.md +43 -81
  81. package/.agy/skills/manage-harvest/SKILL.md +1 -0
  82. package/.agy/skills/manage-issue-discover/SKILL.md +1 -1
  83. package/.agy/skills/manage-knowhow/SKILL.md +1 -1
  84. package/.agy/skills/manage-learn/SKILL.md +4 -4
  85. package/.agy/skills/quality-auto-test/SKILL.md +6 -6
  86. package/.agy/skills/quality-refactor/SKILL.md +1 -1
  87. package/.agy/skills/quality-retrospective/SKILL.md +2 -2
  88. package/.agy/skills/security-audit/SKILL.md +24 -0
  89. package/.agy/skills/spec-remove/SKILL.md +6 -2
  90. package/.agy/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  91. package/.agy/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  92. package/.agy/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  93. package/.agy/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  94. package/.agy/skills/team-lifecycle-v4/templates/epics.md +2 -2
  95. package/.agy/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  96. package/.agy/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  97. package/.claude/agents/cli-explore-agent.md +1 -3
  98. package/.claude/agents/cross-role-reviewer.md +171 -0
  99. package/.claude/agents/role-design-author.md +218 -0
  100. package/.claude/agents/ui-design-agent.md +1 -18
  101. package/.claude/agents/workflow-analyzer.md +1 -1
  102. package/.claude/agents/workflow-external-researcher.md +1 -1
  103. package/.claude/commands/learn-decompose.md +6 -6
  104. package/.claude/commands/learn-follow.md +4 -4
  105. package/.claude/commands/learn-investigate.md +6 -6
  106. package/.claude/commands/learn-retro.md +7 -7
  107. package/.claude/commands/learn-second-opinion.md +4 -4
  108. package/.claude/commands/maestro-amend.md +1 -0
  109. package/.claude/commands/maestro-analyze.md +37 -4
  110. package/.claude/commands/maestro-blueprint.md +131 -0
  111. package/.claude/commands/maestro-brainstorm.md +133 -116
  112. package/.claude/commands/maestro-fork.md +1 -1
  113. package/.claude/commands/maestro-guard.md +3 -2
  114. package/.claude/commands/maestro-impeccable.md +13 -11
  115. package/.claude/commands/maestro-init.md +3 -3
  116. package/.claude/commands/maestro-milestone-audit.md +5 -3
  117. package/.claude/commands/maestro-milestone-complete.md +7 -5
  118. package/.claude/commands/maestro-milestone-release.md +1 -1
  119. package/.claude/commands/maestro-plan.md +16 -4
  120. package/.claude/commands/maestro-ralph-execute.md +82 -67
  121. package/.claude/commands/maestro-ralph.md +297 -226
  122. package/.claude/commands/maestro-roadmap.md +43 -81
  123. package/.claude/commands/maestro.md +61 -27
  124. package/.claude/commands/manage-harvest.md +1 -0
  125. package/.claude/commands/manage-issue-discover.md +1 -1
  126. package/.claude/commands/manage-knowhow.md +1 -1
  127. package/.claude/commands/manage-learn.md +4 -4
  128. package/.claude/commands/quality-auto-test.md +6 -6
  129. package/.claude/commands/quality-refactor.md +1 -1
  130. package/.claude/commands/quality-retrospective.md +2 -2
  131. package/.claude/commands/security-audit.md +24 -0
  132. package/.claude/commands/spec-remove.md +6 -2
  133. package/.claude/skills/maestro-help/SKILL.md +48 -14
  134. package/.claude/skills/maestro-help/index/catalog.json +29 -11
  135. package/.claude/skills/maestro-help/phases/01-parse-intent.md +1 -1
  136. package/.claude/skills/maestro-help/phases/02-search-present.md +6 -4
  137. package/.claude/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  138. package/.claude/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  139. package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  140. package/.claude/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  141. package/.claude/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  142. package/.claude/skills/team-lifecycle-v4/templates/epics.md +2 -2
  143. package/.claude/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  144. package/.claude/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  145. package/.codex/skills/learn-decompose/SKILL.md +4 -4
  146. package/.codex/skills/learn-follow/SKILL.md +3 -3
  147. package/.codex/skills/learn-investigate/SKILL.md +3 -3
  148. package/.codex/skills/learn-retro/SKILL.md +3 -3
  149. package/.codex/skills/learn-second-opinion/SKILL.md +3 -3
  150. package/.codex/skills/maestro/SKILL.md +75 -38
  151. package/.codex/skills/maestro-amend/SKILL.md +157 -0
  152. package/.codex/skills/maestro-analyze/SKILL.md +72 -23
  153. package/.codex/skills/maestro-blueprint/SKILL.md +123 -0
  154. package/.codex/skills/maestro-brainstorm/SKILL.md +277 -46
  155. package/.codex/skills/maestro-composer/SKILL.md +1 -1
  156. package/.codex/skills/maestro-execute/SKILL.md +13 -4
  157. package/.codex/skills/maestro-fork/SKILL.md +2 -0
  158. package/.codex/skills/maestro-guard/SKILL.md +3 -2
  159. package/.codex/skills/maestro-help/SKILL.md +28 -18
  160. package/.codex/skills/maestro-help/catalog.json +29 -11
  161. package/.codex/skills/maestro-impeccable/SKILL.md +13 -11
  162. package/.codex/skills/maestro-init/SKILL.md +7 -7
  163. package/.codex/skills/maestro-plan/SKILL.md +27 -9
  164. package/.codex/skills/maestro-ralph/SKILL.md +740 -601
  165. package/.codex/skills/maestro-roadmap/SKILL.md +56 -72
  166. package/.codex/skills/maestro-update/SKILL.md +169 -0
  167. package/.codex/skills/maestro-verify/SKILL.md +11 -2
  168. package/.codex/skills/manage-codebase-rebuild/SKILL.md +9 -5
  169. package/.codex/skills/manage-harvest/SKILL.md +11 -3
  170. package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
  171. package/.codex/skills/manage-knowhow/SKILL.md +1 -1
  172. package/.codex/skills/manage-learn/SKILL.md +3 -3
  173. package/.codex/skills/quality-refactor/SKILL.md +2 -2
  174. package/.codex/skills/quality-retrospective/SKILL.md +12 -5
  175. package/.codex/skills/security-audit/SKILL.md +24 -0
  176. package/.codex/skills/spec-remove/SKILL.md +8 -2
  177. package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +2 -2
  178. package/.codex/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  179. package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  180. package/.codex/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  181. package/.codex/skills/team-lifecycle-v4/templates/epics.md +2 -2
  182. package/.codex/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  183. package/.codex/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  184. package/README.md +8 -8
  185. package/README.zh-CN.md +8 -8
  186. package/dashboard/dist-server/dashboard/src/server/routes/settings.js +3 -3
  187. package/dashboard/dist-server/dashboard/src/server/routes/settings.js.map +1 -1
  188. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  189. package/dist/src/agents/cli-agent-runner.js +13 -7
  190. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  191. package/dist/src/commands/spec.d.ts.map +1 -1
  192. package/dist/src/commands/spec.js +8 -1
  193. package/dist/src/commands/spec.js.map +1 -1
  194. package/dist/src/tools/spec-init.d.ts +16 -2
  195. package/dist/src/tools/spec-init.d.ts.map +1 -1
  196. package/dist/src/tools/spec-init.js +58 -187
  197. package/dist/src/tools/spec-init.js.map +1 -1
  198. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  199. package/dist/src/tools/spec-loader.js +16 -16
  200. package/dist/src/tools/spec-loader.js.map +1 -1
  201. package/dist/src/tools/spec-seeds.d.ts +33 -0
  202. package/dist/src/tools/spec-seeds.d.ts.map +1 -0
  203. package/dist/src/tools/spec-seeds.js +200 -0
  204. package/dist/src/tools/spec-seeds.js.map +1 -0
  205. package/dist/src/tools/spec-writer.d.ts.map +1 -1
  206. package/dist/src/tools/spec-writer.js +7 -9
  207. package/dist/src/tools/spec-writer.js.map +1 -1
  208. package/dist/src/utils/update-notices.js +12 -0
  209. package/dist/src/utils/update-notices.js.map +1 -1
  210. package/package.json +1 -1
  211. package/templates/business-test-report.json +1 -1
  212. package/templates/index.json +1 -1
  213. package/templates/roadmap.md +15 -9
  214. package/templates/state.json +18 -17
  215. package/workflows/agy-instructions.md +2 -0
  216. package/workflows/analyze.md +79 -11
  217. package/workflows/auto-test.md +12 -7
  218. package/workflows/blueprint.md +431 -0
  219. package/workflows/brainstorm.md +617 -496
  220. package/workflows/business-test.md +7 -7
  221. package/workflows/claude-instructions.md +2 -0
  222. package/workflows/codebase-rebuild.md +4 -4
  223. package/workflows/codex-instructions.md +16 -83
  224. package/workflows/debug.md +1 -1
  225. package/workflows/harvest.md +184 -10
  226. package/workflows/impeccable.md +2 -0
  227. package/workflows/init.md +9 -8
  228. package/workflows/issue-analyze.md +14 -100
  229. package/workflows/issue-discover.md +2 -3
  230. package/workflows/issue-execute.md +1 -1
  231. package/workflows/issue-gaps-analyze.md +2 -0
  232. package/workflows/learn.md +1 -1
  233. package/workflows/maestro-chain-execute.md +10 -228
  234. package/workflows/maestro.md +2 -1
  235. package/workflows/milestone-audit.md +12 -4
  236. package/workflows/milestone-complete.md +14 -9
  237. package/workflows/milestone-release.md +82 -0
  238. package/workflows/plan.md +91 -25
  239. package/workflows/retrospective.md +1 -1
  240. package/workflows/roadmap-common.md +1 -1
  241. package/workflows/roadmap.md +14 -4
  242. package/workflows/spec-generate.md +26 -13
  243. package/workflows/specs-add.md +6 -1
  244. package/workflows/specs-load.md +6 -1
  245. package/workflows/specs-setup.md +6 -1
  246. package/workflows/sync.md +13 -0
  247. package/workflows/tools-spec.md +4 -0
  248. package/workflows/ui-design.md +5 -5
  249. package/workflows/ui-style.md +1 -1
  250. package/workflows/wiki-manage.md +2 -0
  251. package/.agents/agents/conceptual-planning-agent.md +0 -247
  252. package/.agy/agents/conceptual-planning-agent.md +0 -244
  253. package/.claude/agents/conceptual-planning-agent.md +0 -245
@@ -25,7 +25,7 @@ Flags: --executor claude-code|codex|gemini (default: claude-code), --dry-run (de
25
25
 
26
26
  ```
27
27
  Load ISS-ID from .workflow/issues/issues.jsonl → fatal if file missing or ID not found.
28
- Require issue.solution with non-empty steps[] → error if missing (run manage-issue-plan first).
28
+ Require issue.solution with non-empty steps[] → error if missing (run `maestro-plan --gaps {ISS-ID}` first).
29
29
  Resolve EXECUTOR → CLI tool (claude-code→claude, codex→codex, gemini→gemini), all with --mode write.
30
30
  ```
31
31
 
@@ -1,5 +1,7 @@
1
1
  # Workflow: Issue Gaps Analysis
2
2
 
3
+ > **CLI variants**: see `issue-gaps-analyze.codex.md` for codex-specific notes (CSV-wave variant using `spawn_agents_on_csv`).
4
+
3
5
  Root cause analysis for issues using CLI exploration and codebase context gathering.
4
6
  Supports single issue (ISS-ID) or batch (all open/registered) with classification and parallel analysis.
5
7
  Produces analysis records in issues.jsonl and context.md for downstream `plan --gaps`.
@@ -8,7 +8,7 @@ Storage:
8
8
 
9
9
  **Shared store rationale:** Manual captures (`source: "manual"`), tips (`source: "tip"`), retrospective-distilled insights (`source: "retrospective"`, `lens: <name>` from `quality-retrospective`), and learn-retro insights (`source: "retro-git"` or `source: "retro-decision"` from `learn-retro`) all live in the same store so search and list see the entire knowledge corpus. The `source` field disambiguates origin.
10
10
 
11
- This workflow does NOT spawn agents or call CLI tools. It is a thin file operation: parse → infer → append → confirm.
11
+ This workflow does NOT spawn sub-agents; it may invoke maestro CLI utilities (e.g. `maestro wiki search`, `maestro wiki list`) for list/search subcommands. The core capture flow is a thin file operation: parse → infer → append → confirm.
12
12
 
13
13
  ---
14
14
 
@@ -4,235 +4,17 @@
4
4
  > Both maestro and ralph sessions now use `maestro-ralph-execute` for step execution.
5
5
  > This file is kept for reference only and will be removed in a future version.
6
6
 
7
- Original description: Upgraded version of maestro's original direct execution strategy.
8
- Reads session status.json, loops through steps with per-step engine selection,
9
- context propagation, post-step Gemini analysis, and error handling.
10
- Dual-track progress: status.json (persistence + resume) and TodoWrite (UI visibility).
7
+ ## Migration
11
8
 
12
- **Prerequisites:**
13
- - Session directory with valid status.json (status: "running", pending steps)
14
- - TodoWrite initialized by selection workflow (Step 3h) with `MAESTRO:{chain_name}:` prefix
15
- - $SESSION_PATH passed from maestro.md dispatch
9
+ - Caller dispatching from `maestro.md` → use `Skill({ skill: "maestro-ralph-execute" })`
10
+ - Resume from session `Skill({ skill: "maestro-ralph-execute" })` (auto-discovers latest running session via `.workflow/.maestro/*/status.json`)
16
11
 
17
- ## Step 1: Load Session
12
+ ## References
18
13
 
19
- Read status.json from `$SESSION_PATH`.
14
+ - `~/.maestro/workflows/maestro.md` coordinator that creates sessions and dispatches to the unified executor
15
+ - `~/.maestro/workflows/maestro-ralph-execute.md` — current canonical executor (handles both maestro static chains and ralph adaptive chains)
20
16
 
21
- Extract: `session_id`, `chain_name`, `steps[]`, `context`, `auto_mode`, `exec_mode`, `cli_tool`, `gemini_session_id`.
22
-
23
- Set `$STEP_INDEX` = `current_step` (first pending step).
24
-
25
- Validate: `status == "running"` and at least one pending step exists.
26
-
27
- **TodoWrite sync (resume mode):** If TodoWrite has no `MAESTRO:{chain_name}:` entries (e.g., fresh context after `/maestro -c`), rebuild from status.json:
28
-
29
- ```javascript
30
- const todos = steps.map((step, i) => ({
31
- content: `MAESTRO:${chain_name}: [${i + 1}/${steps.length}] ${step.skill}`,
32
- status: step.status === 'completed' ? 'completed'
33
- : i === $STEP_INDEX ? 'in_progress'
34
- : 'pending'
35
- }));
36
- TodoWrite({ todos });
37
- ```
38
-
39
- Display banner:
40
-
41
- ```
42
- ============================================================
43
- CHAIN EXECUTOR
44
- ============================================================
45
- Session: {session_id}
46
- Chain: {chain_name}
47
- Steps: {completed}/{total} done, starting from step {$STEP_INDEX}
48
- Auto: {auto_mode}
49
- Exec: {exec_mode}
50
- ```
51
-
52
- ## Step 2: Context & Argument Assembly
53
-
54
- Initialize context object from `status.json.context`:
55
-
56
- ```
57
- context = {
58
- current_phase, // from status.json.context or top-level phase
59
- user_intent, // from status.json.context or top-level intent
60
- issue_id,
61
- milestone_num,
62
- spec_session_id,
63
- scratch_dir
64
- }
65
- ```
66
-
67
- ### assembleArgs(step)
68
-
69
- ```
70
- 1. Substitute placeholders in step.args:
71
- {phase} → context.current_phase
72
- {description} → context.user_intent (chainMap uses {description} as alias for user intent)
73
- {issue_id} → context.issue_id
74
- {spec_session_id} → context.spec_session_id
75
- {scratch_dir} → context.scratch_dir
76
- {milestone_num} → context.milestone_num
77
-
78
- 2. In auto_mode, append per-command flag if not already present:
79
- maestro-analyze / maestro-brainstorm / maestro-roadmap / maestro-impeccable → -y
80
- maestro-plan → --auto
81
- quality-test → --auto-fix
82
- quality-retrospective → --auto-yes
83
-
84
- 3. Shell-escape strings with single quotes for CLI delegate calls.
85
- ```
86
-
87
- ## Step 3: Step Loop
88
-
89
- For each step starting at `$STEP_INDEX`:
90
-
91
- ### 3a. Select engine & display banner
92
-
93
- Read `step.engine` from status.json (pre-computed by selection workflow Step 3e).
94
-
95
- If `step.engine` is missing or null, fallback to auto selection:
96
- ```
97
- CLI: maestro-plan, maestro-execute, maestro-analyze, maestro-brainstorm,
98
- maestro-roadmap, maestro-impeccable, quality-refactor
99
- Internal: everything else (current-session Skill() call)
100
- ```
101
-
102
- Display: `[Step {N}/{total}] /{step.skill} [{engine}] — {args}`
103
-
104
- Update status.json: step `status = "running"`, `engine`, `started_at`.
105
-
106
- Context window hint:
107
- - Step >= 4 and not autoYes: hint user about `/maestro -c` for fresh context resume.
108
- - autoYes and step >= 5: log warning to status.json.
109
-
110
- ### 3b. Execute (engine-dependent)
111
-
112
- **Internal engine** — current-session Skill() call (synchronous, visible):
113
-
114
- ```
115
- Skill({ skill: step.skill, args: assembledArgs })
116
- ```
117
-
118
- **CLI engine** — template-driven, async, context-isolated:
119
-
120
- ```
121
- 1. Load template ~/.maestro/templates/cli/prompts/coordinate-step.txt
122
- 2. Build analysisHints from previous step's next_step_hints
123
- (prompt_additions, cautions, context_to_carry)
124
- 3. Substitute template placeholders:
125
- {{COMMAND}}, {{ARGS}}, {{STEP_N}}, {{AUTO_DIRECTIVE}},
126
- {{CHAIN_NAME}}, {{ANALYSIS_HINTS}}
127
- 4. Run:
128
- Bash(maestro delegate "<prompt>" --to {cli_tool} --mode write,
129
- run_in_background: true, timeout: 600000)
130
- 5. **STOP** — wait for background callback
131
- ```
132
-
133
- ### 3c. Parse output & update context
134
-
135
- Scan step output for context propagation:
136
-
137
- ```
138
- PHASE: N → context.current_phase
139
- SPEC-xxx → context.spec_session_id
140
- scratch_dir: path → context.scratch_dir
141
- ```
142
-
143
- CLI: capture `exec_id` from stderr `[MAESTRO_EXEC_ID=<id>]`.
144
-
145
- **Persist context back to status.json** after each step — write updated `context` field and `current_step`. This enables resume via `/maestro -c`.
146
-
147
- ### 3d. Handle result & sync dual tracking
148
-
149
- **Success:**
150
- 1. status.json: mark step `status = "completed"`, set `completed_at`
151
- 2. TodoWrite: mark current step `completed`, next step `in_progress`
152
- 3. CLI: save output to `step-{N}-output.txt` in session directory
153
-
154
- ```javascript
155
- // Dual-track update after each step
156
- function updateDualTracking(stepIndex, total, chain_name, result) {
157
- // 1. status.json — already updated in 3c
158
- // 2. TodoWrite — sync UI
159
- const todos = getAllTodos().map(todo => {
160
- if (!todo.content.startsWith(`MAESTRO:${chain_name}:`)) return todo;
161
- const num = extractStepNum(todo.content);
162
- if (num === stepIndex + 1) return { ...todo, status: result };
163
- if (num === stepIndex + 2 && result === 'completed') return { ...todo, status: 'in_progress' };
164
- return todo;
165
- });
166
- TodoWrite({ todos });
167
- }
168
- ```
169
-
170
- **Failure:**
171
- 1. status.json: mark step `"failed"` or `"skipped"`
172
- 2. TodoWrite: mark step `completed` (skipped) or keep `in_progress` (retry)
173
- 3. `auto_mode` → retry once, then skip
174
- 4. Interactive → offer: Retry (max 2) / Skip / Abort
175
- 5. Abort → status.json `status = "aborted"`, TodoWrite mark remaining `pending`, display resume hint: `/maestro -c`
176
-
177
- ### 3e. Post-step analysis (CLI steps only)
178
-
179
- Skip if: step failed/skipped, or `engine == 'internal'`.
180
-
181
- Delegate to gemini (analysis mode, `--resume` if `gemini_session_id` exists) with prompt containing:
182
- - Step command, args, chain name, intent
183
- - Last 200 lines of step output
184
- - Next step info (command, args) if any
185
-
186
- Expected JSON response:
187
-
188
- ```json
189
- {
190
- "quality_score": "<0-100>",
191
- "execution_assessment": {
192
- "success": "<bool>",
193
- "completeness": "<full|partial|minimal>",
194
- "key_outputs": [],
195
- "missing_outputs": []
196
- },
197
- "issues": [
198
- { "severity": "critical|high|medium|low", "description": "" }
199
- ],
200
- "next_step_hints": {
201
- "prompt_additions": "<extra context for next step>",
202
- "cautions": ["<things to watch out for>"],
203
- "context_to_carry": "<key facts from this step>"
204
- },
205
- "step_summary": ""
206
- }
207
- ```
208
-
209
- On callback:
210
- 1. Capture gemini `exec_id` → store as `gemini_session_id` in status.json for session continuity.
211
- 2. Store analysis in `step_analyses[]` and `step-{N}-analysis.json` in session directory.
212
- 3. Advance to next step (**3a**).
213
-
214
- ## Step 4: Completion Report
215
-
216
- Finalize dual tracking:
217
- 1. status.json: `status = "completed"`
218
- 2. TodoWrite: all steps marked `completed` (or `completed` for skipped)
219
-
220
- ```
221
- ============================================================
222
- MAESTRO SESSION COMPLETE
223
- ============================================================
224
- Session: {session_id}
225
- Chain: {chain_name}
226
- Steps: {completed}/{total} completed
227
- Phase: {context.current_phase}
228
-
229
- Results:
230
- [✓] 1. maestro-plan — completed [cli] (quality: 85/100)
231
- [✓] 2. maestro-verify — completed [internal]
232
- [—] 3. quality-review — skipped [internal]
233
-
234
- CLI Avg Quality: {avgScore}/100 (based on {cliStepCount} cli steps)
235
-
236
- Next: /maestro continue | /manage-status
237
- ============================================================
238
- ```
17
+ The unified executor preserves all behaviour previously documented here:
18
+ status.json persistence, TodoWrite dual-tracking, per-step engine selection (`Skill` vs `CLI`),
19
+ context propagation across steps, post-step Gemini analysis for CLI steps,
20
+ and retry/skip/abort on failure.
@@ -357,6 +357,7 @@ const chainMap = {
357
357
  'spec-driven': [{ cmd: 'maestro-init' }, { cmd: 'maestro-roadmap', args: '--mode full "{description}"' }, { cmd: 'maestro-plan', args: '{phase}' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }],
358
358
  'roadmap-driven': [{ cmd: 'maestro-init' }, { cmd: 'maestro-roadmap', args: '"{description}"' }, { cmd: 'maestro-plan', args: '{phase}' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }],
359
359
  'brainstorm-driven': [{ cmd: 'maestro-brainstorm', args: '"{description}"' }, { cmd: 'maestro-plan', args: '{phase}' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }],
360
+ 'brainstorm_visualize': [{ cmd: 'brainstorm-visualize', args: '"{description}"' }],
360
361
  'impeccable-build': [{ cmd: 'maestro-impeccable', args: '"{description}" --chain build' }, { cmd: 'maestro-plan', args: '{phase}' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }],
361
362
  'impeccable-driven': [{ cmd: 'maestro-impeccable', args: '"{description}" --chain build' }, { cmd: 'maestro-verify', args: '{phase}' }],
362
363
  'analyze-plan-execute': [{ cmd: 'maestro-analyze', args: '"{description}" -q' }, { cmd: 'maestro-plan', args: '--dir {scratch_dir}' }, { cmd: 'maestro-execute', args: '--dir {scratch_dir}' }],
@@ -424,7 +425,7 @@ detectNextAction(state):
424
425
  | Chain | Steps | Use Case |
425
426
  |-------|-------|----------|
426
427
  | `full-lifecycle` | plan → execute → verify → review → test → audit | Full milestone completion |
427
- | `spec-driven` | init → spec-generate → plan → execute → verify | From idea/requirements (heavy) |
428
+ | `blueprint-driven` | init → blueprint → plan → execute → verify | From idea/requirements (heavy) |
428
429
  | `roadmap-driven` | init → roadmap → plan → execute → verify | From requirements (light) |
429
430
  | `brainstorm-driven` | brainstorm → plan → execute → verify | From exploration |
430
431
  | `impeccable-build` | impeccable --chain build → plan → execute → verify | From design system generation |
@@ -8,19 +8,27 @@ Cross-phase integration audit for milestone completion. Based on artifact regist
8
8
 
9
9
  1. Read `.workflow/state.json`:
10
10
  - Determine target milestone (from $ARGUMENTS or current_milestone)
11
+ - If no milestone: ERROR E001
11
12
  - Get `artifacts[]` array
13
+ - Resolve milestone object from `milestones[]` by id
14
+ - Determine milestone type: `milestone_obj.type` (default `"standard"` if field missing)
12
15
 
13
- 2. Parse `.workflow/roadmap.md` to identify all phases belonging to this milestone
16
+ 2. **Standard milestone** (`type != "adhoc"`):
17
+ - Parse `.workflow/roadmap.md` to identify all phases belonging to this milestone
14
18
 
15
- 3. Group milestone artifacts by type `analyze_artifacts`, `plan_artifacts`, `execute_artifacts`, `verify_artifacts`
19
+ 3. **Adhoc milestone** (`type == "adhoc"`):
20
+ - Skip roadmap.md parsing (roadmap may not exist)
21
+ - Phases are defined by `milestone_obj.phases[]` (typically `[1]` with slug `"standalone"`)
22
+
23
+ 4. Group milestone artifacts by type → `analyze_artifacts`, `plan_artifacts`, `execute_artifacts`, `verify_artifacts`
16
24
 
17
25
  ---
18
26
 
19
27
  ## Step 2: Phase Coverage Check
20
28
 
21
- Parse roadmap.md phases for this milestone. For each phase, verify completed artifacts exist for analyze, plan, and execute types.
29
+ **Standard milestone**: Parse roadmap.md phases for this milestone. For each phase, verify completed artifacts exist for analyze, plan, and execute types. WARN if any phase is missing its execute artifact: "Phase {number} ({title}) missing execute artifact"
22
30
 
23
- WARN if any phase is missing its execute artifact: "Phase {number} ({title}) missing execute artifact"
31
+ **Adhoc milestone**: Skip phase-level coverage check (no roadmap phases to validate). Instead, verify that at least one complete artifact chain exists: plan artifact (PLN) + execute artifact (EXC) with matching milestone ID. WARN if no execute artifact found.
24
32
 
25
33
  ---
26
34
 
@@ -9,13 +9,15 @@ Archive completed milestone, move artifacts to history, and prepare for next.
9
9
  1. Read `.workflow/state.json`:
10
10
  - Determine target milestone (from $ARGUMENTS or current_milestone)
11
11
  - If no milestone: ERROR E001
12
+ - Resolve milestone object from `milestones[]` by id
13
+ - Determine milestone type: `milestone_obj.type` (default `"standard"` if field missing)
12
14
 
13
15
  2. Check milestone audit status:
14
16
  - Read `.workflow/milestones/{milestone}/audit-report.md` if exists
15
17
  - If no audit report:
16
- - WARN: "No audit report found. Run `/maestro-milestone-audit` first."
17
- - Ask user: "Complete without audit?"
18
- - If NO exit
18
+ - ERROR E004: "No audit report found. Audit is a required hard contract — cannot complete without it."
19
+ - Guidance: "Run `/maestro-milestone-audit` first, then re-run this command."
20
+ - Exit (skipping audit is not permitted)
19
21
  - If verdict is FAIL: ERROR E002
20
22
 
21
23
  3. Verify all milestone artifacts have status "completed" → ERROR E003 if any incomplete (list ids and statuses)
@@ -30,9 +32,8 @@ Archive completed milestone, move artifacts to history, and prepare for next.
30
32
  ```
31
33
 
32
34
  2. Snapshot roadmap:
33
- ```
34
- cp .workflow/roadmap.md .workflow/milestones/{milestone}/roadmap-snapshot.md
35
- ```
35
+ - **Standard milestone**: `cp .workflow/roadmap.md .workflow/milestones/{milestone}/roadmap-snapshot.md`
36
+ - **Adhoc milestone**: Skip roadmap snapshot (roadmap may not exist)
36
37
 
37
38
  3. Archive scratch directories: copy each milestone artifact's `.workflow/{artifact.path}` to `.workflow/milestones/{milestone}/artifacts/{basename}/`
38
39
 
@@ -91,7 +92,9 @@ Check existing entries to avoid duplicates when appending in Step 3.
91
92
 
92
93
  2. Clear artifacts array: remove all entries where `milestone == target_milestone`
93
94
 
94
- 3. Advance to next milestone: activate first pending milestone → set as `current_milestone`. If none pending → set `current_milestone = null`, `status = "completed"`
95
+ 3. Advance to next milestone:
96
+ - **Standard milestone**: activate first pending milestone → set as `current_milestone`. If none pending → set `current_milestone = null`, `status = "completed"`
97
+ - **Adhoc milestone**: Do NOT search for next milestone. Set `current_milestone = null`, `status = "idle"` (adhoc milestones are self-contained, no successor)
95
98
 
96
99
  4. Write state.json (atomic)
97
100
 
@@ -135,10 +138,12 @@ Artifacts: {count} archived
135
138
  Learnings: {learnings_count} extracted
136
139
 
137
140
  Archive: .workflow/milestones/{milestone}/
138
- Next: {next_milestone or "Project complete"}
141
+ Next: {next_milestone or "Project complete" or "Ad-hoc task complete"}
139
142
 
140
143
  Next steps:
141
144
  /maestro-milestone-release -- Cut a release
142
- /maestro-analyze -- Start next milestone
145
+ /maestro-analyze -- Start next milestone (standard only)
143
146
  /manage-status -- View project state
144
147
  ```
148
+
149
+ **Adhoc milestone note:** When completing an adhoc milestone, the "Next steps" section omits "Start next milestone" since adhoc milestones have no successor in a roadmap chain.
@@ -0,0 +1,82 @@
1
+ # Workflow: milestone-release
2
+
3
+ Bump version, generate changelog, and tag the current milestone for release.
4
+
5
+ > **STATUS: PLACEHOLDER** — minimal skeleton referenced by `maestro-milestone-release.md`.
6
+ > Full release pipeline is TODO. Do not invoke until contents below are fleshed out.
7
+
8
+ ---
9
+
10
+ ## Arguments
11
+
12
+ | Flag | Description | Default |
13
+ |------|-------------|---------|
14
+ | `<milestone>` | Milestone id from `.workflow/state.json` `milestones[]` | current_milestone |
15
+ | `--bump <level>` | Semver bump: `major` \| `minor` \| `patch` | `minor` |
16
+ | `--dry-run` | Preview changes without writing | `false` |
17
+
18
+ ---
19
+
20
+ ## Step 1: Validation
21
+
22
+ 1. Read `.workflow/state.json`:
23
+ - Determine target milestone (from `$ARGUMENTS` or `current_milestone`).
24
+ - If no milestone: ERROR E001.
25
+ 2. Verify milestone is **completed**:
26
+ - Read `.workflow/milestones/{milestone}/audit-report.md` — verdict must be `PASS`.
27
+ - If missing or non-PASS: ERROR E002 with guidance to run `/maestro-milestone-complete` first.
28
+ 3. Read package manifest (`package.json` / `pyproject.toml` / etc.) — locate current version. TODO: multi-manifest detection.
29
+
30
+ ---
31
+
32
+ ## Step 2: Version Bump
33
+
34
+ 1. Compute next version from `--bump` level (semver). TODO: prerelease/build metadata handling.
35
+ 2. Update manifest file in place. If `--dry-run`: print diff and exit.
36
+
37
+ ---
38
+
39
+ ## Step 3: Changelog Generation
40
+
41
+ 1. Read milestone audit report + retrospective insights (`.workflow/milestones/{milestone}/`).
42
+ 2. Render `CHANGELOG.md` entry — header `## [vX.Y.Z] - YYYY-MM-DD`, body grouped by `Added / Changed / Fixed / Removed`.
43
+ 3. TODO: integrate with `quality-retrospective` output for richer narrative.
44
+
45
+ ---
46
+
47
+ ## Step 4: Tag and Commit
48
+
49
+ 1. Stage updated manifest + `CHANGELOG.md`.
50
+ 2. Commit: `chore(release): vX.Y.Z — {milestone}`.
51
+ 3. Create annotated git tag `vX.Y.Z`.
52
+ 4. TODO: optionally push tag (`--push` flag).
53
+
54
+ ---
55
+
56
+ ## Outputs
57
+
58
+ | Artifact | Status |
59
+ |----------|--------|
60
+ | Updated manifest version | written |
61
+ | `CHANGELOG.md` entry | appended |
62
+ | Git tag `vX.Y.Z` | created locally (not pushed) |
63
+
64
+ ---
65
+
66
+ ## Error Codes
67
+
68
+ | Code | Meaning |
69
+ |------|---------|
70
+ | E001 | No milestone resolvable |
71
+ | E002 | Milestone not completed / audit not PASS |
72
+ | E003 | Manifest file not found |
73
+ | E004 | Git working tree dirty (uncommitted changes block tagging) |
74
+
75
+ ---
76
+
77
+ ## TODO (placeholder gaps)
78
+
79
+ - Multi-package monorepo support.
80
+ - Push tag + GitHub release integration.
81
+ - Roll-back path on failed tag.
82
+ - Wire to `manage-knowhow-capture` for release-note capture.
package/workflows/plan.md CHANGED
@@ -18,22 +18,68 @@ All output goes to `.workflow/scratch/plan-{slug}-{date}/`.
18
18
  ## Scope Resolution
19
19
 
20
20
  ```
21
- Input: [phase] argument OR --dir <path>
21
+ Input: [phase] argument OR --dir <path> OR --from <source>
22
22
 
23
23
  Worktree guard: reject if phase not in .workflow/worktree-scope.json owned_phases
24
24
  Auto-bootstrap: create minimal state.json if missing
25
25
 
26
- Resolution priority:
27
- --dir <path> → CONTEXT_DIR = path, scope from state.json artifact or "standalone"
28
- no arguments → scope = "milestone", CONTEXT_DIR = latest analyze artifact for current_milestone
29
- (ERROR E001 if no roadmap)
30
- numeric arg → scope = "phase", resolve PHASE_SLUG from roadmap.md,
31
- CONTEXT_DIR = latest analyze artifact for phase
32
- (ERROR if no init + roadmap)
26
+ Resolution priority (highest to lowest):
27
+ 1. --from analyze:ANL-xxx → CONTEXT_DIR = artifact path, scope = "standalone"
28
+ Uses analyze conclusions.implementation_scope to seed task generation
29
+ 2. --from blueprint:BLP-xxx CONTEXT_DIR = blueprint path, scope = "standalone"
30
+ Uses blueprint requirements + architecture to seed task generation
31
+ 3. --from <other> (@file, path/) load context-package.json from path, scope = "standalone"
32
+ 4. --dir <path> → CONTEXT_DIR = path, scope from state.json artifact or "standalone"
33
+ 5. no arguments + roadmap → scope = "milestone", CONTEXT_DIR = latest analyze artifact for current_milestone
34
+ (ERROR E001 if no roadmap)
35
+ 6. numeric arg → scope = "phase", resolve PHASE_SLUG from roadmap.md,
36
+ CONTEXT_DIR = latest analyze artifact for phase
37
+ (ERROR if no init + roadmap)
38
+ 7. no arguments + no roadmap → search state.json for latest analyze artifact
39
+ Found → scope = "standalone", CONTEXT_DIR = artifact path
40
+ Not found → ERROR E001
41
+
42
+ Phase-to-Milestone resolution (when scope="phase"):
43
+ FOR each ms in state.json.milestones[]:
44
+ IF phase_number in ms.phases[]:
45
+ target_milestone = ms.id
46
+ BREAK
47
+ IF no match: target_milestone = current_milestone (fallback)
48
+
49
+ Use target_milestone (not current_milestone) for:
50
+ - artifact registration (P5 Step 4 milestone field)
51
+ - collision detection scope (P4.5)
52
+ - prior artifact lookups
53
+
54
+ OUTPUT_DIR = .workflow/scratch/{YYYYMMDD}-plan-[P{N}-|M{N}-]{slug}/
55
+ ```
56
+
57
+ ### Ad-hoc Milestone Auto-Creation (D-008)
58
+
59
+ When plan resolves to `scope == "standalone"` AND `state.json.current_milestone == null`:
33
60
 
34
- OUTPUT_DIR = .workflow/scratch/plan-{PHASE_SLUG or milestone_slug}-{date}/
61
+ ```
62
+ 1. Generate adhoc milestone ID: "M-adhoc-{YYYYMMDD}-{HHmmss}"
63
+ 2. Create milestone entry:
64
+ {
65
+ "id": "M-adhoc-{YYYYMMDD}-{HHmmss}",
66
+ "type": "adhoc",
67
+ "name": "Ad-hoc: {plan_slug or analyze_title}",
68
+ "status": "active",
69
+ "phases": [1],
70
+ "phase_slugs": { "1": "standalone" },
71
+ "roadmap_ref": null,
72
+ "created_at": "{ISO-8601}"
73
+ }
74
+ 3. Push to state.json.milestones[]
75
+ 4. Set state.json.current_milestone = milestone.id
76
+ 5. Use this milestone ID for artifact registration (P5 Step 4)
35
77
  ```
36
78
 
79
+ This ensures downstream commands (verify, milestone-audit, milestone-complete) have a valid milestone context without requiring roadmap.
80
+
81
+ **Backward compatibility:** If `state.json.milestones[]` already has entries with `current_milestone != null`, skip creation (existing milestone takes precedence). Missing `type` field on legacy milestones defaults to `"standard"`.
82
+
37
83
  ---
38
84
 
39
85
  ## Flag Processing
@@ -48,6 +94,7 @@ OUTPUT_DIR = .workflow/scratch/plan-{PHASE_SLUG or milestone_slug}-{date}/
48
94
  | `--revise [instructions]` | Revise existing plan (skip P1-P3, load → modify → P4). Auto-discovers latest plan or use `--dir` |
49
95
  | `--check <plan-dir>` | Standalone plan verification (P4 only, read-only) |
50
96
  | `--tdd` | Generate TDD task chains (RED-GREEN-REFACTOR triplets). Load `@~/.maestro/workflows/tdd.md` for discipline and task structure |
97
+ | `--from <source>` | Load upstream context directly (analyze:ANL-xxx, blueprint:BLP-xxx, brainstorm:ID, @file, or path). Bypasses roadmap requirement for analyze/blueprint sources |
51
98
 
52
99
  ---
53
100
 
@@ -78,10 +125,18 @@ When `--tdd` is active:
78
125
  ### Steps
79
126
 
80
127
  1. **Load user decisions**
81
- - Read `${CONTEXT_DIR}/context.md` if exists, else warn (no upstream analyze)
82
-
83
- 2. **Load spec reference** (if `--spec` flag or index.json has spec_ref)
84
- - Read from `.workflow/.spec/${spec_ref}/`: spec-summary.md, requirements/_index.md, epics/_index.md
128
+ - If `--from` specified: resolve to `context-package.json` load
129
+ - `constraints[locked]` → immutable constraints (planner must respect)
130
+ - `constraints[open]` implementer discretion
131
+ - `constraints[deferred]` explicitly scoped out
132
+ - `requirements[]` → task scope input
133
+ - `insights[]` → role analysis context (data models, state machines, architecture decisions)
134
+ - `open_questions[]` → flag areas needing clarification in P2
135
+ - Else: read `${CONTEXT_DIR}/context.md` if exists, else warn (no upstream analyze)
136
+ - Merge: if both `--from` and `context.md` exist, context-package takes precedence; context.md supplements
137
+
138
+ 2. **Load spec reference** (if `--spec` flag or index.json has blueprint_ref)
139
+ - Read from `.workflow/blueprint/${blueprint_ref}/`: blueprint-summary.md, requirements/_index.md, epics/_index.md
85
140
 
86
141
  3. **Load project specs**
87
142
  ```
@@ -106,12 +161,17 @@ When `--tdd` is active:
106
161
  - `scope.priority` → task/wave ordering
107
162
  - Skip parallel exploration
108
163
 
109
- 5. **Parallel exploration** (skip if `--gaps` or upstream analysis loaded)
164
+ 5b. **Merge context-package insights** (if `--from` was loaded)
165
+ - If context-package `insights[]` contain `area: "data-model"` or `area: "state-machine"`: inject as planner constraints
166
+ - Map `insights[].summary` to implementation guidance for relevant tasks
167
+ - These replace the need for a separate analyze step when brainstorm already provided sufficient role analysis
168
+
169
+ 6. **Parallel exploration** (skip if `--gaps` or upstream analysis loaded)
110
170
  - Exploration angles (1-4 based on complexity): architecture, implementation, integration, risk
111
171
  - Spawn 1-4 `cli-explore-agent` in parallel, each with phase goal + success_criteria + one angle
112
172
  - Output: `.process/exploration-{angle}.json`, `.process/explorations-manifest.json`, `.process/context-package.json`
113
173
 
114
- 5b. **CLI supplementary context** (runs in parallel with step 5, skip if `--gaps` or no CLI tools enabled)
174
+ 6b. **CLI supplementary context** (runs in parallel with step 6, skip if `--gaps` or no CLI tools enabled)
115
175
  ```
116
176
  IF no CLI tools enabled: skip
117
177
 
@@ -128,7 +188,7 @@ When `--tdd` is active:
128
188
  ```
129
189
  **On callback:** Parse result, merge into explorationContext as `cli_context` field. Planner uses patterns for task `read_first[]`, dependencies for wave ordering, conflict_risks for collision detection.
130
190
 
131
- 6. **Gap-mode context** (if `--gaps`)
191
+ 7. **Gap-mode context** (if `--gaps`)
132
192
 
133
193
  Gap sources (in priority order, first non-empty wins, then additionals merged):
134
194
  - **Primary**: `.workflow/issues/issues.jsonl` — filter by phase_ref + status in ["registered","diagnosed"], mark as "planning"
@@ -171,9 +231,11 @@ When `--tdd` is active:
171
231
 
172
232
  **Purpose:** Generate the execution plan.
173
233
 
234
+ **Rule:** Main flow MUST NOT create/modify TASK files. All planning delegated to planner agent. Upstream analyze results (conclusions.json / implementation_scope) MUST be passed into planner spawn as `explorationContext` in the same step.
235
+
174
236
  ### Standard Mode (default)
175
237
 
176
- Spawn `workflow-planner` agent with: context.md, spec-ref, doc-index.json, explorationContext (incl. implementationScope), clarificationContext, phase goal + success_criteria, templates (plan.json, task.json).
238
+ Spawn `workflow-planner` agent with: context.md, spec-ref, doc-index.json, explorationContext (incl. implementationScope from P1 Step 5), clarificationContext, phase goal + success_criteria, templates (plan.json, task.json).
177
239
 
178
240
  **Task count guard**: Before spawning, assess scope complexity:
179
241
  - Single feature / simple change → expect **1-2 tasks** max
@@ -236,10 +298,11 @@ Every TASK-*.json MUST include these fields — they are NOT optional:
236
298
 
237
299
  ### Gap Mode (`--gaps`)
238
300
 
239
- For each gap from explorationContext (P1 Step 6), create `TASK-{NNN}.json`:
240
- - `type: "fix"`, `description`, `action` (concrete fix_direction), `read_first` (affected files), `convergence.criteria` (grep-verifiable), `issue_id` (if source == "issue")
301
+ Spawn `workflow-planner` agent with: explorationContext (gap list from P1 Step 7), spec-ref, doc-index.json, phase goal + success_criteria, templates, mode = `gap-fix`.
302
+
303
+ Planner: for each gap emit one task — `type: "fix"`, `description`, `action` (concrete fix_direction), `read_first` (affected files), `convergence.criteria` (grep-verifiable), `issue_id` (if source == "issue"); assign IDs and waves; build plan.json.
241
304
 
242
- Bidirectional linking: update matching issues in `.workflow/issues/issues.jsonl` → `status: "planned"`. Build plan.json with gap-fix tasks.
305
+ Bidirectional linking (main flow, post-planner): update matching issues in `.workflow/issues/issues.jsonl` → `status: "planned"`.
243
306
 
244
307
  ### Output
245
308
  - `plan.json` in PHASE_DIR
@@ -332,6 +395,7 @@ Bidirectional linking: update matching issues in `.workflow/issues/issues.jsonl`
332
395
 
333
396
  4. **Register artifact in state.json**
334
397
  - Find upstream analyze artifact by CONTEXT_DIR path
398
+ - Determine milestone: use target_milestone from scope resolution; if adhoc milestone was created in this session, use its ID
335
399
  - Create artifact: `{ id: "PLN-{NNN}", type: "plan", milestone, phase, scope, path, status: "completed", depends_on, harvested: false, created_at, completed_at }`
336
400
  - Append to `state.json.artifacts`, atomic write
337
401
 
@@ -389,11 +453,13 @@ Incrementally modify an existing plan without rebuilding from scratch.
389
453
  - Update convergence criteria
390
454
  - Parse instructions into concrete changes
391
455
 
392
- 3. **Apply targeted changes**
393
- - Modify affected TASK files in-place
394
- - If tasks added/removed: re-sequence task IDs, regenerate wave assignments
395
- - Update plan.json summary (task count, wave structure)
396
- - Preserve unmodified tasks completely
456
+ 3. **Spawn `workflow-planner` agent for revision**
457
+ - Input: existing plan.json + all `.task/TASK-*.json` + parsed revision instructions + explorationContext (include implementation_scope if conclusions.json exists) + templates
458
+ - Planner:
459
+ - Modify affected TASK files in-place
460
+ - If tasks added/removed: re-sequence task IDs, regenerate wave assignments
461
+ - Update plan.json summary (task count, wave structure)
462
+ - Preserve unmodified tasks
397
463
 
398
464
  4. **Re-run plan-checker (P4)**
399
465
  - Validate modified plan with same checker as create mode