maestro-flow 0.3.38 → 0.3.40

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 (187) 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 +130 -126
  16. package/.claude/commands/maestro-brainstorm.md +104 -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 +154 -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 +48 -12
  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 +5 -1
  47. package/.claude/commands/quality-debug.md +125 -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 +107 -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 +11 -3
  66. package/.codex/skills/maestro-brainstorm/SKILL.md +451 -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 +29 -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 +693 -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 +553 -547
  96. package/.codex/skills/quality-debug/SKILL.md +345 -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 +507 -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/analyze.md +24 -2
  182. package/workflows/auto-test.md +12 -0
  183. package/workflows/brainstorm.md +11 -1
  184. package/workflows/debug.md +13 -4
  185. package/workflows/delegate-protocol.codex.md +65 -0
  186. package/workflows/plan.md +14 -4
  187. package/workflows/test.md +10 -0
@@ -1,468 +1,518 @@
1
- ---
2
- name: maestro-roadmap
3
- description: Dual-mode roadmap generation via 2-wave CSV pipeline. Light mode (default) runs scope/risk/dependency analysis → roadmap assembly. Full mode (--mode full) runs domain/competitive/tech-stack research → 7-phase specification document chain → roadmap. Both modes produce .workflow/roadmap.md.
4
- argument-hint: "\"<requirements>\" [--mode light|full] [-y|--yes] [--phases N] [--skip-research] [--from-brainstorm SESSION-ID]"
5
- allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- <purpose>
9
- Unified 2-wave roadmap generation using `spawn_agents_on_csv` with dual execution modes:
10
-
11
- - **Light mode** (default): Wave 1 runs parallel requirement analysis agents (scope, risk, dependency). Wave 2 runs roadmap assembly agent producing `roadmap.md` with phases, milestones, and success criteria.
12
- - **Full mode** (`--mode full`): Wave 1 runs parallel research agents (domain, competitive, tech stack). Wave 2 runs a single synthesis agent producing the 7-phase specification document chain (product brief, PRD, architecture, epics, roadmap).
13
-
14
- **Common workflow**: Parse Input → Parallel Analysis/Research → Sequential Assembly/Synthesis → Output
15
-
16
- ```
17
- +---------------------------------------------------------------------------+
18
- | ROADMAP CSV WAVE WORKFLOW (DUAL MODE) |
19
- +---------------------------------------------------------------------------+
20
- | |
21
- | Phase 1: Input Parsing + CSV Generation |
22
- | +-- Parse requirement/idea from arguments |
23
- | +-- Detect input type (text, @file, brainstorm import) |
24
- | +-- Detect mode: light (default) or full (--mode full) |
25
- | +-- Codebase detection (conditional exploration) |
26
- | +-- Generate mode-specific tasks.csv |
27
- | +-- User validates breakdown (skip if -y) |
28
- | |
29
- | Phase 2: Wave Execution Engine |
30
- | +-- Wave 1: Analysis/Research (parallel) |
31
- | | [Light] scope, risk, dependency analysis |
32
- | | [Full] domain, competitive, tech stack research |
33
- | +-- Wave 2: Assembly/Synthesis (sequential) |
34
- | | [Light] roadmap assembly agent → roadmap.md |
35
- | | [Full] 7-phase document chain → spec package + roadmap.md |
36
- | +-- discoveries.ndjson shared across waves (append-only) |
37
- | |
38
- | Phase 3: Results Aggregation |
39
- | +-- Export results.csv |
40
- | +-- Interactive refinement (skip if -y) |
41
- | +-- [Full only] Readiness check (4 dimensions) |
42
- | +-- Generate context.md |
43
- | +-- Write .workflow/roadmap.md |
44
- | +-- Display summary with next steps |
45
- | |
46
- +---------------------------------------------------------------------------+
47
- ```
48
- </purpose>
49
-
50
- <context>
51
- $ARGUMENTS -- requirement/idea text or @file reference, plus optional flags.
52
-
53
- **Usage**:
54
-
55
- ```bash
56
- # Light mode (default)
57
- $maestro-roadmap "Implement user authentication with OAuth and 2FA"
58
- $maestro-roadmap -y "@requirements.md"
59
- $maestro-roadmap --phases 4 "Build real-time notification system"
60
-
61
- # Full mode
62
- $maestro-roadmap --mode full "Build a real-time collaboration platform"
63
- $maestro-roadmap --mode full -y "@requirements.md"
64
- $maestro-roadmap --mode full --skip-research "CLI workflow orchestration tool"
65
-
66
- # Shared flags
67
- $maestro-roadmap --from-brainstorm WFS-001 "Enhance auth system"
68
- ```
69
-
70
- **Flags**:
71
- - `--mode light|full`: Execution mode (default: light)
72
- - `-y, --yes`: Skip all confirmations (auto mode)
73
- - `-m progressive|direct|auto`: Decomposition strategy (default: auto, light mode only)
74
- - `--phases N`: Target number of roadmap phases (default: auto-determined, light mode only)
75
- - `--revise [instructions]`: Revise existing roadmap preserving completed phase progress (light mode only)
76
- - `--review`: Roadmap health assessment, read-only (light mode only)
77
- - `--skip-research`: Skip Wave 1 research, jump to document generation (full mode only)
78
- - `--from-brainstorm SESSION-ID`: Import guidance-specification.md from brainstorm session as seed
79
-
80
- **Operation modes** (light mode):
81
- - **Create** (default): Build roadmap from requirements via full CSV pipeline
82
- - **Revise** (`--revise`): Load existing roadmap.md, apply modifications while preserving completed phases
83
- - **Review** (`--review`): Health assessment of current roadmap (read-only, no writes)
84
-
85
- When `--yes` or `-y`: Auto-confirm strategy/decisions, skip interactive refinement, use defaults.
86
-
87
- **Output Directory**: `.workflow/.csv-wave/{session-id}/`
88
- **Core Output**: `tasks.csv` + `results.csv` + `discoveries.ndjson` + `context.md` + `.workflow/roadmap.md`
89
- **Full mode additional**: Spec package in `.workflow/.spec/SPEC-{slug}-{date}/`
90
- </context>
91
-
92
- <csv_schema>
93
-
94
- ### tasks.csv — Light Mode
95
-
96
- ```csv
97
- id,title,description,analysis_focus,deps,context_from,wave,status,findings,error
98
- "1","Scope Analysis","Analyze requirement scope: identify all features and sub-features, define MVP boundaries, classify must-have vs nice-to-have, estimate relative size of each feature area. Produce feature inventory with priority tags.","scope","","","1","","",""
99
- "2","Risk Analysis","Assess technical and project risks: identify unknowns, evaluate technical feasibility per feature, rate risk levels (high/medium/low), propose mitigations. Flag features requiring spikes or prototypes.","risk","","","1","","",""
100
- "3","Dependency Analysis","Map dependencies between features: identify ordering constraints, find parallel-safe groups, detect external dependencies (APIs, libraries, infrastructure). Produce dependency graph with critical path.","dependency","","","1","","",""
101
- "4","Roadmap Assembly","Synthesize analysis findings into a complete roadmap. Apply decomposition strategy. Produce roadmap.md with: phase structure (goal, depends-on, requirements, success criteria), milestone grouping, scope decisions, progress table. Each phase must have observable success criteria from user perspective.","","1;2;3","1;2;3","2","","",""
102
- ```
103
-
104
- ### tasks.csv — Full Mode
105
-
106
- ```csv
107
- id,title,description,research_focus,doc_phase,deps,context_from,wave,status,findings,output_file,error
108
- "1","Domain Research","Research the problem domain: identify target users, market needs, existing solutions, industry trends, and domain terminology. Produce structured findings with confidence levels.","domain","","","","1","","","",""
109
- "2","Competitive Analysis","Analyze competing products and approaches: feature comparison matrix, UX patterns, pricing models, market positioning. Identify gaps and opportunities for differentiation.","competitive","","","","1","","","",""
110
- "3","Tech Stack Analysis","Evaluate technical feasibility: recommended languages, frameworks, databases, infrastructure. Assess constraints, integration complexity, scalability requirements. Reference existing codebase if available.","tech_stack","","","","1","","","",""
111
- "4","Document Chain","Generate complete 7-phase specification package using research context. Phases: (1) Product Brief, (2) PRD with REQ-*/NFR-*, (3) Architecture with ADR-*, (4) Data Model, (5) API Specification, (6) UI Wireframes, (7) Epic-to-Roadmap with EPIC-* and phase mapping. Produce glossary.json for terminology consistency.","","1-7","1;2;3","1;2;3","2","","","",""
112
- ```
113
-
114
- ### Shared Columns
115
-
116
- | Column | Phase | Description |
117
- |--------|-------|-------------|
118
- | `id` | Input | Unique task identifier (string) |
119
- | `title` | Input | Short task title |
120
- | `description` | Input | Detailed instructions for this task |
121
- | `deps` | Input | Semicolon-separated dependency task IDs |
122
- | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
123
- | `wave` | Computed | Wave number (1 = analysis/research, 2 = assembly/synthesis) |
124
- | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
125
- | `findings` | Output | Key findings summary (max 500 chars) |
126
- | `error` | Output | Error message if failed |
127
-
128
- **Light-only**: `analysis_focus` (scope/risk/dependency)
129
- **Full-only**: `research_focus` (domain/competitive/tech_stack), `doc_phase`, `output_file`
130
-
131
- ### Per-Wave CSV (Temporary)
132
-
133
- Each wave generates `wave-{N}.csv` with extra `prev_context` column.
134
- </csv_schema>
135
-
136
- <invariants>
137
- 1. **Start Immediately**: First action is session initialization, then Phase 1
138
- 2. **Wave Order is Sacred**: Never execute wave 2 before wave 1 completes and results are merged
139
- 3. **CSV is Source of Truth**: Master tasks.csv holds all state
140
- 4. **Context Propagation**: prev_context built from master CSV, not from memory
141
- 5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
142
- 6. **Graceful Degradation**: If Wave 1 fails, Wave 2 proceeds with seed input only
143
- 7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
144
- 8. **DO NOT STOP**: Continuous execution until all waves complete
145
- </invariants>
146
-
147
- <execution>
148
-
149
- ### Output Artifacts
150
-
151
- | File | Purpose | Lifecycle |
152
- |------|---------|-----------|
153
- | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
154
- | `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
155
- | `results.csv` | Final export of all task results | Created in Phase 3 |
156
- | `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
157
- | `context.md` | Human-readable report | Created in Phase 3 |
158
- | `spec-config.json` | Session metadata (full mode only) | Created in Phase 1 |
159
-
160
- ### Session Structure
161
-
162
- **Light mode**:
163
- ```
164
- .workflow/.csv-wave/{YYYYMMDD}-roadmap-{slug}/
165
- +-- tasks.csv, results.csv, discoveries.ndjson, context.md
166
- ```
167
-
168
- **Full mode**:
169
- ```
170
- .workflow/.csv-wave/{YYYYMMDD}-roadmap-full-{slug}/
171
- +-- tasks.csv, results.csv, discoveries.ndjson, context.md, spec-config.json
172
-
173
- .workflow/.spec/SPEC-{slug}-{date}/
174
- +-- spec-config.json
175
- +-- product-brief.md
176
- +-- glossary.json
177
- +-- requirements/
178
- | +-- _index.md
179
- | +-- REQ-NNN-{slug}.md
180
- | +-- NFR-{type}-NNN-{slug}.md
181
- +-- architecture/
182
- | +-- _index.md
183
- | +-- ADR-NNN-{slug}.md
184
- +-- epics/
185
- | +-- _index.md
186
- | +-- EPIC-NNN-{slug}.md
187
- +-- readiness-report.md
188
- +-- spec-summary.md
189
- ```
190
-
191
- ### Session Initialization
192
-
193
- Parse `$ARGUMENTS` to extract:
194
- - `mode` from `--mode light|full` (default: `light`)
195
- - `AUTO_YES` from `--yes` / `-y`
196
- - `strategy` from `-m progressive|direct|auto` (default: `auto`, light only)
197
- - `targetPhases` from `--phases N` (light mode only)
198
- - `reviseMode` from `--revise [instructions]` (light only, forces mode=light)
199
- - `reviewMode` from `--review` (light only, forces mode=light)
200
- - `skipResearch` from `--skip-research` (full mode only)
201
- - `brainstormSession` from `--from-brainstorm <SESSION-ID>`
202
- - `requirementArg` = remaining text after stripping all flags
203
- - `slug` = requirementArg lowercased, non-alphanumeric `-`, max 40 chars
204
-
205
- **Mode routing:**
206
- - If `--revise` or `--review`: force `mode = light`, bypass CSV pipeline
207
- - **Revise**: Load `.workflow/roadmap.md`, apply instructions (preserve completed phases), write updated roadmap
208
- - **Review**: Read `.workflow/roadmap.md` + `state.json`, assess health (phase completion, dependency validity, scope creep), report read-only
209
- - Both skip Phase 1-3 CSV pipeline, go directly to operation-specific logic
210
- - Otherwise: proceed with CSV pipeline
211
-
212
- Session ID: `{YYYYMMDD}-roadmap-{slug}` (light) or `{YYYYMMDD}-roadmap-full-{slug}` (full)
213
- Session folder: `.workflow/.csv-wave/{sessionId}/` — create via `mkdir -p`
214
-
215
- ### Phase 1: Input Parsing + CSV Generation
216
-
217
- **Shared steps**:
218
- 1. **Input parsing**: Parse `{requirementArg}` -- direct text or `@file` reference
219
- 2. **Brainstorm import**: If `--from-brainstorm`, read `guidance-specification.md` for enriched context
220
- 3. **Codebase detection**: Check for source files; if found, add context to analysis/research prompts
221
- 4. **Load project specs**: Read `.workflow/specs/` for constraint awareness
222
-
223
- **Light mode specific**:
224
- 5. **Uncertainty assessment**:
225
-
226
- | Factor | Low | Medium | High |
227
- |--------|-----|--------|------|
228
- | Scope clarity | Requirements explicit | Some ambiguity | Vague/open-ended |
229
- | Technical risk | Proven stack | Some unknowns | New technology |
230
- | Dependency unknown | All mapped | Some unclear | Many external |
231
- | Domain familiarity | Expert | Moderate | New domain |
232
- | Requirement stability | Locked | Some flux | Evolving |
233
-
234
- Strategy: >=3 high progressive, >=3 low direct, else → ask (or auto if -y).
235
-
236
- 6. **CSV generation**: 3 analysis tasks (wave 1) + 1 assembly task (wave 2)
237
-
238
- **Full mode specific**:
239
- 5. **Session init**: Create `spec-config.json` with session metadata
240
- 6. **CSV generation**: 3 research tasks (wave 1) + 1 document chain task (wave 2). If `--skip-research`: 0 research + 1 doc chain (wave 1).
241
-
242
- **User validation**: Display task breakdown + strategy (skip if AUTO_YES).
243
-
244
- ### Phase 2: Wave Execution Engine
245
-
246
- #### Wave 1 (Parallel)
247
-
248
- Filter master `tasks.csv` for `wave == 1 AND status == pending` → write `wave-1.csv`.
249
-
250
- ```javascript
251
- spawn_agents_on_csv({
252
- csv_path: `${sessionFolder}/wave-1.csv`,
253
- id_column: "id",
254
- instruction: mode === 'light'
255
- ? buildAnalysisInstruction(sessionFolder, requirementArg, strategy)
256
- : buildResearchInstruction(sessionFolder, requirementArg),
257
- max_concurrency: 3,
258
- max_runtime_seconds: 3600,
259
- output_csv_path: `${sessionFolder}/wave-1-results.csv`,
260
- output_schema: {
261
- type: "object",
262
- properties: {
263
- id: { type: "string" },
264
- status: { type: "string", enum: ["completed", "failed"] },
265
- findings: { type: "string" },
266
- output_file: { type: "string" }, // full mode only
267
- error: { type: "string" }
268
- },
269
- required: ["id", "status", "findings"]
270
- }
271
- })
272
- ```
273
-
274
- Merge results into master `tasks.csv`, delete `wave-1.csv`.
275
-
276
- #### Wave 2 (Sequential)
277
-
278
- Filter for `wave == 2 AND status == pending`. If all wave 1 tasks failed, use degraded mode (requirement/seed text only).
279
-
280
- Build `prev_context` from wave 1 findings. Format: `[Task N: Title] summary...` per completed task. Inject decomposition strategy and `--phases N` constraint (light mode) into assembly prompt.
281
-
282
- Write `wave-2.csv` with `prev_context` column execute `spawn_agents_on_csv` merge delete temp CSV.
283
-
284
- **Light mode**: Assembly agent produces roadmap.md with phases, milestones, success criteria.
285
- **Full mode**: Document chain agent produces 7-phase spec package + glossary.json. If agent fails, export partial output and log quality issues (do NOT abort).
286
-
287
- ### Phase 3: Results Aggregation
288
-
289
- Export master `tasks.csv` as `results.csv`.
290
-
291
- **Interactive refinement** (skip if AUTO_YES): Present overview, collect feedback via AskUserQuestion (max 3 rounds).
292
-
293
- **Full mode only Readiness check**: Score on 4 dimensions (25% each):
294
- - Completeness, Consistency, Traceability, Depth
295
- - Gate: Pass (>=80%) / Review (60-79%) / Fail (<60%)
296
-
297
- Generate `context.md`:
298
-
299
- **Light mode template**:
300
- ```markdown
301
- # Roadmap Generation Report
302
-
303
- ## Summary
304
- - Requirements: {requirement_summary}
305
- - Strategy: {progressive|direct}
306
- - Analysis agents: 3 ({completed_count} completed)
307
- - Phases generated: {phase_count}
308
- - Milestones: {milestone_count}
309
-
310
- ## Analysis Findings
311
- ### Scope Analysis
312
- {findings}
313
- ### Risk Analysis
314
- {findings}
315
- ### Dependency Analysis
316
- {findings}
317
-
318
- ## Roadmap
319
- - Phases: {phase_count}
320
- - Strategy: {strategy}
321
- - MVP scope: {mvp_description}
322
- - Deferred: {deferred_items}
323
- ```
324
-
325
- **Full mode template**:
326
- ```markdown
327
- # Spec Generate Report
328
-
329
- ## Summary
330
- - Topic: {topic}
331
- - Research agents: 3 ({completed_count} completed)
332
- - Document phases: 7
333
- - Quality score: {score}% ({gate})
334
-
335
- ## Research Findings
336
- ### Domain Research
337
- {findings}
338
- ### Competitive Analysis
339
- {findings}
340
- ### Tech Stack Analysis
341
- {findings}
342
-
343
- ## Document Chain Output
344
- - Product Brief: {status}
345
- - Requirements: {req_count} REQs + {nfr_count} NFRs
346
- - Architecture: {adr_count} ADRs
347
- - Epics: {epic_count} Epics
348
- - Roadmap: {phase_count} phases
349
-
350
- ## Readiness
351
- - Completeness: {score}%
352
- - Consistency: {score}%
353
- - Traceability: {score}%
354
- - Depth: {score}%
355
- - Overall: {score}% ({gate})
356
- ```
357
-
358
- **Write outputs**:
359
- - `.workflow/roadmap.md` (both modes)
360
- - `.workflow/.spec/SPEC-{slug}-{date}/` (full mode only)
361
- - Ensure `.workflow/scratch/` exists
362
- - Update `state.json` milestones array and `current_milestone`
363
-
364
- Display summary with next steps:
365
- ```
366
- === ROADMAP CREATED ===
367
- Mode: {light|full}
368
- Strategy: {progressive|direct}
369
- Phases: {phase_count} across {milestone_count} milestones
370
- Roadmap: .workflow/roadmap.md
371
- [Full] Spec: .workflow/.spec/SPEC-{slug}-{date}/
372
- [Full] Quality: {score}% ({gate})
373
- ```
374
-
375
- **Next-step routing:**
376
-
377
- | Condition | Next Step |
378
- |-----------|-----------|
379
- | Roadmap approved, need analysis | `$maestro-analyze "1"` |
380
- | Simple project, ready to plan | `$maestro-plan "1"` |
381
- | Need UI design first | `$maestro-ui-design "1"` |
382
- | View project dashboard | `$manage-status` |
383
- | Need project setup (full mode) | `$maestro-init` |
384
-
385
- ### Shared Discovery Board Protocol
386
-
387
- #### Standard Discovery Types
388
-
389
- | Type | Dedup Key | Data Schema | Description |
390
- |------|-----------|-------------|-------------|
391
- | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
392
- | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
393
- | `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
394
- | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
395
-
396
- #### Light Mode Discovery Types
397
-
398
- | Type | Dedup Key | Data Schema | Description |
399
- |------|-----------|-------------|-------------|
400
- | `scope_boundary` | `data.feature` | `{feature, inclusion, rationale}` | Scope decision |
401
- | `risk_factor` | `data.name` | `{name, severity, probability, mitigation}` | Identified risk |
402
- | `dependency_constraint` | `data.from+data.to` | `{from, to, type, strength}` | Feature dependency |
403
- | `external_dependency` | `data.name` | `{name, type, risk, alternative}` | External system dependency |
404
-
405
- #### Full Mode Discovery Types
406
-
407
- | Type | Dedup Key | Data Schema | Description |
408
- |------|-----------|-------------|-------------|
409
- | `domain_term` | `data.term` | `{term, definition, aliases}` | Domain terminology |
410
- | `competitor` | `data.name` | `{name, features[], gaps[]}` | Competitive product |
411
- | `market_trend` | `data.name` | `{name, impact, relevance}` | Market trend |
412
- | `tech_constraint` | `data.name` | `{name, type, severity, mitigation}` | Technical constraint |
413
-
414
- #### Protocol
415
-
416
- Read `{session_folder}/discoveries.ndjson` before own analysis. Deduplicate by type + dedup key before writing. Append-only — never modify or delete.
417
-
418
- ```bash
419
- # Light mode example
420
- echo '{"ts":"<ISO>","worker":"{id}","type":"risk_factor","data":{"name":"OAuth provider rate limits","severity":"medium","probability":"high","mitigation":"Implement token caching and retry logic"}}' >> {session_folder}/discoveries.ndjson
421
-
422
- # Full mode example
423
- echo '{"ts":"<ISO>","worker":"{id}","type":"domain_term","data":{"term":"workflow","definition":"A sequence of orchestrated tasks","aliases":["pipeline","process"]}}' >> {session_folder}/discoveries.ndjson
424
- ```
425
- </execution>
426
-
427
- <error_codes>
428
- | Error | Resolution |
429
- |-------|------------|
430
- | No requirement/idea text provided | Abort with error: "Requirement text or @file required" |
431
- | Brainstorm session not found | Abort with error: "Session {id} not found" -- list available sessions |
432
- | @file not found | Abort with error: "File {path} not found" |
433
- | roadmap.md not found (--revise/--review) | Run maestro-roadmap first to create |
434
- | Revision invalidates completed phase | Warn user, ask to confirm or adjust |
435
- | .workflow/ not initialized (full mode) | Run maestro-init first |
436
- | Wave 1 agent timeout | Mark as failed, Wave 2 uses available findings |
437
- | All Wave 1 agents failed | Wave 2 runs in degraded mode (seed input only) |
438
- | Wave 2 agent failed (light) | Abort with error: "Roadmap generation failed" |
439
- | Wave 2 agent failed (full) | Export partial output, log quality issues |
440
- | Circular dependency detected | Prompt user to re-decompose (light mode) |
441
- | CSV parse error | Validate format, show line number |
442
- | discoveries.ndjson corrupt | Ignore malformed lines |
443
- | Max refinement rounds (3) | Force proceed with current output |
444
- | Readiness score < 60% (full) | Log issues, proceed with available output |
445
- </error_codes>
446
-
447
- <success_criteria>
448
-
449
- **Both modes**:
450
- - [ ] Input parsed from text, @file, or brainstorm session
451
- - [ ] Wave 1 agents completed (analysis or research)
452
- - [ ] Wave 2 agent produced output
453
- - [ ] Interactive refinement offered (or skipped with -y)
454
- - [ ] .workflow/roadmap.md written
455
- - [ ] state.json updated with milestones
456
- - [ ] context.md generated
457
- - [ ] Completion report displayed with next steps
458
-
459
- **Light mode additional**:
460
- - [ ] Uncertainty assessed and decomposition strategy selected
461
- - [ ] Roadmap has phases with milestones and success criteria
462
-
463
- **Full mode additional**:
464
- - [ ] spec-config.json created with session metadata
465
- - [ ] Spec package written to .workflow/.spec/SPEC-{slug}-{date}/
466
- - [ ] Readiness check scored on 4 dimensions
467
- - [ ] Quality score and gate reported
468
- </success_criteria>
1
+ ---
2
+ name: maestro-roadmap
3
+ description: Generate roadmap from requirements (light or full mode)
4
+ argument-hint: "\"<requirements>\" [--mode light|full] [-y|--yes] [-c] [--phases N] [--skip-research] [--from-brainstorm SESSION-ID] [--revise [instructions]] [--review]"
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+
8
+ <purpose>
9
+ Unified 2-wave roadmap generation using `spawn_agents_on_csv` with dual execution modes:
10
+
11
+ - **Light mode** (default): Wave 1 runs parallel requirement analysis agents (scope, risk, dependency). Wave 2 runs roadmap assembly agent producing `roadmap.md` with phases, milestones, and success criteria.
12
+ - **Full mode** (`--mode full`): Wave 1 runs parallel research agents (domain, competitive, tech stack). Wave 2 runs a single synthesis agent producing the 7-phase specification document chain (product brief, PRD, architecture, epics, roadmap).
13
+
14
+ **Common workflow**: Parse Input → Parallel Analysis/Research → Sequential Assembly/Synthesis → Output
15
+
16
+ ```
17
+ +---------------------------------------------------------------------------+
18
+ | ROADMAP CSV WAVE WORKFLOW (DUAL MODE) |
19
+ +---------------------------------------------------------------------------+
20
+ | |
21
+ | Phase 1: Input Parsing + CSV Generation |
22
+ | +-- Parse requirement/idea from arguments |
23
+ | +-- Detect input type (text, @file, brainstorm import) |
24
+ | +-- Detect mode: light (default) or full (--mode full) |
25
+ | +-- Codebase detection (conditional exploration) |
26
+ | +-- Generate mode-specific tasks.csv |
27
+ | +-- User validates breakdown (skip if -y) |
28
+ | |
29
+ | Phase 2: Wave Execution Engine |
30
+ | +-- Wave 1: Analysis/Research (parallel) |
31
+ | | [Light] scope, risk, dependency analysis |
32
+ | | [Full] domain, competitive, tech stack research |
33
+ | +-- Wave 2: Assembly/Synthesis (sequential) |
34
+ | | [Light] roadmap assembly agent → roadmap.md |
35
+ | | [Full] 7-phase document chain → spec package + roadmap.md |
36
+ | +-- discoveries.ndjson shared across waves (append-only) |
37
+ | |
38
+ | Phase 3: Results Aggregation |
39
+ | +-- Export results.csv |
40
+ | +-- Interactive refinement (skip if -y) |
41
+ | +-- [Full only] Readiness check (4 dimensions) |
42
+ | +-- Generate context.md |
43
+ | +-- Write .workflow/roadmap.md |
44
+ | +-- Display summary with next steps |
45
+ | |
46
+ +---------------------------------------------------------------------------+
47
+ ```
48
+
49
+ </purpose>
50
+
51
+ <context>
52
+ $ARGUMENTS -- requirement/idea text or @file reference, plus optional flags.
53
+
54
+ **Usage**:
55
+
56
+ ```bash
57
+ # Light mode (default)
58
+ $maestro-roadmap "Implement user authentication with OAuth and 2FA"
59
+ $maestro-roadmap -y "@requirements.md"
60
+ $maestro-roadmap --phases 4 "Build real-time notification system"
61
+
62
+ # Full mode
63
+ $maestro-roadmap --mode full "Build a real-time collaboration platform"
64
+ $maestro-roadmap --mode full -y "@requirements.md"
65
+ $maestro-roadmap --mode full --skip-research "CLI workflow orchestration tool"
66
+
67
+ # Shared flags
68
+ $maestro-roadmap --from-brainstorm WFS-001 "Enhance auth system"
69
+ ```
70
+
71
+ **Flags**:
72
+ - `--mode light|full`: Execution mode (default: light)
73
+ - `-y, --yes`: Skip all confirmations (auto mode)
74
+ - `-m progressive|direct|auto`: Decomposition strategy (default: auto, light mode only)
75
+ - `--phases N`: Target number of roadmap phases (default: auto-determined, light mode only)
76
+ - `--revise [instructions]`: Revise existing roadmap preserving completed phase progress (light mode only)
77
+ - `--review`: Roadmap health assessment, read-only (light mode only)
78
+ - `--skip-research`: Skip Wave 1 research, jump to document generation (full mode only)
79
+ - `--from-brainstorm SESSION-ID`: Import guidance-specification.md from brainstorm session as seed
80
+
81
+ **Operation modes** (light mode):
82
+ - **Create** (default): Build roadmap from requirements via full CSV pipeline
83
+ - **Revise** (`--revise`): Load existing roadmap.md, apply modifications while preserving completed phases
84
+ - **Review** (`--review`): Health assessment of current roadmap (read-only, no writes)
85
+
86
+ When `--yes` or `-y`: Auto-confirm strategy/decisions, skip interactive refinement, use defaults.
87
+
88
+ **Output Directory**: `.workflow/.csv-wave/{session-id}/`
89
+ **Core Output**: `tasks.csv` + `results.csv` + `discoveries.ndjson` + `context.md` + `.workflow/roadmap.md`
90
+ **Full mode additional**: Spec package in `.workflow/.spec/SPEC-{slug}-{date}/`
91
+ </context>
92
+
93
+ <csv_schema>
94
+
95
+ ### tasks.csv — Light Mode
96
+
97
+ ```csv
98
+ id,title,description,analysis_focus,deps,context_from,wave,status,findings,error
99
+ "1","Scope Analysis","Analyze requirement scope: identify all features and sub-features, define MVP boundaries, classify must-have vs nice-to-have, estimate relative size of each feature area. Produce feature inventory with priority tags.","scope","","","1","","",""
100
+ "2","Risk Analysis","Assess technical and project risks: identify unknowns, evaluate technical feasibility per feature, rate risk levels (high/medium/low), propose mitigations. Flag features requiring spikes or prototypes.","risk","","","1","","",""
101
+ "3","Dependency Analysis","Map dependencies between features: identify ordering constraints, find parallel-safe groups, detect external dependencies (APIs, libraries, infrastructure). Produce dependency graph with critical path.","dependency","","","1","","",""
102
+ "4","Roadmap Assembly","Synthesize analysis findings into a complete roadmap. Apply decomposition strategy. Produce roadmap.md with: phase structure (goal, depends-on, requirements, success criteria), milestone grouping, scope decisions, progress table. Each phase must have observable success criteria from user perspective.","","1;2;3","1;2;3","2","","",""
103
+ ```
104
+
105
+ ### tasks.csv — Full Mode
106
+
107
+ ```csv
108
+ id,title,description,research_focus,doc_phase,deps,context_from,wave,status,findings,output_file,error
109
+ "1","Domain Research","Research the problem domain: identify target users, market needs, existing solutions, industry trends, and domain terminology. Produce structured findings with confidence levels.","domain","","","","1","","","",""
110
+ "2","Competitive Analysis","Analyze competing products and approaches: feature comparison matrix, UX patterns, pricing models, market positioning. Identify gaps and opportunities for differentiation.","competitive","","","","1","","","",""
111
+ "3","Tech Stack Analysis","Evaluate technical feasibility: recommended languages, frameworks, databases, infrastructure. Assess constraints, integration complexity, scalability requirements. Reference existing codebase if available.","tech_stack","","","","1","","","",""
112
+ "4","Document Chain","Generate complete 7-phase specification package using research context. Phases: (1) Product Brief, (2) PRD with REQ-*/NFR-*, (3) Architecture with ADR-*, (4) Data Model, (5) API Specification, (6) UI Wireframes, (7) Epic-to-Roadmap with EPIC-* and phase mapping. Produce glossary.json for terminology consistency.","","1-7","1;2;3","1;2;3","2","","","",""
113
+ ```
114
+
115
+ ### Shared Columns
116
+
117
+ | Column | Phase | Description |
118
+ |--------|-------|-------------|
119
+ | `id` | Input | Unique task identifier (string) |
120
+ | `title` | Input | Short task title |
121
+ | `description` | Input | Detailed instructions for this task |
122
+ | `deps` | Input | Semicolon-separated dependency task IDs |
123
+ | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
124
+ | `wave` | Computed | Wave number (1 = analysis/research, 2 = assembly/synthesis) |
125
+ | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
126
+ | `findings` | Output | Key findings summary (max 500 chars) |
127
+ | `error` | Output | Error message if failed |
128
+
129
+ **Light-only**: `analysis_focus` (scope/risk/dependency)
130
+ **Full-only**: `research_focus` (domain/competitive/tech_stack), `doc_phase`, `output_file`
131
+
132
+ ### Per-Wave CSV (Temporary)
133
+
134
+ Each wave generates `wave-{N}.csv` with extra `prev_context` column.
135
+ </csv_schema>
136
+
137
+ <invariants>
138
+ 1. **Start Immediately**: First action is session initialization, then Phase 1
139
+ 2. **Wave Order is Sacred**: Never execute wave 2 before wave 1 completes and results are merged
140
+ 3. **CSV is Source of Truth**: Master tasks.csv holds all state
141
+ 4. **Context Propagation**: prev_context built from master CSV, not from memory
142
+ 5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
143
+ 6. **Graceful Degradation**: If Wave 1 fails, Wave 2 proceeds with seed input only
144
+ 7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
145
+ 8. **DO NOT STOP**: Continuous execution until all waves complete
146
+ </invariants>
147
+
148
+ <execution>
149
+
150
+ ### Output Artifacts
151
+
152
+ | File | Purpose | Lifecycle |
153
+ |------|---------|-----------|
154
+ | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
155
+ | `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
156
+ | `results.csv` | Final export of all task results | Created in Phase 3 |
157
+ | `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
158
+ | `context.md` | Human-readable report | Created in Phase 3 |
159
+ | `spec-config.json` | Session metadata (full mode only) | Created in Phase 1 |
160
+
161
+ ### Session Structure
162
+
163
+ **Light mode**:
164
+ ```
165
+ .workflow/.csv-wave/{YYYYMMDD}-roadmap-{slug}/
166
+ +-- tasks.csv, results.csv, discoveries.ndjson, context.md
167
+ ```
168
+
169
+ **Full mode**:
170
+ ```
171
+ .workflow/.csv-wave/{YYYYMMDD}-roadmap-full-{slug}/
172
+ +-- tasks.csv, results.csv, discoveries.ndjson, context.md, spec-config.json
173
+
174
+ .workflow/.spec/SPEC-{slug}-{date}/
175
+ +-- spec-config.json
176
+ +-- product-brief.md
177
+ +-- glossary.json
178
+ +-- requirements/
179
+ | +-- _index.md
180
+ | +-- REQ-NNN-{slug}.md
181
+ | +-- NFR-{type}-NNN-{slug}.md
182
+ +-- architecture/
183
+ | +-- _index.md
184
+ | +-- ADR-NNN-{slug}.md
185
+ +-- epics/
186
+ | +-- _index.md
187
+ | +-- EPIC-NNN-{slug}.md
188
+ +-- readiness-report.md
189
+ +-- spec-summary.md
190
+ ```
191
+
192
+ ### Session Initialization
193
+
194
+ Parse `$ARGUMENTS` to extract:
195
+ - `mode` from `--mode light|full` (default: `light`)
196
+ - `AUTO_YES` from `--yes` / `-y`
197
+ - `strategy` from `-m progressive|direct|auto` (default: `auto`, light only)
198
+ - `targetPhases` from `--phases N` (light mode only)
199
+ - `reviseMode` from `--revise [instructions]` (light only, forces mode=light)
200
+ - `reviewMode` from `--review` (light only, forces mode=light)
201
+ - `skipResearch` from `--skip-research` (full mode only)
202
+ - `brainstormSession` from `--from-brainstorm <SESSION-ID>`
203
+ - `requirementArg` = remaining text after stripping all flags
204
+ - `slug` = requirementArg lowercased, non-alphanumeric → `-`, max 40 chars
205
+
206
+ **Mode routing:**
207
+ - If `--revise` or `--review`: force `mode = light`, bypass CSV pipeline
208
+ - **Revise**: Load `.workflow/roadmap.md`, apply instructions (preserve completed phases), write updated roadmap. If instructions provided inline, apply directly; if omitted, ask user via `request_user_input`.
209
+ - **Review**: Read `.workflow/roadmap.md` + `state.json`, assess health (phase completion, dependency validity, scope creep), report read-only. No writes.
210
+ - Both skip Phase 1-3 CSV pipeline, go directly to operation-specific logic
211
+ - If `-c` / `--continue`: Resume from last checkpoint in existing session
212
+ - Otherwise: proceed with CSV pipeline
213
+
214
+ Session ID: `{YYYYMMDD}-roadmap-{slug}` (light) or `{YYYYMMDD}-roadmap-full-{slug}` (full)
215
+ Session folder: `.workflow/.csv-wave/{sessionId}/` create via `mkdir -p`
216
+
217
+ ### Phase 1: Input Parsing + CSV Generation
218
+
219
+ **Shared steps**:
220
+ 1. **Input parsing**: Parse `{requirementArg}` -- direct text or `@file` reference
221
+ 2. **Brainstorm import**: If `--from-brainstorm`, read `guidance-specification.md` for enriched context
222
+ 3. **Codebase detection**: Check for source files; if found, add context to analysis/research prompts
223
+ 4. **Load project specs**: Read `.workflow/specs/` for constraint awareness
224
+
225
+ **Light mode specific**:
226
+ 5. **Uncertainty assessment**:
227
+
228
+ | Factor | Low | Medium | High |
229
+ |--------|-----|--------|------|
230
+ | Scope clarity | Requirements explicit | Some ambiguity | Vague/open-ended |
231
+ | Technical risk | Proven stack | Some unknowns | New technology |
232
+ | Dependency unknown | All mapped | Some unclear | Many external |
233
+ | Domain familiarity | Expert | Moderate | New domain |
234
+ | Requirement stability | Locked | Some flux | Evolving |
235
+
236
+ Strategy: >=3 high progressive, >=3 low direct, else ask (or auto if -y).
237
+
238
+ 6. **CSV generation**: 3 analysis tasks (wave 1) + 1 assembly task (wave 2)
239
+
240
+ **Full mode specific**:
241
+ 5. **Session init**: Create `spec-config.json` with session metadata
242
+ 6. **CSV generation**: 3 research tasks (wave 1) + 1 document chain task (wave 2). If `--skip-research`: 0 research + 1 doc chain (wave 1).
243
+
244
+ **User validation**: Display task breakdown + strategy (skip if AUTO_YES).
245
+
246
+ ### Phase 2: Wave Execution Engine
247
+
248
+ #### Wave 1 (Parallel)
249
+
250
+ Filter master `tasks.csv` for `wave == 1 AND status == pending` → write `wave-1.csv`.
251
+
252
+ ```javascript
253
+ spawn_agents_on_csv({
254
+ csv_path: `${sessionFolder}/wave-1.csv`,
255
+ id_column: "id",
256
+ instruction: mode === 'light'
257
+ ? buildAnalysisInstruction(sessionFolder, requirementArg, strategy)
258
+ : buildResearchInstruction(sessionFolder, requirementArg), // agent: ~/.codex/agents/workflow-project-researcher.toml
259
+ max_concurrency: 3,
260
+ max_runtime_seconds: 3600,
261
+ output_csv_path: `${sessionFolder}/wave-1-results.csv`,
262
+ output_schema: {
263
+ type: "object",
264
+ properties: {
265
+ id: { type: "string" },
266
+ status: { type: "string", enum: ["completed", "failed"] },
267
+ findings: { type: "string" },
268
+ output_file: { type: "string" }, // full mode only
269
+ error: { type: "string" }
270
+ },
271
+ required: ["id", "status", "findings"]
272
+ }
273
+ })
274
+ ```
275
+
276
+ Merge results into master `tasks.csv`, delete `wave-1.csv`.
277
+
278
+ #### Wave 2 (Sequential)
279
+
280
+ Filter for `wave == 2 AND status == pending`. If all wave 1 tasks failed, use degraded mode (requirement/seed text only).
281
+
282
+ Build `prev_context` from wave 1 findings. Format: `[Task N: Title] summary...` per completed task. Inject decomposition strategy and `--phases N` constraint (light mode) into assembly prompt.
283
+
284
+ Write `wave-2.csv` with `prev_context` column execute `spawn_agents_on_csv` merge → delete temp CSV.
285
+
286
+ **Light mode**: Assembly agent produces roadmap.md with phases, milestones, success criteria.
287
+ **Full mode**: Document chain agent produces 7-phase spec package + glossary.json. If agent fails, export partial output and log quality issues (do NOT abort).
288
+
289
+ #### Phase 2.5: Spec Package Generation (Full Mode Only)
290
+
291
+ After Wave 2 completes, read `~/.maestro/workflows/spec-generate.md` and follow its process to generate the 7-phase specification document chain:
292
+
293
+ 1. **Product Brief** (`product-brief.md`): Vision, goals, scope, multi-perspective synthesis
294
+ 2. **PRD** (`requirements/`): `_index.md` + individual `REQ-*.md` + `NFR-*.md` files with RFC 2119 keywords and acceptance criteria
295
+ 3. **Architecture** (`architecture/`): `_index.md` + individual `ADR-*.md` files, state machine, config model, error handling, observability
296
+ 4. **Data Model**: Entity definitions and relationships
297
+ 5. **API Specification**: Endpoint definitions and contracts
298
+ 6. **UI Wireframes**: Interface layout descriptions
299
+ 7. **Epic-to-Roadmap** (`epics/`): `_index.md` + individual `EPIC-*.md` with cross-Epic dependency map (Mermaid) and MVP subset tagged
300
+
301
+ Additional outputs:
302
+ - `glossary.json` with 5+ core terms for cross-document terminology consistency
303
+ - `spec-summary.md` with one-page executive summary
304
+ - All documents have valid YAML frontmatter with `session_id`
305
+
306
+ Output location: `.workflow/.spec/SPEC-{slug}-{date}/`
307
+
308
+ ### Phase 3: Results Aggregation
309
+
310
+ Export master `tasks.csv` as `results.csv`.
311
+
312
+ **Interactive refinement** (skip if AUTO_YES): Present overview, collect feedback via `request_user_input` (max 3 rounds).
313
+
314
+ Each round:
315
+ ```json
316
+ {
317
+ "questions": [{
318
+ "id": "refinement_round_N",
319
+ "header": "Roadmap Refinement (Round N/3)",
320
+ "question": "Review the generated roadmap. Any adjustments needed?",
321
+ "options": [
322
+ { "label": "Approve", "description": "Accept the current roadmap as-is" },
323
+ { "label": "Refine", "description": "Provide specific changes to apply" },
324
+ { "label": "Regenerate", "description": "Discard and regenerate from scratch" }
325
+ ]
326
+ }]
327
+ }
328
+ ```
329
+ If user selects "Refine", apply changes and re-present. After 3 rounds, force proceed with current output.
330
+
331
+ **Full mode only Readiness Assessment**: Score spec package on 4 dimensions (25% each):
332
+
333
+ | Dimension | Weight | Checks |
334
+ |-----------|--------|--------|
335
+ | Completeness | 25% | All 7 phases produced, glossary has 5+ terms, all REQ/NFR/ADR/EPIC files present |
336
+ | Consistency | 25% | Glossary terms used consistently, cross-references valid, no contradictions |
337
+ | Traceability | 25% | Every requirement maps to an epic, every epic maps to a roadmap phase, traceability matrix complete |
338
+ | Depth | 25% | Acceptance criteria present, architecture covers error handling/observability, NFRs have measurable targets |
339
+
340
+ Gate thresholds:
341
+ - **Pass** (>=80%): Spec package ready for implementation
342
+ - **Review** (60-79%): Proceed with documented caveats, note gaps in `readiness-report.md`
343
+ - **Fail** (<60%): Attempt auto-fix (up to 2 iterations), then present manual fix options via `request_user_input`
344
+
345
+ Output: `readiness-report.md` with per-dimension scores and traceability matrix
346
+
347
+ Generate `context.md`:
348
+
349
+ **Light mode template**:
350
+ ```markdown
351
+ # Roadmap Generation Report
352
+
353
+ ## Summary
354
+ - Requirements: {requirement_summary}
355
+ - Strategy: {progressive|direct}
356
+ - Analysis agents: 3 ({completed_count} completed)
357
+ - Phases generated: {phase_count}
358
+ - Milestones: {milestone_count}
359
+
360
+ ## Analysis Findings
361
+ ### Scope Analysis
362
+ {findings}
363
+ ### Risk Analysis
364
+ {findings}
365
+ ### Dependency Analysis
366
+ {findings}
367
+
368
+ ## Roadmap
369
+ - Phases: {phase_count}
370
+ - Strategy: {strategy}
371
+ - MVP scope: {mvp_description}
372
+ - Deferred: {deferred_items}
373
+ ```
374
+
375
+ **Full mode template**:
376
+ ```markdown
377
+ # Spec Generate Report
378
+
379
+ ## Summary
380
+ - Topic: {topic}
381
+ - Research agents: 3 ({completed_count} completed)
382
+ - Document phases: 7
383
+ - Quality score: {score}% ({gate})
384
+
385
+ ## Research Findings
386
+ ### Domain Research
387
+ {findings}
388
+ ### Competitive Analysis
389
+ {findings}
390
+ ### Tech Stack Analysis
391
+ {findings}
392
+
393
+ ## Document Chain Output
394
+ - Product Brief: {status}
395
+ - Requirements: {req_count} REQs + {nfr_count} NFRs
396
+ - Architecture: {adr_count} ADRs
397
+ - Epics: {epic_count} Epics
398
+ - Roadmap: {phase_count} phases
399
+
400
+ ## Readiness
401
+ - Completeness: {score}%
402
+ - Consistency: {score}%
403
+ - Traceability: {score}%
404
+ - Depth: {score}%
405
+ - Overall: {score}% ({gate})
406
+ ```
407
+
408
+ **Write outputs**:
409
+ - `.workflow/roadmap.md` (both modes)
410
+ - `.workflow/.spec/SPEC-{slug}-{date}/` (full mode only)
411
+ - Ensure `.workflow/scratch/` exists
412
+ - Update `state.json` milestones array and `current_milestone`
413
+
414
+ Display summary with next steps:
415
+ ```
416
+ === ROADMAP CREATED ===
417
+ Mode: {light|full}
418
+ Strategy: {progressive|direct}
419
+ Phases: {phase_count} across {milestone_count} milestones
420
+ Roadmap: .workflow/roadmap.md
421
+ [Full] Spec: .workflow/.spec/SPEC-{slug}-{date}/
422
+ [Full] Quality: {score}% ({gate})
423
+ ```
424
+
425
+ **Next-step routing:**
426
+
427
+ | Condition | Next Step |
428
+ |-----------|-----------|
429
+ | Roadmap approved, need analysis | `$maestro-analyze "1"` |
430
+ | Simple project, ready to plan | `$maestro-plan "1"` |
431
+ | Need UI design first | `$maestro-ui-design "1"` |
432
+ | View project dashboard | `$manage-status` |
433
+ | Need project setup (full mode) | `$maestro-init` |
434
+
435
+ ### Shared Discovery Board Protocol
436
+
437
+ #### Standard Discovery Types
438
+
439
+ | Type | Dedup Key | Data Schema | Description |
440
+ |------|-----------|-------------|-------------|
441
+ | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
442
+ | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
443
+ | `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
444
+ | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
445
+
446
+ #### Light Mode Discovery Types
447
+
448
+ | Type | Dedup Key | Data Schema | Description |
449
+ |------|-----------|-------------|-------------|
450
+ | `scope_boundary` | `data.feature` | `{feature, inclusion, rationale}` | Scope decision |
451
+ | `risk_factor` | `data.name` | `{name, severity, probability, mitigation}` | Identified risk |
452
+ | `dependency_constraint` | `data.from+data.to` | `{from, to, type, strength}` | Feature dependency |
453
+ | `external_dependency` | `data.name` | `{name, type, risk, alternative}` | External system dependency |
454
+
455
+ #### Full Mode Discovery Types
456
+
457
+ | Type | Dedup Key | Data Schema | Description |
458
+ |------|-----------|-------------|-------------|
459
+ | `domain_term` | `data.term` | `{term, definition, aliases}` | Domain terminology |
460
+ | `competitor` | `data.name` | `{name, features[], gaps[]}` | Competitive product |
461
+ | `market_trend` | `data.name` | `{name, impact, relevance}` | Market trend |
462
+ | `tech_constraint` | `data.name` | `{name, type, severity, mitigation}` | Technical constraint |
463
+
464
+ #### Protocol
465
+
466
+ Read `{session_folder}/discoveries.ndjson` before own analysis. Deduplicate by type + dedup key before writing. Append-only — never modify or delete.
467
+
468
+ ```bash
469
+ # Light mode example
470
+ echo '{"ts":"<ISO>","worker":"{id}","type":"risk_factor","data":{"name":"OAuth provider rate limits","severity":"medium","probability":"high","mitigation":"Implement token caching and retry logic"}}' >> {session_folder}/discoveries.ndjson
471
+
472
+ # Full mode example
473
+ echo '{"ts":"<ISO>","worker":"{id}","type":"domain_term","data":{"term":"workflow","definition":"A sequence of orchestrated tasks","aliases":["pipeline","process"]}}' >> {session_folder}/discoveries.ndjson
474
+ ```
475
+ </execution>
476
+
477
+ <error_codes>
478
+ | Error | Resolution |
479
+ |-------|------------|
480
+ | No requirement/idea text provided | Abort with error: "Requirement text or @file required" |
481
+ | Brainstorm session not found | Abort with error: "Session {id} not found" -- list available sessions |
482
+ | @file not found | Abort with error: "File {path} not found" |
483
+ | roadmap.md not found (--revise/--review) | Run maestro-roadmap first to create |
484
+ | Revision invalidates completed phase | Warn user, ask to confirm or adjust |
485
+ | .workflow/ not initialized (full mode) | Run maestro-init first |
486
+ | Wave 1 agent timeout | Mark as failed, Wave 2 uses available findings |
487
+ | All Wave 1 agents failed | Wave 2 runs in degraded mode (seed input only) |
488
+ | Wave 2 agent failed (light) | Abort with error: "Roadmap generation failed" |
489
+ | Wave 2 agent failed (full) | Export partial output, log quality issues |
490
+ | Circular dependency detected | Prompt user to re-decompose (light mode) |
491
+ | CSV parse error | Validate format, show line number |
492
+ | discoveries.ndjson corrupt | Ignore malformed lines |
493
+ | Max refinement rounds (3) | Force proceed with current output |
494
+ | Readiness score < 60% (full) | Log issues, proceed with available output |
495
+ </error_codes>
496
+
497
+ <success_criteria>
498
+
499
+ **Both modes**:
500
+ - [ ] Input parsed from text, @file, or brainstorm session
501
+ - [ ] Wave 1 agents completed (analysis or research)
502
+ - [ ] Wave 2 agent produced output
503
+ - [ ] Interactive refinement offered (or skipped with -y)
504
+ - [ ] .workflow/roadmap.md written
505
+ - [ ] state.json updated with milestones
506
+ - [ ] context.md generated
507
+ - [ ] Completion report displayed with next steps
508
+
509
+ **Light mode additional**:
510
+ - [ ] Uncertainty assessed and decomposition strategy selected
511
+ - [ ] Roadmap has phases with milestones and success criteria
512
+
513
+ **Full mode additional**:
514
+ - [ ] spec-config.json created with session metadata
515
+ - [ ] Spec package written to .workflow/.spec/SPEC-{slug}-{date}/
516
+ - [ ] Readiness check scored on 4 dimensions
517
+ - [ ] Quality score and gate reported
518
+ </success_criteria>