maestro-flow 0.3.21 → 0.3.23

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 (151) hide show
  1. package/.claude/commands/maestro-analyze.md +1 -1
  2. package/.claude/commands/maestro-brainstorm.md +1 -1
  3. package/.claude/commands/maestro-composer.md +3 -3
  4. package/.claude/commands/maestro-init.md +4 -4
  5. package/.claude/commands/maestro-roadmap.md +164 -108
  6. package/.claude/commands/maestro.md +19 -10
  7. package/.claude/commands/quality-business-test.md +2 -2
  8. package/.claude/skills/team-quality-assurance/roles/scout/role.md +1 -1
  9. package/.claude/skills/team-review/roles/reviewer/role.md +1 -1
  10. package/.claude/skills/team-review/roles/scanner/role.md +1 -1
  11. package/.claude/skills/team-tech-debt/roles/scanner/role.md +3 -3
  12. package/.codex/skills/maestro/SKILL.md +12 -9
  13. package/.codex/skills/maestro-brainstorm/SKILL.md +1 -1
  14. package/.codex/skills/maestro-composer/SKILL.md +3 -3
  15. package/.codex/skills/maestro-init/SKILL.md +1 -1
  16. package/.codex/skills/maestro-link-coordinate/SKILL.md +1 -1
  17. package/.codex/skills/maestro-player/SKILL.md +2 -2
  18. package/.codex/skills/maestro-roadmap/SKILL.md +443 -332
  19. package/.codex/skills/quality-business-test/SKILL.md +2 -2
  20. package/.codex/skills/team-coordinate/roles/coordinator/role.md +1 -1
  21. package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +1 -1
  22. package/.codex/skills/team-quality-assurance/roles/scout/role.md +1 -1
  23. package/.codex/skills/team-review/roles/reviewer/role.md +1 -1
  24. package/.codex/skills/team-review/roles/scanner/role.md +1 -1
  25. package/.codex/skills/team-tech-debt/roles/scanner/role.md +3 -3
  26. package/chains/singles/spec-generate.json +3 -3
  27. package/chains/spec-driven.json +2 -2
  28. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -0
  29. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  30. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +2 -2
  31. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
  32. package/dashboard/dist-server/dashboard/src/server/routes/install-utils.d.ts +5 -12
  33. package/dashboard/dist-server/dashboard/src/server/routes/install-utils.js +10 -65
  34. package/dashboard/dist-server/dashboard/src/server/routes/install-utils.js.map +1 -1
  35. package/dashboard/dist-server/dashboard/src/server/routes/install.js +17 -11
  36. package/dashboard/dist-server/dashboard/src/server/routes/install.js.map +1 -1
  37. package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +4 -0
  38. package/dashboard/dist-server/src/agents/cli-agent-runner.js +4 -2
  39. package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
  40. package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
  41. package/dashboard/dist-server/src/commands/delegate.js +20 -4
  42. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  43. package/dashboard/dist-server/src/config/cli-tools-config.d.ts +64 -3
  44. package/dashboard/dist-server/src/config/cli-tools-config.js +226 -9
  45. package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
  46. package/dist/src/agents/cli-agent-runner.d.ts +4 -0
  47. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  48. package/dist/src/agents/cli-agent-runner.js +4 -2
  49. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  50. package/dist/src/cli.js +2 -0
  51. package/dist/src/cli.js.map +1 -1
  52. package/dist/src/commands/cli.d.ts.map +1 -1
  53. package/dist/src/commands/cli.js +21 -4
  54. package/dist/src/commands/cli.js.map +1 -1
  55. package/dist/src/commands/delegate.d.ts +2 -0
  56. package/dist/src/commands/delegate.d.ts.map +1 -1
  57. package/dist/src/commands/delegate.js +20 -4
  58. package/dist/src/commands/delegate.js.map +1 -1
  59. package/dist/src/commands/install-backend.d.ts +5 -16
  60. package/dist/src/commands/install-backend.d.ts.map +1 -1
  61. package/dist/src/commands/install-backend.js +8 -104
  62. package/dist/src/commands/install-backend.js.map +1 -1
  63. package/dist/src/commands/install-ui/ExecutionView.js +1 -1
  64. package/dist/src/commands/install-ui/ExecutionView.js.map +1 -1
  65. package/dist/src/commands/install-ui/InstallExecution.d.ts +1 -0
  66. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  67. package/dist/src/commands/install-ui/InstallExecution.js +19 -4
  68. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  69. package/dist/src/commands/install-ui/InstallResult.d.ts.map +1 -1
  70. package/dist/src/commands/install-ui/InstallResult.js +1 -1
  71. package/dist/src/commands/install-ui/InstallResult.js.map +1 -1
  72. package/dist/src/commands/install.d.ts.map +1 -1
  73. package/dist/src/commands/install.js +23 -3
  74. package/dist/src/commands/install.js.map +1 -1
  75. package/dist/src/commands/tools-ui/CommandReference.d.ts +7 -0
  76. package/dist/src/commands/tools-ui/CommandReference.d.ts.map +1 -0
  77. package/dist/src/commands/tools-ui/CommandReference.js +33 -0
  78. package/dist/src/commands/tools-ui/CommandReference.js.map +1 -0
  79. package/dist/src/commands/tools-ui/ConfigSources.d.ts +6 -0
  80. package/dist/src/commands/tools-ui/ConfigSources.d.ts.map +1 -0
  81. package/dist/src/commands/tools-ui/ConfigSources.js +27 -0
  82. package/dist/src/commands/tools-ui/ConfigSources.js.map +1 -0
  83. package/dist/src/commands/tools-ui/RegisterSettings.d.ts +8 -0
  84. package/dist/src/commands/tools-ui/RegisterSettings.d.ts.map +1 -0
  85. package/dist/src/commands/tools-ui/RegisterSettings.js +125 -0
  86. package/dist/src/commands/tools-ui/RegisterSettings.js.map +1 -0
  87. package/dist/src/commands/tools-ui/RoleMappings.d.ts +9 -0
  88. package/dist/src/commands/tools-ui/RoleMappings.d.ts.map +1 -0
  89. package/dist/src/commands/tools-ui/RoleMappings.js +104 -0
  90. package/dist/src/commands/tools-ui/RoleMappings.js.map +1 -0
  91. package/dist/src/commands/tools-ui/ToolsDashboard.d.ts +8 -0
  92. package/dist/src/commands/tools-ui/ToolsDashboard.d.ts.map +1 -0
  93. package/dist/src/commands/tools-ui/ToolsDashboard.js +60 -0
  94. package/dist/src/commands/tools-ui/ToolsDashboard.js.map +1 -0
  95. package/dist/src/commands/tools-ui/ToolsOverview.d.ts +9 -0
  96. package/dist/src/commands/tools-ui/ToolsOverview.d.ts.map +1 -0
  97. package/dist/src/commands/tools-ui/ToolsOverview.js +84 -0
  98. package/dist/src/commands/tools-ui/ToolsOverview.js.map +1 -0
  99. package/dist/src/commands/tools.d.ts +3 -0
  100. package/dist/src/commands/tools.d.ts.map +1 -0
  101. package/dist/src/commands/tools.js +78 -0
  102. package/dist/src/commands/tools.js.map +1 -0
  103. package/dist/src/config/cli-tools-config.d.ts +64 -3
  104. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  105. package/dist/src/config/cli-tools-config.js +226 -9
  106. package/dist/src/config/cli-tools-config.js.map +1 -1
  107. package/dist/src/core/component-defs.d.ts +16 -0
  108. package/dist/src/core/component-defs.d.ts.map +1 -0
  109. package/dist/src/core/component-defs.js +142 -0
  110. package/dist/src/core/component-defs.js.map +1 -0
  111. package/dist/src/core/manifest.d.ts +8 -1
  112. package/dist/src/core/manifest.d.ts.map +1 -1
  113. package/dist/src/core/manifest.js +29 -40
  114. package/dist/src/core/manifest.js.map +1 -1
  115. package/dist/src/core/tag-injector.d.ts +72 -0
  116. package/dist/src/core/tag-injector.d.ts.map +1 -0
  117. package/dist/src/core/tag-injector.js +228 -0
  118. package/dist/src/core/tag-injector.js.map +1 -0
  119. package/dist/src/index.d.ts +4 -0
  120. package/dist/src/index.d.ts.map +1 -1
  121. package/dist/src/index.js +2 -0
  122. package/dist/src/index.js.map +1 -1
  123. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -1
  124. package/dist/src/tools/spec-entry-parser.js +27 -1
  125. package/dist/src/tools/spec-entry-parser.js.map +1 -1
  126. package/dist/src/tools/spec-loader.d.ts +5 -1
  127. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  128. package/dist/src/tools/spec-loader.js +47 -59
  129. package/dist/src/tools/spec-loader.js.map +1 -1
  130. package/dist/tsconfig.tsbuildinfo +1 -0
  131. package/package.json +1 -1
  132. package/templates/cli/prompts/workflow-skill-conflict-patterns.txt +1 -1
  133. package/templates/cli/prompts/workflow-skill-lessons-learned.txt +1 -1
  134. package/templates/search-tools.md +1 -1
  135. package/templates/workflows/specs/node-catalog.md +1 -1
  136. package/workflows/brainstorm.md +1 -1
  137. package/{.claude/CLAUDE.md → workflows/claude-instructions.md} +25 -26
  138. package/workflows/cli-tools-usage.md +16 -2
  139. package/workflows/codex-instructions.md +150 -0
  140. package/workflows/delegate-usage.md +16 -2
  141. package/workflows/execute.md +28 -14
  142. package/workflows/init.md +2 -2
  143. package/workflows/issue-discover.md +2 -2
  144. package/workflows/maestro-super.md +120 -0
  145. package/workflows/maestro.codex.md +4 -4
  146. package/workflows/maestro.md +5 -5
  147. package/workflows/roadmap-common.md +197 -0
  148. package/workflows/roadmap.md +190 -355
  149. package/workflows/spec-generate.md +457 -544
  150. package/.claude/commands/maestro-spec-generate.md +0 -78
  151. package/.codex/skills/maestro-spec-generate/SKILL.md +0 -355
