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
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: maestro-blueprint
3
+ description: Generate formal specification package (Product Brief, PRD, Architecture, Epics) through 7-phase document chain (P0 Spec Study → P1 Discovery → P1.5 Req Expansion → P2 Product Brief → P3 PRD → P4 Architecture → P5 Epics → P6 Readiness Check)
4
+ argument-hint: "<idea or @file> [-y] [-c] [--from <source>]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, spawn_agents_on_csv, request_user_input
6
+ ---
7
+ <purpose>
8
+ Formal specification document chain producing a complete specification package through 7 sequential phases (P0–P6, plus P1.5 requirement expansion) with multi-CLI analysis and interactive refinement. Pure documentation — no code generation, no roadmap generation.
9
+
10
+ Parallel to `brainstorm` as an upstream origin command:
11
+ - **brainstorm** = divergent exploration (lightweight, multi-role creative)
12
+ - **blueprint** = convergent documentation (heavyweight, 7-phase formal spec chain)
13
+
14
+ Output: `.workflow/blueprint/BLP-{slug}-{date}/` containing Product Brief, PRD, Architecture, and Epics.
15
+ </purpose>
16
+
17
+ <required_reading>
18
+ @~/.maestro/workflows/blueprint.md
19
+ </required_reading>
20
+
21
+ <deferred_reading>
22
+ - [blueprint-config.json](~/.maestro/templates/blueprint-config.json) — read when initializing blueprint configuration
23
+ </deferred_reading>
24
+
25
+ <context>
26
+ $ARGUMENTS -- idea text, @file reference, or upstream context source.
27
+
28
+ **Flags:**
29
+ - `-y` / `--yes`: Auto mode — skip interactive questions, use recommended defaults
30
+ - `-c` / `--continue`: Resume from last checkpoint (reads blueprint-config.json)
31
+ - `--from <source>`: Load upstream context package (brainstorm:ID, @file, or path). Consumes context-package.json
32
+ - `--from-brainstorm SESSION-ID`: (backward compat alias for `--from brainstorm:ID`)
33
+
34
+ **Input types:**
35
+ - Direct text: `"Build a real-time collaboration platform with WebSocket"`
36
+ - File reference: `@requirements.md`
37
+ - Context import: `--from brainstorm:BRN-001` or `--from @requirements.md` or `--from path/`
38
+ - Resume: `-c` (resumes from first incomplete phase)
39
+
40
+ **Pipeline position:**
41
+ ```
42
+ maestro-brainstorm (optional upstream)
43
+ ↓ guidance-specification.md / context-package.json
44
+ maestro-blueprint
45
+ ↓ .workflow/blueprint/BLP-{slug}-{date}/
46
+ maestro-analyze → maestro-roadmap → maestro-plan
47
+ ```
48
+
49
+ **Output boundary**: ALL file writes MUST target `.workflow/blueprint/BLP-{slug}-{date}/` or `.workflow/state.json` only. NEVER modify source code or files outside these paths.
50
+
51
+ ### Pre-load specs
52
+ 1. **Architecture specs**: Run `maestro spec load --category arch` to load architecture constraints. Use as context for architecture decisions (Phase 4).
53
+ 2. Optional — proceed without if unavailable.
54
+ </context>
55
+
56
+ <interview_protocol>
57
+ Interview the user relentlessly about every aspect of the spec until shared understanding is reached. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one; if a question can be answered by exploring the codebase, explore the codebase instead. Active only in interactive mode; skip when `-y/--yes`, `-c/--continue`, or input is already specific (clear idea + scope).
58
+
59
+ - Ask one question per turn via request_user_input and wait for the user's feedback before continuing; every question must carry a recommended answer marked `(Recommended)`, 2–4 options total. The user controls termination — keep interviewing until convergence; they can interrupt naturally at any time.
60
+ - Search-first when uncertain: before asking, resolve via `state.json`, existing artifacts, `maestro spec load`, direct codebase exploration (Glob/Grep/Read), or — for open-ended multi-file scans — `maestro delegate ... --role explore`. Never ask what code or memory can verify; never bounce your own ambiguity back to the user — search first, then ask only what truly needs human judgment.
61
+ - Writeback cadence: each settled decision is immediately persisted into `blueprint-config.json` before the next question. Do NOT batch writeback to the end — partial decisions must already be on disk.
62
+ - Walk the decision dependency tree depth-first: scope → spec type → focus areas → requirement priorities. Do not open the next branch until the current one is settled.
63
+ - Scope guard: only decide the shape of the specification. Do not pre-resolve roadmap phases or plan tasks — those belong to downstream commands.
64
+
65
+ Decision points: scope (full product / feature set / single feature) → spec type (service / api / library / platform) → focus areas → whether to run codebase exploration.
66
+
67
+ Exit: on consensus or explicit user signal to proceed, finalize blueprint-config.json (decisions already written incrementally) and proceed to Phase 1.
68
+ </interview_protocol>
69
+
70
+ <execution>
71
+ Follow `~/.maestro/workflows/blueprint.md` completely.
72
+
73
+ ### Phase chain
74
+
75
+ ```
76
+ P0: Spec Study → P1: Discovery → P1.5: Req Expansion → P2: Product Brief → P3: PRD → P4: Architecture → P5: Epics → P6: Readiness Check
77
+ ```
78
+
79
+ P6 gate: Pass (>=80%) → Handoff | Review (60-79%) → Handoff w/caveats | Fail (<60%) → P6.5 Auto-Fix (max 2 iter) → re-check
80
+
81
+ ### Next-step routing on completion
82
+
83
+ | Condition | Suggestion |
84
+ |-----------|-----------|
85
+ | Need codebase analysis | /maestro-analyze {topic} --from blueprint:BLP-xxx |
86
+ | Ready for roadmap | /maestro-roadmap --from blueprint:BLP-xxx |
87
+ | Small scope, direct plan | /maestro-plan --from blueprint:BLP-xxx |
88
+ | Need project setup | /maestro-init |
89
+ </execution>
90
+
91
+ <error_codes>
92
+ | Code | Severity | Condition | Recovery |
93
+ |------|----------|-----------|----------|
94
+ | E001 | error | Idea text or @file required | Prompt user for input |
95
+ | E002 | error | Context source not found (--from) | Show available sessions/sources |
96
+ | E006 | error | `.workflow/` not initialized | Run maestro-init first |
97
+ | E007 | error | Phase 6 readiness Fail after 2 auto-fix iterations | Present manual fix options |
98
+ | W001 | warning | CLI analysis failed, using fallback | Continue with available data |
99
+ | W002 | warning | Codebase exploration failed | Continue without codebase context |
100
+ | W003 | warning | Glossary has < 5 terms | Note in readiness check |
101
+ | W004 | warning | Review-level readiness score (60-79%) | Proceed with caveats |
102
+ | W005 | warning | External research agent failed | Continue without apiResearchContext |
103
+ </error_codes>
104
+
105
+ <success_criteria>
106
+ - [ ] Interactive mode: interview decisions persisted in blueprint-config.json
107
+ - [ ] `blueprint-config.json` created with session metadata and phase tracking
108
+ - [ ] `product-brief.md` with vision, goals, scope, multi-perspective synthesis
109
+ - [ ] `glossary.json` with 5+ core terms for cross-document consistency
110
+ - [ ] `requirements/` directory with `_index.md` + individual `REQ-*.md` + `NFR-*.md` files
111
+ - [ ] All requirements have RFC 2119 keywords and acceptance criteria
112
+ - [ ] `architecture/` directory with `_index.md` + individual `ADR-*.md` files
113
+ - [ ] Architecture includes state machine, config model, error handling, observability (service type)
114
+ - [ ] `epics/` directory with `_index.md` + individual `EPIC-*.md` files
115
+ - [ ] Cross-Epic dependency map (Mermaid) and MVP subset tagged
116
+ - [ ] `readiness-report.md` with 4-dimension quality scores and traceability matrix
117
+ - [ ] `blueprint-summary.md` with one-page executive summary
118
+ - [ ] All documents have valid YAML frontmatter with session_id
119
+ - [ ] Glossary terms used consistently across all documents
120
+ - [ ] Readiness gate: Pass (>=80%) or Review (>=60%) with documented caveats
121
+ - [ ] Artifact registered in state.json (type=blueprint)
122
+ - [ ] context-package.json generated for downstream consumption
123
+ </success_criteria>
@@ -1,49 +1,215 @@
1
1
  ---
