maestro-flow 0.3.10 → 0.3.12

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 (311) hide show
  1. package/.claude/agents/conceptual-planning-agent.md +1 -0
  2. package/.claude/agents/workflow-analyzer.md +114 -114
  3. package/.claude/agents/workflow-collab-planner.md +144 -144
  4. package/.claude/agents/workflow-debugger.md +102 -103
  5. package/.claude/agents/workflow-executor.md +127 -128
  6. package/.claude/agents/workflow-integration-checker.md +82 -82
  7. package/.claude/agents/workflow-nyquist-auditor.md +85 -84
  8. package/.claude/agents/workflow-phase-researcher.md +85 -85
  9. package/.claude/agents/workflow-plan-checker.md +90 -90
  10. package/.claude/agents/workflow-planner.md +178 -178
  11. package/.claude/agents/workflow-roadmapper.md +81 -83
  12. package/.claude/agents/workflow-verifier.md +119 -119
  13. package/.claude/commands/learn-decompose.md +176 -176
  14. package/.claude/commands/learn-follow.md +167 -167
  15. package/.claude/commands/learn-retro.md +3 -3
  16. package/.claude/commands/learn-second-opinion.md +2 -2
  17. package/.claude/commands/maestro-brainstorm.md +1 -0
  18. package/.claude/commands/maestro-coordinate.md +1 -3
  19. package/.claude/commands/maestro-fork.md +133 -111
  20. package/.claude/commands/maestro-merge.md +85 -77
  21. package/.claude/commands/maestro-plan.md +88 -2
  22. package/.claude/commands/maestro-roadmap.md +113 -2
  23. package/.claude/commands/maestro.md +1 -0
  24. package/.claude/commands/manage-harvest.md +131 -131
  25. package/.claude/commands/manage-issue.md +2 -2
  26. package/.claude/commands/quality-business-test.md +5 -5
  27. package/.claude/commands/quality-debug.md +3 -2
  28. package/.claude/commands/quality-retrospective.md +6 -4
  29. package/.claude/commands/quality-review.md +1 -1
  30. package/.claude/commands/quality-test-gen.md +5 -4
  31. package/.claude/commands/spec-add.md +67 -56
  32. package/.claude/commands/spec-load.md +66 -64
  33. package/.claude/commands/spec-setup.md +5 -9
  34. package/.codex/skills/learn-decompose/SKILL.md +119 -0
  35. package/.codex/skills/learn-follow/SKILL.md +83 -0
  36. package/.codex/skills/learn-investigate/SKILL.md +83 -0
  37. package/.codex/skills/learn-retro/SKILL.md +83 -0
  38. package/.codex/skills/learn-second-opinion/SKILL.md +86 -0
  39. package/.codex/skills/maestro/SKILL.md +151 -279
  40. package/.codex/skills/maestro-analyze/SKILL.md +59 -71
  41. package/.codex/skills/maestro-brainstorm/SKILL.md +452 -463
  42. package/.codex/skills/maestro-chain/SKILL.md +95 -110
  43. package/.codex/skills/maestro-coordinate/SKILL.md +68 -234
  44. package/.codex/skills/maestro-execute/SKILL.md +435 -446
  45. package/.codex/skills/maestro-fork/SKILL.md +98 -0
  46. package/.codex/skills/maestro-init/SKILL.md +172 -167
  47. package/.codex/skills/maestro-learn/SKILL.md +80 -0
  48. package/.codex/skills/maestro-link-coordinate/SKILL.md +224 -220
  49. package/.codex/skills/maestro-merge/SKILL.md +69 -0
  50. package/.codex/skills/maestro-milestone-audit/SKILL.md +108 -103
  51. package/.codex/skills/maestro-milestone-complete/SKILL.md +155 -149
  52. package/.codex/skills/maestro-milestone-release/SKILL.md +70 -0
  53. package/.codex/skills/maestro-overlay/SKILL.md +188 -185
  54. package/.codex/skills/maestro-plan/SKILL.md +58 -69
  55. package/.codex/skills/maestro-quick/SKILL.md +26 -23
  56. package/.codex/skills/maestro-roadmap/SKILL.md +65 -73
  57. package/.codex/skills/maestro-spec-generate/SKILL.md +66 -74
  58. package/.codex/skills/maestro-ui-design/SKILL.md +35 -32
  59. package/.codex/skills/maestro-verify/SKILL.md +556 -566
  60. package/.codex/skills/manage-codebase-rebuild/SKILL.md +397 -405
  61. package/.codex/skills/manage-codebase-refresh/SKILL.md +93 -82
  62. package/.codex/skills/manage-harvest/SKILL.md +82 -0
  63. package/.codex/skills/manage-issue/SKILL.md +80 -65
  64. package/.codex/skills/manage-issue-discover/SKILL.md +491 -503
  65. package/.codex/skills/manage-learn/SKILL.md +190 -186
  66. package/.codex/skills/manage-memory/SKILL.md +95 -72
  67. package/.codex/skills/manage-memory-capture/SKILL.md +99 -86
  68. package/.codex/skills/manage-status/SKILL.md +102 -89
  69. package/.codex/skills/quality-business-test/SKILL.md +228 -223
  70. package/.codex/skills/quality-debug/SKILL.md +54 -66
  71. package/.codex/skills/quality-integration-test/SKILL.md +532 -544
  72. package/.codex/skills/quality-refactor/SKILL.md +197 -191
  73. package/.codex/skills/quality-retrospective/SKILL.md +512 -505
  74. package/.codex/skills/quality-review/SKILL.md +95 -107
  75. package/.codex/skills/quality-sync/SKILL.md +101 -89
  76. package/.codex/skills/quality-test/SKILL.md +202 -198
  77. package/.codex/skills/quality-test-gen/SKILL.md +94 -105
  78. package/.codex/skills/spec-add/SKILL.md +58 -39
  79. package/.codex/skills/spec-load/SKILL.md +45 -40
  80. package/.codex/skills/spec-map/SKILL.md +180 -182
  81. package/.codex/skills/spec-setup/SKILL.md +94 -76
  82. package/.codex/skills/team-coordinate/SKILL.md +346 -357
  83. package/.codex/skills/team-executor/SKILL.md +70 -112
  84. package/.codex/skills/team-lifecycle-v4/SKILL.md +311 -299
  85. package/.codex/skills/team-quality-assurance/SKILL.md +234 -227
  86. package/.codex/skills/team-review/SKILL.md +232 -225
  87. package/.codex/skills/team-tech-debt/SKILL.md +78 -100
  88. package/.codex/skills/team-testing/SKILL.md +242 -235
  89. package/.codex/skills/wiki-connect/SKILL.md +75 -0
  90. package/.codex/skills/wiki-digest/SKILL.md +87 -0
  91. package/README.md +9 -4
  92. package/README.zh-CN.md +9 -4
  93. package/dashboard/dist/assets/{ArtifactsPage-DZNCi6tn.js → ArtifactsPage-CUrrDGgN.js} +1 -1
  94. package/dashboard/dist/assets/ChatInput-pUOLJIKE.js +49 -0
  95. package/dashboard/dist/assets/ChatPage-B8Xqkt0v.js +27 -0
  96. package/dashboard/dist/assets/{CollabPage-B4NAHXS2.js → CollabPage-DIUXeazv.js} +1 -1
  97. package/dashboard/dist/assets/{ExecutionPanel-CFt4LJyq.js → ExecutionPanel-VmYeADFj.js} +1 -1
  98. package/dashboard/dist/assets/KanbanPage-DLq8v7hg.js +21 -0
  99. package/dashboard/dist/assets/{MarkdownRenderer-X4af_WNb.js → MarkdownRenderer-D7AehrnR.js} +1 -1
  100. package/dashboard/dist/assets/{McpPage-BKfCVIyU.js → McpPage-BY0SjTgw.js} +2 -2
  101. package/dashboard/dist/assets/{OutputPanel-BlBQFJSW.js → OutputPanel-B-Rjwgmv.js} +1 -1
  102. package/dashboard/dist/assets/{ProblemsPanel-De3DLvoI.js → ProblemsPanel-GEpF-oi4.js} +1 -1
  103. package/dashboard/dist/assets/RequirementBoardPage-xs8uDM7I.js +6 -0
  104. package/dashboard/dist/assets/{RequirementPage-Bllxe2XI.js → RequirementPage-BKDSFwjA.js} +5 -10
  105. package/dashboard/dist/assets/SpecsPage-DLFb9ZH0.js +36 -0
  106. package/dashboard/dist/assets/SupervisorPage-SOki_kgz.js +6 -0
  107. package/dashboard/dist/assets/TeamsPage-BO2kP70F.js +11 -0
  108. package/dashboard/dist/assets/{TreeBrowser-Q12qobZs.js → TreeBrowser-B9DHdULE.js} +1 -1
  109. package/dashboard/dist/assets/{WorkflowPage-D_Fzdy3_.js → WorkflowPage-C8hWbYim.js} +1 -1
  110. package/dashboard/dist/assets/{check-u6fGOwQO.js → check-DJDk3A2a.js} +1 -1
  111. package/dashboard/dist/assets/{chevron-right-Csu22t58.js → chevron-right-C7bVDreZ.js} +1 -1
  112. package/dashboard/dist/assets/{circle-CMrkbRNg.js → circle-Qfgy4LB_.js} +1 -1
  113. package/dashboard/dist/assets/{circle-alert-c3tH1P4z.js → circle-alert-Na1vf6qQ.js} +1 -1
  114. package/dashboard/dist/assets/{circle-check-gYxxSYuH.js → circle-check-CEGgy3NV.js} +1 -1
  115. package/dashboard/dist/assets/{circle-check-big-TDSeWstm.js → circle-check-big-3JB8zRYj.js} +1 -1
  116. package/dashboard/dist/assets/{code-CFN2uX9V.js → code-Ble63Idz.js} +1 -1
  117. package/dashboard/dist/assets/{columns-3-38xIDlzy.js → columns-3-BUcKlxve.js} +1 -1
  118. package/dashboard/dist/assets/{download-DC7KkKyP.js → download-CMqkfn8x.js} +1 -1
  119. package/dashboard/dist/assets/{folder-CWq_lAnf.js → folder-B9ewx9LL.js} +1 -1
  120. package/dashboard/dist/assets/index-C2Mcb4TJ.js +231 -0
  121. package/dashboard/dist/assets/index-DyBbPc18.css +1 -0
  122. package/dashboard/dist/assets/{index-Do71weNR.js → index-JTmGteaT.js} +1 -1
  123. package/dashboard/dist/assets/{list-CgIP_2A-.js → list-DI8Wn2aT.js} +1 -1
  124. package/dashboard/dist/assets/loader-B5F6PzFT.js +11 -0
  125. package/dashboard/dist/assets/{minus-DYoN5UGk.js → minus-Lp_BfctG.js} +1 -1
  126. package/dashboard/dist/assets/{pen-line-Bh_WKYHm.js → pen-line-Ch7sphzZ.js} +1 -1
  127. package/dashboard/dist/assets/pencil-_yRMHmGT.js +6 -0
  128. package/dashboard/dist/assets/{proxy-BKxDAKTj.js → proxy-D72Y8a4Y.js} +1 -1
  129. package/dashboard/dist/assets/{search-SieXnOgr.js → search-BS6fI6Bg.js} +1 -1
  130. package/dashboard/dist/assets/{shallow-Bme1JY57.js → shallow-BXasQBvr.js} +1 -1
  131. package/dashboard/dist/assets/table-CeGlFjlP.js +6 -0
  132. package/dashboard/dist/assets/{terminal-BB3Xfuv5.js → terminal-BJic2yW-.js} +1 -1
  133. package/dashboard/dist/assets/{trash-2-C8f4vFFM.js → trash-2-Czz4X8Fb.js} +1 -1
  134. package/dashboard/dist/assets/{zap-4uwlzVm0.js → zap-C3H0jVFA.js} +1 -1
  135. package/dashboard/dist/index.html +2 -2
  136. package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js +16 -1
  137. package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js.map +1 -1
  138. package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js +1 -2
  139. package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js.map +1 -1
  140. package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.d.ts +1 -1
  141. package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js +2 -1
  142. package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js.map +1 -1
  143. package/dashboard/dist-server/dashboard/src/server/index.js +3 -0
  144. package/dashboard/dist-server/dashboard/src/server/index.js.map +1 -1
  145. package/dashboard/dist-server/dashboard/src/server/routes/collab.js +124 -0
  146. package/dashboard/dist-server/dashboard/src/server/routes/collab.js.map +1 -1
  147. package/dashboard/dist-server/dashboard/src/server/routes/specs.d.ts +1 -1
  148. package/dashboard/dist-server/dashboard/src/server/routes/specs.js +75 -30
  149. package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
  150. package/dashboard/dist-server/dashboard/src/server/state/event-bus.d.ts +5 -0
  151. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js +5 -0
  152. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js.map +1 -1
  153. package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.d.ts +10 -0
  154. package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js +73 -0
  155. package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js.map +1 -0
  156. package/dashboard/dist-server/dashboard/src/shared/collab-types.d.ts +31 -0
  157. package/dashboard/dist-server/dashboard/src/shared/collab-types.js +28 -0
  158. package/dashboard/dist-server/dashboard/src/shared/collab-types.js.map +1 -1
  159. package/dashboard/dist-server/dashboard/src/shared/constants.js +10 -0
  160. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  161. package/dashboard/dist-server/dashboard/src/shared/coordinate-types.d.ts +22 -0
  162. package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +12 -0
  163. package/dashboard/dist-server/dashboard/src/shared/issue-types.js +12 -0
  164. package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
  165. package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +22 -0
  166. package/dashboard/dist-server/dashboard/src/shared/team-types.js +7 -0
  167. package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
  168. package/dashboard/dist-server/dashboard/src/shared/types.d.ts +3 -2
  169. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +28 -2
  170. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
  171. package/dashboard/dist-server/shared/agent-types.d.ts +4 -0
  172. package/dashboard/dist-server/src/hooks/constants.d.ts +3 -1
  173. package/dashboard/dist-server/src/hooks/constants.js +4 -2
  174. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  175. package/dist/shared/agent-types.d.ts +4 -0
  176. package/dist/shared/agent-types.d.ts.map +1 -1
  177. package/dist/src/commands/collab.js +4 -4
  178. package/dist/src/commands/collab.js.map +1 -1
  179. package/dist/src/commands/hooks.d.ts.map +1 -1
  180. package/dist/src/commands/hooks.js +66 -1
  181. package/dist/src/commands/hooks.js.map +1 -1
  182. package/dist/src/commands/install-backend.d.ts.map +1 -1
  183. package/dist/src/commands/install-backend.js +29 -18
  184. package/dist/src/commands/install-backend.js.map +1 -1
  185. package/dist/src/commands/spec.d.ts.map +1 -1
  186. package/dist/src/commands/spec.js +7 -2
  187. package/dist/src/commands/spec.js.map +1 -1
  188. package/dist/src/hooks/__tests__/statusline-visual-test.js +23 -1
  189. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -1
  190. package/dist/src/hooks/constants.d.ts +3 -1
  191. package/dist/src/hooks/constants.d.ts.map +1 -1
  192. package/dist/src/hooks/constants.js +4 -2
  193. package/dist/src/hooks/constants.js.map +1 -1
  194. package/dist/src/hooks/guards/index.d.ts +1 -0
  195. package/dist/src/hooks/guards/index.d.ts.map +1 -1
  196. package/dist/src/hooks/guards/index.js +1 -0
  197. package/dist/src/hooks/guards/index.js.map +1 -1
  198. package/dist/src/hooks/guards/spec-validator.d.ts +25 -0
  199. package/dist/src/hooks/guards/spec-validator.d.ts.map +1 -0
  200. package/dist/src/hooks/guards/spec-validator.js +66 -0
  201. package/dist/src/hooks/guards/spec-validator.js.map +1 -0
  202. package/dist/src/hooks/keyword-spec-injector.d.ts +21 -0
  203. package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -0
  204. package/dist/src/hooks/keyword-spec-injector.js +96 -0
  205. package/dist/src/hooks/keyword-spec-injector.js.map +1 -0
  206. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts +2 -1
  207. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts.map +1 -1
  208. package/dist/src/hooks/plugins/spec-injection-plugin.js +21 -12
  209. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  210. package/dist/src/hooks/skill-context.d.ts +3 -0
  211. package/dist/src/hooks/skill-context.d.ts.map +1 -1
  212. package/dist/src/hooks/skill-context.js +95 -9
  213. package/dist/src/hooks/skill-context.js.map +1 -1
  214. package/dist/src/hooks/spec-bridge.d.ts +40 -0
  215. package/dist/src/hooks/spec-bridge.d.ts.map +1 -0
  216. package/dist/src/hooks/spec-bridge.js +97 -0
  217. package/dist/src/hooks/spec-bridge.js.map +1 -0
  218. package/dist/src/hooks/spec-injector.d.ts.map +1 -1
  219. package/dist/src/hooks/spec-injector.js +18 -12
  220. package/dist/src/hooks/spec-injector.js.map +1 -1
  221. package/dist/src/hooks/statusline.d.ts.map +1 -1
  222. package/dist/src/hooks/statusline.js +6 -3
  223. package/dist/src/hooks/statusline.js.map +1 -1
  224. package/dist/src/team/phase-orchestrator.d.ts +52 -0
  225. package/dist/src/team/phase-orchestrator.d.ts.map +1 -0
  226. package/dist/src/team/phase-orchestrator.js +165 -0
  227. package/dist/src/team/phase-orchestrator.js.map +1 -0
  228. package/dist/src/team/phase-types.d.ts +51 -0
  229. package/dist/src/team/phase-types.d.ts.map +1 -0
  230. package/dist/src/team/phase-types.js +41 -0
  231. package/dist/src/team/phase-types.js.map +1 -0
  232. package/dist/src/tools/index.d.ts.map +1 -1
  233. package/dist/src/tools/index.js +6 -0
  234. package/dist/src/tools/index.js.map +1 -1
  235. package/dist/src/tools/merge-validator.d.ts.map +1 -1
  236. package/dist/src/tools/merge-validator.js +114 -16
  237. package/dist/src/tools/merge-validator.js.map +1 -1
  238. package/dist/src/tools/spec-entry-parser.d.ts +56 -0
  239. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -0
  240. package/dist/src/tools/spec-entry-parser.js +196 -0
  241. package/dist/src/tools/spec-entry-parser.js.map +1 -0
  242. package/dist/src/tools/spec-init.d.ts.map +1 -1
  243. package/dist/src/tools/spec-init.js +66 -92
  244. package/dist/src/tools/spec-init.js.map +1 -1
  245. package/dist/src/tools/spec-keyword-index.d.ts +30 -0
  246. package/dist/src/tools/spec-keyword-index.d.ts.map +1 -0
  247. package/dist/src/tools/spec-keyword-index.js +101 -0
  248. package/dist/src/tools/spec-keyword-index.js.map +1 -0
  249. package/dist/src/tools/spec-loader.d.ts +3 -3
  250. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  251. package/dist/src/tools/spec-loader.js +49 -23
  252. package/dist/src/tools/spec-loader.js.map +1 -1
  253. package/dist/src/tools/team-agents.d.ts +27 -0
  254. package/dist/src/tools/team-agents.d.ts.map +1 -0
  255. package/dist/src/tools/team-agents.js +362 -0
  256. package/dist/src/tools/team-agents.js.map +1 -0
  257. package/dist/src/tools/team-mailbox.d.ts +40 -0
  258. package/dist/src/tools/team-mailbox.d.ts.map +1 -0
  259. package/dist/src/tools/team-mailbox.js +384 -0
  260. package/dist/src/tools/team-mailbox.js.map +1 -0
  261. package/dist/src/tools/team-msg.d.ts +17 -8
  262. package/dist/src/tools/team-msg.d.ts.map +1 -1
  263. package/dist/src/tools/team-msg.js +110 -13
  264. package/dist/src/tools/team-msg.js.map +1 -1
  265. package/dist/src/tools/team-tasks-mcp.d.ts +27 -0
  266. package/dist/src/tools/team-tasks-mcp.d.ts.map +1 -0
  267. package/dist/src/tools/team-tasks-mcp.js +408 -0
  268. package/dist/src/tools/team-tasks-mcp.js.map +1 -0
  269. package/package.json +2 -1
  270. package/shared/agent-types.ts +4 -0
  271. package/templates/worktree-scope.json +9 -10
  272. package/templates/worktrees.json +26 -27
  273. package/workflows/analyze.md +816 -816
  274. package/workflows/brainstorm.md +480 -471
  275. package/workflows/codebase-rebuild.md +332 -332
  276. package/workflows/codebase-refresh.md +240 -240
  277. package/workflows/debug.md +16 -6
  278. package/workflows/execute.md +1 -1
  279. package/workflows/fork.md +100 -36
  280. package/workflows/harvest.md +420 -420
  281. package/workflows/integration-test.md +355 -343
  282. package/workflows/issue-discover.md +414 -414
  283. package/workflows/issue.md +14 -4
  284. package/workflows/learn.md +19 -5
  285. package/workflows/maestro.md +1 -0
  286. package/workflows/map.md +111 -111
  287. package/workflows/merge.md +113 -55
  288. package/workflows/milestone-complete.md +176 -176
  289. package/workflows/plan.md +1 -1
  290. package/workflows/quick.md +497 -497
  291. package/workflows/refactor.md +300 -300
  292. package/workflows/retrospective.md +61 -22
  293. package/workflows/review.md +17 -4
  294. package/workflows/roadmap.md +335 -335
  295. package/workflows/spec-generate.md +640 -640
  296. package/workflows/specs-add.md +46 -81
  297. package/workflows/specs-load.md +15 -17
  298. package/workflows/specs-setup.md +40 -161
  299. package/workflows/test.md +12 -2
  300. package/workflows/ui-style.md +9 -2
  301. package/dashboard/dist/assets/ChatInput-Bvr-FeEq.js +0 -49
  302. package/dashboard/dist/assets/ChatPage-D9zTkJZo.js +0 -22
  303. package/dashboard/dist/assets/KanbanPage-C8USth6H.js +0 -21
  304. package/dashboard/dist/assets/RequirementBoardPage-Bf1trzqs.js +0 -11
  305. package/dashboard/dist/assets/SpecsPage-9lwxKT27.js +0 -36
  306. package/dashboard/dist/assets/SupervisorPage-SusdfHFq.js +0 -6
  307. package/dashboard/dist/assets/TeamsPage-DsuM6OwC.js +0 -6
  308. package/dashboard/dist/assets/arrow-left-Bqtb2hle.js +0 -6
  309. package/dashboard/dist/assets/index-DWG-WrzT.js +0 -231
  310. package/dashboard/dist/assets/index-GUNJodSR.css +0 -1
  311. package/dashboard/dist/assets/table-llyEtj-7.js +0 -6
