maestro-flow 0.3.9 → 0.3.11

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 (281) hide show
  1. package/.claude/agents/workflow-collab-planner.md +1 -1
  2. package/.claude/agents/workflow-executor.md +1 -1
  3. package/.claude/agents/workflow-plan-checker.md +1 -1
  4. package/.claude/agents/workflow-planner.md +1 -1
  5. package/.claude/commands/learn-decompose.md +176 -176
  6. package/.claude/commands/learn-follow.md +167 -167
  7. package/.claude/commands/learn-retro.md +1 -1
  8. package/.claude/commands/maestro-analyze.md +46 -3
  9. package/.claude/commands/maestro-coordinate.md +1 -3
  10. package/.claude/commands/maestro-execute.md +14 -0
  11. package/.claude/commands/maestro-plan.md +16 -0
  12. package/.claude/commands/manage-harvest.md +131 -131
  13. package/.claude/commands/manage-issue-discover.md +2 -2
  14. package/.claude/commands/manage-issue.md +5 -5
  15. package/.claude/commands/spec-add.md +67 -56
  16. package/.claude/commands/spec-load.md +66 -64
  17. package/.claude/commands/spec-setup.md +5 -9
  18. package/.codex/skills/learn-decompose/SKILL.md +119 -0
  19. package/.codex/skills/learn-follow/SKILL.md +83 -0
  20. package/.codex/skills/learn-investigate/SKILL.md +83 -0
  21. package/.codex/skills/learn-retro/SKILL.md +83 -0
  22. package/.codex/skills/learn-second-opinion/SKILL.md +86 -0
  23. package/.codex/skills/maestro/SKILL.md +335 -0
  24. package/.codex/skills/maestro-analyze/SKILL.md +84 -75
  25. package/.codex/skills/maestro-brainstorm/SKILL.md +452 -463
  26. package/.codex/skills/maestro-chain/SKILL.md +233 -0
  27. package/.codex/skills/maestro-coordinate/SKILL.md +167 -278
  28. package/.codex/skills/maestro-execute/SKILL.md +435 -438
  29. package/.codex/skills/maestro-fork/SKILL.md +68 -0
  30. package/.codex/skills/maestro-init/SKILL.md +171 -167
  31. package/.codex/skills/maestro-learn/SKILL.md +80 -0
  32. package/.codex/skills/maestro-link-coordinate/SKILL.md +224 -220
  33. package/.codex/skills/maestro-merge/SKILL.md +62 -0
  34. package/.codex/skills/maestro-milestone-audit/SKILL.md +108 -103
  35. package/.codex/skills/maestro-milestone-complete/SKILL.md +155 -149
  36. package/.codex/skills/maestro-milestone-release/SKILL.md +70 -0
  37. package/.codex/skills/maestro-overlay/SKILL.md +188 -185
  38. package/.codex/skills/maestro-plan/SKILL.md +66 -69
  39. package/.codex/skills/maestro-quick/SKILL.md +26 -23
  40. package/.codex/skills/maestro-roadmap/SKILL.md +65 -73
  41. package/.codex/skills/maestro-spec-generate/SKILL.md +66 -74
  42. package/.codex/skills/maestro-ui-design/SKILL.md +34 -31
  43. package/.codex/skills/maestro-verify/SKILL.md +556 -566
  44. package/.codex/skills/manage-codebase-rebuild/SKILL.md +397 -405
  45. package/.codex/skills/manage-codebase-refresh/SKILL.md +93 -82
  46. package/.codex/skills/manage-harvest/SKILL.md +82 -0
  47. package/.codex/skills/manage-issue/SKILL.md +80 -65
  48. package/.codex/skills/manage-issue-discover/SKILL.md +491 -503
  49. package/.codex/skills/manage-learn/SKILL.md +190 -186
  50. package/.codex/skills/manage-memory/SKILL.md +95 -72
  51. package/.codex/skills/manage-memory-capture/SKILL.md +99 -86
  52. package/.codex/skills/manage-status/SKILL.md +102 -89
  53. package/.codex/skills/quality-business-test/SKILL.md +228 -223
  54. package/.codex/skills/quality-debug/SKILL.md +54 -66
  55. package/.codex/skills/quality-integration-test/SKILL.md +532 -544
  56. package/.codex/skills/quality-refactor/SKILL.md +197 -191
  57. package/.codex/skills/quality-retrospective/SKILL.md +512 -505
  58. package/.codex/skills/quality-review/SKILL.md +93 -105
  59. package/.codex/skills/quality-sync/SKILL.md +101 -89
  60. package/.codex/skills/quality-test/SKILL.md +202 -198
  61. package/.codex/skills/quality-test-gen/SKILL.md +93 -104
  62. package/.codex/skills/spec-add/SKILL.md +58 -39
  63. package/.codex/skills/spec-load/SKILL.md +45 -40
  64. package/.codex/skills/spec-map/SKILL.md +180 -182
  65. package/.codex/skills/spec-setup/SKILL.md +94 -76
  66. package/.codex/skills/team-coordinate/SKILL.md +346 -357
  67. package/.codex/skills/team-executor/SKILL.md +70 -112
  68. package/.codex/skills/team-lifecycle-v4/SKILL.md +311 -299
  69. package/.codex/skills/team-quality-assurance/SKILL.md +234 -227
  70. package/.codex/skills/team-review/SKILL.md +232 -225
  71. package/.codex/skills/team-tech-debt/SKILL.md +78 -100
  72. package/.codex/skills/team-testing/SKILL.md +242 -235
  73. package/.codex/skills/wiki-connect/SKILL.md +75 -0
  74. package/.codex/skills/wiki-digest/SKILL.md +87 -0
  75. package/README.md +14 -11
  76. package/README.zh-CN.md +14 -11
  77. package/chains/issue-lifecycle.json +13 -13
  78. package/chains/singles/issue-analyze.json +3 -3
  79. package/chains/singles/issue-execute.json +3 -3
  80. package/chains/singles/issue-plan.json +3 -3
  81. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js +2 -2
  82. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js.map +1 -1
  83. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +3 -3
  84. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
  85. package/dashboard/dist-server/dashboard/src/server/routes/issues.js +34 -0
  86. package/dashboard/dist-server/dashboard/src/server/routes/issues.js.map +1 -1
  87. package/dashboard/dist-server/dashboard/src/server/routes/specs.d.ts +1 -1
  88. package/dashboard/dist-server/dashboard/src/server/routes/specs.js +75 -30
  89. package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
  90. package/dashboard/dist-server/dashboard/src/server/state/event-bus.d.ts +5 -0
  91. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js +5 -0
  92. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js.map +1 -1
  93. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js +2 -3
  94. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js.map +1 -1
  95. package/dashboard/dist-server/dashboard/src/shared/constants.js +5 -0
  96. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  97. package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +5 -0
  98. package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
  99. package/dashboard/dist-server/dashboard/src/shared/normalize-task.d.ts +2 -0
  100. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js +75 -0
  101. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js.map +1 -0
  102. package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +21 -0
  103. package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
  104. package/dashboard/dist-server/dashboard/src/shared/types.d.ts +3 -2
  105. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +1 -1
  106. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
  107. package/dashboard/dist-server/src/hooks/constants.d.ts +92 -12
  108. package/dashboard/dist-server/src/hooks/constants.js +151 -16
  109. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  110. package/dashboard/dist-server/src/types/index.d.ts +5 -0
  111. package/dist/src/commands/collab.d.ts +1 -34
  112. package/dist/src/commands/collab.d.ts.map +1 -1
  113. package/dist/src/commands/collab.js +8 -76
  114. package/dist/src/commands/collab.js.map +1 -1
  115. package/dist/src/commands/hooks.d.ts +5 -1
  116. package/dist/src/commands/hooks.d.ts.map +1 -1
  117. package/dist/src/commands/hooks.js +115 -10
  118. package/dist/src/commands/hooks.js.map +1 -1
  119. package/dist/src/commands/install-ui/InstallConfirm.d.ts +3 -1
  120. package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
  121. package/dist/src/commands/install-ui/InstallConfirm.js +3 -1
  122. package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
  123. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  124. package/dist/src/commands/install-ui/InstallExecution.js +5 -1
  125. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  126. package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
  127. package/dist/src/commands/install-ui/InstallFlow.js +7 -3
  128. package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
  129. package/dist/src/commands/install-ui/StatuslineConfig.d.ts +6 -1
  130. package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
  131. package/dist/src/commands/install-ui/StatuslineConfig.js +27 -5
  132. package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
  133. package/dist/src/commands/spec.d.ts.map +1 -1
  134. package/dist/src/commands/spec.js +7 -2
  135. package/dist/src/commands/spec.js.map +1 -1
  136. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +7 -0
  137. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -0
  138. package/dist/src/hooks/__tests__/statusline-visual-test.js +236 -0
  139. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -0
  140. package/dist/src/hooks/constants.d.ts +92 -12
  141. package/dist/src/hooks/constants.d.ts.map +1 -1
  142. package/dist/src/hooks/constants.js +151 -16
  143. package/dist/src/hooks/constants.js.map +1 -1
  144. package/dist/src/hooks/guards/index.d.ts +2 -0
  145. package/dist/src/hooks/guards/index.d.ts.map +1 -1
  146. package/dist/src/hooks/guards/index.js +2 -0
  147. package/dist/src/hooks/guards/index.js.map +1 -1
  148. package/dist/src/hooks/guards/preflight-guard.d.ts +29 -0
  149. package/dist/src/hooks/guards/preflight-guard.d.ts.map +1 -0
  150. package/dist/src/hooks/guards/preflight-guard.js +95 -0
  151. package/dist/src/hooks/guards/preflight-guard.js.map +1 -0
  152. package/dist/src/hooks/guards/spec-validator.d.ts +25 -0
  153. package/dist/src/hooks/guards/spec-validator.d.ts.map +1 -0
  154. package/dist/src/hooks/guards/spec-validator.js +66 -0
  155. package/dist/src/hooks/guards/spec-validator.js.map +1 -0
  156. package/dist/src/hooks/index.d.ts +1 -0
  157. package/dist/src/hooks/index.d.ts.map +1 -1
  158. package/dist/src/hooks/index.js +1 -0
  159. package/dist/src/hooks/index.js.map +1 -1
  160. package/dist/src/hooks/keyword-spec-injector.d.ts +21 -0
  161. package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -0
  162. package/dist/src/hooks/keyword-spec-injector.js +96 -0
  163. package/dist/src/hooks/keyword-spec-injector.js.map +1 -0
  164. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts +2 -1
  165. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts.map +1 -1
  166. package/dist/src/hooks/plugins/spec-injection-plugin.js +21 -12
  167. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  168. package/dist/src/hooks/preflight-core.d.ts +37 -0
  169. package/dist/src/hooks/preflight-core.d.ts.map +1 -0
  170. package/dist/src/hooks/preflight-core.js +86 -0
  171. package/dist/src/hooks/preflight-core.js.map +1 -0
  172. package/dist/src/hooks/spec-bridge.d.ts +40 -0
  173. package/dist/src/hooks/spec-bridge.d.ts.map +1 -0
  174. package/dist/src/hooks/spec-bridge.js +97 -0
  175. package/dist/src/hooks/spec-bridge.js.map +1 -0
  176. package/dist/src/hooks/spec-injector.d.ts.map +1 -1
  177. package/dist/src/hooks/spec-injector.js +18 -12
  178. package/dist/src/hooks/spec-injector.js.map +1 -1
  179. package/dist/src/hooks/statusline.d.ts +8 -17
  180. package/dist/src/hooks/statusline.d.ts.map +1 -1
  181. package/dist/src/hooks/statusline.js +269 -112
  182. package/dist/src/hooks/statusline.js.map +1 -1
  183. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  184. package/dist/src/i18n/locales/en.js +5 -0
  185. package/dist/src/i18n/locales/en.js.map +1 -1
  186. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  187. package/dist/src/i18n/locales/zh.js +5 -0
  188. package/dist/src/i18n/locales/zh.js.map +1 -1
  189. package/dist/src/i18n/types.d.ts +5 -0
  190. package/dist/src/i18n/types.d.ts.map +1 -1
  191. package/dist/src/team/phase-orchestrator.d.ts +52 -0
  192. package/dist/src/team/phase-orchestrator.d.ts.map +1 -0
  193. package/dist/src/team/phase-orchestrator.js +165 -0
  194. package/dist/src/team/phase-orchestrator.js.map +1 -0
  195. package/dist/src/team/phase-types.d.ts +51 -0
  196. package/dist/src/team/phase-types.d.ts.map +1 -0
  197. package/dist/src/team/phase-types.js +41 -0
  198. package/dist/src/team/phase-types.js.map +1 -0
  199. package/dist/src/tools/collab-adapter.d.ts +17 -0
  200. package/dist/src/tools/collab-adapter.d.ts.map +1 -1
  201. package/dist/src/tools/collab-adapter.js +138 -0
  202. package/dist/src/tools/collab-adapter.js.map +1 -1
  203. package/dist/src/tools/index.d.ts.map +1 -1
  204. package/dist/src/tools/index.js +6 -0
  205. package/dist/src/tools/index.js.map +1 -1
  206. package/dist/src/tools/merge-validator.d.ts +24 -0
  207. package/dist/src/tools/merge-validator.d.ts.map +1 -0
  208. package/dist/src/tools/merge-validator.js +220 -0
  209. package/dist/src/tools/merge-validator.js.map +1 -0
  210. package/dist/src/tools/spec-entry-parser.d.ts +56 -0
  211. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -0
  212. package/dist/src/tools/spec-entry-parser.js +196 -0
  213. package/dist/src/tools/spec-entry-parser.js.map +1 -0
  214. package/dist/src/tools/spec-init.d.ts.map +1 -1
  215. package/dist/src/tools/spec-init.js +66 -92
  216. package/dist/src/tools/spec-init.js.map +1 -1
  217. package/dist/src/tools/spec-keyword-index.d.ts +30 -0
  218. package/dist/src/tools/spec-keyword-index.d.ts.map +1 -0
  219. package/dist/src/tools/spec-keyword-index.js +101 -0
  220. package/dist/src/tools/spec-keyword-index.js.map +1 -0
  221. package/dist/src/tools/spec-loader.d.ts +3 -3
  222. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  223. package/dist/src/tools/spec-loader.js +49 -23
  224. package/dist/src/tools/spec-loader.js.map +1 -1
  225. package/dist/src/tools/team-agents.d.ts +27 -0
  226. package/dist/src/tools/team-agents.d.ts.map +1 -0
  227. package/dist/src/tools/team-agents.js +362 -0
  228. package/dist/src/tools/team-agents.js.map +1 -0
  229. package/dist/src/tools/team-mailbox.d.ts +40 -0
  230. package/dist/src/tools/team-mailbox.d.ts.map +1 -0
  231. package/dist/src/tools/team-mailbox.js +384 -0
  232. package/dist/src/tools/team-mailbox.js.map +1 -0
  233. package/dist/src/tools/team-msg.d.ts +17 -8
  234. package/dist/src/tools/team-msg.d.ts.map +1 -1
  235. package/dist/src/tools/team-msg.js +110 -13
  236. package/dist/src/tools/team-msg.js.map +1 -1
  237. package/dist/src/tools/team-tasks-mcp.d.ts +27 -0
  238. package/dist/src/tools/team-tasks-mcp.d.ts.map +1 -0
  239. package/dist/src/tools/team-tasks-mcp.js +408 -0
  240. package/dist/src/tools/team-tasks-mcp.js.map +1 -0
  241. package/dist/src/types/index.d.ts +5 -0
  242. package/dist/src/types/index.d.ts.map +1 -1
  243. package/package.json +2 -1
  244. package/templates/cli/prompts/workflow-skill-conflict-patterns.txt +3 -3
  245. package/templates/cli/prompts/workflow-skill-lessons-learned.txt +3 -3
  246. package/templates/search-tools.md +1 -1
  247. package/workflows/analyze.md +816 -816
  248. package/workflows/brainstorm.md +471 -471
  249. package/workflows/cli-tools-usage.md +44 -27
  250. package/workflows/codebase-rebuild.md +332 -332
  251. package/workflows/codebase-refresh.md +240 -240
  252. package/workflows/delegate-usage.md +3 -3
  253. package/workflows/execute.md +1 -1
  254. package/workflows/harvest.md +420 -420
  255. package/workflows/integration-test.md +343 -343
  256. package/workflows/issue-analyze.md +6 -2
  257. package/workflows/issue-discover.md +414 -414
  258. package/workflows/issue-execute.md +6 -3
  259. package/workflows/issue-plan.md +5 -2
  260. package/workflows/maestro-coordinate.codex.md +281 -470
  261. package/workflows/maestro-coordinate.md +14 -14
  262. package/workflows/maestro-link-coordinate.md +2 -2
  263. package/workflows/maestro.codex.md +710 -0
  264. package/workflows/maestro.md +10 -11
  265. package/workflows/map.md +111 -111
  266. package/workflows/milestone-complete.md +176 -176
  267. package/workflows/plan.md +1 -1
  268. package/workflows/quick.md +497 -497
  269. package/workflows/refactor.md +300 -300
  270. package/workflows/retrospective.md +1 -1
  271. package/workflows/roadmap.md +335 -335
  272. package/workflows/spec-generate.md +640 -640
  273. package/workflows/specs-add.md +46 -81
  274. package/workflows/specs-load.md +15 -17
  275. package/workflows/specs-setup.md +40 -161
  276. package/.claude/commands/manage-issue-analyze.md +0 -62
  277. package/.claude/commands/manage-issue-execute.md +0 -73
  278. package/.claude/commands/manage-issue-plan.md +0 -62
  279. package/.codex/skills/manage-issue-analyze/SKILL.md +0 -207
  280. package/.codex/skills/manage-issue-execute/SKILL.md +0 -200
  281. package/.codex/skills/manage-issue-plan/SKILL.md +0 -186
