maestro-flow 0.3.38 → 0.3.39

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 (181) hide show
  1. package/.claude/agents/workflow-analyzer.md +2 -0
  2. package/.claude/agents/workflow-debugger.md +2 -0
  3. package/.claude/agents/workflow-executor.md +2 -0
  4. package/.claude/agents/workflow-integration-checker.md +1 -0
  5. package/.claude/agents/workflow-nyquist-auditor.md +1 -0
  6. package/.claude/agents/workflow-planner.md +2 -0
  7. package/.claude/agents/workflow-reviewer.md +2 -0
  8. package/.claude/agents/workflow-verifier.md +2 -0
  9. package/.claude/commands/learn-decompose.md +176 -176
  10. package/.claude/commands/learn-follow.md +167 -167
  11. package/.claude/commands/learn-investigate.md +221 -221
  12. package/.claude/commands/learn-retro.md +303 -303
  13. package/.claude/commands/learn-second-opinion.md +167 -167
  14. package/.claude/commands/maestro-amend.md +300 -300
  15. package/.claude/commands/maestro-analyze.md +126 -126
  16. package/.claude/commands/maestro-brainstorm.md +100 -100
  17. package/.claude/commands/maestro-composer.md +354 -354
  18. package/.claude/commands/maestro-execute.md +120 -114
  19. package/.claude/commands/maestro-fork.md +86 -86
  20. package/.claude/commands/maestro-init.md +78 -78
  21. package/.claude/commands/maestro-learn.md +140 -140
  22. package/.claude/commands/maestro-link-coordinate.md +1 -1
  23. package/.claude/commands/maestro-merge.md +61 -61
  24. package/.claude/commands/maestro-milestone-release.md +96 -96
  25. package/.claude/commands/maestro-overlay.md +178 -178
  26. package/.claude/commands/maestro-plan.md +150 -138
  27. package/.claude/commands/maestro-player.md +404 -404
  28. package/.claude/commands/maestro-quick.md +56 -56
  29. package/.claude/commands/maestro-ralph-execute.md +7 -18
  30. package/.claude/commands/maestro-ralph.md +9 -3
  31. package/.claude/commands/maestro-roadmap.md +1 -1
  32. package/.claude/commands/maestro-ui-design.md +93 -93
  33. package/.claude/commands/maestro-update.md +176 -176
  34. package/.claude/commands/maestro-verify.md +96 -90
  35. package/.claude/commands/maestro.md +121 -121
  36. package/.claude/commands/manage-codebase-rebuild.md +75 -75
  37. package/.claude/commands/manage-codebase-refresh.md +57 -57
  38. package/.claude/commands/manage-harvest.md +94 -94
  39. package/.claude/commands/manage-issue-discover.md +77 -77
  40. package/.claude/commands/manage-issue.md +73 -73
  41. package/.claude/commands/manage-knowhow-capture.md +193 -193
  42. package/.claude/commands/manage-knowhow.md +77 -77
  43. package/.claude/commands/manage-learn.md +67 -67
  44. package/.claude/commands/manage-status.md +51 -51
  45. package/.claude/commands/manage-wiki.md +62 -62
  46. package/.claude/commands/quality-auto-test.md +1 -1
  47. package/.claude/commands/quality-debug.md +121 -115
  48. package/.claude/commands/quality-refactor.md +55 -55
  49. package/.claude/commands/quality-retrospective.md +78 -78
  50. package/.claude/commands/quality-review.md +114 -108
  51. package/.claude/commands/quality-sync.md +51 -51
  52. package/.claude/commands/quality-test.md +103 -103
  53. package/.claude/commands/spec-add.md +49 -49
  54. package/.claude/commands/spec-load.md +51 -51
  55. package/.claude/commands/spec-remove.md +51 -51
  56. package/.claude/commands/spec-setup.md +51 -51
  57. package/.claude/commands/wiki-connect.md +62 -62
  58. package/.claude/commands/wiki-digest.md +69 -69
  59. package/.codex/skills/learn-decompose/SKILL.md +113 -113
  60. package/.codex/skills/learn-follow/SKILL.md +1 -1
  61. package/.codex/skills/learn-investigate/SKILL.md +83 -83
  62. package/.codex/skills/learn-retro/SKILL.md +83 -83
  63. package/.codex/skills/learn-second-opinion/SKILL.md +86 -86
  64. package/.codex/skills/maestro/SKILL.md +304 -304
  65. package/.codex/skills/maestro-analyze/SKILL.md +4 -3
  66. package/.codex/skills/maestro-brainstorm/SKILL.md +442 -397
  67. package/.codex/skills/maestro-composer/SKILL.md +213 -213
  68. package/.codex/skills/maestro-execute/SKILL.md +346 -318
  69. package/.codex/skills/maestro-fork/SKILL.md +56 -2
  70. package/.codex/skills/maestro-init/SKILL.md +40 -16
  71. package/.codex/skills/maestro-learn/SKILL.md +80 -80
  72. package/.codex/skills/maestro-link-coordinate/SKILL.md +257 -257
  73. package/.codex/skills/maestro-merge/SKILL.md +1 -1
  74. package/.codex/skills/maestro-milestone-audit/SKILL.md +1 -1
  75. package/.codex/skills/maestro-milestone-complete/SKILL.md +40 -9
  76. package/.codex/skills/maestro-milestone-release/SKILL.md +70 -70
  77. package/.codex/skills/maestro-overlay/SKILL.md +1 -1
  78. package/.codex/skills/maestro-plan/SKILL.md +19 -4
  79. package/.codex/skills/maestro-player/SKILL.md +323 -323
  80. package/.codex/skills/maestro-quick/SKILL.md +1 -1
  81. package/.codex/skills/maestro-ralph/SKILL.md +681 -578
  82. package/.codex/skills/maestro-roadmap/SKILL.md +518 -468
  83. package/.codex/skills/maestro-ui-design/SKILL.md +109 -12
  84. package/.codex/skills/maestro-verify/SKILL.md +27 -9
  85. package/.codex/skills/manage-codebase-rebuild/SKILL.md +3 -2
  86. package/.codex/skills/manage-codebase-refresh/SKILL.md +1 -1
  87. package/.codex/skills/manage-harvest/SKILL.md +91 -91
  88. package/.codex/skills/manage-issue/SKILL.md +19 -6
  89. package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
  90. package/.codex/skills/manage-knowhow/SKILL.md +95 -95
  91. package/.codex/skills/manage-knowhow-capture/SKILL.md +110 -110
  92. package/.codex/skills/manage-learn/SKILL.md +1 -1
  93. package/.codex/skills/manage-status/SKILL.md +1 -1
  94. package/.codex/skills/manage-wiki/SKILL.md +55 -55
  95. package/.codex/skills/quality-auto-test/SKILL.md +547 -547
  96. package/.codex/skills/quality-debug/SKILL.md +339 -334
  97. package/.codex/skills/quality-refactor/SKILL.md +1 -1
  98. package/.codex/skills/quality-retrospective/SKILL.md +292 -292
  99. package/.codex/skills/quality-review/SKILL.md +365 -364
  100. package/.codex/skills/quality-sync/SKILL.md +1 -1
  101. package/.codex/skills/quality-test/SKILL.md +498 -498
  102. package/.codex/skills/spec-add/SKILL.md +101 -101
  103. package/.codex/skills/spec-load/SKILL.md +77 -77
  104. package/.codex/skills/spec-map/SKILL.md +1 -1
  105. package/.codex/skills/spec-remove/SKILL.md +69 -69
  106. package/.codex/skills/spec-setup/SKILL.md +1 -1
  107. package/.codex/skills/team-coordinate/SKILL.md +2 -1
  108. package/.codex/skills/team-executor/SKILL.md +116 -115
  109. package/.codex/skills/team-lifecycle-v4/SKILL.md +2 -1
  110. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +14 -6
  111. package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +16 -4
  112. package/.codex/skills/team-lifecycle-v4/roles/executor/commands/implement.md +7 -1
  113. package/.codex/skills/team-lifecycle-v4/roles/planner/role.md +16 -4
  114. package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +8 -2
  115. package/.codex/skills/team-quality-assurance/SKILL.md +2 -1
  116. package/.codex/skills/team-quality-assurance/roles/scout/role.md +9 -2
  117. package/.codex/skills/team-review/SKILL.md +2 -1
  118. package/.codex/skills/team-review/roles/reviewer/role.md +10 -1
  119. package/.codex/skills/team-review/roles/scanner/role.md +10 -1
  120. package/.codex/skills/team-tech-debt/SKILL.md +144 -143
  121. package/.codex/skills/team-tech-debt/roles/executor/role.md +9 -5
  122. package/.codex/skills/team-tech-debt/roles/scanner/role.md +10 -0
  123. package/.codex/skills/team-tech-debt/roles/validator/role.md +8 -2
  124. package/.codex/skills/team-testing/SKILL.md +2 -1
  125. package/.codex/skills/team-testing/roles/executor/role.md +8 -2
  126. package/.codex/skills/team-testing/roles/generator/role.md +8 -2
  127. package/.codex/skills/wiki-connect/SKILL.md +73 -73
  128. package/.codex/skills/wiki-digest/SKILL.md +87 -87
  129. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -0
  130. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  131. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +6 -0
  132. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  133. package/dashboard/dist-server/shared/agent-types.d.ts +2 -0
  134. package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +2 -0
  135. package/dashboard/dist-server/src/agents/cli-agent-runner.js +4 -0
  136. package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
  137. package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
  138. package/dashboard/dist-server/src/commands/delegate.js +18 -0
  139. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  140. package/dashboard/dist-server/src/config/cli-tools-config.d.ts +6 -0
  141. package/dashboard/dist-server/src/config/cli-tools-config.js +2 -0
  142. package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
  143. package/dist/shared/agent-types.d.ts +2 -0
  144. package/dist/shared/agent-types.d.ts.map +1 -1
  145. package/dist/src/agents/cli-agent-runner.d.ts +2 -0
  146. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  147. package/dist/src/agents/cli-agent-runner.js +4 -0
  148. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  149. package/dist/src/commands/config.d.ts.map +1 -1
  150. package/dist/src/commands/config.js +29 -1
  151. package/dist/src/commands/config.js.map +1 -1
  152. package/dist/src/commands/delegate.d.ts +2 -0
  153. package/dist/src/commands/delegate.d.ts.map +1 -1
  154. package/dist/src/commands/delegate.js +18 -0
  155. package/dist/src/commands/delegate.js.map +1 -1
  156. package/dist/src/commands/launcher.d.ts.map +1 -1
  157. package/dist/src/commands/launcher.js +27 -4
  158. package/dist/src/commands/launcher.js.map +1 -1
  159. package/dist/src/config/cli-tools-config.d.ts +6 -0
  160. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  161. package/dist/src/config/cli-tools-config.js +2 -0
  162. package/dist/src/config/cli-tools-config.js.map +1 -1
  163. package/dist/src/core/overlay/applier.d.ts.map +1 -1
  164. package/dist/src/core/overlay/applier.js +65 -5
  165. package/dist/src/core/overlay/applier.js.map +1 -1
  166. package/dist/src/core/overlay/loader.d.ts.map +1 -1
  167. package/dist/src/core/overlay/loader.js +9 -4
  168. package/dist/src/core/overlay/loader.js.map +1 -1
  169. package/dist/src/core/overlay/types.d.ts +2 -0
  170. package/dist/src/core/overlay/types.d.ts.map +1 -1
  171. package/dist/src/core/overlay/types.js +2 -0
  172. package/dist/src/core/overlay/types.js.map +1 -1
  173. package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -1
  174. package/dist/src/tui/tools-ui/ToolsDashboard.js +1 -1
  175. package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -1
  176. package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -1
  177. package/dist/src/tui/tools-ui/ToolsOverview.js +51 -4
  178. package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -1
  179. package/package.json +1 -1
  180. package/shared/agent-types.ts +2 -0
  181. package/workflows/delegate-protocol.codex.md +65 -0