2
2
  name: maestro-brainstorm
3
3
  description: Use when exploring ideas, evaluating approaches, or needing multi-perspective analysis before implementation
4
- argument-hint: "[topic] [-y|--yes] [-c|--concurrency N] [--continue] [--count N] [--skip-questions]"
4
+ argument-hint: "[topic] [-y|--yes] [-c|--concurrency N] [--continue] [--count N] [--skip-questions] [--review-only]"
5
5
  allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
6
  ---
7
7
 
8
8
  <purpose>
9
9
  Wave-based multi-role brainstorming via `spawn_agents_on_csv`. Diamond topology:
10
- Wave 1 (guidance spec) → Wave 2 (parallel role analysis, 3-9 agents) → Wave 3 (synthesis + feature index).
10
+ Wave 1 (guidance spec) → Wave 2 (parallel role analysis, 3-9 agents) → Wave 3 (cross-role review + resolution writeback).
11
+ Wave 2 agents produce multi-file analysis per role under `{role}/` (analysis.md index + per-feature files + findings).
12
+ Wave 3 compares Decision Digests from each role's `analysis.md` §2 and patches the role files. Audit trail appended to `guidance-specification.md` §12.
11
13
  </purpose>
12
14
 
13
15
  <context>
14
16
  $ARGUMENTS — topic text and optional flags.
15
17
 
16
- **Flags**: `-y` (auto), `-c N` (concurrency, default 6), `--continue` (resume), `--count N` (roles, default 3 max 9), `--skip-questions`
18
+ **Flags**: `-y` (auto), `-c N` (concurrency, default 6), `--continue` (resume), `--count N` (roles, default 3 max 9), `--skip-questions`, `--review-only` (skip Wave 1/2; run Wave 3 only against existing */analysis.md)
17
19
 
18
20
  **9 valid roles**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
19
21
 
20
22
  ### Pre-load specs
21
- 1. **Architecture specs**: `maestro spec load --category arch` — load architecture constraints as context for multi-role analysis (roles respect documented decisions).
23
+ 1. **Architecture specs**: `maestro spec load --category arch` — load architecture constraints as context for multi-role design (roles respect documented decisions).
22
24
  2. **Role Knowledge**: `maestro wiki list --category arch` → identify relevant entries → `maestro wiki load <id1> [id2...]`
23
25
  3. Both optional — proceed without if unavailable.
24
26
 
25
27
  **Session**: `.workflow/.csv-wave/{YYYYMMDD}-brainstorm-{slug}/`
26
- **Output**: tasks.csv, results.csv, discoveries.ndjson, context.md, `.brainstorming/` (guidance-specification.md, feature-index.json, synthesis-changelog.md, feature-specs/, {role}/analysis*.md)
28
+
29
+ **Output** (per session):
30
+ - `guidance-specification.md` — machine contract (Wave 1; consumed by downstream roadmap/analyze/blueprint). §11 Decision Tracking, §12 Cross-Role Resolutions.
31
+ - `design-research.md` — optional, external research from Wave 1
32
+ - `{role}/analysis.md` — index + Decision Digest + cross-cutting foundations per selected role (Wave 2)
33
+ - `{role}/analysis-F-{id}-{slug}.md` — per-feature analysis files (Wave 2)
34
+ - `{role}/findings-{slug}.md` — additional discoveries (Wave 2, optional)
35
+ - `context-package.json` — standardized context contract (context-package/1.0 schema) for downstream commands
36
+ - `tasks.csv`, `results.csv`, `discoveries.ndjson`, `context.md` — wave-engine bookkeeping
27
37
  </context>