@@ -1,640 +1,640 @@
1
- # Workflow: Spec Generate
2
-
3
- Specification document chain producing a complete specification package (Product Brief, PRD, Architecture, Epics, Roadmap) through 7 sequential phases with multi-CLI analysis and interactive refinement. Pure documentation — no code generation.
4
-
5
- ## Worktree Guard
6
-
7
- ```
8
- # Block in worktree
9
- IF file_exists(".workflow/worktree-scope.json"):
10
- ERROR "Cannot run maestro-spec-generate inside a worktree. Run from the main worktree."
11
- EXIT
12
- ```
13
-
14
- ## Pipeline Position
15
-
16
- ```
17
- maestro-brainstorm (optional upstream)
18
- ↓ guidance-specification.md
19
- maestro-init (REQUIRED first step — project setup)
20
- ↓ project.md, state.json, config.json
21
- maestro-spec-generate ← THIS (heavy path)
22
- ↓ spec package + roadmap.md → .workflow/roadmap.md
23
- maestro-plan → maestro-execute → maestro-verify
24
-
25
- Alternative light path (skip spec-generate):
26
- maestro-init → maestro-roadmap → roadmap.md directly
27
-
28
- Note: maestro-init MUST run before spec-generate.
29
- ```
30
-
31
- ## Architecture
32
-
33
- ```
34
- Phase 0: Specification Study (read specs + templates)
35
- |
36
- Phase 1: Discovery → spec-config.json + discovery-context.json
37
- | (includes spec_type selection)
38
- Phase 1.5: Req Expansion → refined-requirements.json
39
- | (-y: auto-expansion, skip interaction)
40
- Phase 2: Product Brief → product-brief.md + glossary.json
41
- | (multi-CLI parallel analysis)
42
- Phase 3: Requirements (PRD) → requirements/ (_index.md + REQ-*.md + NFR-*.md)
43
- | (RFC 2119, data model definitions)
44
- Phase 4: Architecture → architecture/ (_index.md + ADR-*.md)
45
- | (state machine, config model, error handling, observability)
46
- Phase 5: Epics & Stories → epics/ (_index.md + EPIC-*.md)
47
- |
48
- Phase 6: Readiness Check → readiness-report.md + spec-summary.md
49
- | (terminology + scope consistency validation)
50
- ├── Pass (>=80%): Proceed to Phase 7
51
- ├── Review (60-79%): Proceed with caveats
52
- └── Fail (<60%): Phase 6.5 Auto-Fix (max 2 iterations)
53
- |
54
- Phase 6.5: Auto-Fix → Updated Phase 2-5 documents
55
- └── Re-run Phase 6 validation
56
- |
57
- Phase 7: Roadmap Generation → roadmap.md + .workflow/roadmap.md
58
- (Epic→Phase mapping, interactive refinement)
59
- ```
60
-
61
- ## Arguments
62
-
63
- ```
64
- $ARGUMENTS: "<idea or @file> [-y] [-c] [--from-brainstorm SESSION-ID]"
65
-
66
- <idea> -- Idea text or @file reference
67
- -y / --yes -- Auto mode, skip interactive questions
68
- -c / --continue -- Resume from last checkpoint
69
- --from-brainstorm -- Import brainstorm session as enriched seed
70
- ```
71
-
72
- ## Output Structure
73
-
74
- ```
75
- .workflow/.spec/SPEC-{slug}-{YYYY-MM-DD}/
76
- ├── spec-config.json # Session configuration + phase state
77
- ├── discovery-context.json # Codebase exploration (optional)
78
- ├── refined-requirements.json # Phase 1.5: Confirmed requirements
79
- ├── glossary.json # Phase 2: Terminology glossary
80
- ├── product-brief.md # Phase 2: Product brief
81
- ├── requirements/ # Phase 3: Detailed PRD
82
- │ ├── _index.md # Summary, MoSCoW table, traceability
83
- │ ├── REQ-NNN-{slug}.md # Functional requirement
84
- │ └── NFR-{type}-NNN-{slug}.md # Non-functional requirement
85
- ├── architecture/ # Phase 4: Architecture decisions
86
- │ ├── _index.md # Overview, components, tech stack
87
- │ └── ADR-NNN-{slug}.md # Architecture Decision Record
88
- ├── epics/ # Phase 5: Epic/Story breakdown
89
- │ ├── _index.md # Epic table, dependency map, MVP
90
- │ └── EPIC-NNN-{slug}.md # Individual Epic with Stories
91
- ├── readiness-report.md # Phase 6: Quality report
92
- ├── spec-summary.md # Phase 6: Executive summary
93
- └── roadmap.md # Phase 7: Project roadmap (also written to .workflow/roadmap.md)
94
- ```
95
-
96
- ---
97
-
98
- ## Process
99
-
100
- ### Step 1: Prerequisite Loading (Phase 0)
101
-
102
- Before any operations, load specification and template documents:
103
-
104
- | Document | Purpose | Priority |
105
- |----------|---------|----------|
106
- | Document standards | Format, frontmatter, naming conventions | P0 - must read |
107
- | Quality gates | Per-phase quality criteria and scoring | P0 - must read |
108
- | Templates | product-brief, requirements-prd, architecture-doc, epics-template | Read on-demand per phase |
109
-
110
- **Load project specs:**
111
- ```
112
- specs_content = maestro spec load --category planning
113
- ```
114
- Used in Phase 3 (architecture doc) and Phase 6 (epic decomposition) for constraint awareness.
115
-
116
- These inform validation and output formatting for all subsequent phases.
117
-
118
- **Load project history (if `.workflow/` exists):**
119
- ```
120
- IF .workflow/project.md exists:
121
- Read project.md:
122
- - "### Validated" → already_shipped (DO NOT re-specify)
123
- - "### Active" → current_scope
124
- - "## Context" → project_history (milestone summaries)
125
- - "## Key Decisions" → locked_decisions
126
-
127
- IF .workflow/state.json exists:
128
- Read state.json.accumulated_context:
129
- - deferred[] → candidate_requirements (high priority for this iteration)
130
- - key_decisions[] → architectural_constraints
131
-
132
- ```
133
-
134
- **Rules**:
135
- - Features in `already_shipped` are EXCLUDED from spec generation scope — they are done
136
- - `deferred` items from previous milestone are HIGH PRIORITY candidates
137
- - `locked_decisions` constrain architecture choices in Phase 4
138
- - `lessons_learned` inform risk assessment in Phase 1 and architecture decisions in Phase 4
139
- - Pass assembled `project_context` to Phase 1 seed analysis and Phase 7 roadmap generation
140
-
141
- ### Step 2: Discovery & Seed Analysis (Phase 1)
142
-
143
- Parse input, analyze the seed idea, optionally explore codebase, establish session.
144
-
145
- **Step 2.1: Input Parsing**
146
- - Parse $ARGUMENTS: extract idea/topic, flags (-y, -c, --from-brainstorm)
147
- - If `-c`: read spec-config.json, resume from first incomplete phase
148
- - If `--from-brainstorm SESSION-ID`:
149
- - Locate brainstorm session directory
150
- - Read `guidance-specification.md` as enriched seed (already has terminology, non-goals, feature decomposition)
151
- - Extract problem statement, features, roles from specification
152
- - Set `input_type: "brainstorm"` — skip Phase 1.5 (requirements already clarified)
153
- - If `@file`: read file content as seed
154
- - If text: use directly as seed
155
- - Missing input → error E001
156
-
157
- **Step 2.2: Session Initialization**
158
- ```
159
- Session ID: SPEC-{slug}-{YYYY-MM-DD}
160
- Output dir: .workflow/.spec/{session_id}/
161
- ```
162
-
163
- **Step 2.3: Seed Analysis via CLI**
164
- - Spawn CLI analysis to extract: problem_statement, target_users, domain, constraints, dimensions (3-5)
165
- - Assess complexity: simple (1-2 components) / moderate (3-5) / complex (6+)
166
- - For brainstorm input: enrich with feature decomposition data
167
-
168
- **Step 2.4: Codebase Exploration (conditional)**
169
- - Detect if project has source files (*.ts, *.js, *.py, etc.)
170
- - If yes: spawn cli-explore-agent for context discovery
171
- - Output: `discovery-context.json` with relevant_files, patterns, tech_stack
172
-
173
- **Step 2.5: External Research — API & Technology Details (Optional)**
174
-
175
- Spawn `workflow-external-researcher` agent to gather concrete API details, library versions, and integration patterns for the technologies identified in seed analysis and codebase exploration.
176
-
177
- **Trigger**: When seed analysis identifies specific technologies, APIs, or external services. Auto-trigger in auto mode (`-y`). Skip if topic is purely conceptual with no technology keywords.
178
-
179
- ```
180
- // Step 2.5.1: Build research queries from seed analysis
181
- researchTopics = extract from seed_analysis:
182
- - Named technologies/frameworks (e.g., "OAuth 2.0", "WebSocket", "PostgreSQL")
183
- - External APIs/services mentioned (e.g., "Stripe API", "SendGrid")
184
- - Domain-specific protocols or standards
185
-
186
- IF researchTopics is empty: skip to Step 2.6, set apiResearchContext = null
187
-
188
- // Step 2.5.2: Spawn external researcher
189
- Agent(
190
- subagent_type="workflow-external-researcher",
191
- prompt="""
192
- <objective>
193
- Research API details and technology specifics for: {seed_analysis.problem_statement}
194
- Mode: API Research
195
- </objective>
196
-
197
- <context>
198
- Technologies identified: {researchTopics}
199
- Domain: {seed_analysis.domain}
200
- Spec type: {spec_type or "TBD"}
201
- Codebase tech stack: {discovery_context.tech_stack or "none"}
202
- </context>
203
-
204
- <task>
205
- For each identified technology/API:
206
- 1. Current stable version and key capabilities
207
- 2. API surface: core endpoints/methods, authentication model, rate limits
208
- 3. Integration patterns: recommended setup, configuration, common middleware
209
- 4. Data models: key entities, request/response shapes
210
- 5. Known limitations, deprecations, or migration paths
211
-
212
- Focus on CONCRETE details — versions, method signatures, config options.
213
- Be prescriptive. Return structured markdown only — do NOT write files.
214
- </task>
215
- """,
216
- run_in_background=false
217
- )
218
-
219
- // Step 2.5.3: Store as apiResearchContext (in-memory)
220
- apiResearchContext = agent_output
221
- ```
222
-
223
- `apiResearchContext` is passed into:
224
- - Step 4 (Product Brief): technology feasibility assessment
225
- - Step 5 (Requirements): API-aware requirement writing with concrete constraints
226
- - Step 6 (Architecture): informed ADR decisions with version-specific details
227
- - Step 7 (Epics): realistic story sizing based on API complexity
228
-
229
- If research fails (W005): `apiResearchContext = null`, continue without external context.
230
-
231
- **Step 2.6: Spec Type Selection**
232
- - Interactive (AskUserQuestion): Service / API / Library / Platform
233
- - `--yes`: default to "service"
234
- - Each type loads a profile template for domain-specific sections
235
-
236
- **Step 2.7: User Confirmation (interactive)**
237
- - Confirm problem statement, select depth (Light/Standard/Comprehensive), select focus areas
238
- - `--yes`: accept all defaults
239
-
240
- **Output**: `spec-config.json` (session state), `discovery-context.json` (optional), `apiResearchContext` (in-memory, optional)
241
-
242
- ### Step 3: Requirement Expansion & Clarification (Phase 1.5)
243
-
244
- Skip if `--from-brainstorm` (requirements already in guidance-specification.md).
245
-
246
- **Step 3.1: CLI Gap Analysis**
247
- - Analyze seed for completeness (score 1-10), identify missing dimensions
248
- - Generate 3-5 clarification areas with questions and expansion suggestions
249
- - Dimensions checked: functional scope, user scenarios, NFRs, integrations, data model, error handling
250
-
251
- **Step 3.2: Interactive Discussion Loop (max 5 rounds)**
252
- - Round 1: present gap analysis + expansion suggestions via AskUserQuestion
253
- - Round N: CLI follow-up analysis based on user responses, refine requirements
254
- - User can: answer questions, accept suggestions, or skip to generation
255
- - `--yes`: CLI auto-expansion without interaction
256
-
257
- **Step 3.3: User Confirmation**
258
- - Present requirement summary, user confirms or requests adjustments
259
- - `--yes`: auto-confirm
260
-
261
- **Output**: `refined-requirements.json` (confirmed features, NFRs, boundaries, assumptions)
262
-
263
- ### Step 4: Product Brief (Phase 2)
264
-
265
- Generate product brief through multi-perspective CLI analysis.
266
-
267
- **Step 4.1: Load Context**
268
- - Read refined-requirements.json (preferred) or seed_analysis fallback
269
- - Read discovery-context.json (if codebase detected)
270
- - For brainstorm input: read guidance-specification.md sections
271
-
272
- **Step 4.2: Multi-CLI Parallel Analysis (3 perspectives)**
273
-
274
- | Perspective | CLI Tool | Focus |
275
- |-------------|----------|-------|
276
- | Product | gemini | Vision, market fit, success criteria, scope boundaries |
277
- | Technical | codex | Feasibility, constraints, integration complexity, tech recommendations |
278
- | User | claude | Personas, journey maps, pain points, UX criteria |
279
-
280
- **Step 4.3: Synthesis**
281
- - Extract convergent themes (all agree), conflicts (need resolution), unique insights
282
- - For brainstorm input: cross-reference with guidance-specification decisions
283
- - If `apiResearchContext` is set: inject API details into technical feasibility assessment, enrich technology recommendations with concrete versions and constraints
284
-
285
- **Step 4.4: Interactive Refinement**
286
- - Present synthesis, user adjusts scope/vision
287
- - `--yes`: accept synthesis as-is
288
-
289
- **Step 4.5: Generate Outputs**
290
- - `product-brief.md` from template (YAML frontmatter + filled content)
291
- - `glossary.json` — 5+ core terms extracted from product brief and CLI analysis
292
- - Each term: canonical name, definition, aliases, category (core/technical/business)
293
- - Injected into all subsequent phase CLI prompts for terminology consistency
294
-
295
- **Output**: `product-brief.md`, `glossary.json`
296
-
297
- ### Step 5: Requirements / PRD (Phase 3)
298
-
299
- Generate detailed PRD with functional/non-functional requirements.
300
-
301
- **Step 5.1: Requirement Expansion via CLI**
302
- - For each product brief goal, generate 3-7 functional requirements
303
- - Each requirement: REQ-NNN ID, title, description, user story, 2-4 acceptance criteria
304
- - Generate non-functional requirements: performance, security, scalability, usability
305
- - Apply RFC 2119 keywords (MUST/SHOULD/MAY) to all behavioral constraints
306
- - Define core entity data models: fields, types, constraints, relationships
307
- - Inject glossary.json for terminology consistency
308
-
309
- **Step 5.2: MoSCoW Priority Sorting (interactive)**
310
- - Present requirements grouped by initial priority
311
- - User adjusts Must/Should/Could/Won't labels
312
- - Select MVP scope: Must-only / Must+key Should / Comprehensive
313
- - `--yes`: accept CLI-suggested priorities
314
-
315
- **Step 5.3: Generate Directory**
316
- - `requirements/_index.md` — summary table, MoSCoW breakdown, traceability matrix
317
- - `requirements/REQ-NNN-{slug}.md` — one per functional requirement
318
- - `requirements/NFR-{type}-NNN-{slug}.md` — one per non-functional requirement
319
-
320
- **Output**: `requirements/` directory (index + individual files)
321
-
322
- ### Step 6: Architecture (Phase 4)
323
-
324
- Generate architecture decisions, component design, and technology selections.
325
-
326
- **Step 6.1: Architecture Analysis via CLI (gemini)**
327
- - System architecture style with justification
328
- - Core components and responsibilities
329
- - Component interaction diagram (Mermaid graph TD)
330
- - Technology stack: languages, frameworks, databases, infrastructure
331
- - 2-4 Architecture Decision Records (ADRs): context, decision, alternatives, consequences
332
- - Data model: entities and relationships (Mermaid erDiagram)
333
- - Security architecture: auth, authorization, data protection
334
- - **State machine**: ASCII diagram + transition table for lifecycle entities (service/platform type)
335
- - **Configuration model**: all configurable fields with type, default, constraint
336
- - **Error handling strategy**: per-component classification (transient/permanent/degraded), recovery mechanisms
337
- - **Observability**: key metrics (5+), structured log events, health checks
338
- - Spec type profile injection for domain-specific depth
339
- - Glossary injection for terminology consistency
340
- - If `apiResearchContext` is set: inject as "External API Research" context — concrete versions, API surfaces, integration patterns inform ADR decisions and technology stack selection
341
-
342
- **Step 6.2: Architecture Review via CLI (codex)**
343
- - Challenge each ADR, identify scalability bottlenecks
344
- - Assess security gaps, evaluate technology choices
345
- - Rate overall quality 1-5
346
-
347
- **Step 6.3: Interactive ADR Decisions**
348
- - Present ADRs with review feedback, user decides: accept / incorporate feedback / simplify
349
- - `--yes`: auto-accept
350
-
351
- **Step 6.4: Codebase Integration Mapping (conditional)**
352
- - Map new components to existing code modules
353
-
354
- **Step 6.5: Generate Directory**
355
- - `architecture/_index.md` — overview, component diagram, tech stack, data model, security
356
- - `architecture/ADR-NNN-{slug}.md` — one per Architecture Decision Record
357
-
358
- **Output**: `architecture/` directory (index + individual ADR files)
359
-
360
- ### Step 7: Epics & Stories (Phase 5)
361
-
362
- Decompose specification into executable Epics and Stories.
363
-
364
- **Step 7.1: Epic Decomposition via CLI**
365
- - Group requirements into logical Epics (EPIC-NNN IDs). Epic count is unconstrained — Phase 7 will merge Epics into minimal phases via the minimum-phase principle.
366
- - Tag MVP subset
367
- - For each Epic: 2-5 Stories in "As a...I want...So that..." format
368
- - Each Story: 2-4 testable acceptance criteria, relative size (S/M/L/XL), trace to REQ-NNN
369
- - Cross-Epic dependency map (Mermaid graph LR)
370
- - Recommended execution order with rationale
371
- - MVP definition of done (3-5 criteria)
372
-
373
- **Epic sizing awareness** (informs Phase 7 roadmap generation):
374
- - Epics that are too small (1-2 Stories, all size S) should be flagged for merge in Phase 7
375
- - Each Epic should carry enough substance to become part of a phase with 5+ tasks
376
- - Prefer fewer, larger Epics over many tiny ones
377
-
378
- **Step 7.2: Interactive Validation**
379
- - Present Epic overview, user adjusts: merge/split epics, adjust MVP scope
380
- - `--yes`: accept as-is
381
-
382
- **Step 7.3: Generate Directory**
383
- - `epics/_index.md` — overview table, dependency map, MVP scope, execution order, traceability
384
- - `epics/EPIC-NNN-{slug}.md` — one per Epic with embedded Stories
385
-
386
- **Output**: `epics/` directory (index + individual Epic files)
387
-
388
- ### Step 8: Readiness Check & Handoff (Phase 6)
389
-
390
- Validate specification package and provide execution handoff.
391
-
392
- **Step 8.1: Cross-Document Validation via CLI**
393
- Score on 4 dimensions (25% each):
394
- 1. **Completeness**: all required sections present with substantive content
395
- 2. **Consistency**: terminology uniform (glossary compliance), scope containment, non-goals respected
396
- 3. **Traceability**: goals → requirements → architecture → epics (matrix generated)
397
- 4. **Depth**: acceptance criteria testable, ADRs justified, stories estimable
398
-
399
- Gate decision: Pass (>=80) / Review (60-79) / Fail (<60)
400
-
401
- **Step 8.2: Generate Reports**
402
- - `readiness-report.md` — quality scores, issue list (Error/Warning/Info), traceability matrix
403
- - `spec-summary.md` — one-page executive summary
404
-
405
- **Step 8.3: Update Document Status**
406
- - All document frontmatter updated to `status: complete`
407
-
408
- **Step 8.4: Gate Routing**
409
-
410
- | Gate Result | Action |
411
- |-------------|--------|
412
- | Pass (>=80%) | Proceed to Step 11 (Phase 7: Roadmap Generation) |
413
- | Review (60-79%) | Proceed to Step 11 with caveats logged |
414
- | Fail (<60%) | Trigger Step 9 (Phase 6.5 Auto-Fix), then re-run Step 8 |
415
-
416
- ### Step 9: Auto-Fix (Phase 6.5, conditional)
417
-
418
- Triggered when Phase 6 score < 60%. Automatically repair specification issues.
419
-
420
- **Step 9.1: Parse Readiness Report**
421
- - Extract Error and Warning items
422
- - Group by originating phase (2-5)
423
- - Map to affected output files
424
-
425
- **Step 9.2: Fix Affected Phases (sequential, Phase 2→3→4→5)**
426
- - For each phase with issues:
427
- - Read current phase output
428
- - CLI re-generation with error context injected
429
- - Inject glossary for terminology consistency
430
- - Preserve unflagged content, only fix flagged issues
431
- - Increment document version
432
-
433
- **Step 9.3: Re-run Phase 6**
434
- - Generate new readiness-report.md
435
- - If still Fail and iteration_count < 2: loop back
436
- - If Pass or max iterations (2) reached: proceed to handoff
437
-
438
- **Output**: Updated Phase 2-5 documents, updated spec-config.json with iteration tracking
439
-
440
- ### Step 11: Roadmap Generation (Phase 7)
441
-
442
- Convert Epics into an interactive roadmap with user confirmation.
443
-
444
- **Step 11.1: Epic→Phase Mapping**
445
- - Read `epics/_index.md` for Epic table, dependency map, MVP tags
446
- - Read individual `EPIC-NNN-{slug}.md` for Stories and acceptance criteria
447
- - Read `architecture/_index.md` for technical constraints (ADR decisions)
448
-
449
- **Minimum-Phase Principle (MANDATORY — applied during mapping):**
450
-
451
- Phase = synchronization barrier (full plan→execute→verify cycle). Minimize phases for maximum execution efficiency. The wave DAG inside each Phase handles task ordering and parallelism.
452
-
453
- | Rule | Constraint |
454
- |------|-----------|
455
- | **Default** | **1 Phase**. Merge all Epics into a single phase; wave DAG handles internal ordering. |
456
- | **Maximum** | **2 Phases**. Only when a hard dependency boundary exists that cannot be resolved. |
457
- | **Exceptional** | **3 Phases**. Must explicitly justify why 2 is insufficient. |
458
- | **Minimum Stories per phase** | 5 Stories. If an Epic maps to fewer than 5 Stories, merge with related Epic. |
459
- | **Merge principle** | Small Epics (1-2 Stories, all size S) MUST be merged. Same-module or same-concern Epics belong together. Multiple Epics → one phase is normal. |
460
- | **Split principle** | Only split when ALL three hard-dependency conditions are met: (1) runtime dependency — cannot mock/stub, (2) not parallelizable via contract/interface, (3) full barrier — all of Phase A must complete before any of Phase B starts. |
461
-
462
- - Map (with minimum-phase principle applied):
463
- - Default: ALL Epics → 1 Phase (wave DAG orders tasks by Epic dependencies)
464
- - Only split if hard dependency conditions are all met
465
- - MVP-tagged Epics → Milestone 1, Post-MVP → Milestone 2+
466
- - Epic dependencies → wave ordering within phase (not phase splits)
467
- - Stories within Epics → phase success criteria
468
- - ADR decisions → phase technical constraints
469
-
470
- **Post-mapping sizing check:**
471
- 1. Count total phases. If > 2 → justify each split against the 3 hard-dependency conditions, merge if unjustified.
472
- 2. Count Stories per phase. Any phase < 5 Stories → merge into neighbor.
473
- 3. Verify each phase has a meaningful deliverable boundary.
474
-
475
- **Scope escalation:**
476
- - **Single project** (any size): 1-2 Phases. Use wave DAG for internal parallelism.
477
- - **Large scope** (monorepo with 2+ independently deployable services): Use **Milestones**. Each Milestone follows the 1-2 Phase limit independently.
478
-
479
- **Step 11.2: Generate Draft Roadmap**
480
- - Produce `roadmap.md` following `@templates/roadmap.md` structure:
481
- ```markdown
482
- # Roadmap: {project_name}
483
-
484
- ## Overview
485
- <from product-brief.md vision>
486
-
487
- ## Phases
488
- - [ ] **Phase 1: {Epic Title}** - {one-line goal}
489
- - [ ] **Phase 2: {Epic Title}** - {one-line goal}
490
-
491
- ## Phase Details
492
-
493
- ### Phase 1: {Epic Title}
494
- **Goal**: {Epic goal}
495
- **Depends on**: {from Epic dependency map}
496
- **Requirements**: {REQ-IDs traced from Epic→Stories→Requirements}
497
- **Success Criteria** (what must be TRUE):
498
- 1. {from Stories' acceptance criteria — observable behavior}
499
- 2. {from Stories' acceptance criteria — observable behavior}
500
-
501
- ## Scope Decisions
502
- - **In scope**: {MVP Epics}
503
- - **Deferred**: {Post-MVP Epics}
504
- - **Out of scope**: {from product-brief non-goals}
505
-
506
- ## Progress
507
- | Phase | Status | Completed |
508
- |-------|--------|-----------|
509
- | 1. {Title} | Not started | - |
510
- ```
511
-
512
- **Step 11.3: Interactive Refinement (max 3 rounds)**
513
- - Present roadmap overview: phase count, milestone structure, dependency graph
514
- - **Before presenting**: validate minimum-phase principle (default 1, max 2, exceptional 3). Auto-merge violations and inform user.
515
- - User feedback via AskUserQuestion:
516
- - **Approve**: Run final sizing check before accepting
517
- - **Adjust Scope**: Move Epics between milestones, merge phases (enforce minimum-phase principle)
518
- - **Reorder**: Change phase sequencing
519
- - **Split/Merge**: Combine small phases (min 5 tasks enforced); splits require hard-dependency justification
520
- - `--yes`: auto-approve draft roadmap (minimum-phase principle still enforced automatically)
521
- - Each round: update roadmap.md, log change in iteration history
522
-
523
- **Step 11.4: Write Outputs**
524
- - Write `roadmap.md` to spec directory: `{spec_dir}/roadmap.md`
525
- - If `.workflow/` exists: also write to `.workflow/roadmap.md`
526
- - Update `spec-config.json`: add Phase 7 completion
527
-
528
- **Step 11.5: Handoff Options (AskUserQuestion)**
529
-
530
- | Option | Action |
531
- |--------|--------|
532
- | Initialize project | Skill({ skill: "maestro-init" }) — set up project infrastructure |
533
- | Plan first phase | Skill({ skill: "maestro-plan", args: "1" }) — plan first roadmap phase |
534
- | Create issues | Generate issues per phase via Skill({ skill: "manage-issue" }) |
535
- | Export only | Spec + roadmap complete, no further action |
536
-
537
- ### Step 12: Final Report
538
-
539
- ```
540
- == spec-generate complete ==
541
- Session: SPEC-{slug}-{date}
542
- Output: .workflow/.spec/{session_id}/
543
- Quality: {score}% ({gate})
544
- Phases: {completed_count}/7
545
-
546
- Files:
547
- spec-config.json — Session state
548
- product-brief.md — Product brief
549
- requirements/ — PRD ({req_count} REQs + {nfr_count} NFRs)
550
- architecture/ — Architecture ({adr_count} ADRs)
551
- epics/ — Epics & Stories ({epic_count} Epics)
552
- readiness-report.md — Quality validation
553
- spec-summary.md — Executive summary
554
- roadmap.md — Project roadmap ({phase_count} phases, {milestone_count} milestones)
555
-
556
- Next:
557
- Skill({ skill: "maestro-init" }) — Set up project
558
- Skill({ skill: "maestro-plan", args: "1" }) — Plan first phase
559
- ```
560
-
561
- ---
562
-
563
- ## Key Design Principles
564
-
565
- 1. **Document Chain**: Each phase builds on previous outputs with traceability
566
- 2. **Multi-Perspective Analysis**: CLI tools provide product, technical, and user perspectives
567
- 3. **Interactive by Default**: Each phase offers user confirmation; `-y` enables auto mode
568
- 4. **Resumable Sessions**: spec-config.json tracks phases; `-c` resumes from checkpoint
569
- 5. **Template-Driven**: All documents from standardized templates with YAML frontmatter
570
- 6. **Spec Type Specialization**: Templates adapt to service/api/library/platform via profiles
571
- 7. **Terminology Consistency**: glossary.json from Phase 2 injected into all subsequent phases
572
- 8. **Iterative Quality**: Phase 6.5 auto-fix loop (max 2 iterations)
573
- 9. **Brainstorm Integration**: `--from-brainstorm` imports guidance-specification.md as seed
574
-
575
- ## State Management
576
-
577
- **spec-config.json**:
578
- ```json
579
- {
580
- "session_id": "SPEC-xxx-2026-03-15",
581
- "seed_input": "User input text",
582
- "input_type": "text|file|brainstorm",
583
- "timestamp": "ISO8601",
584
- "mode": "interactive|auto",
585
- "complexity": "simple|moderate|complex",
586
- "depth": "light|standard|comprehensive",
587
- "focus_areas": [],
588
- "spec_type": "service|api|library|platform",
589
- "iteration_count": 0,
590
- "iteration_history": [],
591
- "seed_analysis": {
592
- "problem_statement": "...",
593
- "target_users": [],
594
- "domain": "...",
595
- "constraints": [],
596
- "dimensions": []
597
- },
598
- "has_codebase": false,
599
- "phasesCompleted": [
600
- { "phase": 1, "name": "discovery", "output_file": "spec-config.json", "completed_at": "ISO8601" }
601
- ]
602
- }
603
- ```
604
-
605
- Resume: `-c` reads spec-config.json, resumes from first incomplete phase.
606
-
607
- ## Quality Dimensions (Phase 6)
608
-
609
- | Dimension | Weight | Focus |
610
- |-----------|--------|-------|
611
- | Completeness | 25% | All sections present with substance |
612
- | Consistency | 25% | Terminology, scope, non-goals alignment |
613
- | Traceability | 25% | Goals → Reqs → Arch → Epics chain |
614
- | Depth | 25% | Testable criteria, justified decisions, estimable stories |
615
-
616
- **Gate**: Pass (>=80%) / Review (60-79%) / Fail (<60%)
617
-
618
- ## Handoff to maestro-init
619
-
620
- When spec-generate completes, `roadmap.md` is already generated (Phase 7).
621
- Run `maestro-init` to set up project infrastructure (project.md, state.json, config.json, specs/).
622
- Init detects existing `.workflow/roadmap.md` and skips roadmap creation.
623
-
624
- ## Error Handling
625
-
626
- | Phase | Error | Blocking? | Action |
627
- |-------|-------|-----------|--------|
628
- | Phase 1 | Empty input | Yes | Error and exit |
629
- | Phase 1 | CLI analysis fails | No | Basic parsing fallback |
630
- | Phase 1.5 | Gap analysis fails | No | Skip to basic prompts |
631
- | Phase 2 | Single CLI fails | No | Continue with available |
632
- | Phase 3 | Gemini fails | No | Codex fallback |
633
- | Phase 4 | Review fails | No | Skip review |
634
- | Phase 5 | Story generation fails | No | Generate epics only |
635
- | Phase 6 | Validation fails | No | Partial report |
636
- | Phase 6.5 | Max iterations (2) | No | Force handoff |
637
-
638
- | Step 2.5 | External research fails | No | apiResearchContext = null, continue |
639
-
640
- CLI Fallback Chain: Gemini → Codex → Claude → degraded mode (local only)
1
+ # Workflow: Spec Generate
2
+
3
+ Specification document chain producing a complete specification package (Product Brief, PRD, Architecture, Epics, Roadmap) through 7 sequential phases with multi-CLI analysis and interactive refinement. Pure documentation — no code generation.
4
+
5
+ ## Worktree Guard
6
+
7
+ ```
8
+ # Block in worktree
9
+ IF file_exists(".workflow/worktree-scope.json"):
10
+ ERROR "Cannot run maestro-spec-generate inside a worktree. Run from the main worktree."
11
+ EXIT
12
+ ```
13
+
14
+ ## Pipeline Position
15
+
16
+ ```
17
+ maestro-brainstorm (optional upstream)
18
+ ↓ guidance-specification.md
19
+ maestro-init (REQUIRED first step — project setup)
20
+ ↓ project.md, state.json, config.json
21
+ maestro-spec-generate ← THIS (heavy path)
22
+ ↓ spec package + roadmap.md → .workflow/roadmap.md
23
+ maestro-plan → maestro-execute → maestro-verify
24
+
25
+ Alternative light path (skip spec-generate):
26
+ maestro-init → maestro-roadmap → roadmap.md directly
27
+
28
+ Note: maestro-init MUST run before spec-generate.
29
+ ```
30
+
31
+ ## Architecture
32
+
33
+ ```
34
+ Phase 0: Specification Study (read specs + templates)
35
+ |
36
+ Phase 1: Discovery → spec-config.json + discovery-context.json
37
+ | (includes spec_type selection)
38
+ Phase 1.5: Req Expansion → refined-requirements.json
39
+ | (-y: auto-expansion, skip interaction)
40
+ Phase 2: Product Brief → product-brief.md + glossary.json
41
+ | (multi-CLI parallel analysis)
42
+ Phase 3: Requirements (PRD) → requirements/ (_index.md + REQ-*.md + NFR-*.md)
43
+ | (RFC 2119, data model definitions)
44
+ Phase 4: Architecture → architecture/ (_index.md + ADR-*.md)
45
+ | (state machine, config model, error handling, observability)
46
+ Phase 5: Epics & Stories → epics/ (_index.md + EPIC-*.md)
47
+ |
48
+ Phase 6: Readiness Check → readiness-report.md + spec-summary.md
49
+ | (terminology + scope consistency validation)
50
+ ├── Pass (>=80%): Proceed to Phase 7
51
+ ├── Review (60-79%): Proceed with caveats
52
+ └── Fail (<60%): Phase 6.5 Auto-Fix (max 2 iterations)
53
+ |
54
+ Phase 6.5: Auto-Fix → Updated Phase 2-5 documents
55
+ └── Re-run Phase 6 validation
56
+ |
57
+ Phase 7: Roadmap Generation → roadmap.md + .workflow/roadmap.md
58
+ (Epic→Phase mapping, interactive refinement)
59
+ ```
60
+
61
+ ## Arguments
62
+
63
+ ```
64
+ $ARGUMENTS: "<idea or @file> [-y] [-c] [--from-brainstorm SESSION-ID]"
65
+
66
+ <idea> -- Idea text or @file reference
67
+ -y / --yes -- Auto mode, skip interactive questions
68
+ -c / --continue -- Resume from last checkpoint
69
+ --from-brainstorm -- Import brainstorm session as enriched seed
70
+ ```
71
+
72
+ ## Output Structure
73
+
74
+ ```
75
+ .workflow/.spec/SPEC-{slug}-{YYYY-MM-DD}/
76
+ ├── spec-config.json # Session configuration + phase state
77
+ ├── discovery-context.json # Codebase exploration (optional)
78
+ ├── refined-requirements.json # Phase 1.5: Confirmed requirements
79
+ ├── glossary.json # Phase 2: Terminology glossary
80
+ ├── product-brief.md # Phase 2: Product brief
81
+ ├── requirements/ # Phase 3: Detailed PRD
82
+ │ ├── _index.md # Summary, MoSCoW table, traceability
83
+ │ ├── REQ-NNN-{slug}.md # Functional requirement
84
+ │ └── NFR-{type}-NNN-{slug}.md # Non-functional requirement
85
+ ├── architecture/ # Phase 4: Architecture decisions
86
+ │ ├── _index.md # Overview, components, tech stack
87
+ │ └── ADR-NNN-{slug}.md # Architecture Decision Record
88
+ ├── epics/ # Phase 5: Epic/Story breakdown
89
+ │ ├── _index.md # Epic table, dependency map, MVP
90
+ │ └── EPIC-NNN-{slug}.md # Individual Epic with Stories
91
+ ├── readiness-report.md # Phase 6: Quality report
92
+ ├── spec-summary.md # Phase 6: Executive summary
93
+ └── roadmap.md # Phase 7: Project roadmap (also written to .workflow/roadmap.md)
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Process
99
+
100
+ ### Step 1: Prerequisite Loading (Phase 0)
101
+
102
+ Before any operations, load specification and template documents:
103
+
104
+ | Document | Purpose | Priority |
105
+ |----------|---------|----------|
106
+ | Document standards | Format, frontmatter, naming conventions | P0 - must read |
107
+ | Quality gates | Per-phase quality criteria and scoring | P0 - must read |
108
+ | Templates | product-brief, requirements-prd, architecture-doc, epics-template | Read on-demand per phase |
109
+
110
+ **Load project specs:**
111
+ ```
112
+ specs_content = maestro spec load --category arch
113
+ ```
114
+ Used in Phase 3 (architecture doc) and Phase 6 (epic decomposition) for constraint awareness.
115
+
116
+ These inform validation and output formatting for all subsequent phases.
117
+
118
+ **Load project history (if `.workflow/` exists):**
119
+ ```
120
+ IF .workflow/project.md exists:
121
+ Read project.md:
122
+ - "### Validated" → already_shipped (DO NOT re-specify)
123
+ - "### Active" → current_scope
124
+ - "## Context" → project_history (milestone summaries)
125
+ - "## Key Decisions" → locked_decisions
126
+
127
+ IF .workflow/state.json exists:
128
+ Read state.json.accumulated_context:
129
+ - deferred[] → candidate_requirements (high priority for this iteration)
130
+ - key_decisions[] → architectural_constraints
131
+
132
+ ```
133
+
134
+ **Rules**:
135
+ - Features in `already_shipped` are EXCLUDED from spec generation scope — they are done
136
+ - `deferred` items from previous milestone are HIGH PRIORITY candidates
137
+ - `locked_decisions` constrain architecture choices in Phase 4
138
+ - `lessons_learned` inform risk assessment in Phase 1 and architecture decisions in Phase 4
139
+ - Pass assembled `project_context` to Phase 1 seed analysis and Phase 7 roadmap generation
140
+
141
+ ### Step 2: Discovery & Seed Analysis (Phase 1)
142
+
143
+ Parse input, analyze the seed idea, optionally explore codebase, establish session.
144
+
145
+ **Step 2.1: Input Parsing**
146
+ - Parse $ARGUMENTS: extract idea/topic, flags (-y, -c, --from-brainstorm)
147
+ - If `-c`: read spec-config.json, resume from first incomplete phase
148
+ - If `--from-brainstorm SESSION-ID`:
149
+ - Locate brainstorm session directory
150
+ - Read `guidance-specification.md` as enriched seed (already has terminology, non-goals, feature decomposition)
151
+ - Extract problem statement, features, roles from specification
152
+ - Set `input_type: "brainstorm"` — skip Phase 1.5 (requirements already clarified)
153
+ - If `@file`: read file content as seed
154
+ - If text: use directly as seed
155
+ - Missing input → error E001
156
+
157
+ **Step 2.2: Session Initialization**
158
+ ```
159
+ Session ID: SPEC-{slug}-{YYYY-MM-DD}
160
+ Output dir: .workflow/.spec/{session_id}/
161
+ ```
162
+
163
+ **Step 2.3: Seed Analysis via CLI**
164
+ - Spawn CLI analysis to extract: problem_statement, target_users, domain, constraints, dimensions (3-5)
165
+ - Assess complexity: simple (1-2 components) / moderate (3-5) / complex (6+)
166
+ - For brainstorm input: enrich with feature decomposition data
167
+
168
+ **Step 2.4: Codebase Exploration (conditional)**
169
+ - Detect if project has source files (*.ts, *.js, *.py, etc.)
170
+ - If yes: spawn cli-explore-agent for context discovery
171
+ - Output: `discovery-context.json` with relevant_files, patterns, tech_stack
172
+
173
+ **Step 2.5: External Research — API & Technology Details (Optional)**
174
+
175
+ Spawn `workflow-external-researcher` agent to gather concrete API details, library versions, and integration patterns for the technologies identified in seed analysis and codebase exploration.
176
+
177
+ **Trigger**: When seed analysis identifies specific technologies, APIs, or external services. Auto-trigger in auto mode (`-y`). Skip if topic is purely conceptual with no technology keywords.
178
+
179
+ ```
180
+ // Step 2.5.1: Build research queries from seed analysis
181
+ researchTopics = extract from seed_analysis:
182
+ - Named technologies/frameworks (e.g., "OAuth 2.0", "WebSocket", "PostgreSQL")
183
+ - External APIs/services mentioned (e.g., "Stripe API", "SendGrid")
184
+ - Domain-specific protocols or standards
185
+
186
+ IF researchTopics is empty: skip to Step 2.6, set apiResearchContext = null
187
+
188
+ // Step 2.5.2: Spawn external researcher
189
+ Agent(
190
+ subagent_type="workflow-external-researcher",
191
+ prompt="""
192
+ <objective>
193
+ Research API details and technology specifics for: {seed_analysis.problem_statement}
194
+ Mode: API Research
195
+ </objective>
196
+
197
+ <context>
198
+ Technologies identified: {researchTopics}
199
+ Domain: {seed_analysis.domain}
200
+ Spec type: {spec_type or "TBD"}
201
+ Codebase tech stack: {discovery_context.tech_stack or "none"}
202
+ </context>
203
+
204
+ <task>
205
+ For each identified technology/API:
206
+ 1. Current stable version and key capabilities
207
+ 2. API surface: core endpoints/methods, authentication model, rate limits
208
+ 3. Integration patterns: recommended setup, configuration, common middleware
209
+ 4. Data models: key entities, request/response shapes
210
+ 5. Known limitations, deprecations, or migration paths
211
+
212
+ Focus on CONCRETE details — versions, method signatures, config options.
213
+ Be prescriptive. Return structured markdown only — do NOT write files.
214
+ </task>
215
+ """,
216
+ run_in_background=false
217
+ )
218
+
219
+ // Step 2.5.3: Store as apiResearchContext (in-memory)
220
+ apiResearchContext = agent_output
221
+ ```
222
+
223
+ `apiResearchContext` is passed into:
224
+ - Step 4 (Product Brief): technology feasibility assessment
225
+ - Step 5 (Requirements): API-aware requirement writing with concrete constraints
226
+ - Step 6 (Architecture): informed ADR decisions with version-specific details
227
+ - Step 7 (Epics): realistic story sizing based on API complexity
228
+
229
+ If research fails (W005): `apiResearchContext = null`, continue without external context.
230
+
231
+ **Step 2.6: Spec Type Selection**
232
+ - Interactive (AskUserQuestion): Service / API / Library / Platform
233
+ - `--yes`: default to "service"
234
+ - Each type loads a profile template for domain-specific sections
235
+
236
+ **Step 2.7: User Confirmation (interactive)**
237
+ - Confirm problem statement, select depth (Light/Standard/Comprehensive), select focus areas
238
+ - `--yes`: accept all defaults
239
+
240
+ **Output**: `spec-config.json` (session state), `discovery-context.json` (optional), `apiResearchContext` (in-memory, optional)
241
+
242
+ ### Step 3: Requirement Expansion & Clarification (Phase 1.5)
243
+
244
+ Skip if `--from-brainstorm` (requirements already in guidance-specification.md).
245
+
246
+ **Step 3.1: CLI Gap Analysis**
247
+ - Analyze seed for completeness (score 1-10), identify missing dimensions
248
+ - Generate 3-5 clarification areas with questions and expansion suggestions
249
+ - Dimensions checked: functional scope, user scenarios, NFRs, integrations, data model, error handling
250
+
251
+ **Step 3.2: Interactive Discussion Loop (max 5 rounds)**
252
+ - Round 1: present gap analysis + expansion suggestions via AskUserQuestion
253
+ - Round N: CLI follow-up analysis based on user responses, refine requirements
254
+ - User can: answer questions, accept suggestions, or skip to generation
255
+ - `--yes`: CLI auto-expansion without interaction
256
+
257
+ **Step 3.3: User Confirmation**
258
+ - Present requirement summary, user confirms or requests adjustments
259
+ - `--yes`: auto-confirm
260
+
261
+ **Output**: `refined-requirements.json` (confirmed features, NFRs, boundaries, assumptions)
262
+
263
+ ### Step 4: Product Brief (Phase 2)
264
+
265
+ Generate product brief through multi-perspective CLI analysis.
266
+
267
+ **Step 4.1: Load Context**
268
+ - Read refined-requirements.json (preferred) or seed_analysis fallback
269
+ - Read discovery-context.json (if codebase detected)
270
+ - For brainstorm input: read guidance-specification.md sections
271
+
272
+ **Step 4.2: Multi-CLI Parallel Analysis (3 perspectives)**
273
+
274
+ | Perspective | CLI Tool | Focus |
275
+ |-------------|----------|-------|
276
+ | Product | gemini | Vision, market fit, success criteria, scope boundaries |
277
+ | Technical | codex | Feasibility, constraints, integration complexity, tech recommendations |
278
+ | User | claude | Personas, journey maps, pain points, UX criteria |
279
+
280
+ **Step 4.3: Synthesis**
281
+ - Extract convergent themes (all agree), conflicts (need resolution), unique insights
282
+ - For brainstorm input: cross-reference with guidance-specification decisions
283
+ - If `apiResearchContext` is set: inject API details into technical feasibility assessment, enrich technology recommendations with concrete versions and constraints
284
+
285
+ **Step 4.4: Interactive Refinement**
286
+ - Present synthesis, user adjusts scope/vision
287
+ - `--yes`: accept synthesis as-is
288
+
289
+ **Step 4.5: Generate Outputs**
290
+ - `product-brief.md` from template (YAML frontmatter + filled content)
291
+ - `glossary.json` — 5+ core terms extracted from product brief and CLI analysis
292
+ - Each term: canonical name, definition, aliases, category (core/technical/business)
293
+ - Injected into all subsequent phase CLI prompts for terminology consistency
294
+
295
+ **Output**: `product-brief.md`, `glossary.json`
296
+
297
+ ### Step 5: Requirements / PRD (Phase 3)
298
+
299
+ Generate detailed PRD with functional/non-functional requirements.
300
+
301
+ **Step 5.1: Requirement Expansion via CLI**
302
+ - For each product brief goal, generate 3-7 functional requirements
303
+ - Each requirement: REQ-NNN ID, title, description, user story, 2-4 acceptance criteria
304
+ - Generate non-functional requirements: performance, security, scalability, usability
305
+ - Apply RFC 2119 keywords (MUST/SHOULD/MAY) to all behavioral constraints
306
+ - Define core entity data models: fields, types, constraints, relationships
307
+ - Inject glossary.json for terminology consistency
308
+
309
+ **Step 5.2: MoSCoW Priority Sorting (interactive)**
310
+ - Present requirements grouped by initial priority
311
+ - User adjusts Must/Should/Could/Won't labels
312
+ - Select MVP scope: Must-only / Must+key Should / Comprehensive
313
+ - `--yes`: accept CLI-suggested priorities
314
+
315
+ **Step 5.3: Generate Directory**
316
+ - `requirements/_index.md` — summary table, MoSCoW breakdown, traceability matrix
317
+ - `requirements/REQ-NNN-{slug}.md` — one per functional requirement
318
+ - `requirements/NFR-{type}-NNN-{slug}.md` — one per non-functional requirement
319
+
320
+ **Output**: `requirements/` directory (index + individual files)
321
+
322
+ ### Step 6: Architecture (Phase 4)
323
+
324
+ Generate architecture decisions, component design, and technology selections.
325
+
326
+ **Step 6.1: Architecture Analysis via CLI (gemini)**
327
+ - System architecture style with justification
328
+ - Core components and responsibilities
329
+ - Component interaction diagram (Mermaid graph TD)
330
+ - Technology stack: languages, frameworks, databases, infrastructure
331
+ - 2-4 Architecture Decision Records (ADRs): context, decision, alternatives, consequences
332
+ - Data model: entities and relationships (Mermaid erDiagram)
333
+ - Security architecture: auth, authorization, data protection
334
+ - **State machine**: ASCII diagram + transition table for lifecycle entities (service/platform type)
335
+ - **Configuration model**: all configurable fields with type, default, constraint
336
+ - **Error handling strategy**: per-component classification (transient/permanent/degraded), recovery mechanisms
337
+ - **Observability**: key metrics (5+), structured log events, health checks
338
+ - Spec type profile injection for domain-specific depth
339
+ - Glossary injection for terminology consistency
340
+ - If `apiResearchContext` is set: inject as "External API Research" context — concrete versions, API surfaces, integration patterns inform ADR decisions and technology stack selection
341
+
342
+ **Step 6.2: Architecture Review via CLI (codex)**
343
+ - Challenge each ADR, identify scalability bottlenecks
344
+ - Assess security gaps, evaluate technology choices
345
+ - Rate overall quality 1-5
346
+
347
+ **Step 6.3: Interactive ADR Decisions**
348
+ - Present ADRs with review feedback, user decides: accept / incorporate feedback / simplify
349
+ - `--yes`: auto-accept
350
+
351
+ **Step 6.4: Codebase Integration Mapping (conditional)**
352
+ - Map new components to existing code modules
353
+
354
+ **Step 6.5: Generate Directory**
355
+ - `architecture/_index.md` — overview, component diagram, tech stack, data model, security
356
+ - `architecture/ADR-NNN-{slug}.md` — one per Architecture Decision Record
357
+
358
+ **Output**: `architecture/` directory (index + individual ADR files)
359
+
360
+ ### Step 7: Epics & Stories (Phase 5)
361
+
362
+ Decompose specification into executable Epics and Stories.
363
+
364
+ **Step 7.1: Epic Decomposition via CLI**
365
+ - Group requirements into logical Epics (EPIC-NNN IDs). Epic count is unconstrained — Phase 7 will merge Epics into minimal phases via the minimum-phase principle.
366
+ - Tag MVP subset
367
+ - For each Epic: 2-5 Stories in "As a...I want...So that..." format
368
+ - Each Story: 2-4 testable acceptance criteria, relative size (S/M/L/XL), trace to REQ-NNN
369
+ - Cross-Epic dependency map (Mermaid graph LR)
370
+ - Recommended execution order with rationale
371
+ - MVP definition of done (3-5 criteria)
372
+
373
+ **Epic sizing awareness** (informs Phase 7 roadmap generation):
374
+ - Epics that are too small (1-2 Stories, all size S) should be flagged for merge in Phase 7
375
+ - Each Epic should carry enough substance to become part of a phase with 5+ tasks
376
+ - Prefer fewer, larger Epics over many tiny ones
377
+
378
+ **Step 7.2: Interactive Validation**
379
+ - Present Epic overview, user adjusts: merge/split epics, adjust MVP scope
380
+ - `--yes`: accept as-is
381
+
382
+ **Step 7.3: Generate Directory**
383
+ - `epics/_index.md` — overview table, dependency map, MVP scope, execution order, traceability
384
+ - `epics/EPIC-NNN-{slug}.md` — one per Epic with embedded Stories
385
+
386
+ **Output**: `epics/` directory (index + individual Epic files)
387
+
388
+ ### Step 8: Readiness Check & Handoff (Phase 6)
389
+
390
+ Validate specification package and provide execution handoff.
391
+
392
+ **Step 8.1: Cross-Document Validation via CLI**
393
+ Score on 4 dimensions (25% each):
394
+ 1. **Completeness**: all required sections present with substantive content
395
+ 2. **Consistency**: terminology uniform (glossary compliance), scope containment, non-goals respected
396
+ 3. **Traceability**: goals → requirements → architecture → epics (matrix generated)
397
+ 4. **Depth**: acceptance criteria testable, ADRs justified, stories estimable
398
+
399
+ Gate decision: Pass (>=80) / Review (60-79) / Fail (<60)
400
+
401
+ **Step 8.2: Generate Reports**
402
+ - `readiness-report.md` — quality scores, issue list (Error/Warning/Info), traceability matrix
403
+ - `spec-summary.md` — one-page executive summary
404
+
405
+ **Step 8.3: Update Document Status**
406
+ - All document frontmatter updated to `status: complete`
407
+
408
+ **Step 8.4: Gate Routing**
409
+
410
+ | Gate Result | Action |
411
+ |-------------|--------|
412
+ | Pass (>=80%) | Proceed to Step 11 (Phase 7: Roadmap Generation) |
413
+ | Review (60-79%) | Proceed to Step 11 with caveats logged |
414
+ | Fail (<60%) | Trigger Step 9 (Phase 6.5 Auto-Fix), then re-run Step 8 |
415
+
416
+ ### Step 9: Auto-Fix (Phase 6.5, conditional)
417
+
418
+ Triggered when Phase 6 score < 60%. Automatically repair specification issues.
419
+
420
+ **Step 9.1: Parse Readiness Report**
421
+ - Extract Error and Warning items
422
+ - Group by originating phase (2-5)
423
+ - Map to affected output files
424
+
425
+ **Step 9.2: Fix Affected Phases (sequential, Phase 2→3→4→5)**
426
+ - For each phase with issues:
427
+ - Read current phase output
428
+ - CLI re-generation with error context injected
429
+ - Inject glossary for terminology consistency
430
+ - Preserve unflagged content, only fix flagged issues
431
+ - Increment document version
432
+
433
+ **Step 9.3: Re-run Phase 6**
434
+ - Generate new readiness-report.md
435
+ - If still Fail and iteration_count < 2: loop back
436
+ - If Pass or max iterations (2) reached: proceed to handoff
437
+
438
+ **Output**: Updated Phase 2-5 documents, updated spec-config.json with iteration tracking
439
+
440
+ ### Step 11: Roadmap Generation (Phase 7)
441
+
442
+ Convert Epics into an interactive roadmap with user confirmation.
443
+
444
+ **Step 11.1: Epic→Phase Mapping**
445
+ - Read `epics/_index.md` for Epic table, dependency map, MVP tags
446
+ - Read individual `EPIC-NNN-{slug}.md` for Stories and acceptance criteria
447
+ - Read `architecture/_index.md` for technical constraints (ADR decisions)
448
+
449
+ **Minimum-Phase Principle (MANDATORY — applied during mapping):**
450
+
451
+ Phase = synchronization barrier (full plan→execute→verify cycle). Minimize phases for maximum execution efficiency. The wave DAG inside each Phase handles task ordering and parallelism.
452
+
453
+ | Rule | Constraint |
454
+ |------|-----------|
455
+ | **Default** | **1 Phase**. Merge all Epics into a single phase; wave DAG handles internal ordering. |
456
+ | **Maximum** | **2 Phases**. Only when a hard dependency boundary exists that cannot be resolved. |
457
+ | **Exceptional** | **3 Phases**. Must explicitly justify why 2 is insufficient. |
458
+ | **Minimum Stories per phase** | 5 Stories. If an Epic maps to fewer than 5 Stories, merge with related Epic. |
459
+ | **Merge principle** | Small Epics (1-2 Stories, all size S) MUST be merged. Same-module or same-concern Epics belong together. Multiple Epics → one phase is normal. |
460
+ | **Split principle** | Only split when ALL three hard-dependency conditions are met: (1) runtime dependency — cannot mock/stub, (2) not parallelizable via contract/interface, (3) full barrier — all of Phase A must complete before any of Phase B starts. |
461
+
462
+ - Map (with minimum-phase principle applied):
463
+ - Default: ALL Epics → 1 Phase (wave DAG orders tasks by Epic dependencies)
464
+ - Only split if hard dependency conditions are all met
465
+ - MVP-tagged Epics → Milestone 1, Post-MVP → Milestone 2+
466
+ - Epic dependencies → wave ordering within phase (not phase splits)
467
+ - Stories within Epics → phase success criteria
468
+ - ADR decisions → phase technical constraints
469
+
470
+ **Post-mapping sizing check:**
471
+ 1. Count total phases. If > 2 → justify each split against the 3 hard-dependency conditions, merge if unjustified.
472
+ 2. Count Stories per phase. Any phase < 5 Stories → merge into neighbor.
473
+ 3. Verify each phase has a meaningful deliverable boundary.
474
+
475
+ **Scope escalation:**
476
+ - **Single project** (any size): 1-2 Phases. Use wave DAG for internal parallelism.
477
+ - **Large scope** (monorepo with 2+ independently deployable services): Use **Milestones**. Each Milestone follows the 1-2 Phase limit independently.
478
+
479
+ **Step 11.2: Generate Draft Roadmap**
480
+ - Produce `roadmap.md` following `@templates/roadmap.md` structure:
481
+ ```markdown
482
+ # Roadmap: {project_name}
483
+
484
+ ## Overview
485
+ <from product-brief.md vision>
486
+
487
+ ## Phases
488
+ - [ ] **Phase 1: {Epic Title}** - {one-line goal}
489
+ - [ ] **Phase 2: {Epic Title}** - {one-line goal}
490
+
491
+ ## Phase Details
492
+
493
+ ### Phase 1: {Epic Title}
494
+ **Goal**: {Epic goal}
495
+ **Depends on**: {from Epic dependency map}
496
+ **Requirements**: {REQ-IDs traced from Epic→Stories→Requirements}
497
+ **Success Criteria** (what must be TRUE):
498
+ 1. {from Stories' acceptance criteria — observable behavior}
499
+ 2. {from Stories' acceptance criteria — observable behavior}
500
+
501
+ ## Scope Decisions
502
+ - **In scope**: {MVP Epics}
503
+ - **Deferred**: {Post-MVP Epics}
504
+ - **Out of scope**: {from product-brief non-goals}
505
+
506
+ ## Progress
507
+ | Phase | Status | Completed |
508
+ |-------|--------|-----------|
509
+ | 1. {Title} | Not started | - |
510
+ ```
511
+
512
+ **Step 11.3: Interactive Refinement (max 3 rounds)**
513
+ - Present roadmap overview: phase count, milestone structure, dependency graph
514
+ - **Before presenting**: validate minimum-phase principle (default 1, max 2, exceptional 3). Auto-merge violations and inform user.
515
+ - User feedback via AskUserQuestion:
516
+ - **Approve**: Run final sizing check before accepting
517
+ - **Adjust Scope**: Move Epics between milestones, merge phases (enforce minimum-phase principle)
518
+ - **Reorder**: Change phase sequencing
519
+ - **Split/Merge**: Combine small phases (min 5 tasks enforced); splits require hard-dependency justification
520
+ - `--yes`: auto-approve draft roadmap (minimum-phase principle still enforced automatically)
521
+ - Each round: update roadmap.md, log change in iteration history
522
+
523
+ **Step 11.4: Write Outputs**
524
+ - Write `roadmap.md` to spec directory: `{spec_dir}/roadmap.md`
525
+ - If `.workflow/` exists: also write to `.workflow/roadmap.md`
526
+ - Update `spec-config.json`: add Phase 7 completion
527
+
528
+ **Step 11.5: Handoff Options (AskUserQuestion)**
529
+
530
+ | Option | Action |
531
+ |--------|--------|
532
+ | Initialize project | Skill({ skill: "maestro-init" }) — set up project infrastructure |
533
+ | Plan first phase | Skill({ skill: "maestro-plan", args: "1" }) — plan first roadmap phase |
534
+ | Create issues | Generate issues per phase via Skill({ skill: "manage-issue" }) |
535
+ | Export only | Spec + roadmap complete, no further action |
536
+
537
+ ### Step 12: Final Report
538
+
539
+ ```
540
+ == spec-generate complete ==
541
+ Session: SPEC-{slug}-{date}
542
+ Output: .workflow/.spec/{session_id}/
543
+ Quality: {score}% ({gate})
544
+ Phases: {completed_count}/7
545
+
546
+ Files:
547
+ spec-config.json — Session state
548
+ product-brief.md — Product brief
549
+ requirements/ — PRD ({req_count} REQs + {nfr_count} NFRs)
550
+ architecture/ — Architecture ({adr_count} ADRs)
551
+ epics/ — Epics & Stories ({epic_count} Epics)
552
+ readiness-report.md — Quality validation
553
+ spec-summary.md — Executive summary
554
+ roadmap.md — Project roadmap ({phase_count} phases, {milestone_count} milestones)
555
+
556
+ Next:
557
+ Skill({ skill: "maestro-init" }) — Set up project
558
+ Skill({ skill: "maestro-plan", args: "1" }) — Plan first phase
559
+ ```
560
+
561
+ ---
562
+
563
+ ## Key Design Principles
564
+
565
+ 1. **Document Chain**: Each phase builds on previous outputs with traceability
566
+ 2. **Multi-Perspective Analysis**: CLI tools provide product, technical, and user perspectives
567
+ 3. **Interactive by Default**: Each phase offers user confirmation; `-y` enables auto mode
568
+ 4. **Resumable Sessions**: spec-config.json tracks phases; `-c` resumes from checkpoint
569
+ 5. **Template-Driven**: All documents from standardized templates with YAML frontmatter
570
+ 6. **Spec Type Specialization**: Templates adapt to service/api/library/platform via profiles
571
+ 7. **Terminology Consistency**: glossary.json from Phase 2 injected into all subsequent phases
572
+ 8. **Iterative Quality**: Phase 6.5 auto-fix loop (max 2 iterations)
573
+ 9. **Brainstorm Integration**: `--from-brainstorm` imports guidance-specification.md as seed
574
+
575
+ ## State Management
576
+
577
+ **spec-config.json**:
578
+ ```json
579
+ {
580
+ "session_id": "SPEC-xxx-2026-03-15",
581
+ "seed_input": "User input text",
582
+ "input_type": "text|file|brainstorm",
583
+ "timestamp": "ISO8601",
584
+ "mode": "interactive|auto",
585
+ "complexity": "simple|moderate|complex",
586
+ "depth": "light|standard|comprehensive",
587
+ "focus_areas": [],
588
+ "spec_type": "service|api|library|platform",
589
+ "iteration_count": 0,
590
+ "iteration_history": [],
591
+ "seed_analysis": {
592
+ "problem_statement": "...",
593
+ "target_users": [],
594
+ "domain": "...",
595
+ "constraints": [],
596
+ "dimensions": []
597
+ },
598
+ "has_codebase": false,
599
+ "phasesCompleted": [
600
+ { "phase": 1, "name": "discovery", "output_file": "spec-config.json", "completed_at": "ISO8601" }
601
+ ]
602
+ }
603
+ ```
604
+
605
+ Resume: `-c` reads spec-config.json, resumes from first incomplete phase.
606
+
607
+ ## Quality Dimensions (Phase 6)
608
+
609
+ | Dimension | Weight | Focus |
610
+ |-----------|--------|-------|
611
+ | Completeness | 25% | All sections present with substance |
612
+ | Consistency | 25% | Terminology, scope, non-goals alignment |
613
+ | Traceability | 25% | Goals → Reqs → Arch → Epics chain |
614
+ | Depth | 25% | Testable criteria, justified decisions, estimable stories |
615
+
616
+ **Gate**: Pass (>=80%) / Review (60-79%) / Fail (<60%)
617
+
618
+ ## Handoff to maestro-init
619
+
620
+ When spec-generate completes, `roadmap.md` is already generated (Phase 7).
621
+ Run `maestro-init` to set up project infrastructure (project.md, state.json, config.json, specs/).
622
+ Init detects existing `.workflow/roadmap.md` and skips roadmap creation.
623
+
624
+ ## Error Handling
625
+
626
+ | Phase | Error | Blocking? | Action |
627
+ |-------|-------|-----------|--------|
628
+ | Phase 1 | Empty input | Yes | Error and exit |
629
+ | Phase 1 | CLI analysis fails | No | Basic parsing fallback |
630
+ | Phase 1.5 | Gap analysis fails | No | Skip to basic prompts |
631
+ | Phase 2 | Single CLI fails | No | Continue with available |
632
+ | Phase 3 | Gemini fails | No | Codex fallback |
633
+ | Phase 4 | Review fails | No | Skip review |
634
+ | Phase 5 | Story generation fails | No | Generate epics only |
635
+ | Phase 6 | Validation fails | No | Partial report |
636
+ | Phase 6.5 | Max iterations (2) | No | Force handoff |
637
+
638
+ | Step 2.5 | External research fails | No | apiResearchContext = null, continue |
639
+
640
+ CLI Fallback Chain: Gemini → Codex → Claude → degraded mode (local only)