@@ -1,463 +1,452 @@
1
- ---
2
- name: maestro-brainstorm
3
- description: Multi-role brainstorming via CSV wave pipeline. Diamond topology — guidance specification generator (Wave 1), parallel role analysis agents (Wave 2), synthesis + feature-index agent (Wave 3). Replaces maestro-brainstorm command.
4
- argument-hint: "[topic] [-y|--yes] [-c|--concurrency N] [--continue] [--count N] [--skip-questions]"
5
- allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- ## Auto Mode
9
-
10
- When `--yes` or `-y`: Auto-confirm role selection, skip interactive questions, use defaults for count and role selection.
11
-
12
- # Maestro Brainstorm (CSV Wave)
13
-
14
- ## Usage
15
-
16
- ```bash
17
- $maestro-brainstorm "Build real-time collaboration platform"
18
- $maestro-brainstorm -y "Build real-time collaboration platform"
19
- $maestro-brainstorm -c 6 "Build real-time collaboration platform --count 5"
20
- $maestro-brainstorm --continue "brainstorm-collab-20260318"
21
- ```
22
-
23
- **Flags**:
24
- - `-y, --yes`: Skip all confirmations (auto mode)
25
- - `-c, --concurrency N`: Max concurrent agents within each wave (default: 6)
26
- - `--continue`: Resume existing session
27
- - `--count N`: Number of roles to select (default 3, max 9)
28
- - `--skip-questions`: Skip context gathering questions
29
-
30
- **Output Directory**: `.workflow/.csv-wave/{session-id}/`
31
- **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report) + `.brainstorming/` (role analyses + synthesis artifacts)
32
-
33
- ---
34
-
35
- ## Overview
36
-
37
- Wave-based multi-role brainstorming using `spawn_agents_on_csv`. Diamond topology: guidance specification generation (Wave 1), parallel role analysis agents (Wave 2), then synthesis + feature-index generation (Wave 3).
38
-
39
- **Core workflow**: Parse Topic Generate Guidance Spec → Parallel Role Analysis → Synthesis + Feature Index
40
-
41
- ```
42
- +---------------------------------------------------------------------------+
43
- | BRAINSTORM CSV WAVE WORKFLOW |
44
- +---------------------------------------------------------------------------+
45
- | |
46
- | Phase 1: Topic Resolution -> CSV |
47
- | +-- Parse topic and flags from arguments |
48
- | +-- Detect mode (phase / scratch) |
49
- | +-- Resolve output directory |
50
- | +-- Select roles (interactive or auto, --count N) |
51
- | +-- Load project specs for architecture-aware analysis |
52
- | +-- Generate tasks.csv with guidance + role + synthesis rows |
53
- | +-- User validates role breakdown (skip if -y) |
54
- | |
55
- | Phase 2: Wave Execution Engine |
56
- | +-- Wave 1: Guidance Specification (single agent) |
57
- | | +-- Analyze topic, extract terminology, define boundaries |
58
- | | +-- Generate guidance-specification.md with RFC 2119 keywords |
59
- | | +-- Feature decomposition (max 8 features) |
60
- | | +-- Discoveries shared via board (terms, non-goals, features) |
61
- | | +-- Results: guidance_spec content + analysis_file path |
62
- | +-- Wave 2: Role Analysis (parallel, 3-9 agents) |
63
- | | +-- Each role agent analyzes topic through its lens |
64
- | | +-- Receives guidance-specification.md via prev_context |
65
- | | +-- Feature-point organization when feature list available |
66
- | | +-- Discoveries shared via board (role insights, conflicts) |
67
- | | +-- Results: analysis_file path per role |
68
- | +-- Wave 3: Synthesis + Feature Index (single agent) |
69
- | | +-- Cross-role analysis: consensus, conflicts, unique insights |
70
- | | +-- Generate feature specs or synthesis-specification.md |
71
- | | +-- Build feature-index.json + synthesis-changelog.md |
72
- | | +-- Discoveries shared via board (cross-role patterns) |
73
- | +-- discoveries.ndjson shared across all waves (append-only) |
74
- | |
75
- | Phase 3: Results Aggregation |
76
- | +-- Export results.csv |
77
- | +-- Generate context.md with all findings |
78
- | +-- Copy artifacts to .brainstorming/ directory |
79
- | +-- Update phase index.json with brainstorm status |
80
- | +-- Display summary with next steps |
81
- | |
82
- +---------------------------------------------------------------------------+
83
- ```
84
-
85
- ---
86
-
87
- ## CSV Schema
88
-
89
- ### tasks.csv (Master State)
90
-
91
- ```csv
92
- id,title,description,role,topic,guidance_spec,deps,context_from,wave,status,findings,analysis_file,error
93
- "1","Guidance Specification","Analyze topic and generate guidance-specification.md: extract 5-10 core terms, define non-goals, decompose into features (max 8), apply RFC 2119 keywords. Output: guidance-specification.md with sections for positioning, terminology, non-goals, feature decomposition.","guidance-generator","Build real-time collaboration platform","","","","1","","","",""
94
- "2","System Architect Analysis","Analyze topic from system-architect perspective: technical architecture, scalability, integration patterns. Must include Data Model (3-5 entities), State Machine, Error Handling, Observability (5+ metrics), Configuration Model. Use RFC 2119 keywords. Reference guidance-specification.md for framework.","system-architect","Build real-time collaboration platform","","1","1","2","","","",""
95
- "3","UI Designer Analysis","Analyze topic from ui-designer perspective: visual design, layout systems, component hierarchy, design tokens, responsive breakpoints. Reference guidance-specification.md for framework and feature decomposition.","ui-designer","Build real-time collaboration platform","","1","1","2","","","",""
96
- "4","Product Manager Analysis","Analyze topic from product-manager perspective: product strategy, prioritization, user value proposition, competitive analysis, roadmap alignment. Reference guidance-specification.md for framework.","product-manager","Build real-time collaboration platform","","1","1","2","","","",""
97
- "5","Synthesis + Feature Index","Cross-role synthesis: analyze all role outputs for consensus, conflicts, unique contributions. Generate feature specs (F-001 through F-00N) or synthesis-specification.md. Build feature-index.json and synthesis-changelog.md. Resolve conflicts with [RESOLVED]/[SUGGESTED]/[UNRESOLVED] tags.","synthesis","Build real-time collaboration platform","","2;3;4","2;3;4","3","","","",""
98
- ```
99
-
100
- **Columns**:
101
-
102
- | Column | Phase | Description |
103
- |--------|-------|-------------|
104
- | `id` | Input | Unique task identifier (string) |
105
- | `title` | Input | Short task title |
106
- | `description` | Input | Detailed instructions for this task |
107
- | `role` | Input | Role identifier: guidance-generator, system-architect, ui-designer, product-manager, ..., synthesis |
108
- | `topic` | Input | Brainstorm topic text |
109
- | `guidance_spec` | Input | Guidance-specification.md content reference (populated for wave 2+ from wave 1) |
110
- | `deps` | Input | Semicolon-separated dependency task IDs |
111
- | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
112
- | `wave` | Computed | Wave number (1 = guidance, 2 = role analysis, 3 = synthesis) |
113
- | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
114
- | `findings` | Output | Key findings summary (max 500 chars) |
115
- | `analysis_file` | Output | Path to generated analysis file |
116
- | `error` | Output | Error message if failed |
117
-
118
- ### Per-Wave CSV (Temporary)
119
-
120
- Each wave generates `wave-{N}.csv` with extra `prev_context` column.
121
-
122
- ---
123
-
124
- ## Output Artifacts
125
-
126
- | File | Purpose | Lifecycle |
127
- |------|---------|-----------|
128
- | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
129
- | `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
130
- | `results.csv` | Final export of all task results | Created in Phase 3 |
131
- | `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
132
- | `context.md` | Human-readable brainstorm report | Created in Phase 3 |
133
- | `.brainstorming/` | Role analyses + synthesis artifacts | Populated in Phase 3 |
134
-
135
- ---
136
-
137
- ## Session Structure
138
-
139
- ```
140
- .workflow/.csv-wave/brainstorm-{slug}-{date}/
141
- +-- tasks.csv
142
- +-- results.csv
143
- +-- discoveries.ndjson
144
- +-- context.md
145
- +-- wave-{N}.csv (temporary)
146
- +-- .brainstorming/
147
- +-- guidance-specification.md
148
- +-- feature-index.json
149
- +-- synthesis-changelog.md
150
- +-- feature-specs/
151
- | +-- F-001-{slug}.md
152
- | +-- F-00N-{slug}.md
153
- +-- {role}/
154
- | +-- analysis.md
155
- | +-- analysis-cross-cutting.md
156
- | +-- analysis-F-{id}-{slug}.md
157
- +-- synthesis-specification.md (fallback mode)
158
- ```
159
-
160
- ---
161
-
162
- ## Implementation
163
-
164
- ### Session Initialization
165
-
166
- ```javascript
167
- const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
168
-
169
- // Parse flags
170
- const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
171
- const continueMode = $ARGUMENTS.includes('--continue')
172
- const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
173
- const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 6
174
-
175
- // Parse brainstorm-specific flags
176
- const countMatch = $ARGUMENTS.match(/--count\s+(\d+)/)
177
- const roleCount = countMatch ? Math.min(parseInt(countMatch[1]), 9) : 3
178
- const skipQuestions = $ARGUMENTS.includes('--skip-questions')
179
-
180
- // Clean topic text
181
- const topicArg = $ARGUMENTS
182
- .replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+|--count\s+\d+|--skip-questions/g, '')
183
- .trim()
184
-
185
- const slug = topicArg.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
186
- const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
187
- const sessionId = `brainstorm-${slug}-${dateStr}`
188
- const sessionFolder = `.workflow/.csv-wave/${sessionId}`
189
-
190
- Bash(`mkdir -p ${sessionFolder}/.brainstorming`)
191
- ```
192
-
193
- ---
194
-
195
- ### Phase 1: Topic Resolution -> CSV
196
-
197
- **Objective**: Parse topic, select roles, generate tasks.csv.
198
-
199
- **Decomposition Rules**:
200
-
201
- 1. **Mode detection**: Number = phase mode (resolve `.workflow/phases/{NN}-{slug}/`), text = scratch mode
202
- 2. **Project specs loading**: Read `.workflow/specs/` for architecture-aware analysis context
203
- 3. **Role selection**:
204
-
205
- | Condition | Action |
206
- |-----------|--------|
207
- | `--yes` flag | Auto-select top `roleCount` roles based on topic relevance |
208
- | Interactive | AskUserQuestion (multiSelect=true) with recommended roles + rationale |
209
-
210
- 4. **Valid roles** (9 total):
211
-
212
- | Role ID | Focus Area |
213
- |---------|------------|
214
- | `data-architect` | Data models, storage strategies, data flow |
215
- | `product-manager` | Product strategy, roadmap, prioritization |
216
- | `product-owner` | Backlog management, user stories, acceptance criteria |
217
- | `scrum-master` | Process facilitation, impediment removal |
218
- | `subject-matter-expert` | Domain knowledge, business rules, compliance |
219
- | `system-architect` | Technical architecture, scalability, integration |
220
- | `test-strategist` | Test strategy, quality assurance |
221
- | `ui-designer` | Visual design, mockups, design systems |
222
- | `ux-expert` | User research, information architecture, journey |
223
-
224
- 5. **CSV generation**: 1 guidance row (wave 1) + N role rows (wave 2) + 1 synthesis row (wave 3).
225
-
226
- **Wave computation**: 3-wave diamond -- guidance = wave 1, all role tasks = wave 2, synthesis = wave 3.
227
-
228
- **User validation**: Display task breakdown (skip if AUTO_YES).
229
-
230
- ---
231
-
232
- ### Phase 2: Wave Execution Engine
233
-
234
- **Objective**: Execute brainstorm pipeline wave-by-wave via spawn_agents_on_csv.
235
-
236
- #### Wave 1: Guidance Specification (Single Agent)
237
-
238
- 1. Read master `tasks.csv`
239
- 2. Filter rows where `wave == 1` AND `status == pending`
240
- 3. No prev_context needed (wave 1 has no predecessors)
241
- 4. Write `wave-1.csv`
242
- 5. Execute:
243
-
244
- ```javascript
245
- spawn_agents_on_csv({
246
- csv_path: `${sessionFolder}/wave-1.csv`,
247
- id_column: "id",
248
- instruction: buildGuidanceInstruction(sessionFolder, topicArg),
249
- max_concurrency: 1,
250
- max_runtime_seconds: 600,
251
- output_csv_path: `${sessionFolder}/wave-1-results.csv`,
252
- output_schema: {
253
- type: "object",
254
- properties: {
255
- id: { type: "string" },
256
- status: { type: "string", enum: ["completed", "failed"] },
257
- findings: { type: "string" },
258
- analysis_file: { type: "string" },
259
- error: { type: "string" }
260
- },
261
- required: ["id", "status", "findings"]
262
- }
263
- })
264
- ```
265
-
266
- 6. Read `wave-1-results.csv`, merge into master `tasks.csv`
267
- 7. Delete `wave-1.csv`
268
- 8. Read generated `guidance-specification.md` for wave 2 context propagation
269
-
270
- **Guidance agent responsibilities**:
271
- - Analyze topic, extract 5-10 core domain terms
272
- - Define non-goals and scope boundaries
273
- - Decompose into features (max 8): F-{3-digit} ID, kebab-case slug, description, related roles, priority
274
- - Apply RFC 2119 keywords (MUST, SHOULD, MAY, MUST NOT, SHOULD NOT)
275
- - Write `guidance-specification.md` to `.brainstorming/`
276
-
277
- #### Wave 2: Role Analysis (Parallel, 3-9 Agents)
278
-
279
- 1. Read master `tasks.csv`
280
- 2. Filter rows where `wave == 2` AND `status == pending`
281
- 3. Build `prev_context` from wave 1 findings:
282
- ```
283
- [Task 1: Guidance Specification] Generated guidance-specification.md with N features, M terms defined...
284
- ```
285
- 4. Include `guidance-specification.md` content in prev_context for each role agent
286
- 5. Write `wave-2.csv` with `prev_context` column
287
- 6. Execute:
288
-
289
- ```javascript
290
- spawn_agents_on_csv({
291
- csv_path: `${sessionFolder}/wave-2.csv`,
292
- id_column: "id",
293
- instruction: buildRoleAnalysisInstruction(sessionFolder),
294
- max_concurrency: maxConcurrency,
295
- max_runtime_seconds: 900,
296
- output_csv_path: `${sessionFolder}/wave-2-results.csv`,
297
- output_schema: {
298
- type: "object",
299
- properties: {
300
- id: { type: "string" },
301
- status: { type: "string", enum: ["completed", "failed"] },
302
- findings: { type: "string" },
303
- analysis_file: { type: "string" },
304
- error: { type: "string" }
305
- },
306
- required: ["id", "status", "findings"]
307
- }
308
- })
309
- ```
310
-
311
- 7. Read `wave-2-results.csv`, merge into master `tasks.csv`
312
- 8. Delete `wave-2.csv`
313
-
314
- **Role agent responsibilities**:
315
- - Read guidance-specification.md for framework context
316
- - Analyze topic through role-specific lens
317
- - Feature-point organization when feature list available:
318
- - `analysis.md` -- Role overview INDEX only (< 1500 words)
319
- - `analysis-cross-cutting.md` -- Cross-feature decisions (< 2000 words)
320
- - `analysis-F-{id}-{slug}.md` -- Per-feature analysis (< 2000 words each)
321
- - Fallback organization (no feature list):
322
- - `analysis.md` -- Main analysis (< 3000 words)
323
- - system-architect MUST include: Data Model, State Machine, Error Handling, Observability, Configuration Model
324
- - Write analysis files to `.brainstorming/{role}/`
325
-
326
- #### Wave 3: Synthesis + Feature Index (Single Agent)
327
-
328
- 1. Read master `tasks.csv`
329
- 2. Filter rows where `wave == 3` AND `status == pending`
330
- 3. Check deps -- if all wave 2 tasks failed, skip synthesis
331
- 4. Build `prev_context` from wave 2 findings:
332
- ```
333
- [Task 2: System Architect Analysis] Key findings: microservice architecture with event sourcing...
334
- [Task 3: UI Designer Analysis] Key findings: component-based design system with real-time cursors...
335
- [Task 4: Product Manager Analysis] Key findings: MVP focuses on document editing + presence...
336
- ```
337
- 5. Write `wave-3.csv` with `prev_context` column
338
- 6. Execute `spawn_agents_on_csv` for synthesis agent
339
- 7. Merge results into master `tasks.csv`
340
- 8. Delete `wave-3.csv`
341
-
342
- **Synthesis agent responsibilities**:
343
- - Cross-role analysis: consensus, conflicts, unique contributions
344
- - Conflict resolution with [RESOLVED]/[SUGGESTED]/[UNRESOLVED] tags
345
- - Feature mode: generate `feature-specs/F-{id}-{slug}.md` per feature (7 sections, 1500-2500 words)
346
- - Fallback mode: generate `synthesis-specification.md`
347
- - Build `feature-index.json` and `synthesis-changelog.md`
348
- - Four-Layer Aggregation: Direct Reference, Structured Extraction, Conflict Distillation, Cross-Feature Annotation
349
-
350
- ---
351
-
352
- ### Phase 3: Results Aggregation
353
-
354
- **Objective**: Generate final results and human-readable report.
355
-
356
- 1. Read final master `tasks.csv`
357
- 2. Export as `results.csv`
358
- 3. Generate `context.md`:
359
-
360
- ```markdown
361
- # Brainstorm Report -- {topic}
362
-
363
- ## Summary
364
- - Topic: {topic}
365
- - Roles analyzed: {role_count}
366
- - Features decomposed: {feature_count}
367
- - Conflicts resolved: {resolved_count}
368
-
369
- ## Guidance Specification
370
- {summary of guidance-specification.md}
371
-
372
- ## Role Analysis Results
373
- ### {role_name}
374
- {findings summary}
375
- **Analysis file**: {analysis_file path}
376
-
377
- ## Synthesis
378
- {synthesis summary}
379
- - Consensus areas: {list}
380
- - Resolved conflicts: {list}
381
- - Unresolved items: {list}
382
-
383
- ## Feature Index
384
- {feature-index.json summary}
385
-
386
- ## Next Steps
387
- - Skill: maestro-analyze -- Evaluate feasibility + lock decisions
388
- - Skill: maestro-plan -- Plan directly if scope is clear
389
- - Skill: maestro-spec-generate -- Generate full spec package from brainstorm
390
- ```
391
-
392
- 4. Copy artifacts to output `.brainstorming/` directory (phase mode or scratch mode target)
393
- 5. Update phase `index.json` with brainstorm status (if phase mode)
394
- 6. Display summary with next step suggestions
395
-
396
- ---
397
-
398
- ## Shared Discovery Board Protocol
399
-
400
- ### Standard Discovery Types
401
-
402
- | Type | Dedup Key | Data Schema | Description |
403
- |------|-----------|-------------|-------------|
404
- | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
405
- | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
406
- | `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
407
- | `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue found |
408
- | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
409
-
410
- ### Domain Discovery Types
411
-
412
- | Type | Dedup Key | Data Schema | Description |
413
- |------|-----------|-------------|-------------|
414
- | `terminology` | `data.term` | `{term, definition, aliases[], category}` | Domain term extracted |
415
- | `non_goal` | `data.title` | `{title, rationale}` | Scope exclusion identified |
416
- | `feature_candidate` | `data.id` | `{id, slug, description, roles[], priority}` | Feature decomposed from topic |
417
- | `role_insight` | `data.role+data.topic` | `{role, topic, insight, confidence}` | Role-specific finding |
418
- | `cross_role_conflict` | `data.area` | `{area, roles[], positions[], resolution}` | Cross-role disagreement |
419
-
420
- ### Protocol
421
-
422
- 1. **Read** `{session_folder}/discoveries.ndjson` before own analysis
423
- 2. **Skip covered**: If discovery of same type + dedup key exists, skip
424
- 3. **Write immediately**: Append findings as found
425
- 4. **Append-only**: Never modify or delete
426
- 5. **Deduplicate**: Check before writing
427
-
428
- ```bash
429
- echo '{"ts":"<ISO>","worker":"{id}","type":"terminology","data":{"term":"CRDT","definition":"Conflict-free Replicated Data Type","aliases":["conflict-free"],"category":"technical"}}' >> {session_folder}/discoveries.ndjson
430
- ```
431
-
432
- ---
433
-
434
- ## Error Handling
435
-
436
- | Error | Resolution |
437
- |-------|------------|
438
- | Topic argument missing | Abort with error: "Topic text required" |
439
- | Invalid role name in selection | Filter to valid roles, warn user |
440
- | Role count exceeds 9 | Cap at 9 with warning |
441
- | Guidance agent timeout | Mark as failed, abort pipeline (wave 2 depends on guidance) |
442
- | Role agent timeout | Mark as failed, continue with remaining roles |
443
- | All role agents failed | Skip synthesis (wave 3), report partial results |
444
- | Synthesis agent failed | Use wave 2 results directly, no feature index |
445
- | CSV parse error | Validate format, show line number |
446
- | discoveries.ndjson corrupt | Ignore malformed lines |
447
- | Continue mode: no session found | List available sessions |
448
- | Phase directory not found | Abort with error: "Phase {N} not found" |
449
-
450
- ---
451
-
452
- ## Core Rules
453
-
454
- 1. **Start Immediately**: First action is session initialization, then Phase 1
455
- 2. **Wave Order is Sacred**: Never execute wave 2 before wave 1 completes and results are merged
456
- 3. **CSV is Source of Truth**: Master tasks.csv holds all state
457
- 4. **Context Propagation**: prev_context built from master CSV, not from memory
458
- 5. **Guidance First**: Wave 1 (guidance) MUST complete before any role analysis begins
459
- 6. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
460
- 7. **Skip on Failure**: If guidance fails, abort. If all roles fail, skip synthesis.
461
- 8. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
462
- 9. **DO NOT STOP**: Continuous execution until all waves complete
463
- 10. **9 Valid Roles Only**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
1
+ ---
2
+ name: maestro-brainstorm
3
+ description: Multi-role brainstorming via CSV wave pipeline. Diamond topology — guidance specification generator (Wave 1), parallel role analysis agents (Wave 2), synthesis + feature-index agent (Wave 3). Replaces maestro-brainstorm command.
4
+ argument-hint: "[topic] [-y|--yes] [-c|--concurrency N] [--continue] [--count N] [--skip-questions]"
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Wave-based multi-role brainstorming using `spawn_agents_on_csv`. Diamond topology: guidance specification generation (Wave 1), parallel role analysis agents (Wave 2), then synthesis + feature-index generation (Wave 3).
10
+
11
+ **Core workflow**: Parse Topic -> Generate Guidance Spec -> Parallel Role Analysis -> Synthesis + Feature Index
12
+
13
+ ```
14
+ +---------------------------------------------------------------------------+
15
+ | BRAINSTORM CSV WAVE WORKFLOW |
16
+ +---------------------------------------------------------------------------+
17
+ | |
18
+ | Phase 1: Topic Resolution -> CSV |
19
+ | +-- Parse topic and flags from arguments |
20
+ | +-- Detect mode (phase / scratch) |
21
+ | +-- Resolve output directory |
22
+ | +-- Select roles (interactive or auto, --count N) |
23
+ | +-- Load project specs for architecture-aware analysis |
24
+ | +-- Generate tasks.csv with guidance + role + synthesis rows |
25
+ | +-- User validates role breakdown (skip if -y) |
26
+ | |
27
+ | Phase 2: Wave Execution Engine |
28
+ | +-- Wave 1: Guidance Specification (single agent) |
29
+ | | +-- Analyze topic, extract terminology, define boundaries |
30
+ | | +-- Generate guidance-specification.md with RFC 2119 keywords |
31
+ | | +-- Feature decomposition (max 8 features) |
32
+ | | +-- Discoveries shared via board (terms, non-goals, features) |
33
+ | | +-- Results: guidance_spec content + analysis_file path |
34
+ | +-- Wave 2: Role Analysis (parallel, 3-9 agents) |
35
+ | | +-- Each role agent analyzes topic through its lens |
36
+ | | +-- Receives guidance-specification.md via prev_context |
37
+ | | +-- Feature-point organization when feature list available |
38
+ | | +-- Discoveries shared via board (role insights, conflicts) |
39
+ | | +-- Results: analysis_file path per role |
40
+ | +-- Wave 3: Synthesis + Feature Index (single agent) |
41
+ | | +-- Cross-role analysis: consensus, conflicts, unique insights |
42
+ | | +-- Generate feature specs or synthesis-specification.md |
43
+ | | +-- Build feature-index.json + synthesis-changelog.md |
44
+ | | +-- Discoveries shared via board (cross-role patterns) |
45
+ | +-- discoveries.ndjson shared across all waves (append-only) |
46
+ | |
47
+ | Phase 3: Results Aggregation |
48
+ | +-- Export results.csv |
49
+ | +-- Generate context.md with all findings |
50
+ | +-- Copy artifacts to .brainstorming/ directory |
51
+ | +-- Update phase index.json with brainstorm status |
52
+ | +-- Display summary with next steps |
53
+ | |
54
+ +---------------------------------------------------------------------------+
55
+ ```
56
+ </purpose>
57
+
58
+ <context>
59
+ ```bash
60
+ $maestro-brainstorm "Build real-time collaboration platform"
61
+ $maestro-brainstorm -y "Build real-time collaboration platform"
62
+ $maestro-brainstorm -c 6 "Build real-time collaboration platform --count 5"
63
+ $maestro-brainstorm --continue "brainstorm-collab-20260318"
64
+ ```
65
+
66
+ **Flags**:
67
+ - `-y, --yes`: Skip all confirmations (auto mode)
68
+ - `-c, --concurrency N`: Max concurrent agents within each wave (default: 6)
69
+ - `--continue`: Resume existing session
70
+ - `--count N`: Number of roles to select (default 3, max 9)
71
+ - `--skip-questions`: Skip context gathering questions
72
+
73
+ When `--yes` or `-y`: Auto-confirm role selection, skip interactive questions, use defaults for count and role selection.
74
+
75
+ **Output Directory**: `.workflow/.csv-wave/{session-id}/`
76
+ **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report) + `.brainstorming/` (role analyses + synthesis artifacts)
77
+ </context>
78
+
79
+ <csv_schema>
80
+
81
+ ### tasks.csv (Master State)
82
+
83
+ ```csv
84
+ id,title,description,role,topic,guidance_spec,deps,context_from,wave,status,findings,analysis_file,error
85
+ "1","Guidance Specification","Analyze topic and generate guidance-specification.md: extract 5-10 core terms, define non-goals, decompose into features (max 8), apply RFC 2119 keywords. Output: guidance-specification.md with sections for positioning, terminology, non-goals, feature decomposition.","guidance-generator","Build real-time collaboration platform","","","","1","","","",""
86
+ "2","System Architect Analysis","Analyze topic from system-architect perspective: technical architecture, scalability, integration patterns. Must include Data Model (3-5 entities), State Machine, Error Handling, Observability (5+ metrics), Configuration Model. Use RFC 2119 keywords. Reference guidance-specification.md for framework.","system-architect","Build real-time collaboration platform","","1","1","2","","","",""
87
+ "3","UI Designer Analysis","Analyze topic from ui-designer perspective: visual design, layout systems, component hierarchy, design tokens, responsive breakpoints. Reference guidance-specification.md for framework and feature decomposition.","ui-designer","Build real-time collaboration platform","","1","1","2","","","",""
88
+ "4","Product Manager Analysis","Analyze topic from product-manager perspective: product strategy, prioritization, user value proposition, competitive analysis, roadmap alignment. Reference guidance-specification.md for framework.","product-manager","Build real-time collaboration platform","","1","1","2","","","",""
89
+ "5","Synthesis + Feature Index","Cross-role synthesis: analyze all role outputs for consensus, conflicts, unique contributions. Generate feature specs (F-001 through F-00N) or synthesis-specification.md. Build feature-index.json and synthesis-changelog.md. Resolve conflicts with [RESOLVED]/[SUGGESTED]/[UNRESOLVED] tags.","synthesis","Build real-time collaboration platform","","2;3;4","2;3;4","3","","","",""
90
+ ```
91
+
92
+ **Columns**:
93
+
94
+ | Column | Phase | Description |
95
+ |--------|-------|-------------|
96
+ | `id` | Input | Unique task identifier (string) |
97
+ | `title` | Input | Short task title |
98
+ | `description` | Input | Detailed instructions for this task |
99
+ | `role` | Input | Role identifier: guidance-generator, system-architect, ui-designer, product-manager, ..., synthesis |
100
+ | `topic` | Input | Brainstorm topic text |
101
+ | `guidance_spec` | Input | Guidance-specification.md content reference (populated for wave 2+ from wave 1) |
102
+ | `deps` | Input | Semicolon-separated dependency task IDs |
103
+ | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
104
+ | `wave` | Computed | Wave number (1 = guidance, 2 = role analysis, 3 = synthesis) |
105
+ | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
106
+ | `findings` | Output | Key findings summary (max 500 chars) |
107
+ | `analysis_file` | Output | Path to generated analysis file |
108
+ | `error` | Output | Error message if failed |
109
+
110
+ ### Per-Wave CSV (Temporary)
111
+
112
+ Each wave generates `wave-{N}.csv` with extra `prev_context` column.
113
+
114
+ ### Output Artifacts
115
+
116
+ | File | Purpose | Lifecycle |
117
+ |------|---------|-----------|
118
+ | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
119
+ | `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
120
+ | `results.csv` | Final export of all task results | Created in Phase 3 |
121
+ | `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
122
+ | `context.md` | Human-readable brainstorm report | Created in Phase 3 |
123
+ | `.brainstorming/` | Role analyses + synthesis artifacts | Populated in Phase 3 |
124
+
125
+ ### Session Structure
126
+
127
+ ```
128
+ .workflow/.csv-wave/brainstorm-{slug}-{date}/
129
+ +-- tasks.csv
130
+ +-- results.csv
131
+ +-- discoveries.ndjson
132
+ +-- context.md
133
+ +-- wave-{N}.csv (temporary)
134
+ +-- .brainstorming/
135
+ +-- guidance-specification.md
136
+ +-- feature-index.json
137
+ +-- synthesis-changelog.md
138
+ +-- feature-specs/
139
+ | +-- F-001-{slug}.md
140
+ | +-- F-00N-{slug}.md
141
+ +-- {role}/
142
+ | +-- analysis.md
143
+ | +-- analysis-cross-cutting.md
144
+ | +-- analysis-F-{id}-{slug}.md
145
+ +-- synthesis-specification.md (fallback mode)
146
+ ```
147
+ </csv_schema>
148
+
149
+ <invariants>
150
+ 1. **Start Immediately**: First action is session initialization, then Phase 1
151
+ 2. **Wave Order is Sacred**: Never execute wave 2 before wave 1 completes and results are merged
152
+ 3. **CSV is Source of Truth**: Master tasks.csv holds all state
153
+ 4. **Context Propagation**: prev_context built from master CSV, not from memory
154
+ 5. **Guidance First**: Wave 1 (guidance) MUST complete before any role analysis begins
155
+ 6. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
156
+ 7. **Skip on Failure**: If guidance fails, abort. If all roles fail, skip synthesis.
157
+ 8. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
158
+ 9. **DO NOT STOP**: Continuous execution until all waves complete
159
+ 10. **9 Valid Roles Only**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
160
+ </invariants>
161
+
162
+ <execution>
163
+
164
+ ### Session Initialization
165
+
166
+ ```javascript
167
+ const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
168
+
169
+ // Parse flags
170
+ const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
171
+ const continueMode = $ARGUMENTS.includes('--continue')
172
+ const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
173
+ const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 6
174
+
175
+ // Parse brainstorm-specific flags
176
+ const countMatch = $ARGUMENTS.match(/--count\s+(\d+)/)
177
+ const roleCount = countMatch ? Math.min(parseInt(countMatch[1]), 9) : 3
178
+ const skipQuestions = $ARGUMENTS.includes('--skip-questions')
179
+
180
+ // Clean topic text
181
+ const topicArg = $ARGUMENTS
182
+ .replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+|--count\s+\d+|--skip-questions/g, '')
183
+ .trim()
184
+
185
+ const slug = topicArg.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
186
+ const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
187
+ const sessionId = `brainstorm-${slug}-${dateStr}`
188
+ const sessionFolder = `.workflow/.csv-wave/${sessionId}`
189
+
190
+ Bash(`mkdir -p ${sessionFolder}/.brainstorming`)
191
+ ```
192
+
193
+ ### Phase 1: Topic Resolution -> CSV
194
+
195
+ **Objective**: Parse topic, select roles, generate tasks.csv.
196
+
197
+ **Decomposition Rules**:
198
+
199
+ 1. **Mode detection**: Number = phase mode (resolve `.workflow/phases/{NN}-{slug}/`), text = scratch mode
200
+ 2. **Project specs loading**: Read `.workflow/specs/` for architecture-aware analysis context
201
+ 3. **Role selection**:
202
+
203
+ | Condition | Action |
204
+ |-----------|--------|
205
+ | `--yes` flag | Auto-select top `roleCount` roles based on topic relevance |
206
+ | Interactive | AskUserQuestion (multiSelect=true) with recommended roles + rationale |
207
+
208
+ 4. **Valid roles** (9 total):
209
+
210
+ | Role ID | Focus Area |
211
+ |---------|------------|
212
+ | `data-architect` | Data models, storage strategies, data flow |
213
+ | `product-manager` | Product strategy, roadmap, prioritization |
214
+ | `product-owner` | Backlog management, user stories, acceptance criteria |
215
+ | `scrum-master` | Process facilitation, impediment removal |
216
+ | `subject-matter-expert` | Domain knowledge, business rules, compliance |
217
+ | `system-architect` | Technical architecture, scalability, integration |
218
+ | `test-strategist` | Test strategy, quality assurance |
219
+ | `ui-designer` | Visual design, mockups, design systems |
220
+ | `ux-expert` | User research, information architecture, journey |
221
+
222
+ 5. **CSV generation**: 1 guidance row (wave 1) + N role rows (wave 2) + 1 synthesis row (wave 3).
223
+
224
+ **Wave computation**: 3-wave diamond -- guidance = wave 1, all role tasks = wave 2, synthesis = wave 3.
225
+
226
+ **User validation**: Display task breakdown (skip if AUTO_YES).
227
+
228
+ ### Phase 2: Wave Execution Engine
229
+
230
+ **Objective**: Execute brainstorm pipeline wave-by-wave via spawn_agents_on_csv.
231
+
232
+ #### Wave 1: Guidance Specification (Single Agent)
233
+
234
+ 1. Read master `tasks.csv`
235
+ 2. Filter rows where `wave == 1` AND `status == pending`
236
+ 3. No prev_context needed (wave 1 has no predecessors)
237
+ 4. Write `wave-1.csv`
238
+ 5. Execute:
239
+
240
+ ```javascript
241
+ spawn_agents_on_csv({
242
+ csv_path: `${sessionFolder}/wave-1.csv`,
243
+ id_column: "id",
244
+ instruction: buildGuidanceInstruction(sessionFolder, topicArg),
245
+ max_concurrency: 1,
246
+ max_runtime_seconds: 600,
247
+ output_csv_path: `${sessionFolder}/wave-1-results.csv`,
248
+ output_schema: {
249
+ type: "object",
250
+ properties: {
251
+ id: { type: "string" },
252
+ status: { type: "string", enum: ["completed", "failed"] },
253
+ findings: { type: "string" },
254
+ analysis_file: { type: "string" },
255
+ error: { type: "string" }
256
+ },
257
+ required: ["id", "status", "findings"]
258
+ }
259
+ })
260
+ ```
261
+
262
+ 6. Read `wave-1-results.csv`, merge into master `tasks.csv`
263
+ 7. Delete `wave-1.csv`
264
+ 8. Read generated `guidance-specification.md` for wave 2 context propagation
265
+
266
+ **Guidance agent responsibilities**:
267
+ - Analyze topic, extract 5-10 core domain terms
268
+ - Define non-goals and scope boundaries
269
+ - Decompose into features (max 8): F-{3-digit} ID, kebab-case slug, description, related roles, priority
270
+ - Apply RFC 2119 keywords (MUST, SHOULD, MAY, MUST NOT, SHOULD NOT)
271
+ - Write `guidance-specification.md` to `.brainstorming/`
272
+
273
+ #### Wave 2: Role Analysis (Parallel, 3-9 Agents)
274
+
275
+ 1. Read master `tasks.csv`
276
+ 2. Filter rows where `wave == 2` AND `status == pending`
277
+ 3. Build `prev_context` from wave 1 findings:
278
+ ```
279
+ [Task 1: Guidance Specification] Generated guidance-specification.md with N features, M terms defined...
280
+ ```
281
+ 4. Include `guidance-specification.md` content in prev_context for each role agent
282
+ 5. Write `wave-2.csv` with `prev_context` column
283
+ 6. Execute:
284
+
285
+ ```javascript
286
+ spawn_agents_on_csv({
287
+ csv_path: `${sessionFolder}/wave-2.csv`,
288
+ id_column: "id",
289
+ instruction: buildRoleAnalysisInstruction(sessionFolder),
290
+ max_concurrency: maxConcurrency,
291
+ max_runtime_seconds: 900,
292
+ output_csv_path: `${sessionFolder}/wave-2-results.csv`,
293
+ output_schema: {
294
+ type: "object",
295
+ properties: {
296
+ id: { type: "string" },
297
+ status: { type: "string", enum: ["completed", "failed"] },
298
+ findings: { type: "string" },
299
+ analysis_file: { type: "string" },
300
+ error: { type: "string" }
301
+ },
302
+ required: ["id", "status", "findings"]
303
+ }
304
+ })
305
+ ```
306
+
307
+ 7. Read `wave-2-results.csv`, merge into master `tasks.csv`
308
+ 8. Delete `wave-2.csv`
309
+
310
+ **Role agent responsibilities**:
311
+ - Read guidance-specification.md for framework context
312
+ - Analyze topic through role-specific lens
313
+ - Feature-point organization when feature list available:
314
+ - `analysis.md` -- Role overview INDEX only (< 1500 words)
315
+ - `analysis-cross-cutting.md` -- Cross-feature decisions (< 2000 words)
316
+ - `analysis-F-{id}-{slug}.md` -- Per-feature analysis (< 2000 words each)
317
+ - Fallback organization (no feature list):
318
+ - `analysis.md` -- Main analysis (< 3000 words)
319
+ - system-architect MUST include: Data Model, State Machine, Error Handling, Observability, Configuration Model
320
+ - Write analysis files to `.brainstorming/{role}/`
321
+
322
+ #### Wave 3: Synthesis + Feature Index (Single Agent)
323
+
324
+ 1. Read master `tasks.csv`
325
+ 2. Filter rows where `wave == 3` AND `status == pending`
326
+ 3. Check deps -- if all wave 2 tasks failed, skip synthesis
327
+ 4. Build `prev_context` from wave 2 findings:
328
+ ```
329
+ [Task 2: System Architect Analysis] Key findings: microservice architecture with event sourcing...
330
+ [Task 3: UI Designer Analysis] Key findings: component-based design system with real-time cursors...
331
+ [Task 4: Product Manager Analysis] Key findings: MVP focuses on document editing + presence...
332
+ ```
333
+ 5. Write `wave-3.csv` with `prev_context` column
334
+ 6. Execute `spawn_agents_on_csv` for synthesis agent
335
+ 7. Merge results into master `tasks.csv`
336
+ 8. Delete `wave-3.csv`
337
+
338
+ **Synthesis agent responsibilities**:
339
+ - Cross-role analysis: consensus, conflicts, unique contributions
340
+ - Conflict resolution with [RESOLVED]/[SUGGESTED]/[UNRESOLVED] tags
341
+ - Feature mode: generate `feature-specs/F-{id}-{slug}.md` per feature (7 sections, 1500-2500 words)
342
+ - Fallback mode: generate `synthesis-specification.md`
343
+ - Build `feature-index.json` and `synthesis-changelog.md`
344
+ - Four-Layer Aggregation: Direct Reference, Structured Extraction, Conflict Distillation, Cross-Feature Annotation
345
+
346
+ ### Phase 3: Results Aggregation
347
+
348
+ **Objective**: Generate final results and human-readable report.
349
+
350
+ 1. Read final master `tasks.csv`
351
+ 2. Export as `results.csv`
352
+ 3. Generate `context.md`:
353
+
354
+ ```markdown
355
+ # Brainstorm Report -- {topic}
356
+
357
+ ## Summary
358
+ - Topic: {topic}
359
+ - Roles analyzed: {role_count}
360
+ - Features decomposed: {feature_count}
361
+ - Conflicts resolved: {resolved_count}
362
+
363
+ ## Guidance Specification
364
+ {summary of guidance-specification.md}
365
+
366
+ ## Role Analysis Results
367
+ ### {role_name}
368
+ {findings summary}
369
+ **Analysis file**: {analysis_file path}
370
+
371
+ ## Synthesis
372
+ {synthesis summary}
373
+ - Consensus areas: {list}
374
+ - Resolved conflicts: {list}
375
+ - Unresolved items: {list}
376
+
377
+ ## Feature Index
378
+ {feature-index.json summary}
379
+
380
+ ## Next Steps
381
+ - Skill: maestro-analyze -- Evaluate feasibility + lock decisions
382
+ - Skill: maestro-plan -- Plan directly if scope is clear
383
+ - Skill: maestro-spec-generate -- Generate full spec package from brainstorm
384
+ ```
385
+
386
+ 4. Copy artifacts to output `.brainstorming/` directory (phase mode or scratch mode target)
387
+ 5. Update phase `index.json` with brainstorm status (if phase mode)
388
+ 6. Display summary with next step suggestions
389
+
390
+ ### Shared Discovery Board Protocol
391
+
392
+ #### Standard Discovery Types
393
+
394
+ | Type | Dedup Key | Data Schema | Description |
395
+ |------|-----------|-------------|-------------|
396
+ | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
397
+ | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
398
+ | `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
399
+ | `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue found |
400
+ | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
401
+
402
+ #### Domain Discovery Types
403
+
404
+ | Type | Dedup Key | Data Schema | Description |
405
+ |------|-----------|-------------|-------------|
406
+ | `terminology` | `data.term` | `{term, definition, aliases[], category}` | Domain term extracted |
407
+ | `non_goal` | `data.title` | `{title, rationale}` | Scope exclusion identified |
408
+ | `feature_candidate` | `data.id` | `{id, slug, description, roles[], priority}` | Feature decomposed from topic |
409
+ | `role_insight` | `data.role+data.topic` | `{role, topic, insight, confidence}` | Role-specific finding |
410
+ | `cross_role_conflict` | `data.area` | `{area, roles[], positions[], resolution}` | Cross-role disagreement |
411
+
412
+ #### Protocol
413
+
414
+ 1. **Read** `{session_folder}/discoveries.ndjson` before own analysis
415
+ 2. **Skip covered**: If discovery of same type + dedup key exists, skip
416
+ 3. **Write immediately**: Append findings as found
417
+ 4. **Append-only**: Never modify or delete
418
+ 5. **Deduplicate**: Check before writing
419
+
420
+ ```bash
421
+ echo '{"ts":"<ISO>","worker":"{id}","type":"terminology","data":{"term":"CRDT","definition":"Conflict-free Replicated Data Type","aliases":["conflict-free"],"category":"technical"}}' >> {session_folder}/discoveries.ndjson
422
+ ```
423
+ </execution>
424
+
425
+ <error_codes>
426
+
427
+ | Error | Resolution |
428
+ |-------|------------|
429
+ | Topic argument missing | Abort with error: "Topic text required" |
430
+ | Invalid role name in selection | Filter to valid roles, warn user |
431
+ | Role count exceeds 9 | Cap at 9 with warning |
432
+ | Guidance agent timeout | Mark as failed, abort pipeline (wave 2 depends on guidance) |
433
+ | Role agent timeout | Mark as failed, continue with remaining roles |
434
+ | All role agents failed | Skip synthesis (wave 3), report partial results |
435
+ | Synthesis agent failed | Use wave 2 results directly, no feature index |
436
+ | CSV parse error | Validate format, show line number |
437
+ | discoveries.ndjson corrupt | Ignore malformed lines |
438
+ | Continue mode: no session found | List available sessions |
439
+ | Phase directory not found | Abort with error: "Phase {N} not found" |
440
+ </error_codes>
441
+
442
+ <success_criteria>
443
+ - [ ] Session folder created with valid tasks.csv
444
+ - [ ] All 3 waves executed in order
445
+ - [ ] guidance-specification.md produced in .brainstorming/
446
+ - [ ] Role analysis files produced per selected role
447
+ - [ ] Synthesis artifacts produced (feature specs or synthesis-specification.md)
448
+ - [ ] feature-index.json and synthesis-changelog.md produced
449
+ - [ ] context.md produced with full brainstorm report
450
+ - [ ] Artifacts copied to target .brainstorming/ directory
451
+ - [ ] discoveries.ndjson append-only throughout
452
+ </success_criteria>