28
38
 
39
+ <interview_protocol>
40
+ Interview the user relentlessly until shared understanding is reached. Active only in interactive mode; skip when `-y/--yes`, `--skip-questions`, `--continue` (existing session), or input is already specific.
41
+
42
+ - One decision per turn via request_user_input with 2–4 options + a (Recommended) default. The user controls termination — keep interviewing until convergence; they can interrupt naturally at any time.
43
+ - Search-first when uncertain: before asking, resolve via `state.json`, the session directory, `maestro spec load`, `maestro wiki search`, Glob/Grep/Read, or — for open-ended multi-file scans — `maestro delegate ... --role explore`. Never ask what code or memory can verify; never bounce your own ambiguity back to the user — search first, then ask only what truly needs human judgment.
44
+ - Writeback cadence: each time a decision settles, immediately append/update its row in `guidance-specification.md` §11 (create the section if absent). Do NOT batch writeback to the end — partial decisions must already be on disk before the next question.
45
+ - Branch jumps allowed: the user may switch freely between mode / role / upstream / sub-pipeline branches; sequence is not enforced, but every decision point must end with a definite answer.
46
+ - Scope guard: only ask about decisions owned by `brainstorm`. Do not pre-resolve roadmap/plan choices.
47
+
48
+ Decision points: mode (auto / single-role / review-only) / role selection and `--count` / `--from` upstream source / whether to enable design-research and the DESIGN.md sub-pipeline.
49
+
50
+ Exit: on consensus or explicit user signal to proceed, finalize session metadata. The §11 table (already populated incrementally) uses this schema:
51
+ `| # | Decision | Choice | Source (user / code / default) |`
52
+ </interview_protocol>
53
+
29
54
  <csv_schema>
30
55
  ```csv
31
- id,title,description,role,topic,guidance_spec,deps,context_from,wave,status,findings,analysis_file,error
32
- "1","Guidance Spec","...","guidance-generator","<topic>","","","","1","","","",""
33
- "2","System Architect","...","system-architect","<topic>","","1","1","2","","","",""
34
- "3","UI Designer","...","ui-designer","<topic>","","1","1","2","","","",""
35
- "4","Synthesis","...","synthesis","<topic>","","2;3","2;3","3","","","",""
56
+ id,title,description,role,topic,guidance_spec,deps,context_from,wave,status,findings,output_file,error
57
+ "1","Guidance Spec","<W1 prompt — see <agent_prompt_template>>","guidance-generator","<topic>","","","","1","","","",""
58
+ "2","System Architect","<W2 prompt — see <agent_prompt_template>>","system-architect","<topic>","","1","1","2","","","<ABS_SESSION>/system-architect/analysis.md",""
59
+ "3","UI Designer","<W2 prompt — see <agent_prompt_template>>","ui-designer","<topic>","","1","1","2","","","<ABS_SESSION>/ui-designer/analysis.md",""
60
+ "4","Cross-Role Review","<W3 prompt — see <agent_prompt_template>>","cross-role-reviewer","<topic>","","2;3","2;3","3","","","",""
36
61
  ```
37
- Wave 1: 1 guidance row. Wave 2: N role rows (parallel). Wave 3: 1 synthesis row.
62
+
63
+ **Column semantics (orchestrator MUST honor when generating tasks.csv)**:
64
+ - `description`: full agent prompt — orchestrator MUST inflate `<W1/W2/W3 prompt>` placeholders using the templates in `<agent_prompt_template>` below. Never leave it as `"..."` — the spawned agent reads ONLY this field as its task brief.
65
+ - `output_file`: **index file only** (single primary deliverable used by Wave 3 reviewer to locate the role). Wave 2 role agents write multiple files (`analysis.md` + per-feature + findings) under the same `{role}/` directory; the CSV only tracks the index path for dependency wiring.
66
+ - **All paths in CSV (`output_file`, any path referenced in `description`) MUST be absolute.** Orchestrator MUST resolve `<ABS_SESSION>` to the absolute session dir (e.g. `D:/proj/.workflow/.csv-wave/20260521-brainstorm-foo/`) before writing tasks.csv. Relative paths break agent Write calls.
67
+
68
+ Wave 1: 1 guidance row. Wave 2: N role rows (parallel) — each writes `{role}/analysis.md` + `{role}/analysis-F-*.md` + `{role}/findings-*.md`. Wave 3: 1 reviewer row (reads analysis.md §2 Decision Digests; emits structured findings consumed by orchestrator).
38
69
  </csv_schema>
39
70
 