@@ -1,397 +1,442 @@
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 "20260318-brainstorm-collab"
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/{YYYYMMDD}-brainstorm-{slug}/
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
- ```
167
- Parse from $ARGUMENTS:
168
- AUTO_YES ← --yes | -y
169
- continueMode ← --continue
170
- maxConcurrency ← --concurrency | -c N (default: 6)
171
- roleCount ← --count N (default: 3, max: 9)
172
- skipQuestions ← --skip-questions
173
- topicArg remaining text after flag removal
174
-
175
- Derive:
176
- slug topicArg kebab-cased, max 40 chars
177
- dateStr UTC+8 YYYYMMDD
178
- sessionId ← "{dateStr}-brainstorm-{slug}"
179
- sessionFolder ← ".workflow/.csv-wave/{sessionId}"
180
-
181
- mkdir -p {sessionFolder}/.brainstorming
182
- ```
183
-
184
- ### Phase 1: Topic Resolution -> CSV
185
-
186
- **Objective**: Parse topic, select roles, generate tasks.csv.
187
-
188
- **Decomposition Rules**:
189
-
190
- 1. **Mode detection**: Number = phase mode (resolve via state.json artifact registry to `.workflow/scratch/{YYYYMMDD}-{type}-{slug}/`), text = scratch mode
191
- 2. **Project specs loading**: Read `.workflow/specs/` for architecture-aware analysis context
192
- 3. **Role selection**:
193
-
194
- | Condition | Action |
195
- |-----------|--------|
196
- | `--yes` flag | Auto-select top `roleCount` roles based on topic relevance |
197
- | Interactive | AskUserQuestion (multiSelect=true) with recommended roles + rationale |
198
-
199
- 4. **Valid roles** (9 total):
200
-
201
- | Role ID | Focus Area |
202
- |---------|------------|
203
- | `data-architect` | Data models, storage strategies, data flow |
204
- | `product-manager` | Product strategy, roadmap, prioritization |
205
- | `product-owner` | Backlog management, user stories, acceptance criteria |
206
- | `scrum-master` | Process facilitation, impediment removal |
207
- | `subject-matter-expert` | Domain knowledge, business rules, compliance |
208
- | `system-architect` | Technical architecture, scalability, integration |
209
- | `test-strategist` | Test strategy, quality assurance |
210
- | `ui-designer` | Visual design, mockups, design systems |
211
- | `ux-expert` | User research, information architecture, journey |
212
-
213
- 5. **CSV generation**: 1 guidance row (wave 1) + N role rows (wave 2) + 1 synthesis row (wave 3).
214
-
215
- **Wave computation**: 3-wave diamond -- guidance = wave 1, all role tasks = wave 2, synthesis = wave 3.
216
-
217
- **User validation**: Display task breakdown (skip if AUTO_YES).
218
-
219
- ### Phase 2: Wave Execution Engine
220
-
221
- **Objective**: Execute brainstorm pipeline wave-by-wave via spawn_agents_on_csv.
222
-
223
- #### Wave 1: Guidance Specification (Single Agent)
224
-
225
- 1. Extract wave 1 pending rows from master `tasks.csv` into `wave-1.csv` (no prev_context needed)
226
- 2. Execute:
227
-
228
- ```javascript
229
- spawn_agents_on_csv({
230
- csv_path: `${sessionFolder}/wave-1.csv`,
231
- id_column: "id",
232
- instruction: buildGuidanceInstruction(sessionFolder, topicArg),
233
- max_concurrency: 1, max_runtime_seconds: 3600,
234
- output_csv_path: `${sessionFolder}/wave-1-results.csv`,
235
- output_schema: { id, status: [completed|failed], findings, analysis_file, error }
236
- })
237
- ```
238
-
239
- 3. Merge results into master `tasks.csv`, delete `wave-1.csv`
240
- 4. Read generated `guidance-specification.md` for wave 2 context propagation
241
-
242
- **Guidance agent responsibilities**:
243
- - Analyze topic, extract 5-10 core domain terms
244
- - Define non-goals and scope boundaries
245
- - Decompose into features (max 8): F-{3-digit} ID, kebab-case slug, description, related roles, priority
246
- - Apply RFC 2119 keywords (MUST, SHOULD, MAY, MUST NOT, SHOULD NOT)
247
- - Write `guidance-specification.md` to `.brainstorming/`
248
-
249
- #### Wave 2: Role Analysis (Parallel, 3-9 Agents)
250
-
251
- 1. Extract wave 2 pending rows from master `tasks.csv`
252
- 2. Build `prev_context` from wave 1 findings + `guidance-specification.md` content
253
- 3. Write `wave-2.csv` with `prev_context` column
254
- 4. Execute:
255
-
256
- ```javascript
257
- spawn_agents_on_csv({
258
- csv_path: `${sessionFolder}/wave-2.csv`,
259
- id_column: "id",
260
- instruction: buildRoleAnalysisInstruction(sessionFolder),
261
- max_concurrency: maxConcurrency, max_runtime_seconds: 3600,
262
- output_csv_path: `${sessionFolder}/wave-2-results.csv`,
263
- output_schema: { id, status: [completed|failed], findings, analysis_file, error }
264
- })
265
- ```
266
-
267
- 5. Merge results into master `tasks.csv`, delete `wave-2.csv`
268
-
269
- **Role agent responsibilities**:
270
- - Read guidance-specification.md for framework context
271
- - Analyze topic through role-specific lens
272
- - Feature-point organization when feature list available:
273
- - `analysis.md` -- Role overview INDEX only (< 1500 words)
274
- - `analysis-cross-cutting.md` -- Cross-feature decisions (< 2000 words)
275
- - `analysis-F-{id}-{slug}.md` -- Per-feature analysis (< 2000 words each)
276
- - Fallback organization (no feature list):
277
- - `analysis.md` -- Main analysis (< 3000 words)
278
- - system-architect MUST include: Data Model, State Machine, Error Handling, Observability, Configuration Model
279
- - Write analysis files to `.brainstorming/{role}/`
280
-
281
- #### Wave 3: Synthesis + Feature Index (Single Agent)
282
-
283
- 1. If all wave 2 tasks failed, skip synthesis entirely
284
- 2. Extract wave 3 pending rows, build `prev_context` from wave 2 findings
285
- 3. Write `wave-3.csv`, execute `spawn_agents_on_csv` for synthesis agent (same output_schema pattern)
286
- 4. Merge results into master `tasks.csv`, delete `wave-3.csv`
287
-
288
- **Synthesis agent responsibilities**:
289
- - Cross-role analysis: consensus, conflicts, unique contributions
290
- - Conflict resolution with [RESOLVED]/[SUGGESTED]/[UNRESOLVED] tags
291
- - Feature mode: generate `feature-specs/F-{id}-{slug}.md` per feature (7 sections, 1500-2500 words)
292
- - Fallback mode: generate `synthesis-specification.md`
293
- - Build `feature-index.json` and `synthesis-changelog.md`
294
- - Four-Layer Aggregation: Direct Reference, Structured Extraction, Conflict Distillation, Cross-Feature Annotation
295
-
296
- ### Phase 3: Results Aggregation
297
-
298
- **Objective**: Generate final results and human-readable report.
299
-
300
- 1. Export final `tasks.csv` as `results.csv`
301
- 2. Generate `context.md`:
302
-
303
- ```markdown
304
- # Brainstorm Report -- {topic}
305
-
306
- ## Summary
307
- - Topic: {topic}
308
- - Roles analyzed: {role_count}
309
- - Features decomposed: {feature_count}
310
- - Conflicts resolved: {resolved_count}
311
-
312
- ## Guidance Specification
313
- {summary of guidance-specification.md}
314
-
315
- ## Role Analysis Results
316
- ### {role_name}
317
- {findings summary}
318
- **Analysis file**: {analysis_file path}
319
-
320
- ## Synthesis
321
- {synthesis summary}
322
- - Consensus areas: {list}
323
- - Resolved conflicts: {list}
324
- - Unresolved items: {list}
325
-
326
- ## Feature Index
327
- {feature-index.json summary}
328
-
329
- ## Next Steps
330
- - Skill: maestro-analyze -- Evaluate feasibility + lock decisions
331
- - Skill: maestro-plan -- Plan directly if scope is clear
332
- - Skill: maestro-roadmap --mode full -- Generate full spec package from brainstorm
333
- ```
334
-
335
- 4. Copy artifacts to output `.brainstorming/` directory (phase mode or scratch mode target)
336
- 5. Update phase `index.json` with brainstorm status (if phase mode)
337
- 6. Display summary with next step suggestions
338
-
339
- ### Shared Discovery Board Protocol
340
-
341
- #### Standard Discovery Types
342
-
343
- | Type | Dedup Key | Data Schema | Description |
344
- |------|-----------|-------------|-------------|
345
- | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
346
- | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
347
- | `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
348
- | `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue found |
349
- | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
350
-
351
- #### Domain Discovery Types
352
-
353
- | Type | Dedup Key | Data Schema | Description |
354
- |------|-----------|-------------|-------------|
355
- | `terminology` | `data.term` | `{term, definition, aliases[], category}` | Domain term extracted |
356
- | `non_goal` | `data.title` | `{title, rationale}` | Scope exclusion identified |
357
- | `feature_candidate` | `data.id` | `{id, slug, description, roles[], priority}` | Feature decomposed from topic |
358
- | `role_insight` | `data.role+data.topic` | `{role, topic, insight, confidence}` | Role-specific finding |
359
- | `cross_role_conflict` | `data.area` | `{area, roles[], positions[], resolution}` | Cross-role disagreement |
360
-
361
- #### Protocol
362
-
363
- Read `discoveries.ndjson` before analysis. Append-only: dedup by type+key before writing, never modify/delete.
364
-
365
- ```bash
366
- 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
367
- ```
368
- </execution>
369
-
370
- <error_codes>
371
-
372
- | Error | Resolution |
373
- |-------|------------|
374
- | Topic argument missing | Abort with error: "Topic text required" |
375
- | Invalid role name in selection | Filter to valid roles, warn user |
376
- | Role count exceeds 9 | Cap at 9 with warning |
377
- | Guidance agent timeout | Mark as failed, abort pipeline (wave 2 depends on guidance) |
378
- | Role agent timeout | Mark as failed, continue with remaining roles |
379
- | All role agents failed | Skip synthesis (wave 3), report partial results |
380
- | Synthesis agent failed | Use wave 2 results directly, no feature index |
381
- | CSV parse error | Validate format, show line number |
382
- | discoveries.ndjson corrupt | Ignore malformed lines |
383
- | Continue mode: no session found | List available sessions |
384
- | Phase directory not found | Abort with error: "Phase {N} not found" |
385
- </error_codes>
386
-
387
- <success_criteria>
388
- - [ ] Session folder created with valid tasks.csv
389
- - [ ] All 3 waves executed in order
390
- - [ ] guidance-specification.md produced in .brainstorming/
391
- - [ ] Role analysis files produced per selected role
392
- - [ ] Synthesis artifacts produced (feature specs or synthesis-specification.md)
393
- - [ ] feature-index.json and synthesis-changelog.md produced
394
- - [ ] context.md produced with full brainstorm report
395
- - [ ] Artifacts copied to target .brainstorming/ directory
396
- - [ ] discoveries.ndjson append-only throughout
397
- </success_criteria>
1
+ ---
2
+ name: maestro-brainstorm
3
+ description: Brainstorm with auto pipeline or single-role analysis
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, request_user_input
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
+ | +-- [CHECKPOINT] User reviews guidance spec (skip if -y) |
35
+ | +-- Wave 2: Role Analysis (parallel, 3-9 agents) |
36
+ | | +-- Each role agent analyzes topic through its lens |
37
+ | | +-- Receives guidance-specification.md via prev_context |
38
+ | | +-- Feature-point organization when feature list available |
39
+ | | +-- Discoveries shared via board (role insights, conflicts) |
40
+ | | +-- Results: analysis_file path per role |
41
+ | +-- [CHECKPOINT] User reviews role analyses (skip if -y) |
42
+ | +-- Wave 3: Synthesis + Feature Index (single agent) |
43
+ | | +-- Cross-role analysis: consensus, conflicts, unique insights |
44
+ | | +-- Generate feature specs or synthesis-specification.md |
45
+ | | +-- Build feature-index.json + synthesis-changelog.md |
46
+ | | +-- Discoveries shared via board (cross-role patterns) |
47
+ | +-- discoveries.ndjson shared across all waves (append-only) |
48
+ | |
49
+ | Phase 3: Results Aggregation |
50
+ | +-- Export results.csv |
51
+ | +-- Generate context.md with all findings |
52
+ | +-- Copy artifacts to .brainstorming/ directory |
53
+ | +-- Update phase index.json with brainstorm status |
54
+ | +-- [ROUTING] Offer ui-design when UI features detected |
55
+ | +-- Display summary with next steps |
56
+ | |
57
+ +---------------------------------------------------------------------------+
58
+ ```
59
+
60
+ </purpose>
61
+
62
+ <context>
63
+ ```bash
64
+ $maestro-brainstorm "Build real-time collaboration platform"
65
+ $maestro-brainstorm -y "Build real-time collaboration platform"
66
+ $maestro-brainstorm -c 6 "Build real-time collaboration platform --count 5"
67
+ $maestro-brainstorm --continue "20260318-brainstorm-collab"
68
+ ```
69
+
70
+ **Flags**:
71
+ - `-y, --yes`: Skip all confirmations (auto mode)
72
+ - `-c, --concurrency N`: Max concurrent agents within each wave (default: 6)
73
+ - `--continue`: Resume existing session
74
+ - `--count N`: Number of roles to select (default 3, max 9)
75
+ - `--skip-questions`: Skip context gathering questions
76
+
77
+ When `--yes` or `-y`: Auto-confirm role selection, skip interactive questions, use defaults for count and role selection.
78
+
79
+ **Output Directory**: `.workflow/.csv-wave/{session-id}/`
80
+ **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report) + `.brainstorming/` (role analyses + synthesis artifacts)
81
+ </context>
82
+
83
+ <csv_schema>
84
+
85
+ ### tasks.csv (Master State)
86
+
87
+ ```csv
88
+ id,title,description,role,topic,guidance_spec,deps,context_from,wave,status,findings,analysis_file,error
89
+ "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","","","",""
90
+ "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","","","",""
91
+ "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","","","",""
92
+ "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","","","",""
93
+ "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","","","",""
94
+ ```
95
+
96
+ **Columns**:
97
+
98
+ | Column | Phase | Description |
99
+ |--------|-------|-------------|
100
+ | `id` | Input | Unique task identifier (string) |
101
+ | `title` | Input | Short task title |
102
+ | `description` | Input | Detailed instructions for this task |
103
+ | `role` | Input | Role identifier: guidance-generator, system-architect, ui-designer, product-manager, ..., synthesis |
104
+ | `topic` | Input | Brainstorm topic text |
105
+ | `guidance_spec` | Input | Guidance-specification.md content reference (populated for wave 2+ from wave 1) |
106
+ | `deps` | Input | Semicolon-separated dependency task IDs |
107
+ | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
108
+ | `wave` | Computed | Wave number (1 = guidance, 2 = role analysis, 3 = synthesis) |
109
+ | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
110
+ | `findings` | Output | Key findings summary (max 500 chars) |
111
+ | `analysis_file` | Output | Path to generated analysis file |
112
+ | `error` | Output | Error message if failed |
113
+
114
+ ### Per-Wave CSV (Temporary)
115
+
116
+ Each wave generates `wave-{N}.csv` with extra `prev_context` column.
117
+
118
+ ### Output Artifacts
119
+
120
+ | File | Purpose | Lifecycle |
121
+ |------|---------|-----------|
122
+ | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
123
+ | `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
124
+ | `results.csv` | Final export of all task results | Created in Phase 3 |
125
+ | `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
126
+ | `context.md` | Human-readable brainstorm report | Created in Phase 3 |
127
+ | `.brainstorming/` | Role analyses + synthesis artifacts | Populated in Phase 3 |
128
+
129
+ ### Session Structure
130
+
131
+ ```
132
+ .workflow/.csv-wave/{YYYYMMDD}-brainstorm-{slug}/
133
+ +-- tasks.csv
134
+ +-- results.csv
135
+ +-- discoveries.ndjson
136
+ +-- context.md
137
+ +-- wave-{N}.csv (temporary)
138
+ +-- .brainstorming/
139
+ +-- guidance-specification.md
140
+ +-- feature-index.json
141
+ +-- synthesis-changelog.md
142
+ +-- feature-specs/
143
+ | +-- F-001-{slug}.md
144
+ | +-- F-00N-{slug}.md
145
+ +-- {role}/
146
+ | +-- analysis.md
147
+ | +-- analysis-cross-cutting.md
148
+ | +-- analysis-F-{id}-{slug}.md
149
+ +-- synthesis-specification.md (fallback mode)
150
+ ```
151
+ </csv_schema>
152
+
153
+ <invariants>
154
+ 1. **Start Immediately**: First action is session initialization, then Phase 1
155
+ 2. **Wave Order is Sacred**: Never execute wave 2 before wave 1 completes and results are merged
156
+ 3. **CSV is Source of Truth**: Master tasks.csv holds all state
157
+ 4. **Context Propagation**: prev_context built from master CSV, not from memory
158
+ 5. **Guidance First**: Wave 1 (guidance) MUST complete before any role analysis begins
159
+ 6. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
160
+ 7. **Skip on Failure**: If guidance fails, abort. If all roles fail, skip synthesis.
161
+ 8. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
162
+ 9. **DO NOT STOP**: Continuous execution until all waves complete — only pause at [CHECKPOINT] interaction points (skipped with -y)
163
+ 10. **9 Valid Roles Only**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
164
+ </invariants>
165
+
166
+ <execution>
167
+
168
+ ### Session Initialization
169
+
170
+ ```
171
+ Parse from $ARGUMENTS:
172
+ AUTO_YES ← --yes | -y
173
+ continueMode --continue
174
+ maxConcurrency ← --concurrency | -c N (default: 6)
175
+ roleCount ← --count N (default: 3, max: 9)
176
+ skipQuestions --skip-questions
177
+ topicArg remaining text after flag removal
178
+
179
+ Derive:
180
+ slug ← topicArg kebab-cased, max 40 chars
181
+ dateStr ← UTC+8 YYYYMMDD
182
+ sessionId ← "{dateStr}-brainstorm-{slug}"
183
+ sessionFolder ← ".workflow/.csv-wave/{sessionId}"
184
+
185
+ mkdir -p {sessionFolder}/.brainstorming
186
+ ```
187
+
188
+ ### Phase 1: Topic Resolution -> CSV
189
+
190
+ **Objective**: Parse topic, select roles, generate tasks.csv.
191
+
192
+ **Decomposition Rules**:
193
+
194
+ 1. **Mode detection**: Number = phase mode (resolve via state.json artifact registry to `.workflow/scratch/{YYYYMMDD}-{type}-{slug}/`), text = scratch mode
195
+ 2. **Project specs loading**: Read `.workflow/specs/` for architecture-aware analysis context
196
+ 3. **Role selection**:
197
+
198
+ | Condition | Action |
199
+ |-----------|--------|
200
+ | `--yes` flag | Auto-select top `roleCount` roles based on topic relevance |
201
+ | Interactive | `request_user_input` with recommended roles + rationale |
202
+
203
+ 4. **Valid roles** (9 total):
204
+
205
+ | Role ID | Focus Area |
206
+ |---------|------------|
207
+ | `data-architect` | Data models, storage strategies, data flow |
208
+ | `product-manager` | Product strategy, roadmap, prioritization |
209
+ | `product-owner` | Backlog management, user stories, acceptance criteria |
210
+ | `scrum-master` | Process facilitation, impediment removal |
211
+ | `subject-matter-expert` | Domain knowledge, business rules, compliance |
212
+ | `system-architect` | Technical architecture, scalability, integration |
213
+ | `test-strategist` | Test strategy, quality assurance |
214
+ | `ui-designer` | Visual design, mockups, design systems |
215
+ | `ux-expert` | User research, information architecture, journey |
216
+
217
+ 5. **CSV generation**: 1 guidance row (wave 1) + N role rows (wave 2) + 1 synthesis row (wave 3).
218
+
219
+ **Wave computation**: 3-wave diamond -- guidance = wave 1, all role tasks = wave 2, synthesis = wave 3.
220
+
221
+ **User validation**: Display task breakdown (skip if AUTO_YES).
222
+
223
+ ### Phase 2: Wave Execution Engine
224
+
225
+ **Objective**: Execute brainstorm pipeline wave-by-wave via spawn_agents_on_csv.
226
+
227
+ #### Wave 1: Guidance Specification (Single Agent)
228
+
229
+ 1. Extract wave 1 pending rows from master `tasks.csv` into `wave-1.csv` (no prev_context needed)
230
+ 2. Execute:
231
+
232
+ ```javascript
233
+ spawn_agents_on_csv({
234
+ csv_path: `${sessionFolder}/wave-1.csv`,
235
+ id_column: "id",
236
+ instruction: buildGuidanceInstruction(sessionFolder, topicArg),
237
+ max_concurrency: 1, max_runtime_seconds: 3600,
238
+ output_csv_path: `${sessionFolder}/wave-1-results.csv`,
239
+ output_schema: { id, status: [completed|failed], findings, analysis_file, error }
240
+ })
241
+ ```
242
+
243
+ 3. Merge results into master `tasks.csv`, delete `wave-1.csv`
244
+ 4. Read generated `guidance-specification.md` for wave 2 context propagation
245
+ 5. **Interaction Checkpoint** (skip if AUTO_YES):
246
+ - Display guidance-specification summary: terminology count, feature list, non-goals
247
+ - `request_user_input`:
248
+ ```json
249
+ { "questions": [{ "id": "guidance_review", "header": "Guidance", "question": "Guidance specification generated. How to proceed?", "options": [
250
+ { "label": "Proceed (Recommended)", "description": "Continue to parallel role analysis with current guidance." },
251
+ { "label": "Revise", "description": "Provide feedback to directly edit guidance-specification.md." },
252
+ { "label": "Abort", "description": "Stop pipeline, output partial results (guidance only)." }
253
+ ]}] }
254
+ ```
255
+ - **Proceed** → continue to Wave 2
256
+ - **Revise** → user provides feedback, directly edit guidance-specification.md to incorporate changes
257
+ - **Abort** → stop pipeline, output partial results (guidance only)
258
+
259
+ **Guidance agent responsibilities**:
260
+ - Analyze topic, extract 5-10 core domain terms
261
+ - Define non-goals and scope boundaries
262
+ - Decompose into features (max 8): F-{3-digit} ID, kebab-case slug, description, related roles, priority
263
+ - Apply RFC 2119 keywords (MUST, SHOULD, MAY, MUST NOT, SHOULD NOT)
264
+ - Write `guidance-specification.md` to `.brainstorming/`
265
+
266
+ #### Wave 2: Role Analysis (Parallel, 3-9 Agents)
267
+
268
+ 1. Extract wave 2 pending rows from master `tasks.csv`
269
+ 2. Build `prev_context` from wave 1 findings + `guidance-specification.md` content
270
+ 3. Write `wave-2.csv` with `prev_context` column
271
+ 4. Execute:
272
+
273
+ ```javascript
274
+ spawn_agents_on_csv({
275
+ csv_path: `${sessionFolder}/wave-2.csv`,
276
+ id_column: "id",
277
+ instruction: buildRoleAnalysisInstruction(sessionFolder), // agent: ~/.codex/agents/conceptual-planning-agent.toml
278
+ max_concurrency: maxConcurrency, max_runtime_seconds: 3600,
279
+ output_csv_path: `${sessionFolder}/wave-2-results.csv`,
280
+ output_schema: { id, status: [completed|failed], findings, analysis_file, error }
281
+ })
282
+ ```
283
+
284
+ 5. Merge results into master `tasks.csv`, delete `wave-2.csv`
285
+ 6. **Interaction Checkpoint** (skip if AUTO_YES):
286
+ - Display per-role findings summary (role name + key insight, 1-2 lines each)
287
+ - Show success/failure counts: "{N} roles completed, {M} failed"
288
+ - `request_user_input`:
289
+ ```json
290
+ { "questions": [{ "id": "role_review", "header": "Roles", "question": "Role analyses complete. How to proceed?", "options": [
291
+ { "label": "Proceed (Recommended)", "description": "Continue to cross-role synthesis." },
292
+ { "label": "Add Roles", "description": "Select additional roles and run only the new ones." },
293
+ { "label": "Revise", "description": "Pick role(s) to directly edit analysis files with feedback." }
294
+ ]}] }
295
+ ```
296
+ - **Proceed** → continue to Wave 3 (synthesis)
297
+ - **Add Roles** → select additional roles, generate new wave-2 rows, execute only new roles
298
+ - **Revise** user picks specific role(s), directly edit its analysis files to incorporate feedback
299
+
300
+ **Role agent responsibilities**:
301
+ - Read guidance-specification.md for framework context
302
+ - Analyze topic through role-specific lens
303
+ - Feature-point organization when feature list available:
304
+ - `analysis.md` -- Role overview INDEX only (< 1500 words)
305
+ - `analysis-cross-cutting.md` -- Cross-feature decisions (< 2000 words)
306
+ - `analysis-F-{id}-{slug}.md` -- Per-feature analysis (< 2000 words each)
307
+ - Fallback organization (no feature list):
308
+ - `analysis.md` -- Main analysis (< 3000 words)
309
+ - system-architect MUST include: Data Model, State Machine, Error Handling, Observability, Configuration Model
310
+ - Write analysis files to `.brainstorming/{role}/`
311
+
312
+ #### Wave 3: Synthesis + Feature Index (Single Agent)
313
+
314
+ 1. If all wave 2 tasks failed, skip synthesis entirely
315
+ 2. Extract wave 3 pending rows, build `prev_context` from wave 2 findings
316
+ 3. Write `wave-3.csv`, execute `spawn_agents_on_csv` for synthesis agent (same output_schema pattern)
317
+ 4. Merge results into master `tasks.csv`, delete `wave-3.csv`
318
+
319
+ **Synthesis agent responsibilities**:
320
+ - Cross-role analysis: consensus, conflicts, unique contributions
321
+ - Conflict resolution with [RESOLVED]/[SUGGESTED]/[UNRESOLVED] tags
322
+ - Feature mode: generate `feature-specs/F-{id}-{slug}.md` per feature (7 sections, 1500-2500 words)
323
+ - Fallback mode: generate `synthesis-specification.md`
324
+ - Build `feature-index.json` and `synthesis-changelog.md`
325
+ - Four-Layer Aggregation: Direct Reference, Structured Extraction, Conflict Distillation, Cross-Feature Annotation
326
+
327
+ ### Phase 3: Results Aggregation
328
+
329
+ **Objective**: Generate final results and human-readable report.
330
+
331
+ 1. Export final `tasks.csv` as `results.csv`
332
+ 2. Generate `context.md`:
333
+
334
+ ```markdown
335
+ # Brainstorm Report -- {topic}
336
+
337
+ ## Summary
338
+ - Topic: {topic}
339
+ - Roles analyzed: {role_count}
340
+ - Features decomposed: {feature_count}
341
+ - Conflicts resolved: {resolved_count}
342
+
343
+ ## Guidance Specification
344
+ {summary of guidance-specification.md}
345
+
346
+ ## Role Analysis Results
347
+ ### {role_name}
348
+ {findings summary}
349
+ **Analysis file**: {analysis_file path}
350
+
351
+ ## Synthesis
352
+ {synthesis summary}
353
+ - Consensus areas: {list}
354
+ - Resolved conflicts: {list}
355
+ - Unresolved items: {list}
356
+
357
+ ## Feature Index
358
+ {feature-index.json summary}
359
+
360
+ ## Next Steps
361
+ - Skill: maestro-ui-design {topic} -- Generate UI prototypes (when UI features detected)
362
+ - Skill: maestro-analyze -- Evaluate feasibility + lock decisions
363
+ - Skill: maestro-plan -- Plan directly if scope is clear
364
+ - Skill: maestro-roadmap --mode full -- Generate full spec package from brainstorm
365
+ ```
366
+
367
+ 4. Copy artifacts to output `.brainstorming/` directory (phase mode or scratch mode target)
368
+ 5. Update phase `index.json` with brainstorm status (if phase mode)
369
+ 6. **Next-Step Routing** (skip if AUTO_YES — default to first applicable):
370
+ - Detect UI features: scan feature-index.json for UI/frontend-related features (keywords: ui, interface, page, component, dashboard, form, layout)
371
+ - `request_user_input` (include UI Design option only when UI features detected):
372
+ ```json
373
+ { "questions": [{ "id": "next_step", "header": "Next Step", "question": "Brainstorm complete. What next?", "options": [
374
+ { "label": "UI Design (Recommended)", "description": "Generate UI prototypes from brainstorm features." },
375
+ { "label": "Analyze", "description": "Evaluate feasibility and lock architectural decisions." },
376
+ { "label": "Plan", "description": "Create execution plan directly if scope is clear." }
377
+ ]}] }
378
+ ```
379
+ - **UI Design** invoke `maestro-ui-design` with topic + brainstorm session context
380
+ - **Analyze** invoke `maestro-analyze` for feasibility evaluation
381
+ - **Plan** invoke `maestro-plan` directly if scope is clear
382
+ - When no UI features detected, replace UI Design with Roadmap: `{ "label": "Roadmap (Recommended)", "description": "Generate full spec package from brainstorm." }`
383
+
384
+ ### Shared Discovery Board Protocol
385
+
386
+ #### Standard Discovery Types
387
+
388
+ | Type | Dedup Key | Data Schema | Description |
389
+ |------|-----------|-------------|-------------|
390
+ | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
391
+ | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
392
+ | `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
393
+ | `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue found |
394
+ | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
395
+
396
+ #### Domain Discovery Types
397
+
398
+ | Type | Dedup Key | Data Schema | Description |
399
+ |------|-----------|-------------|-------------|
400
+ | `terminology` | `data.term` | `{term, definition, aliases[], category}` | Domain term extracted |
401
+ | `non_goal` | `data.title` | `{title, rationale}` | Scope exclusion identified |
402
+ | `feature_candidate` | `data.id` | `{id, slug, description, roles[], priority}` | Feature decomposed from topic |
403
+ | `role_insight` | `data.role+data.topic` | `{role, topic, insight, confidence}` | Role-specific finding |
404
+ | `cross_role_conflict` | `data.area` | `{area, roles[], positions[], resolution}` | Cross-role disagreement |
405
+
406
+ #### Protocol
407
+
408
+ Read `discoveries.ndjson` before analysis. Append-only: dedup by type+key before writing, never modify/delete.
409
+
410
+ ```bash
411
+ 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
412
+ ```
413
+ </execution>
414
+
415
+ <error_codes>
416
+
417
+ | Error | Resolution |
418
+ |-------|------------|
419
+ | Topic argument missing | Abort with error: "Topic text required" |
420
+ | Invalid role name in selection | Filter to valid roles, warn user |
421
+ | Role count exceeds 9 | Cap at 9 with warning |
422
+ | Guidance agent timeout | Mark as failed, abort pipeline (wave 2 depends on guidance) |
423
+ | Role agent timeout | Mark as failed, continue with remaining roles |
424
+ | All role agents failed | Skip synthesis (wave 3), report partial results |
425
+ | Synthesis agent failed | Use wave 2 results directly, no feature index |
426
+ | CSV parse error | Validate format, show line number |
427
+ | discoveries.ndjson corrupt | Ignore malformed lines |
428
+ | Continue mode: no session found | List available sessions |
429
+ | Phase directory not found | Abort with error: "Phase {N} not found" |
430
+ </error_codes>
431
+
432
+ <success_criteria>
433
+ - [ ] Session folder created with valid tasks.csv
434
+ - [ ] All 3 waves executed in order
435
+ - [ ] guidance-specification.md produced in .brainstorming/
436
+ - [ ] Role analysis files produced per selected role
437
+ - [ ] Synthesis artifacts produced (feature specs or synthesis-specification.md)
438
+ - [ ] feature-index.json and synthesis-changelog.md produced
439
+ - [ ] context.md produced with full brainstorm report
440
+ - [ ] Artifacts copied to target .brainstorming/ directory
441
+ - [ ] discoveries.ndjson append-only throughout
442
+ </success_criteria>