@@ -1,332 +1,443 @@
1
- ---
2
- name: maestro-roadmap
3
- description: Lightweight roadmap generation via 2-wave CSV pipeline. 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. Replaces maestro-roadmap command.
4
- argument-hint: "\"<requirements>\" [-y|--yes] [--phases N] [--from-brainstorm SESSION-ID]"
5
- allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- <purpose>
9
- 2-wave roadmap generation using `spawn_agents_on_csv`. Wave 1 runs parallel requirement analysis agents to assess scope, risk, and dependencies. Wave 2 runs a single roadmap assembly agent that synthesizes analysis findings into a complete roadmap with phases, milestones, and success criteria.
10
-
11
- **Core workflow**: Parse Requirements -> Parallel Analysis -> Roadmap Assembly -> Interactive Refinement -> Output
12
-
13
- ```
14
- +---------------------------------------------------------------------------+
15
- | ROADMAP CSV WAVE WORKFLOW |
16
- +---------------------------------------------------------------------------+
17
- | |
18
- | Phase 1: Requirement Parsing + CSV Generation |
19
- | +-- Parse requirement text from arguments |
20
- | +-- Detect input type (text, @file, brainstorm import) |
21
- | +-- Codebase detection (conditional exploration) |
22
- | +-- Assess uncertainty factors for strategy selection |
23
- | +-- Select decomposition strategy (progressive/direct/auto) |
24
- | +-- Generate tasks.csv with analysis + assembly rows |
25
- | +-- User validates breakdown (skip if -y) |
26
- | |
27
- | Phase 2: Wave Execution Engine |
28
- | +-- Wave 1: Requirement Analysis (parallel) |
29
- | | +-- Scope analysis agent: features, boundaries, MVP definition |
30
- | | +-- Risk analysis agent: technical risks, uncertainties, mitigations|
31
- | | +-- Dependency analysis agent: ordering, blockers, parallel groups |
32
- | | +-- Discoveries shared via board (constraints, patterns) |
33
- | | +-- Results: findings per analysis dimension |
34
- | +-- Wave 2: Roadmap Assembly (sequential) |
35
- | | +-- Single agent produces roadmap.md: |
36
- | | | - Phase structure with goals and success criteria |
37
- | | | - Dependency ordering between phases |
38
- | | | - Milestone grouping (MVP, Usable, Complete) |
39
- | | | - Scope decisions (in/deferred/out) |
40
- | | | - Progress tracking table |
41
- | | +-- Uses Wave 1 analysis as prev_context |
42
- | | +-- Applies decomposition strategy from Phase 1 |
43
- | +-- discoveries.ndjson shared across all waves (append-only) |
44
- | |
45
- | Phase 3: Results Aggregation |
46
- | +-- Export results.csv |
47
- | +-- Interactive refinement (max 3 rounds, skip if -y) |
48
- | +-- Generate context.md with roadmap summary |
49
- | +-- Write .workflow/roadmap.md |
50
- | +-- Ensure .workflow/scratch/ directory exists |
51
- | +-- Display summary with next steps |
52
- | |
53
- +---------------------------------------------------------------------------+
54
- ```
55
- </purpose>
56
-
57
- <context>
58
- $ARGUMENTS -- requirement text or @file reference, plus optional flags.
59
-
60
- **Usage**:
61
-
62
- ```bash
63
- $maestro-roadmap "Implement user authentication with OAuth and 2FA"
64
- $maestro-roadmap -y "@requirements.md"
65
- $maestro-roadmap --phases 4 "Build real-time notification system"
66
- $maestro-roadmap --from-brainstorm WFS-001 "Enhance auth system"
67
- ```
68
-
69
- **Flags**:
70
- - `-y, --yes`: Skip all confirmations (auto mode)
71
- - `--phases N`: Target number of roadmap phases (default: auto-determined)
72
- - `--from-brainstorm SESSION-ID`: Import guidance-specification.md from brainstorm session as seed
73
-
74
- When `--yes` or `-y`: Auto-confirm strategy selection, skip interactive refinement rounds, use recommended defaults for decomposition mode and phase count.
75
-
76
- **Output Directory**: `.workflow/.csv-wave/{session-id}/`
77
- **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report) + `.workflow/roadmap.md`
78
- </context>
79
-
80
- <csv_schema>
81
-
82
- ### tasks.csv (Master State)
83
-
84
- ```csv
85
- id,title,description,analysis_focus,deps,context_from,wave,status,findings,error
86
- "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","","",""
87
- "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","","",""
88
- "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","","",""
89
- "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","","",""
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
- | `analysis_focus` | Input | Analysis dimension: scope/risk/dependency (Wave 1 only) |
100
- | `deps` | Input | Semicolon-separated dependency task IDs |
101
- | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
102
- | `wave` | Computed | Wave number (1 = analysis, 2 = assembly) |
103
- | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
104
- | `findings` | Output | Key findings summary (max 500 chars) |
105
- | `error` | Output | Error message if failed |
106
-
107
- ### Per-Wave CSV (Temporary)
108
-
109
- Each wave generates `wave-{N}.csv` with extra `prev_context` column.
110
- </csv_schema>
111
-
112
- <invariants>
113
- 1. **Start Immediately**: First action is session initialization, then Phase 1
114
- 2. **Wave Order is Sacred**: Never execute wave 2 before wave 1 completes and results are merged
115
- 3. **CSV is Source of Truth**: Master tasks.csv holds all state
116
- 4. **Context Propagation**: prev_context built from master CSV, not from memory
117
- 5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
118
- 6. **Graceful Degradation**: If analysis fails, assembly proceeds with requirement text only
119
- 7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
120
- 8. **DO NOT STOP**: Continuous execution until all waves complete
121
- </invariants>
122
-
123
- <execution>
124
-
125
- ### Output Artifacts
126
-
127
- | File | Purpose | Lifecycle |
128
- |------|---------|-----------|
129
- | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
130
- | `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
131
- | `results.csv` | Final export of all task results | Created in Phase 3 |
132
- | `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
133
- | `context.md` | Human-readable roadmap generation report | Created in Phase 3 |
134
-
135
- ### Session Structure
136
-
137
- ```
138
- .workflow/.csv-wave/{YYYYMMDD}-roadmap-{slug}/
139
- +-- tasks.csv
140
- +-- results.csv
141
- +-- discoveries.ndjson
142
- +-- context.md
143
- +-- wave-{N}.csv (temporary)
144
- ```
145
-
146
- ### Session Initialization
147
-
148
- Parse `$ARGUMENTS` to extract:
149
- - `AUTO_YES` from `--yes` / `-y`
150
- - `targetPhases` from `--phases N` (default: auto-determined)
151
- - `brainstormSession` from `--from-brainstorm <SESSION-ID>`
152
- - `requirementArg` = remaining text after stripping all flags
153
- - `slug` = requirementArg lowercased, non-alphanumeric → `-`, max 40 chars
154
-
155
- Session ID: `{YYYYMMDD}-roadmap-{slug}`
156
- Session folder: `.workflow/.csv-wave/{sessionId}/` — create via `mkdir -p`
157
-
158
- ### Phase 1: Requirement Parsing + CSV Generation
159
-
160
- **Objective**: Parse requirements, assess uncertainty, select strategy, generate tasks.csv.
161
-
162
- **Decomposition Rules**:
163
-
164
- 1. **Input parsing**: Parse `{requirementArg}` -- direct text or `@file` reference
165
- 2. **Brainstorm import**: If `--from-brainstorm`, read `guidance-specification.md` for enriched context (problem statement, features, non-goals, terminology)
166
- 3. **Codebase detection**: Check for source files; if found, add codebase context to analysis prompts
167
- 4. **Load project specs**: Read `.workflow/specs/` for constraint awareness
168
-
169
- 5. **Uncertainty assessment**:
170
-
171
- | Factor | Low | Medium | High |
172
- |--------|-----|--------|------|
173
- | Scope clarity | Requirements explicit | Some ambiguity | Vague/open-ended |
174
- | Technical risk | Proven stack | Some unknowns | New technology |
175
- | Dependency unknown | All mapped | Some unclear | Many external |
176
- | Domain familiarity | Expert | Moderate | New domain |
177
- | Requirement stability | Locked | Some flux | Evolving |
178
-
179
- Strategy: >= 3 high -> progressive, >= 3 low -> direct, else -> ask user (or auto if `-y`).
180
-
181
- 6. **CSV generation**: 3 analysis tasks (wave 1) + 1 assembly task (wave 2).
182
-
183
- 7. **Wave computation**: Simple 2-wave -- all analysis tasks = wave 1, assembly = wave 2.
184
-
185
- **User validation**: Display task breakdown + strategy (skip if AUTO_YES).
186
-
187
- ### Phase 2: Wave Execution Engine
188
-
189
- **Objective**: Execute analysis and assembly wave-by-wave via spawn_agents_on_csv.
190
-
191
- #### Wave 1: Requirement Analysis (Parallel)
192
-
193
- Filter master `tasks.csv` for `wave == 1 AND status == pending` write `wave-1.csv` (no prev_context needed).
194
-
195
- ```javascript
196
- spawn_agents_on_csv({
197
- csv_path: `${sessionFolder}/wave-1.csv`,
198
- id_column: "id",
199
- instruction: buildAnalysisInstruction(sessionFolder, requirementArg, strategy),
200
- max_concurrency: 3,
201
- max_runtime_seconds: 3600,
202
- output_csv_path: `${sessionFolder}/wave-1-results.csv`,
203
- output_schema: {
204
- type: "object",
205
- properties: {
206
- id: { type: "string" },
207
- status: { type: "string", enum: ["completed", "failed"] },
208
- findings: { type: "string" },
209
- error: { type: "string" }
210
- },
211
- required: ["id", "status", "findings"]
212
- }
213
- })
214
- ```
215
-
216
- Merge `wave-1-results.csv` into master `tasks.csv`, delete `wave-1.csv`.
217
-
218
- #### Wave 2: Roadmap Assembly (Sequential)
219
-
220
- Filter master `tasks.csv` for `wave == 2 AND status == pending`. If all wave 1 tasks failed, use degraded mode (requirement text only).
221
-
222
- Build `prev_context` from wave 1 findings (format: `[Task N: Title] summary...` per task). Inject strategy and `--phases N` constraint into assembly prompt.
223
- Write `wave-2.csv` with `prev_context` column execute `spawn_agents_on_csv` merge results delete `wave-2.csv`.
224
-
225
- ### Phase 3: Results Aggregation
226
-
227
- **Objective**: Generate final results, optional refinement, and write roadmap.
228
-
229
- Export master `tasks.csv` as `results.csv`.
230
-
231
- **Interactive refinement** (skip if AUTO_YES): Present roadmap overview, collect user feedback via AskUserQuestion (max 3 rounds). Options: Approve, Adjust Scope, Reorder, Split/Merge. Update draft each round.
232
-
233
- Generate `context.md`:
234
-
235
- ```markdown
236
- # Roadmap Generation Report
237
-
238
- ## Summary
239
- - Requirements: {requirement_summary}
240
- - Strategy: {progressive|direct}
241
- - Analysis agents: 3 ({completed_count} completed)
242
- - Phases generated: {phase_count}
243
- - Milestones: {milestone_count}
244
-
245
- ## Analysis Findings
246
- ### Scope Analysis
247
- {findings}
248
-
249
- ### Risk Analysis
250
- {findings}
251
-
252
- ### Dependency Analysis
253
- {findings}
254
-
255
- ## Roadmap
256
- - Phases: {phase_count}
257
- - Strategy: {strategy}
258
- - MVP scope: {mvp_description}
259
- - Deferred: {deferred_items}
260
- ```
261
-
262
- **Write outputs**: `.workflow/roadmap.md` (standard template), ensure `.workflow/scratch/` exists, update `state.json` milestones array and `current_milestone`.
263
-
264
- Display summary:
265
-
266
- ```
267
- === ROADMAP CREATED ===
268
- Strategy: {progressive|direct}
269
- Phases: {phase_count} across {milestone_count} milestones
270
- Roadmap: .workflow/roadmap.md
271
-
272
- Next steps:
273
- maestro-init -- Set up project (if not yet initialized)
274
- maestro-plan "1" -- Plan first phase
275
- manage-status -- View project dashboard
276
- ```
277
-
278
- ### Shared Discovery Board Protocol
279
-
280
- #### Standard Discovery Types
281
-
282
- | Type | Dedup Key | Data Schema | Description |
283
- |------|-----------|-------------|-------------|
284
- | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
285
- | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
286
- | `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
287
- | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
288
-
289
- #### Domain Discovery Types
290
-
291
- | Type | Dedup Key | Data Schema | Description |
292
- |------|-----------|-------------|-------------|
293
- | `scope_boundary` | `data.feature` | `{feature, inclusion, rationale}` | Scope inclusion/exclusion decision |
294
- | `risk_factor` | `data.name` | `{name, severity, probability, mitigation}` | Identified risk |
295
- | `dependency_constraint` | `data.from+data.to` | `{from, to, type, strength}` | Dependency between features |
296
- | `external_dependency` | `data.name` | `{name, type, risk, alternative}` | External system dependency |
297
-
298
- #### Protocol
299
-
300
- Read `{session_folder}/discoveries.ndjson` before own analysis. Deduplicate by type + dedup key before writing. Append-only — never modify or delete.
301
-
302
- ```bash
303
- 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
304
- ```
305
- </execution>
306
-
307
- <error_codes>
308
- | Error | Resolution |
309
- |-------|------------|
310
- | No requirement text provided | Abort with error: "Requirement text or @file required" |
311
- | Brainstorm session not found | Abort with error: "Session {id} not found" -- list available sessions |
312
- | @file not found | Abort with error: "File {path} not found" |
313
- | Analysis agent timeout | Mark as failed, assembly uses available findings |
314
- | All analysis agents failed | Assembly runs in degraded mode (requirement text only) |
315
- | Assembly agent failed | Abort with error: "Roadmap generation failed" |
316
- | Circular dependency detected | Prompt user to re-decompose |
317
- | CSV parse error | Validate format, show line number |
318
- | discoveries.ndjson corrupt | Ignore malformed lines |
319
- | Max refinement rounds (3) | Force proceed with current roadmap |
320
- </error_codes>
321
-
322
- <success_criteria>
323
- - [ ] Requirements parsed from text, @file, or brainstorm session
324
- - [ ] Uncertainty assessed and decomposition strategy selected
325
- - [ ] Wave 1 analysis agents completed (scope, risk, dependency)
326
- - [ ] Wave 2 assembly agent produced roadmap.md
327
- - [ ] Interactive refinement offered (or skipped with -y)
328
- - [ ] .workflow/roadmap.md written with phases, milestones, success criteria
329
- - [ ] state.json updated with milestones
330
- - [ ] context.md generated with analysis summary
331
- - [ ] Completion report displayed with next steps
332
- </success_criteria>
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
+ - `--phases N`: Target number of roadmap phases (default: auto-determined, light mode only)
74
+ - `--skip-research`: Skip Wave 1 research, jump to document generation (full mode only)
75
+ - `--from-brainstorm SESSION-ID`: Import guidance-specification.md from brainstorm session as seed
76
+
77
+ When `--yes` or `-y`: Auto-confirm strategy/decisions, skip interactive refinement, use defaults.
78
+
79
+ **Output Directory**: `.workflow/.csv-wave/{session-id}/`
80
+ **Core Output**: `tasks.csv` + `results.csv` + `discoveries.ndjson` + `context.md` + `.workflow/roadmap.md`
81
+ **Full mode additional**: Spec package in `.workflow/.spec/SPEC-{slug}-{date}/`
82
+ </context>
83
+
84
+ <csv_schema>
85
+
86
+ ### tasks.csv Light Mode
87
+
88
+ ```csv
89
+ id,title,description,analysis_focus,deps,context_from,wave,status,findings,error
90
+ "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","","",""
91
+ "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","","",""
92
+ "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","","",""
93
+ "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","","",""
94
+ ```
95
+
96
+ ### tasks.csv Full Mode
97
+
98
+ ```csv
99
+ id,title,description,research_focus,doc_phase,deps,context_from,wave,status,findings,output_file,error
100
+ "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","","","",""
101
+ "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","","","",""
102
+ "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","","","",""
103
+ "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","","","",""
104
+ ```
105
+
106
+ ### Shared Columns
107
+
108
+ | Column | Phase | Description |
109
+ |--------|-------|-------------|
110
+ | `id` | Input | Unique task identifier (string) |
111
+ | `title` | Input | Short task title |
112
+ | `description` | Input | Detailed instructions for this task |
113
+ | `deps` | Input | Semicolon-separated dependency task IDs |
114
+ | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
115
+ | `wave` | Computed | Wave number (1 = analysis/research, 2 = assembly/synthesis) |
116
+ | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
117
+ | `findings` | Output | Key findings summary (max 500 chars) |
118
+ | `error` | Output | Error message if failed |
119
+
120
+ **Light-only**: `analysis_focus` (scope/risk/dependency)
121
+ **Full-only**: `research_focus` (domain/competitive/tech_stack), `doc_phase`, `output_file`
122
+
123
+ ### Per-Wave CSV (Temporary)
124
+
125
+ Each wave generates `wave-{N}.csv` with extra `prev_context` column.
126
+ </csv_schema>
127
+
128
+ <invariants>
129
+ 1. **Start Immediately**: First action is session initialization, then Phase 1
130
+ 2. **Wave Order is Sacred**: Never execute wave 2 before wave 1 completes and results are merged
131
+ 3. **CSV is Source of Truth**: Master tasks.csv holds all state
132
+ 4. **Context Propagation**: prev_context built from master CSV, not from memory
133
+ 5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
134
+ 6. **Graceful Degradation**: If Wave 1 fails, Wave 2 proceeds with seed input only
135
+ 7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
136
+ 8. **DO NOT STOP**: Continuous execution until all waves complete
137
+ </invariants>
138
+
139
+ <execution>
140
+
141
+ ### Output Artifacts
142
+
143
+ | File | Purpose | Lifecycle |
144
+ |------|---------|-----------|
145
+ | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
146
+ | `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
147
+ | `results.csv` | Final export of all task results | Created in Phase 3 |
148
+ | `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
149
+ | `context.md` | Human-readable report | Created in Phase 3 |
150
+ | `spec-config.json` | Session metadata (full mode only) | Created in Phase 1 |
151
+
152
+ ### Session Structure
153
+
154
+ **Light mode**:
155
+ ```
156
+ .workflow/.csv-wave/{YYYYMMDD}-roadmap-{slug}/
157
+ +-- tasks.csv, results.csv, discoveries.ndjson, context.md
158
+ ```
159
+
160
+ **Full mode**:
161
+ ```
162
+ .workflow/.csv-wave/{YYYYMMDD}-roadmap-full-{slug}/
163
+ +-- tasks.csv, results.csv, discoveries.ndjson, context.md, spec-config.json
164
+
165
+ .workflow/.spec/SPEC-{slug}-{date}/
166
+ +-- spec-config.json
167
+ +-- product-brief.md
168
+ +-- glossary.json
169
+ +-- requirements/
170
+ | +-- _index.md
171
+ | +-- REQ-NNN-{slug}.md
172
+ | +-- NFR-{type}-NNN-{slug}.md
173
+ +-- architecture/
174
+ | +-- _index.md
175
+ | +-- ADR-NNN-{slug}.md
176
+ +-- epics/
177
+ | +-- _index.md
178
+ | +-- EPIC-NNN-{slug}.md
179
+ +-- readiness-report.md
180
+ +-- spec-summary.md
181
+ +-- roadmap.md
182
+ ```
183
+
184
+ ### Session Initialization
185
+
186
+ Parse `$ARGUMENTS` to extract:
187
+ - `mode` from `--mode light|full` (default: `light`)
188
+ - `AUTO_YES` from `--yes` / `-y`
189
+ - `targetPhases` from `--phases N` (light mode only)
190
+ - `skipResearch` from `--skip-research` (full mode only)
191
+ - `brainstormSession` from `--from-brainstorm <SESSION-ID>`
192
+ - `requirementArg` = remaining text after stripping all flags
193
+ - `slug` = requirementArg lowercased, non-alphanumeric`-`, max 40 chars
194
+
195
+ Session ID: `{YYYYMMDD}-roadmap-{slug}` (light) or `{YYYYMMDD}-roadmap-full-{slug}` (full)
196
+ Session folder: `.workflow/.csv-wave/{sessionId}/` — create via `mkdir -p`
197
+
198
+ ### Phase 1: Input Parsing + CSV Generation
199
+
200
+ **Shared steps**:
201
+ 1. **Input parsing**: Parse `{requirementArg}` -- direct text or `@file` reference
202
+ 2. **Brainstorm import**: If `--from-brainstorm`, read `guidance-specification.md` for enriched context
203
+ 3. **Codebase detection**: Check for source files; if found, add context to analysis/research prompts
204
+ 4. **Load project specs**: Read `.workflow/specs/` for constraint awareness
205
+
206
+ **Light mode specific**:
207
+ 5. **Uncertainty assessment**:
208
+
209
+ | Factor | Low | Medium | High |
210
+ |--------|-----|--------|------|
211
+ | Scope clarity | Requirements explicit | Some ambiguity | Vague/open-ended |
212
+ | Technical risk | Proven stack | Some unknowns | New technology |
213
+ | Dependency unknown | All mapped | Some unclear | Many external |
214
+ | Domain familiarity | Expert | Moderate | New domain |
215
+ | Requirement stability | Locked | Some flux | Evolving |
216
+
217
+ Strategy: >=3 high → progressive, >=3 low → direct, else → ask (or auto if -y).
218
+
219
+ 6. **CSV generation**: 3 analysis tasks (wave 1) + 1 assembly task (wave 2)
220
+
221
+ **Full mode specific**:
222
+ 5. **Session init**: Create `spec-config.json` with session metadata
223
+ 6. **CSV generation**: 3 research tasks (wave 1) + 1 document chain task (wave 2). If `--skip-research`: 0 research + 1 doc chain (wave 1).
224
+
225
+ **User validation**: Display task breakdown + strategy (skip if AUTO_YES).
226
+
227
+ ### Phase 2: Wave Execution Engine
228
+
229
+ #### Wave 1 (Parallel)
230
+
231
+ Filter master `tasks.csv` for `wave == 1 AND status == pending` write `wave-1.csv`.
232
+
233
+ ```javascript
234
+ spawn_agents_on_csv({
235
+ csv_path: `${sessionFolder}/wave-1.csv`,
236
+ id_column: "id",
237
+ instruction: mode === 'light'
238
+ ? buildAnalysisInstruction(sessionFolder, requirementArg, strategy)
239
+ : buildResearchInstruction(sessionFolder, requirementArg),
240
+ max_concurrency: 3,
241
+ max_runtime_seconds: 3600,
242
+ output_csv_path: `${sessionFolder}/wave-1-results.csv`,
243
+ output_schema: {
244
+ type: "object",
245
+ properties: {
246
+ id: { type: "string" },
247
+ status: { type: "string", enum: ["completed", "failed"] },
248
+ findings: { type: "string" },
249
+ output_file: { type: "string" }, // full mode only
250
+ error: { type: "string" }
251
+ },
252
+ required: ["id", "status", "findings"]
253
+ }
254
+ })
255
+ ```
256
+
257
+ Merge results into master `tasks.csv`, delete `wave-1.csv`.
258
+
259
+ #### Wave 2 (Sequential)
260
+
261
+ Filter for `wave == 2 AND status == pending`. If all wave 1 tasks failed, use degraded mode (requirement/seed text only).
262
+
263
+ 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.
264
+
265
+ Write `wave-2.csv` with `prev_context` column → execute `spawn_agents_on_csv` → merge → delete temp CSV.
266
+
267
+ **Light mode**: Assembly agent produces roadmap.md with phases, milestones, success criteria.
268
+ **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).
269
+
270
+ ### Phase 3: Results Aggregation
271
+
272
+ Export master `tasks.csv` as `results.csv`.
273
+
274
+ **Interactive refinement** (skip if AUTO_YES): Present overview, collect feedback via AskUserQuestion (max 3 rounds).
275
+
276
+ **Full mode only — Readiness check**: Score on 4 dimensions (25% each):
277
+ - Completeness, Consistency, Traceability, Depth
278
+ - Gate: Pass (>=80%) / Review (60-79%) / Fail (<60%)
279
+
280
+ Generate `context.md`:
281
+
282
+ **Light mode template**:
283
+ ```markdown
284
+ # Roadmap Generation Report
285
+
286
+ ## Summary
287
+ - Requirements: {requirement_summary}
288
+ - Strategy: {progressive|direct}
289
+ - Analysis agents: 3 ({completed_count} completed)
290
+ - Phases generated: {phase_count}
291
+ - Milestones: {milestone_count}
292
+
293
+ ## Analysis Findings
294
+ ### Scope Analysis
295
+ {findings}
296
+ ### Risk Analysis
297
+ {findings}
298
+ ### Dependency Analysis
299
+ {findings}
300
+
301
+ ## Roadmap
302
+ - Phases: {phase_count}
303
+ - Strategy: {strategy}
304
+ - MVP scope: {mvp_description}
305
+ - Deferred: {deferred_items}
306
+ ```
307
+
308
+ **Full mode template**:
309
+ ```markdown
310
+ # Spec Generate Report
311
+
312
+ ## Summary
313
+ - Topic: {topic}
314
+ - Research agents: 3 ({completed_count} completed)
315
+ - Document phases: 7
316
+ - Quality score: {score}% ({gate})
317
+
318
+ ## Research Findings
319
+ ### Domain Research
320
+ {findings}
321
+ ### Competitive Analysis
322
+ {findings}
323
+ ### Tech Stack Analysis
324
+ {findings}
325
+
326
+ ## Document Chain Output
327
+ - Product Brief: {status}
328
+ - Requirements: {req_count} REQs + {nfr_count} NFRs
329
+ - Architecture: {adr_count} ADRs
330
+ - Epics: {epic_count} Epics
331
+ - Roadmap: {phase_count} phases
332
+
333
+ ## Readiness
334
+ - Completeness: {score}%
335
+ - Consistency: {score}%
336
+ - Traceability: {score}%
337
+ - Depth: {score}%
338
+ - Overall: {score}% ({gate})
339
+ ```
340
+
341
+ **Write outputs**:
342
+ - `.workflow/roadmap.md` (both modes)
343
+ - `.workflow/.spec/SPEC-{slug}-{date}/` (full mode only)
344
+ - Ensure `.workflow/scratch/` exists
345
+ - Update `state.json` milestones array and `current_milestone`
346
+
347
+ Display summary with next steps:
348
+ ```
349
+ === ROADMAP CREATED ===
350
+ Mode: {light|full}
351
+ Strategy: {progressive|direct}
352
+ Phases: {phase_count} across {milestone_count} milestones
353
+ Roadmap: .workflow/roadmap.md
354
+ [Full] Spec: .workflow/.spec/SPEC-{slug}-{date}/
355
+ [Full] Quality: {score}% ({gate})
356
+
357
+ Next steps:
358
+ maestro-init -- Set up project (if not yet initialized)
359
+ maestro-plan "1" -- Plan first phase
360
+ manage-status -- View project dashboard
361
+ ```
362
+
363
+ ### Shared Discovery Board Protocol
364
+
365
+ #### Standard Discovery Types
366
+
367
+ | Type | Dedup Key | Data Schema | Description |
368
+ |------|-----------|-------------|-------------|
369
+ | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
370
+ | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
371
+ | `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
372
+ | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
373
+
374
+ #### Light Mode Discovery Types
375
+
376
+ | Type | Dedup Key | Data Schema | Description |
377
+ |------|-----------|-------------|-------------|
378
+ | `scope_boundary` | `data.feature` | `{feature, inclusion, rationale}` | Scope decision |
379
+ | `risk_factor` | `data.name` | `{name, severity, probability, mitigation}` | Identified risk |
380
+ | `dependency_constraint` | `data.from+data.to` | `{from, to, type, strength}` | Feature dependency |
381
+ | `external_dependency` | `data.name` | `{name, type, risk, alternative}` | External system dependency |
382
+
383
+ #### Full Mode Discovery Types
384
+
385
+ | Type | Dedup Key | Data Schema | Description |
386
+ |------|-----------|-------------|-------------|
387
+ | `domain_term` | `data.term` | `{term, definition, aliases}` | Domain terminology |
388
+ | `competitor` | `data.name` | `{name, features[], gaps[]}` | Competitive product |
389
+ | `market_trend` | `data.name` | `{name, impact, relevance}` | Market trend |
390
+ | `tech_constraint` | `data.name` | `{name, type, severity, mitigation}` | Technical constraint |
391
+
392
+ #### Protocol
393
+
394
+ Read `{session_folder}/discoveries.ndjson` before own analysis. Deduplicate by type + dedup key before writing. Append-only — never modify or delete.
395
+
396
+ ```bash
397
+ # Light mode example
398
+ 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
399
+
400
+ # Full mode example
401
+ echo '{"ts":"<ISO>","worker":"{id}","type":"domain_term","data":{"term":"workflow","definition":"A sequence of orchestrated tasks","aliases":["pipeline","process"]}}' >> {session_folder}/discoveries.ndjson
402
+ ```
403
+ </execution>
404
+
405
+ <error_codes>
406
+ | Error | Resolution |
407
+ |-------|------------|
408
+ | No requirement/idea text provided | Abort with error: "Requirement text or @file required" |
409
+ | Brainstorm session not found | Abort with error: "Session {id} not found" -- list available sessions |
410
+ | @file not found | Abort with error: "File {path} not found" |
411
+ | Wave 1 agent timeout | Mark as failed, Wave 2 uses available findings |
412
+ | All Wave 1 agents failed | Wave 2 runs in degraded mode (seed input only) |
413
+ | Wave 2 agent failed (light) | Abort with error: "Roadmap generation failed" |
414
+ | Wave 2 agent failed (full) | Export partial output, log quality issues |
415
+ | Circular dependency detected | Prompt user to re-decompose (light mode) |
416
+ | CSV parse error | Validate format, show line number |
417
+ | discoveries.ndjson corrupt | Ignore malformed lines |
418
+ | Max refinement rounds (3) | Force proceed with current output |
419
+ | Readiness score < 60% (full) | Log issues, proceed with available output |
420
+ </error_codes>
421
+
422
+ <success_criteria>
423
+
424
+ **Both modes**:
425
+ - [ ] Input parsed from text, @file, or brainstorm session
426
+ - [ ] Wave 1 agents completed (analysis or research)
427
+ - [ ] Wave 2 agent produced output
428
+ - [ ] Interactive refinement offered (or skipped with -y)
429
+ - [ ] .workflow/roadmap.md written
430
+ - [ ] state.json updated with milestones
431
+ - [ ] context.md generated
432
+ - [ ] Completion report displayed with next steps
433
+
434
+ **Light mode additional**:
435
+ - [ ] Uncertainty assessed and decomposition strategy selected
436
+ - [ ] Roadmap has phases with milestones and success criteria
437
+
438
+ **Full mode additional**:
439
+ - [ ] spec-config.json created with session metadata
440
+ - [ ] Spec package written to .workflow/.spec/SPEC-{slug}-{date}/
441
+ - [ ] Readiness check scored on 4 dimensions
442
+ - [ ] Quality score and gate reported
443
+ </success_criteria>