maestro-flow-one 0.1.0

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 (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +173 -0
  3. package/bin/maestro-flow.js +730 -0
  4. package/claude/maestro-flow/SKILL.md +239 -0
  5. package/claude/maestro-flow/chains/templates.json +256 -0
  6. package/claude/maestro-flow/commands/learn/decompose.md +176 -0
  7. package/claude/maestro-flow/commands/learn/follow.md +167 -0
  8. package/claude/maestro-flow/commands/learn/investigate.md +221 -0
  9. package/claude/maestro-flow/commands/learn/retro.md +303 -0
  10. package/claude/maestro-flow/commands/learn/second-opinion.md +167 -0
  11. package/claude/maestro-flow/commands/lifecycle/amend.md +300 -0
  12. package/claude/maestro-flow/commands/lifecycle/analyze.md +126 -0
  13. package/claude/maestro-flow/commands/lifecycle/brainstorm.md +100 -0
  14. package/claude/maestro-flow/commands/lifecycle/composer.md +354 -0
  15. package/claude/maestro-flow/commands/lifecycle/execute.md +114 -0
  16. package/claude/maestro-flow/commands/lifecycle/fork.md +86 -0
  17. package/claude/maestro-flow/commands/lifecycle/init.md +78 -0
  18. package/claude/maestro-flow/commands/lifecycle/learn.md +140 -0
  19. package/claude/maestro-flow/commands/lifecycle/link-coordinate.md +71 -0
  20. package/claude/maestro-flow/commands/lifecycle/merge.md +61 -0
  21. package/claude/maestro-flow/commands/lifecycle/overlay.md +178 -0
  22. package/claude/maestro-flow/commands/lifecycle/plan.md +138 -0
  23. package/claude/maestro-flow/commands/lifecycle/player.md +404 -0
  24. package/claude/maestro-flow/commands/lifecycle/quick.md +56 -0
  25. package/claude/maestro-flow/commands/lifecycle/roadmap.md +164 -0
  26. package/claude/maestro-flow/commands/lifecycle/ui-design.md +93 -0
  27. package/claude/maestro-flow/commands/lifecycle/update.md +176 -0
  28. package/claude/maestro-flow/commands/lifecycle/verify.md +90 -0
  29. package/claude/maestro-flow/commands/manage/codebase-rebuild.md +75 -0
  30. package/claude/maestro-flow/commands/manage/codebase-refresh.md +57 -0
  31. package/claude/maestro-flow/commands/manage/harvest.md +94 -0
  32. package/claude/maestro-flow/commands/manage/issue-discover.md +77 -0
  33. package/claude/maestro-flow/commands/manage/issue.md +73 -0
  34. package/claude/maestro-flow/commands/manage/knowhow-capture.md +193 -0
  35. package/claude/maestro-flow/commands/manage/knowhow.md +77 -0
  36. package/claude/maestro-flow/commands/manage/learn.md +67 -0
  37. package/claude/maestro-flow/commands/manage/status.md +51 -0
  38. package/claude/maestro-flow/commands/manage/wiki.md +62 -0
  39. package/claude/maestro-flow/commands/milestone/audit.md +68 -0
  40. package/claude/maestro-flow/commands/milestone/complete.md +75 -0
  41. package/claude/maestro-flow/commands/milestone/release.md +96 -0
  42. package/claude/maestro-flow/commands/quality/auto-test.md +124 -0
  43. package/claude/maestro-flow/commands/quality/debug.md +115 -0
  44. package/claude/maestro-flow/commands/quality/refactor.md +55 -0
  45. package/claude/maestro-flow/commands/quality/retrospective.md +78 -0
  46. package/claude/maestro-flow/commands/quality/review.md +108 -0
  47. package/claude/maestro-flow/commands/quality/sync.md +51 -0
  48. package/claude/maestro-flow/commands/quality/test.md +103 -0
  49. package/claude/maestro-flow/commands/spec/add.md +49 -0
  50. package/claude/maestro-flow/commands/spec/load.md +51 -0
  51. package/claude/maestro-flow/commands/spec/remove.md +51 -0
  52. package/claude/maestro-flow/commands/spec/setup.md +51 -0
  53. package/claude/maestro-flow/commands/wiki/connect.md +62 -0
  54. package/claude/maestro-flow/commands/wiki/digest.md +69 -0
  55. package/codex/maestro-flow/SKILL.md +505 -0
  56. package/codex/maestro-flow/chains/templates.json +256 -0
  57. package/codex/maestro-flow/commands/learn/decompose.md +113 -0
  58. package/codex/maestro-flow/commands/learn/follow.md +83 -0
  59. package/codex/maestro-flow/commands/learn/investigate.md +83 -0
  60. package/codex/maestro-flow/commands/learn/retro.md +83 -0
  61. package/codex/maestro-flow/commands/learn/second-opinion.md +86 -0
  62. package/codex/maestro-flow/commands/lifecycle/amend.md +300 -0
  63. package/codex/maestro-flow/commands/lifecycle/analyze.md +483 -0
  64. package/codex/maestro-flow/commands/lifecycle/brainstorm.md +397 -0
  65. package/codex/maestro-flow/commands/lifecycle/composer.md +213 -0
  66. package/codex/maestro-flow/commands/lifecycle/execute.md +318 -0
  67. package/codex/maestro-flow/commands/lifecycle/fork.md +98 -0
  68. package/codex/maestro-flow/commands/lifecycle/init.md +134 -0
  69. package/codex/maestro-flow/commands/lifecycle/learn.md +80 -0
  70. package/codex/maestro-flow/commands/lifecycle/link-coordinate.md +257 -0
  71. package/codex/maestro-flow/commands/lifecycle/merge.md +69 -0
  72. package/codex/maestro-flow/commands/lifecycle/overlay.md +119 -0
  73. package/codex/maestro-flow/commands/lifecycle/plan.md +460 -0
  74. package/codex/maestro-flow/commands/lifecycle/player.md +323 -0
  75. package/codex/maestro-flow/commands/lifecycle/quick.md +124 -0
  76. package/codex/maestro-flow/commands/lifecycle/roadmap.md +468 -0
  77. package/codex/maestro-flow/commands/lifecycle/ui-design.md +135 -0
  78. package/codex/maestro-flow/commands/lifecycle/update.md +176 -0
  79. package/codex/maestro-flow/commands/lifecycle/verify.md +468 -0
  80. package/codex/maestro-flow/commands/manage/codebase-rebuild.md +347 -0
  81. package/codex/maestro-flow/commands/manage/codebase-refresh.md +66 -0
  82. package/codex/maestro-flow/commands/manage/harvest.md +91 -0
  83. package/codex/maestro-flow/commands/manage/issue-discover.md +431 -0
  84. package/codex/maestro-flow/commands/manage/issue.md +75 -0
  85. package/codex/maestro-flow/commands/manage/knowhow-capture.md +110 -0
  86. package/codex/maestro-flow/commands/manage/knowhow.md +95 -0
  87. package/codex/maestro-flow/commands/manage/learn.md +137 -0
  88. package/codex/maestro-flow/commands/manage/status.md +76 -0
  89. package/codex/maestro-flow/commands/manage/wiki.md +55 -0
  90. package/codex/maestro-flow/commands/milestone/audit.md +87 -0
  91. package/codex/maestro-flow/commands/milestone/complete.md +91 -0
  92. package/codex/maestro-flow/commands/milestone/release.md +70 -0
  93. package/codex/maestro-flow/commands/quality/auto-test.md +547 -0
  94. package/codex/maestro-flow/commands/quality/debug.md +334 -0
  95. package/codex/maestro-flow/commands/quality/refactor.md +151 -0
  96. package/codex/maestro-flow/commands/quality/retrospective.md +292 -0
  97. package/codex/maestro-flow/commands/quality/review.md +364 -0
  98. package/codex/maestro-flow/commands/quality/sync.md +111 -0
  99. package/codex/maestro-flow/commands/quality/test.md +498 -0
  100. package/codex/maestro-flow/commands/spec/add.md +101 -0
  101. package/codex/maestro-flow/commands/spec/load.md +77 -0
  102. package/codex/maestro-flow/commands/spec/remove.md +69 -0
  103. package/codex/maestro-flow/commands/spec/setup.md +75 -0
  104. package/codex/maestro-flow/commands/wiki/connect.md +73 -0
  105. package/codex/maestro-flow/commands/wiki/digest.md +87 -0
  106. package/package.json +24 -0
@@ -0,0 +1,468 @@
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>
@@ -0,0 +1,135 @@
1
+ ---
2
+ name: maestro-ui-design
3
+ description: Generate UI design prototypes with multiple styles. User selects style/palette/typography, generates design tokens, produces prototypes. Delegates to ui-ux-pro-max when available, falls back to self-contained pipeline.
4
+ argument-hint: "[topic] [-y] [--style-skill PKG]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Two workflow paths, auto-selected by skill availability:
10
+ 1. **Primary (ui-ux-pro-max)**: Lightweight -- delegates design generation, owns selection and solidification
11
+ 2. **Fallback (self-contained)**: Full 4-layer pipeline (style -> animation -> layout -> assembly)
12
+
13
+ Both produce the same output contract for downstream plan/execute consumption.
14
+ </purpose>
15
+
16
+ <context>
17
+ $ARGUMENTS -- phase number or topic text, plus optional flags.
18
+
19
+ **Usage**:
20
+
21
+ ```bash
22
+ $maestro-ui-design "3" # phase mode
23
+ $maestro-ui-design "landing page for SaaS" # scratch mode
24
+ $maestro-ui-design -y "3 --styles 5" # auto mode, 5 variants
25
+ $maestro-ui-design "3 --style-skill PKG --stack react"
26
+ ```
27
+
28
+ **Flags**:
29
+ - `[topic]`: Phase number or topic text (scratch mode)
30
+ - `-y, --yes`: Auto mode -- skip all interactive selection
31
+ - `--style-skill PKG`: Override ui-ux-pro-max skill path
32
+ - `--styles N`: Number of style variants (default: 3, range: 2-5)
33
+ - `--stack <stack>`: Tech stack for implementation guidelines (default: html-tailwind)
34
+ - `--targets <pages>`: Comma-separated page/component targets
35
+ - `--persist`: Save design system with hierarchical page overrides
36
+ - `--full`: Force full 4-layer self-contained pipeline
37
+
38
+ When `--yes` or `-y`: Skip interactive selection, auto-pick top-scored variant, skip brief review.
39
+
40
+ **Output**: `{scratch_dir}/design-ref/` with MASTER.md, design-tokens.json, animation-tokens.json, selection.json, prototypes/
41
+ </context>
42
+
43
+ <invariants>
44
+ 1. **Output contract is fixed** -- both paths produce MASTER.md + design-tokens.json + animation-tokens.json + selection.json
45
+ 2. **Colors in OKLCH** format in design-tokens.json
46
+ 3. **WCAG AA** contrast: 4.5:1 text, 3:1 UI elements
47
+ 4. **No lorem ipsum** -- use contextual placeholder content
48
+ 5. **Agent calls use `run_in_background: false`** for synchronous execution
49
+ 6. **Variant contrast** -- each variant must represent a distinctly different design direction
50
+ </invariants>
51
+
52
+ <execution>
53
+
54
+ ### Step 1: Parse Input and Resolve Target
55
+
56
+ 1. Parse flags from `$ARGUMENTS`: `--styles N`, `--stack`, `--targets`, `--persist`, `--full`, `-y`
57
+ 2. **Phase mode** (number): resolve via state.json artifact registry to `.workflow/scratch/{YYYYMMDD}-{type}-{slug}/`
58
+ 3. **Scratch mode** (text): create `.workflow/scratch/ui-design-{slug}-{date}/` with minimal index.json
59
+ 4. Create output directories: `${PHASE_DIR}/design-ref/prototypes/` and `${PHASE_DIR}/design-ref/layout-templates/`
60
+
61
+ ### Step 2: Detect Skill Availability
62
+
63
+ Search for `ui-ux-pro-max` script at `skills/ui-ux-pro-max/scripts/search.py` or `$HOME/.claude/plugins/cache/ui-ux-pro-max-skill/ui-ux-pro-max/*/scripts/search.py`.
64
+
65
+ - If `--style-skill PKG` provided: override detected path
66
+ - If `--full`: force self-contained pipeline regardless of skill availability
67
+
68
+ ### Step 3: Gather Requirements Context
69
+
70
+ 1. Read phase context (context.md, brainstorm results, spec references)
71
+ 2. Synthesize design brief: product_type, industry, style_keywords, audience
72
+ 3. Infer targets from phase goal if not specified (fallback: "home")
73
+ 4. **Interactive brief review** (skip if `-y`): present brief, allow user adjustments
74
+
75
+ ### Step 4: Generate Style Variants
76
+
77
+ **If SKILL_PATH found (primary path):**
78
+
79
+ Generate `styleCount` keyword sets with intentional contrast, then call ui-ux-pro-max for each:
80
+ ```bash
81
+ python3 "${SKILL_PATH}" "${variant_keywords}" --design-system -p "${project_name}" -f markdown
82
+ ```
83
+
84
+ **If SKILL_PATH empty or --full (fallback path):**
85
+
86
+ Spawn ui-design-agent to generate variants using 6D attribute space (mood, density, contrast, rounding, motion, color-temp) for maximum contrast between styles.
87
+
88
+ ### Step 5: Present and Select
89
+
90
+ Present all variants with key attributes (colors, typography, effects).
91
+
92
+ **Interactive** (default): user selects variant number, "redo", or "all"
93
+ **Auto** (`-y`): select variant 1
94
+
95
+ ### Step 6: Solidify Selected Design
96
+
97
+ Spawn Agent to extract structured tokens from selected variant: `design-tokens.json` (OKLCH colors, component_styles, typography.combinations, spacing, border_radius, shadows, breakpoints) and `animation-tokens.json` (duration, easing, transitions, keyframes, interactions, reduced_motion).
98
+
99
+ Write output artifacts:
100
+ - `design-ref/MASTER.md` -- complete design system specification
101
+ - `design-ref/design-tokens.json` -- production-ready tokens
102
+ - `design-ref/animation-tokens.json` -- animation system
103
+ - `design-ref/selection.json` -- selection metadata + rationale
104
+
105
+ ### Step 7: Optional Prototype Generation
106
+
107
+ For each target, spawn Agent to generate standalone HTML+CSS prototype from design-tokens.json and animation-tokens.json. Requirements: realistic content (no lorem ipsum), SVG icons via CDN, responsive at 375/768/1024px, WCAG AA contrast.
108
+
109
+ ### Step 8: Update State and Report
110
+
111
+ 1. Update index.json with `design_ref` status
112
+ 2. Display completion report: phase, variant count + selected, stack, targets, design system artifact paths (`MASTER.md`, `design-tokens.json`, `animation-tokens.json`, `prototypes/`). Suggest next: `$maestro-plan {phase}` or `$maestro-ui-design {phase} --refine`.
113
+ </execution>
114
+
115
+ <error_codes>
116
+ | Code | Severity | Condition | Recovery |
117
+ |------|----------|-----------|----------|
118
+ | E001 | error | Phase or topic argument required | Prompt user |
119
+ | E002 | error | Phase directory not found | Check phase number |
120
+ | E003 | error | Python not available for ui-ux-pro-max | Fall back to self-contained pipeline |
121
+ | E004 | error | --refine requires existing design-ref/ | Run without --refine first |
122
+ | W001 | warning | Design system returned partial results | Retry with broader keywords |
123
+ | W002 | warning | Prototype rendering failed for one variant | Continue with remaining |
124
+ | W004 | warning | ui-ux-pro-max not found, using fallback | Proceed with self-contained pipeline |
125
+ </error_codes>
126
+
127
+ <success_criteria>
128
+ - [ ] Target resolved (phase or scratch directory)
129
+ - [ ] Style variants generated with intentional contrast
130
+ - [ ] User selected variant (or auto-picked in `-y` mode)
131
+ - [ ] MASTER.md + design-tokens.json + animation-tokens.json + selection.json written
132
+ - [ ] Colors in OKLCH format, WCAG AA contrast met
133
+ - [ ] Prototypes generated for all targets (if applicable)
134
+ - [ ] index.json updated with design_ref status
135
+ </success_criteria>