71
+ <agent_prompt_template>
72
+ The orchestrator MUST inflate the CSV `description` field per row using these templates before invoking `spawn_agents_on_csv`. Without inflation, spawned agents have no contract and will not write files.
73
+
74
+ ### W1 prompt (role: guidance-generator)
75
+
76
+ ```
77
+ You are the guidance generator for a brainstorm session on: <topic>.
78
+
79
+ OUTPUT: Write `<ABS_SESSION>/guidance-specification.md` using the Write tool. MUST be on disk; do NOT return as chat text.
80
+
81
+ CONTRACT — guidance-specification.md sections:
82
+ §1 Project Positioning & Goals
83
+ §2 Concepts & Terminology (5–10 core terms table)
84
+ §3 Non-Goals (Out of Scope) with rationale
85
+ §4–N Role Decisions with RFC 2119 keywords (MUST / SHOULD / MAY / MUST NOT / SHOULD NOT)
86
+ Cross-Role Integration
87
+ Risks & Constraints
88
+ §10 Feature Decomposition (max 8 features, F-{3-digit} id + slug, independently implementable)
89
+ §11 Decision Tracking appendix (incrementally populated during interview)
90
+ §12 Cross-Role Resolutions (initially empty — populated by Wave 3)
91
+
92
+ CONSTRAINTS:
93
+ - All behavioural statements MUST use RFC 2119 keywords.
94
+ - No interrogative sentences in the deliverable (all declarative).
95
+ - After write, verify with Glob; emit `TASK COMPLETE` only after file exists on disk.
96
+ ```
97
+
98
+ ### W2 prompt (role: one of the 9 valid roles)
99
+
100
+ ```
101
+ You are the <role> for a brainstorm session on: <topic>.
102
+
103
+ INPUTS:
104
+ - Read guidance-specification.md at: <ABS_SESSION>/guidance-specification.md
105
+ - Extract decisions belonging to your role (by ID prefix) and the §10 feature list.
106
+ - If <ABS_SESSION>/design-research.md exists, integrate it as evidence (cite by project name + section).
107
+
108
+ OUTPUT: Write multiple files under `<ABS_SESSION>/<role>/` using the Write tool. Files on disk are the ONLY valid deliverable — do NOT return analysis as chat text.
109
+
110
+ FILE LAYOUT (all under <ABS_SESSION>/<role>/):
111
+ analysis.md — INDEX (see structure below)
112
+ analysis-F-{id}-{slug}.md — one per feature in guidance §10 (< 2000 words each)
113
+ findings-{slug}.md — additional discoveries (0 or more, < 1000 words each)
114
+
115
+ analysis.md structure (MUST contain):
116
+ §1 Role Mandate (≤ 200 words: what you decide, what you defer, why you are here)
117
+ §2 Decision Digest — four tables:
118
+ Decisions | ID | Feature | Stance | Constraints (RFC 2119) |
119
+ Interfaces | Name | Contract | Consumers |
120
+ Cross-Cutting Positions | Topic | Stance |
121
+ Findings Summary | Slug | Title | Impact |
122
+ MUST have ≥ 1 Decisions row per feature in §10.
123
+ §3 Cross-Cutting Foundations — role-specific subsections (see role-specific addendum below).
124
+ §4 File Index — list every written file with its top-level headings.
125
+ §5 Outstanding TODOs
126
+
127
+ REFERENCE, DON'T DUPLICATE:
128
+ - Reference guidance decisions by ID (e.g., SA-03) — do NOT copy decision text.
129
+ - Cross-link sub-files with relative links: `see [F-002](analysis-F-002-skill-engine.md)`.
130
+
131
+ CONSTRAINTS:
132
+ - Aim for ≥ 5 RFC 2119 keyword occurrences across analysis.md.
133
+ - No interrogative sentences.
134
+ - After all writes, verify with Glob that analysis.md and every analysis-F-*.md exist. Only then emit `TASK COMPLETE`.
135
+
136
+ ROLE-SPECIFIC §3 ADDENDUM (use these as §3 subsection headings):
137
+ - system-architect: Data Model · State Machine · Error Handling · Observability · Configuration · Boundary Scenarios
138
+ - data-architect: Filesystem Layout · YAML Schemas · Indexer Algorithm · Ref Bridge · Lifecycle · Migration
139
+ - ux-expert: Information Architecture · Sigil/Input · Visual Choreography · Streaming · Confirmation · Interrupt · Accessibility
140
+ - subject-matter-expert: Pitfall Taxonomy · Pattern Fingerprints · Domain-Silence Decisions · Differentiation Thesis · Crosswalk
141
+ - test-strategist: Test Layers · Coverage Targets · Risk-Based Prioritization · Tooling
142
+ - product-manager: Personas · Success Metrics · Roadmap Shape · Prioritization Rationale
143
+ - product-owner: Backlog Decomposition · Acceptance Criteria · Done Definition
144
+ - scrum-master: Cadence · Ceremonies · Impediments · Flow Metrics
145
+ - ui-designer: Design Tokens · Component States · Visual Language · Animation
146
+
147
+ (Orchestrator inflates only the addendum line matching the current row's role.)
148
+ ```
149
+
150
+ ### W3 prompt (role: cross-role-reviewer)
151
+
152
+ ```
153
+ You are the cross-role reviewer for a brainstorm session on: <topic>.
154
+
155
+ INPUTS — read these files (do NOT modify):
156
+ - <ABS_SESSION>/guidance-specification.md
157
+ - <ABS_SESSION>/<role_1>/analysis.md
158
+ - <ABS_SESSION>/<role_2>/analysis.md
159
+ - ... (one per role from Wave 2)
160
+
161
+ (Orchestrator MUST inject the actual absolute paths for all completed Wave 2 rows.)
162
+
163
+ TASK: Compare §2 Decision Digests across role analysis.md index files. Identify:
164
+ - Conflicts: contradictory stances between roles on the same feature/topic
165
+ - Gaps: §2 Interfaces consumers referencing definitions that no role owns
166
+ - Synergies: §2 Findings Summary items that align across roles and should cross-reference
167
+
168
+ OUTPUT — return this structured markdown report as your final message (do NOT write files; the orchestrator parses your output and applies patches):
169
+
170
+ ## Conflicts (need user decision)
171
+ ### C-001: <one-line summary>
172
+ patch_targets:
173
+ - target_file: <ABS_SESSION>/<role-A>/analysis-F-{id}-{slug}.md (or <role-A>/analysis.md for cross-cutting)
174
+ target_heading: ## <exact heading text from §4 File Index>
175
+ edit_type: annotate_and_strikeout
176
+ edit_content: > **Cross-Role Resolution (C-001)**: <1-line resolution>
177
+ - target_file: <ABS_SESSION>/<role-B>/analysis-F-{id}-{slug}.md
178
+ target_heading: ## <exact heading text>
179
+ edit_type: annotate_and_strikeout
180
+
181
+ ## Gaps
182
+ ### G-001: ...
183
+ patch_targets:
184
+ - target_file: <ABS_SESSION>/<ref-role>/analysis.md edit_type: annotate_after_heading
185
+ target_heading: ### Interfaces
186
+ - target_file: <ABS_SESSION>/<owner-role>/analysis.md edit_type: append_to_section
187
+ target_heading: ### Decisions
188
+
189
+ ## Synergy Opportunities
190
+ ### S-001: ...
191
+ patch_targets:
192
+ - target_file: <ABS_SESSION>/<role-A>/analysis-F-{id}-{slug}.md edit_type: annotate_after_heading
193
+ - target_file: <ABS_SESSION>/<role-B>/analysis-F-{id}-{slug}.md edit_type: annotate_after_heading
194
+
195
+ ## Summary
196
+ conflicts_count / gaps_count / synergies_count / review_confidence (0–1)
197
+
198
+ CONSTRAINTS:
199
+ - `edit_type` is a CLOSED vocabulary: only `annotate_after_heading` / `annotate_and_strikeout` / `append_to_section`.
200
+ - `target_heading` MUST match the heading text verbatim as it appears in the target file's §4 File Index (case + punctuation). Never invent.
201
+ - If zero conflicts/gaps/synergies detected, return a `## Summary` block with all counts = 0 and a one-line explanation. Do not fabricate findings.
202
+ ```
203
+ </agent_prompt_template>
204
+
40
205
  <invariants>
41
- 1. **Wave order sacred**: Guidance (W1) MUST complete before roles (W2)
42
- 2. **CSV source of truth**: Master tasks.csv holds all state
43
- 3. **Discovery board append-only**: Never modify/delete discoveries.ndjson
44
- 4. **Skip on failure**: Guidance fails → abort. All roles fail → skip synthesis.
206
+ 1. **Wave order sacred**: Guidance (W1) MUST complete before role design (W2); review (W3) MUST run only after all W2 rows complete.
207
+ 2. **CSV source of truth**: Master tasks.csv holds all state.
208
+ 3. **Discovery board append-only**: Never modify/delete discoveries.ndjson.
209
+ 4. **Skip on failure**: Guidance fails → abort. All W2 roles fail → skip review.
45
210
  5. **9 valid roles only**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
46
- 6. **DO NOT STOP**: Continuous until all waves complete; only pause at [CHECKPOINT] (skipped with -y)
211
+ 6. **Wave 3 is read-only at the agent boundary**: the reviewer emits structured findings (conflicts / gaps / synergies with `patch_targets[]`). The orchestrator (not the agent) applies the patches via Edit.
212
+ 7. **DO NOT STOP**: Continuous until all waves complete; only pause at [CHECKPOINT] (skipped with -y).
47
213
  </invariants>
48
214
 
49
215
  <state_machine>
@@ -55,16 +221,21 @@ S_CSV_GEN — 生成 tasks.csv PERSIST: tasks.cs
55
221
  S_WAVE_1 — Guidance Spec (single agent) PERSIST: guidance-specification.md
56
222
  S_CHECK_1 — Checkpoint: 用户审阅 guidance(-y 跳过) PERSIST: —
57
223
  S_DESIGN — 视觉风格确定 (impeccable teach + explore) PERSIST: DESIGN.md
58
- S_WAVE_2 — Role Analysis (parallel spawn) PERSIST: role analyses
59
- S_CHECK_2 — Checkpoint: 用户审阅 roles(-y 跳过) PERSIST: —
60
- S_WAVE_3 — Synthesis + Feature Index (single agent) PERSIST: synthesis artifacts
224
+ S_WAVE_2 — Role Analysis (parallel spawn) PERSIST: {role}/ multi-file × N
225
+ S_CHECK_2 — Checkpoint: 用户审阅分析结果(-y 跳过) PERSIST: —
226
+ S_WAVE_3 — Cross-Role Review (single agent, read-only) PERSIST: review_findings (in-memory)
227
+ S_RESOLVE — Apply Resolutions (orchestrator-side) PERSIST: */analysis.md edits + guidance §12
61
228
  S_AGGREGATE — 生成报告、注册 artifact PERSIST: context.md + results.csv
62
229
  </states>
63
230
 
64
231
  <transitions>
65
- S_PARSE → S_ROLES DO: parse args, detect mode (phase/scratch), load specs
232
+ S_PARSE → S_ROLES DO: parse args, detect mode (phase/scratch/review-only), load specs
66
233
  S_ROLES → S_CSV_GEN DO: select roles (-y: auto top N; interactive: request_user_input)
67
- S_CSV_GEN → S_WAVE_1 DO: generate tasks.csv (1 guidance + N roles + 1 synthesis)
234
+ S_CSV_GEN → S_WAVE_1 DO: generate tasks.csv (1 guidance + N roles + 1 reviewer)
235
+
236
+ # --review-only path: skip W1/W2, jump straight to W3
237
+ S_PARSE → S_WAVE_3 WHEN: --review-only AND existing session has guidance-specification.md AND */analysis.md
238
+ S_PARSE → END WHEN: --review-only AND missing prerequisites (E006/E007)
68
239
 
69
240
  S_WAVE_1 → S_CHECK_1 WHEN: completed DO: spawn wave-1, merge results, read guidance-spec
70
241
  S_WAVE_1 → END WHEN: failed DO: abort pipeline
@@ -78,13 +249,16 @@ S_DESIGN → S_WAVE_2 WHEN: DESIGN.md exists OR explore completed DO: A_DE
78
249
  S_DESIGN → S_WAVE_2 WHEN: DESIGN.md already exists (skip explore)
79
250
  S_DESIGN → S_WAVE_2 WHEN: explore failed → W004 → continue without
80
251
 
81
- S_WAVE_2 → S_CHECK_2 DO: spawn wave-2 (parallel), merge results
82
- S_WAVE_2 → S_WAVE_3 WHEN: all failed DO: skip synthesis
252
+ S_WAVE_2 → S_CHECK_2 DO: spawn wave-2 (parallel), merge results — each agent writes {role}/analysis.md + sub-files
253
+ S_WAVE_2 → S_AGGREGATE WHEN: all failed DO: skip review
83
254
 
84
255
  S_CHECK_2 → S_WAVE_3 WHEN: -y OR user "Proceed"
85
256
  S_CHECK_2 → S_WAVE_2 WHEN: user "Add Roles" DO: add new role rows, spawn only new
86
257
 
87
- S_WAVE_3 → S_AGGREGATE DO: spawn wave-3, merge results
258
+ S_WAVE_3 → S_RESOLVE DO: spawn wave-3, capture review_findings (conflicts/gaps/synergies with patch_targets)
259
+ S_WAVE_3 → S_AGGREGATE WHEN: zero findings DO: log "No cross-role issues detected", skip resolve
260
+
261
+ S_RESOLVE → S_AGGREGATE DO: A_APPLY_RESOLUTIONS (orchestrator iterates patch_targets and applies Edits)
88
262
 
89
263
  S_AGGREGATE → END DO: A_AGGREGATE
90
264
  </transitions>
@@ -93,11 +267,48 @@ S_AGGREGATE → END DO: A_AGGREGATE
93
267
 
94
268
  ### Wave agent responsibilities
95
269
 
96
- **Guidance (W1)**: Analyze topic → extract 5-10 terms → define non-goals → decompose features (max 8, F-{3digit}) → RFC 2119 keywords → write guidance-specification.md
270
+ **Guidance (W1, agent role `guidance-generator`)**: Analyze topic → extract 5-10 terms → define non-goals → decompose features (max 8, F-{3digit}) → RFC 2119 keywords → write `guidance-specification.md` with §1-§12 (§11 Decision Tracking, §12 Cross-Role Resolutions initially empty — populated later by S_RESOLVE).
271
+
272
+ **Role Analysis (W2, agent role = the role name itself)**: Read guidance-spec → produce multi-file analysis under `{role}/`:
273
+ - `analysis.md` — INDEX with §1 Role Mandate (≤ 200 words), §2 Decision Digest (4 tables: Decisions, Interfaces, Cross-Cutting Positions, Findings Summary), §3 Cross-Cutting Foundations, §4 File Index, §5 Outstanding TODOs
274
+ - `analysis-F-{id}-{slug}.md` — one per feature (< 2000 words each)
275
+ - `findings-{slug}.md` — additional discoveries (0 or more, < 1000 words)
276
+
277
+ system-architect MUST include in §3: Data Model, State Machine, Error Handling, Observability, Configuration, Boundary Scenarios.
97
278
 
98
- **Role (W2)**: Read guidance-spec → analyze through role lens → feature-point organization (analysis.md index + analysis-cross-cutting.md + per-feature analysis-F-{id}.md) or fallback single analysis.md. system-architect MUST include: Data Model, State Machine, Error Handling, Observability, Config Model.
279
+ The agent MUST write files. The agent MUST NOT return analysis as text.
99
280
 
100
- **Synthesis (W3)**: Cross-role consensus/conflicts/unique conflict tags [RESOLVED]/[SUGGESTED]/[UNRESOLVED] feature-specs or synthesis-specification.md → feature-index.json + synthesis-changelog.md. Four-layer: Direct Reference Structured Extraction Conflict Distillation → Cross-Feature Annotation.
281
+ **Cross-Role Review (W3, agent role `cross-role-reviewer`)**: Read ALL `{role}/analysis.md` files (§2 Decision Digests) + guidance-specification.md → emit structured report (NOT files):
282
+
283
+ ```
284
+ ## Conflicts (need user decision)
285
+ ### C-001: ...
286
+ patch_targets:
287
+ - target_file: {role-A}/analysis-F-{id}-{slug}.md # or {role-A}/analysis.md for cross-cutting
288
+ target_heading: ## {exact heading text}
289
+ edit_type: annotate_and_strikeout
290
+ edit_content: > **Cross-Role Resolution (C-001)**: {1-line resolution}
291
+ - target_file: {role-B}/analysis-F-{id}-{slug}.md
292
+ target_heading: ## {exact heading text}
293
+ edit_type: annotate_and_strikeout
294
+
295
+ ## Gaps
296
+ ### G-001: ...
297
+ patch_targets:
298
+ - target_file: {ref-role}/analysis.md edit_type: annotate_after_heading # §2 Interfaces table
299
+ - target_file: {owner-role}/analysis.md edit_type: append_to_section # §2 Decisions table
300
+
301
+ ## Synergy Opportunities
302
+ ### S-001: ...
303
+ patch_targets:
304
+ - target_file: {role-A}/analysis-F-{id}-{slug}.md edit_type: annotate_after_heading
305
+ - target_file: {role-B}/analysis-F-{id}-{slug}.md edit_type: annotate_after_heading
306
+
307
+ ## Summary
308
+ conflicts_count / gaps_count / synergies_count / review_confidence
309
+ ```
310
+
311
+ `edit_type` vocabulary is closed: `annotate_after_heading` / `annotate_and_strikeout` / `append_to_section`. The orchestrator MUST refuse any patch outside this set.
101
312
 
102
313
  ### A_DESIGN_EXPLORE
103
314
 
@@ -108,14 +319,29 @@ When ui-designer is among selected roles, establish visual direction before Wave
108
319
  3. If both already exist → skip (visual direction already locked)
109
320
 
110
321
  explore generates multi-style HTML prototypes, visual comparison, user selection/mix, and produces DESIGN.md.
111
- ui-designer agents in Wave 2 then focus on UX analysis only (interaction flows, state design), not visual styling.
322
+ ui-designer agents in Wave 2 then focus on UX/visual design referencing DESIGN.md.
323
+
324
+ ### A_APPLY_RESOLUTIONS
325
+
326
+ For each finding in `review_findings`:
327
+
328
+ 1. **Confirm with user** (skip if -y): present finding + suggested resolution; user picks `Accept` / `Pick A` / `Pick B` (conflict only) / `Skip` / `Defer to TODO`.
329
+ 2. **Iterate `patch_targets[]`**: for each target, locate `target_heading` verbatim in `target_file`; apply the edit per `edit_type`.
330
+ 3. **Heading drift fallback**: if `target_heading` not found verbatim, log W006 and skip that target. Never invent or fuzzy-match headings.
331
+ 4. **Append audit row** to `guidance-specification.md` §12 "Cross-Role Resolutions":
332
+ ```
333
+ | C-001 | conflict | system-architect/analysis-F-*.md "<heading>" / subject-matter-expert/analysis-F-*.md "<heading>" | {resolution} | both annotated+superseded |
334
+ ```
335
+
336
+ If zero findings, S_RESOLVE is bypassed and `guidance §12` is unchanged.
112
337
 
113
338
  ### A_AGGREGATE
114
339
 
115
340
  1. Export results.csv
116
- 2. Generate context.md (summary, guidance, per-role findings, synthesis, feature index, next steps)
117
- 3. Confidence scoring: 5 dimensions (role_coverage, cross_role_consistency, feature_completeness, spec_quality, design_feasibility). Quality gate: >3 UNRESOLVED → warn.
118
- 4. Copy artifacts to target .brainstorming/
341
+ 1.5. Generate context-package.json (extract from guidance-specification.md + {role}/analysis.md §2 Digests standardized schema per context-package/1.0)
342
+ 2. Generate context.md (summary, guidance, per-role analyses, review_findings_count, resolutions_applied, patches_skipped, next steps)
343
+ 3. Confidence scoring: 5 dimensions (role_coverage, cross_role_consistency, feature_completeness, spec_quality, design_feasibility). Quality gate: cross_role_consistency < 0.4 → warn.
344
+ 4. Copy artifacts to target session directory (preserve `{role}/` subdirs).
119
345
  5. Next-step routing: DESIGN.md established → `maestro-impeccable build <feature>`; else UI features detected → `maestro-impeccable build <feature>`; else → maestro-analyze / maestro-plan / maestro-roadmap
120
346
 
121
347
  </actions>
@@ -128,7 +354,8 @@ ui-designer agents in Wave 2 then focus on UX analysis only (interaction flows,
128
354
  | non_goal | title | {title, rationale} |
129
355
  | feature_candidate | id | {id, slug, description, roles[], priority} |
130
356
  | role_insight | role+topic | {role, topic, insight, confidence} |
131
- | cross_role_conflict | area | {area, roles[], positions[], resolution} |
357
+ | cross_role_finding | finding_id | {kind: conflict\|gap\|synergy, finding_id: C-/G-/S-XXX, patch_targets[]} |
358
+ | resolution_applied | finding_id | {finding_id, decision, patched_files[], skipped_targets[]} |
132
359
 
133
360
  Protocol: read before analysis, append-only, dedup by type+key.
134
361
  </discovery_board>
@@ -137,23 +364,27 @@ Protocol: read before analysis, append-only, dedup by type+key.
137
364
  | Condition | Recovery |
138
365
  |-----------|----------|
139
366
  | Guidance agent failed | Abort pipeline (W2 depends on guidance) |
140
- | All role agents failed | Skip synthesis, report partial |
141
- | Synthesis failed | Use W2 results directly |
367
+ | All role agents failed | Skip review, report partial |
368
+ | Review agent failed | Use analysis files directly, no resolution writeback |
142
369
  | Role count > 9 | Cap at 9 with warning |
370
+ | E006 --review-only but no */analysis.md | Run auto mode or single roles first |
371
+ | E007 --review-only but missing guidance-specification.md | Run auto mode first |
372
+ | W006 patch heading drift (no verbatim match) | Skip that patch, surface in final report |
143
373
  </error_codes>
144
374
 
145
375
  <success_criteria>
146
- - [ ] 3 waves executed: guidance parallel roles → synthesis
147
- - [ ] guidance-specification.md with RFC 2119 keywords, terminology, non-goals, feature decomposition
148
- - [ ] Role analysis files for each selected NON-UI role
149
- - [ ] If ui-designer selected: DESIGN.md established via impeccable explore; analysis.md with UX analysis
150
- - [ ] Feature specs in `.brainstorming/feature-specs/` or synthesis-specification.md
151
- - [ ] UI-bearing feature specs reference DESIGN.md for visual constraints
152
- - [ ] feature-index.json + synthesis-changelog.md + context.md generated
153
- - [ ] All user decisions captured with Decision Recording Protocol
154
- - [ ] Confidence scored per role and after cross-role analysis
155
- - [ ] Readiness gate checked before spec generation (wave 3)
156
- - [ ] Pressure pass completed on at least 1 feature spec
376
+ - [ ] Interactive mode: interview decision table written to `guidance-specification.md` §11 and session metadata
377
+ - [ ] guidance-specification.md with RFC 2119 keywords, terminology, non-goals, feature decomposition (§10), decision tracking (§11)
378
+ - [ ] If ui-designer selected: DESIGN.md established via impeccable explore
379
+ - [ ] {role}/analysis.md written for each selected role with §1 Role Mandate / §2 Decision Digest (4 tables) / §3 Cross-Cutting Foundations / §4 File Index / §5 Outstanding TODOs
380
+ - [ ] {role}/analysis-F-{id}-{slug}.md written per feature (< 2000 words)
381
+ - [ ] system-architect/analysis.md §3 includes Data Model + State Machine when system-architect selected
382
+ - [ ] Each {role}/analysis.md §2 Decisions table has ≥ 1 row per feature
383
+ - [ ] Cross-role review (W3) executed; reviewer output includes `patch_targets[]` for every finding
384
+ - [ ] If findings: resolutions applied via Edit AND logged in guidance §12 "Cross-Role Resolutions"
385
+ - [ ] If zero findings: final report explicitly notes "No cross-role issues detected"; guidance §12 unchanged
386
+ - [ ] Heading-drift patch failures surfaced (not silently dropped)
387
+ - [ ] context-package.json generated with per-item `ref` traceability
157
388
  - [ ] discoveries.ndjson append-only throughout
158
- - [ ] Conflict quality gate: >3 UNRESOLVED warn
389
+ - [ ] context.md aggregates session results with next-step routing
159
390
  </success_criteria>
@@ -125,7 +125,7 @@ If spec not found, use built-in fallback:
125
125
  | `verify` | skill | `maestro-verify` |
126
126
  | `refactor` | skill | `quality-refactor` |
127
127
  | `debug` | skill | `quality-debug` |
128
- | `spec` | skill | `maestro-roadmap --mode full` |
128
+ | `spec` | skill | `maestro-blueprint` |
129
129
  | `checkpoint` | checkpoint | — |
130
130
 
131
131
  **Step 2.1** — Load `intent.json`, map each step to executor.
@@ -206,12 +206,21 @@ If exit code is 1, present warnings and ask whether to proceed.
206
206
 
207
207
  | Input | Resolution |
208
208
  |-------|------------|
209
- | `--dir <path>` | Use path directly (scratch plan dir) |
209
+ | `--dir <path>` | Use path directly (scratch plan dir); scope=standalone |
210
210
  | No args | Find all pending plans for current milestone from state.json.artifacts[] |
211
- | Number (e.g., `3`) | Find pending plans for phase N from state.json.artifacts[] |
211
+ | Number (e.g., `3`) | Find pending plans for phase N from state.json.artifacts[]; **resolve milestone via D-007 reverse lookup** |
212
212
 
213
213
  For multi-plan: execute sequentially. Each plan is a full CSV session.
214
214
 
215
+ **D-007 milestone reverse lookup** (numeric arg only):
216
+ ```
217
+ resolve_milestone(phase_number):
218
+ for ms in state.json.milestones[]:
219
+ if str(phase_number) in ms.phase_slugs: return ms.id
220
+ return state.json.current_milestone # fallback
221
+ ```
222
+ Use the resolved milestone for EXC artifact registration (`milestone` field) and artifact filtering. NEVER read `current_milestone` directly for phase-scoped runs — phase N may belong to a milestone different from current.
223
+
215
224
  2. **Load plan**: Read `{PLAN_DIR}/plan.json` for wave structure and task assignments
216
225
 
217
226
  3. **Detect completed tasks (breakpoint resume)**: Read `.task/TASK-{NNN}.json` for each task; exclude completed ones from CSV. Log resume count.
@@ -279,7 +288,7 @@ Blocked/failed tasks cascade: mark all downstream dependents as `skipped` with e
279
288
  - All task_refs completed -> `issue.status = "resolved"`; any failed -> `"in_progress"`
280
289
  - Append history entry: `{ action: "executed", at: <ISO>, by: "maestro-execute", summary: "TASK-{NNN} {status}" }`
281
290
 
282
- 4. **Register EXC artifact in state.json**: Find matching plan artifact, create `{ id: "EXC-{next_id}", type: "execute", milestone, phase, scope, path, status: "completed", depends_on: plan_artifact.id, harvested: false, created_at, completed_at }`
291
+ 4. **Register EXC artifact in state.json**: Find matching plan artifact, create `{ id: "EXC-{next_id}", type: "execute", milestone, phase, scope, path, status: "completed", depends_on: plan_artifact.id, harvested: false, created_at, completed_at }`. `milestone` MUST come from D-007 `phase_slugs` reverse lookup (numeric phase) — inherit from matching plan artifact if available, otherwise reverse-lookup directly.
283
292
 
284
293
  5. **Extract incremental specs**: Read `.summaries/`, use `maestro spec add` CLI:
285
294
  - Learnings/pitfalls → `maestro spec add learning "<title>" "<content>" --keywords ... --source execute:{PLAN_DIR}`
@@ -356,7 +365,7 @@ echo '{"ts":"<ISO>","worker":"TASK-001","type":"code_pattern","data":{"name":"Re
356
365
  - [ ] All waves executed in order with cross-wave context propagation
357
366
  - [ ] Completed tasks have .summaries/TASK-{NNN}-summary.md
358
367
  - [ ] .task/TASK-*.json statuses updated to match execution results
359
- - [ ] state.json updated with EXC artifact
368
+ - [ ] state.json updated with EXC artifact (numeric scope: milestone resolved via D-007 `phase_slugs` reverse lookup, NOT direct `current_milestone` read)
360
369
  - [ ] Issue status synced for tasks with issue_id (all completed → resolved, any failed → in_progress)
361
370
  - [ ] Incremental specs extracted from summaries (learnings, design rationale, root causes)
362
371
  - [ ] Post-task knowledge inquiry triggered when applicable (deviation, retry>=2, design rationale)
@@ -12,6 +12,8 @@ the worktree. Since `.workflow/` is gitignored, this command explicitly copies p
12
12
  and milestone scratch artifacts into the worktree.
13
13
 
14
14
  Also supports `--sync` mode to pull latest main into an active worktree.
15
+
16
+ Produces `.workflow/worktrees.json` registry in the main worktree and `.workflow/worktree-scope.json` marker in the worktree, and writes a scoped `state.json` inside the worktree containing only the forked milestone's artifacts.
15
17
  </purpose>
16
18
 
17
19
  <required_reading>
@@ -73,10 +73,11 @@ Read `.workflow/config.json`. If file missing, initialize with empty guard secti
73
73
  - Write config
74
74
 
75
75
  **`deny <path>`:**
76
- - Normalize path to forward slashes
76
+ - Normalize path to forward slashes, ensure trailing slash for directories
77
+ - If `guard.mode` is `allow`, switch to `deny` and clear paths with warning
77
78
  - Set `guard.mode = "deny"`
78
79
  - Add path to `guard.paths` (deduplicate)
79
- - Set `guard.enabled = true` if not already
80
+ - Set `guard.enabled = true` if not already (symmetric with `allow`: adding a deny path auto-enables the guard)
80
81
  - Write config
81
82
 
82
83
  **Step 4: Confirm**