maestro-flow-one 0.1.3 → 0.2.1

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 (100) hide show
  1. package/.ace-tool/index.json +108 -0
  2. package/README.md +10 -10
  3. package/bin/maestro-flow.js +30 -0
  4. package/claude/maestro-flow/SKILL.md +28 -94
  5. package/claude/maestro-flow/agents/cli-explore-agent.md +187 -0
  6. package/claude/maestro-flow/agents/conceptual-planning-agent.md +245 -0
  7. package/claude/maestro-flow/agents/team-supervisor.md +143 -0
  8. package/claude/maestro-flow/agents/team-worker.md +237 -0
  9. package/claude/maestro-flow/agents/ui-design-agent.md +286 -0
  10. package/claude/maestro-flow/agents/workflow-analyzer.md +115 -0
  11. package/claude/maestro-flow/agents/workflow-codebase-mapper.md +77 -0
  12. package/claude/maestro-flow/agents/workflow-collab-planner.md +143 -0
  13. package/claude/maestro-flow/agents/workflow-debugger.md +103 -0
  14. package/claude/maestro-flow/agents/workflow-executor.md +129 -0
  15. package/claude/maestro-flow/agents/workflow-external-researcher.md +86 -0
  16. package/claude/maestro-flow/agents/workflow-integration-checker.md +83 -0
  17. package/claude/maestro-flow/agents/workflow-nyquist-auditor.md +85 -0
  18. package/claude/maestro-flow/agents/workflow-phase-researcher.md +85 -0
  19. package/claude/maestro-flow/agents/workflow-plan-checker.md +90 -0
  20. package/claude/maestro-flow/agents/workflow-planner.md +195 -0
  21. package/claude/maestro-flow/agents/workflow-project-researcher.md +74 -0
  22. package/claude/maestro-flow/agents/workflow-research-synthesizer.md +70 -0
  23. package/claude/maestro-flow/agents/workflow-reviewer.md +82 -0
  24. package/claude/maestro-flow/agents/workflow-roadmapper.md +81 -0
  25. package/claude/maestro-flow/agents/workflow-verifier.md +120 -0
  26. package/claude/maestro-flow/executor.md +328 -0
  27. package/codex/maestro-flow/SKILL.md +18 -0
  28. package/codex/maestro-flow/agents/team-supervisor.toml +40 -0
  29. package/codex/maestro-flow/agents/team-worker.toml +63 -0
  30. package/maestro-flow/agents/cli-explore-agent.md +187 -0
  31. package/maestro-flow/agents/conceptual-planning-agent.md +245 -0
  32. package/maestro-flow/agents/team-supervisor.md +143 -0
  33. package/maestro-flow/agents/team-worker.md +237 -0
  34. package/maestro-flow/agents/ui-design-agent.md +286 -0
  35. package/maestro-flow/agents/workflow-analyzer.md +115 -0
  36. package/maestro-flow/agents/workflow-codebase-mapper.md +77 -0
  37. package/maestro-flow/agents/workflow-collab-planner.md +143 -0
  38. package/maestro-flow/agents/workflow-debugger.md +103 -0
  39. package/maestro-flow/agents/workflow-executor.md +129 -0
  40. package/maestro-flow/agents/workflow-external-researcher.md +86 -0
  41. package/maestro-flow/agents/workflow-integration-checker.md +83 -0
  42. package/maestro-flow/agents/workflow-nyquist-auditor.md +85 -0
  43. package/maestro-flow/agents/workflow-phase-researcher.md +85 -0
  44. package/maestro-flow/agents/workflow-plan-checker.md +90 -0
  45. package/maestro-flow/agents/workflow-planner.md +195 -0
  46. package/maestro-flow/agents/workflow-project-researcher.md +74 -0
  47. package/maestro-flow/agents/workflow-research-synthesizer.md +70 -0
  48. package/maestro-flow/agents/workflow-reviewer.md +82 -0
  49. package/maestro-flow/agents/workflow-roadmapper.md +81 -0
  50. package/maestro-flow/agents/workflow-verifier.md +120 -0
  51. package/maestro-flow/commands/learn/decompose.md +176 -0
  52. package/maestro-flow/commands/learn/follow.md +167 -0
  53. package/maestro-flow/commands/learn/investigate.md +221 -0
  54. package/maestro-flow/commands/learn/retro.md +303 -0
  55. package/maestro-flow/commands/learn/second-opinion.md +167 -0
  56. package/maestro-flow/commands/lifecycle/amend.md +300 -0
  57. package/maestro-flow/commands/lifecycle/analyze.md +130 -0
  58. package/maestro-flow/commands/lifecycle/brainstorm.md +104 -0
  59. package/maestro-flow/commands/lifecycle/composer.md +354 -0
  60. package/maestro-flow/commands/lifecycle/execute.md +120 -0
  61. package/maestro-flow/commands/lifecycle/fork.md +86 -0
  62. package/maestro-flow/commands/lifecycle/init.md +78 -0
  63. package/maestro-flow/commands/lifecycle/learn.md +140 -0
  64. package/maestro-flow/commands/lifecycle/link-coordinate.md +71 -0
  65. package/maestro-flow/commands/lifecycle/merge.md +61 -0
  66. package/maestro-flow/commands/lifecycle/overlay.md +178 -0
  67. package/maestro-flow/commands/lifecycle/plan.md +154 -0
  68. package/maestro-flow/commands/lifecycle/player.md +404 -0
  69. package/maestro-flow/commands/lifecycle/quick.md +56 -0
  70. package/maestro-flow/commands/lifecycle/roadmap.md +164 -0
  71. package/maestro-flow/commands/lifecycle/ui-design.md +93 -0
  72. package/maestro-flow/commands/lifecycle/update.md +176 -0
  73. package/maestro-flow/commands/lifecycle/verify.md +96 -0
  74. package/maestro-flow/commands/manage/codebase-rebuild.md +75 -0
  75. package/maestro-flow/commands/manage/codebase-refresh.md +57 -0
  76. package/maestro-flow/commands/manage/harvest.md +94 -0
  77. package/maestro-flow/commands/manage/issue-discover.md +77 -0
  78. package/maestro-flow/commands/manage/issue.md +73 -0
  79. package/maestro-flow/commands/manage/knowhow-capture.md +193 -0
  80. package/maestro-flow/commands/manage/knowhow.md +77 -0
  81. package/maestro-flow/commands/manage/learn.md +67 -0
  82. package/maestro-flow/commands/manage/status.md +51 -0
  83. package/maestro-flow/commands/manage/wiki.md +62 -0
  84. package/maestro-flow/commands/milestone/audit.md +68 -0
  85. package/maestro-flow/commands/milestone/complete.md +75 -0
  86. package/maestro-flow/commands/milestone/release.md +96 -0
  87. package/maestro-flow/commands/quality/auto-test.md +128 -0
  88. package/maestro-flow/commands/quality/debug.md +125 -0
  89. package/maestro-flow/commands/quality/refactor.md +55 -0
  90. package/maestro-flow/commands/quality/retrospective.md +78 -0
  91. package/maestro-flow/commands/quality/review.md +114 -0
  92. package/maestro-flow/commands/quality/sync.md +51 -0
  93. package/maestro-flow/commands/quality/test.md +107 -0
  94. package/maestro-flow/commands/spec/add.md +49 -0
  95. package/maestro-flow/commands/spec/load.md +51 -0
  96. package/maestro-flow/commands/spec/remove.md +51 -0
  97. package/maestro-flow/commands/spec/setup.md +51 -0
  98. package/maestro-flow/commands/wiki/connect.md +62 -0
  99. package/maestro-flow/commands/wiki/digest.md +69 -0
  100. package/package.json +1 -1
@@ -0,0 +1,300 @@
1
+ ---
2
+ name: maestro-amend
3
+ description: Generate overlays to fix workflow command deficiencies
4
+ argument-hint: "[description] [--from-verify <dir>] [--from-review <dir>] [--from-session <id>] [--from-issues ISS-xxx,...] [--scan] [--dry-run]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - AskUserQuestion
12
+ ---
13
+ <purpose>
14
+ Signal-driven overlay generator — collects workflow deficiency signals from heterogeneous sources (verification gaps, review findings, debug sessions, open issues, user feedback), diagnoses which commands need amendment, and batch-generates targeted overlays to fix them.
15
+
16
+ Differs from `/maestro-overlay` which takes a single explicit intent. This command **discovers** what needs amending by analyzing workflow artifacts, then proposes and applies overlay fixes automatically.
17
+
18
+ **Mechanism**: All amendments use the overlay system (`~/.maestro/overlays/*.json`) — non-invasive, idempotent, survives reinstall.
19
+ </purpose>
20
+
21
+ <required_reading>
22
+ @~/.maestro/workflows/overlays.md
23
+ @~/.maestro/cli-tools.json
24
+ </required_reading>
25
+
26
+ <context>
27
+ $ARGUMENTS — optional description and/or source flags.
28
+
29
+ ### Signal Sources
30
+
31
+ | Flag | Source | What it collects |
32
+ |------|--------|------------------|
33
+ | `--from-verify <dir>` | `verification.json` | Workflow gaps exposed by verify failures |
34
+ | `--from-review <dir>` | `review.json` | Process deficiencies from code review |
35
+ | `--from-session <id>` | Session artifacts | Problems encountered during workflow execution |
36
+ | `--from-issues ISS-xxx,...` | `issues.jsonl` | Issues that trace to command deficiency |
37
+ | `--scan` | Auto-scan `.workflow/` | Discover all workflow-related signals |
38
+ | _(positional text)_ | User description | Direct observation of command deficiency |
39
+
40
+ Multiple sources combinable. No flags and no description → interactive mode.
41
+
42
+ ### Control Flags
43
+
44
+ | Flag | Description |
45
+ |------|-------------|
46
+ | `--dry-run` | Generate overlay JSON, show preview, don't install |
47
+ | `-y` | Skip confirmations |
48
+
49
+ ### Signal-to-Overlay Classification
50
+
51
+ A signal becomes an overlay candidate when it identifies a **workflow command deficiency** — a missing step, missing precondition, absent reading, or gap in success criteria. Signals about code bugs (not command gaps) are out of scope; suggest `/maestro-quick` or `/maestro-plan --gaps` for those.
52
+
53
+ ### CLI Targeting
54
+
55
+ Overlays support the `cli` field to target different workflow systems:
56
+ - `"cli": "claude"` (default) → patches `.claude/commands/{name}.md`
57
+ - `"cli": "codex"` → patches `.codex/skills/{name}/SKILL.md`
58
+ - `"cli": "both"` → patches both paths
59
+
60
+ When diagnosing signals, determine which CLI's workflow is affected and set the `cli` field accordingly.
61
+
62
+ ### Output
63
+ - Overlay files: `~/.maestro/overlays/amend-{slug}.json`
64
+ - Optional docs: `~/.maestro/overlays/docs/amend-{slug}.md`
65
+ </context>
66
+
67
+ <execution>
68
+ ### 1. Collect signals
69
+
70
+ Parse $ARGUMENTS for source flags and description text.
71
+
72
+ **If no sources and no description** → interactive mode:
73
+ Scan `.workflow/` for recent artifacts containing workflow-level signals:
74
+
75
+ ```
76
+ candidates = []
77
+
78
+ # Verification: workflow gaps (not code bugs)
79
+ for each verification.json in .workflow/scratch/*-verify-*/
80
+ extract must_have_failures, anti_pattern items
81
+ filter for items whose fix_direction points at a command gap
82
+ (e.g., "missing pre-check step", "no reading for X", "success criteria incomplete")
83
+
84
+ # Review: process findings
85
+ for each review.json in .workflow/scratch/*-review-*/
86
+ extract findings tagged as "process" or "workflow"
87
+
88
+ # Debug sessions: root causes tracing to command omission
89
+ for each understanding.md in .workflow/scratch/*-debug-*/
90
+ extract root causes where cause_type mentions workflow/command
91
+
92
+ # Open issues: workflow-tagged
93
+ issues = read .workflow/issues/issues.jsonl
94
+ | filter status == "open" AND tags include "workflow" or "command"
95
+
96
+ # Execution summaries: deviations
97
+ for each summary in .workflow/scratch/*-plan-*/.summaries/
98
+ extract plan deviations that suggest a missing command step
99
+ ```
100
+
101
+ Display scan results and use AskUserQuestion (multiSelect) to let user pick sources. Also allow user to add a freeform description.
102
+
103
+ **If source flags** → extract signals from each specified source.
104
+
105
+ **If only description** → user's text is the sole signal. Parse for:
106
+ - Which command(s) are affected
107
+ - What's missing or broken in the command flow
108
+ - What the expected behavior should be
109
+
110
+ ### 2. Diagnose: map signals to command patches
111
+
112
+ For each signal, determine:
113
+
114
+ ```
115
+ {
116
+ signal_id: "SIG-001",
117
+ source: "verify:scratch/20260426-verify-M1/",
118
+ description: "maestro-execute skipped pre-flight when no test suite exists",
119
+ target_command: "maestro-execute",
120
+ target_section: "execution",
121
+ patch_mode: "append",
122
+ fix_direction: "Add fallback verification when no test suite detected",
123
+ severity: "medium"
124
+ }
125
+ ```
126
+
127
+ **Diagnosis heuristics:**
128
+
129
+ | Signal pattern | Target section | Mode |
130
+ |---------------|----------------|------|
131
+ | Missing pre-check / gate | `execution` | `prepend` |
132
+ | Missing post-step / verification | `execution` | `append` |
133
+ | Missing reading / context | `required_reading` or `deferred_reading` | `append` |
134
+ | Incomplete success criteria | `success_criteria` | `append` |
135
+ | Missing error handling | `error_codes` | `append` |
136
+ | Scope/context gap | `context` | `append` |
137
+ | Entirely new concern | _(new section)_ | `new-section` |
138
+
139
+ If target command is ambiguous, read the pristine source from `$PKG_ROOT/.claude/commands/<name>.md` (preferred) or `~/.claude/commands/<name>.md` to confirm the right section.
140
+
141
+ ### 3. Group and plan overlays
142
+
143
+ Group signals by target command. Signals hitting the same command **and** same section merge into one patch. Different sections on the same command stay as separate patches in one overlay.
144
+
145
+ Decide overlay granularity:
146
+ - **Single-concern** (1–2 signals on same command) → one overlay per command: `patch-{command}-{slug}.json`
147
+ - **Multi-concern** (3+ signals across commands) → one umbrella overlay: `amend-{slug}.json`
148
+
149
+ For each planned overlay, read the target command's pristine source to:
150
+ - Verify the section exists
151
+ - Check for existing overlays (via `<!-- maestro-overlay:` markers)
152
+ - Confirm the injection point makes sense
153
+
154
+ ### 4. Preview injection points
155
+
156
+ For each target command, render a section map with injection points (same format as `/maestro-overlay`):
157
+
158
+ ```
159
+ === maestro-execute.md (1 existing overlay) ===
160
+
161
+ <purpose>
162
+ <required_reading>
163
+ ├─ [existing] require-spec-before-plan #0
164
+ <context>
165
+ <execution>
166
+ ├─ [existing] require-spec-before-plan #1 "Pre-check: Load Spec"
167
+ ├─ [existing] cli-verify-after-execute #0 "CLI Verification"
168
+ >>> NEW: prepend — SIG-001 "Fallback verify when no tests"
169
+ >>> NEW: append — SIG-003 "Issue sync retry on failure"
170
+ <error_codes>
171
+ <success_criteria>
172
+ >>> NEW: append — SIG-002 "Verify issue status updated"
173
+
174
+ === maestro-plan.md (0 existing overlays) ===
175
+
176
+ <purpose>
177
+ <required_reading>
178
+ <context>
179
+ >>> NEW: append — SIG-004 "Load prior patch history"
180
+ <execution>
181
+ <success_criteria>
182
+ ```
183
+
184
+ Use AskUserQuestion to confirm:
185
+ - **"Apply all"** — proceed with all patches
186
+ - **"Select patches"** — per-signal confirmation
187
+ - **"Edit"** — modify a specific signal's target/section before proceeding
188
+ - **"Cancel"** — abort
189
+
190
+ ### 5. Draft overlay JSON
191
+
192
+ For each overlay, build the JSON following the overlay schema:
193
+
194
+ ```json
195
+ {
196
+ "name": "amend-execute-verify-fallback",
197
+ "description": "Add fallback verification and issue sync retry to maestro-execute [from: AMEND-20260426]",
198
+ "targets": ["maestro-execute"],
199
+ "cli": "claude",
200
+ "priority": 60,
201
+ "enabled": true,
202
+ "patches": [
203
+ {
204
+ "section": "execution",
205
+ "mode": "prepend",
206
+ "content": "## Fallback Verification (patch: SIG-001)\n\nIf no test suite exists for the affected module, run a structural verification instead:\n..."
207
+ },
208
+ {
209
+ "section": "execution",
210
+ "mode": "append",
211
+ "content": "## Issue Sync Retry (patch: SIG-003)\n\nIf issue status sync fails, retry once before logging as warning:\n..."
212
+ },
213
+ {
214
+ "section": "success_criteria",
215
+ "mode": "append",
216
+ "content": "- [ ] Issue statuses confirmed synced after execution (patch: SIG-002)"
217
+ }
218
+ ]
219
+ }
220
+ ```
221
+
222
+ **Content rules:**
223
+ - Heading includes `(patch: SIG-NNN)` for traceability
224
+ - Content is concise — fix the gap, nothing more
225
+ - `@~/.maestro/overlays/docs/` references for anything longer than 10 lines
226
+ - If supplementary doc needed, write it to `~/.maestro/overlays/docs/amend-{slug}.md` first
227
+
228
+ Write overlay JSON to `~/.maestro/overlays/amend-{slug}.json`.
229
+
230
+ If `--dry-run`, show the JSON and section map preview, then stop.
231
+
232
+ ### 6. Install overlays
233
+
234
+ For each generated overlay:
235
+
236
+ ```bash
237
+ maestro overlay add ~/.maestro/overlays/amend-{slug}.json
238
+ ```
239
+
240
+ On validation failure, fix the JSON and retry (max 2 attempts).
241
+
242
+ ### 7. Report
243
+
244
+ ```
245
+ === AMEND OVERLAYS INSTALLED ===
246
+ Session: AMEND-20260426
247
+ Signals: 5 collected, 4 applied, 1 skipped (code bug, not command gap)
248
+ Overlays: 2 created
249
+
250
+ amend-execute-verify-fallback
251
+ Targets: maestro-execute (3 patches: exec prepend, exec append, criteria append)
252
+ Path: ~/.maestro/overlays/amend-execute-verify-fallback.json
253
+ Source: SIG-001, SIG-002, SIG-003
254
+
255
+ amend-plan-context-history
256
+ Targets: maestro-plan (1 patch: context append)
257
+ Path: ~/.maestro/overlays/amend-plan-context-history.json
258
+ Source: SIG-004
259
+
260
+ Skipped:
261
+ SIG-005 "Missing null check in auth.ts" → code bug, use /maestro-quick
262
+
263
+ Re-apply: maestro overlay apply
264
+ Remove: maestro overlay remove amend-execute-verify-fallback
265
+ Inspect: maestro overlay list
266
+ ```
267
+
268
+ ### Post-patch routing
269
+
270
+ Use AskUserQuestion:
271
+ - **"Test commands"** — run affected commands to verify patches work
272
+ - **"View overlays"** — `maestro overlay list`
273
+ - **"Continue"** — done
274
+ </execution>
275
+
276
+ <error_codes>
277
+ | Code | Severity | Condition | Recovery |
278
+ |------|----------|-----------|----------|
279
+ | E001 | error | No signals found from any source | Verify artifact paths, or provide description |
280
+ | E002 | error | Source artifact not found | Check path exists |
281
+ | E003 | error | No signals map to command deficiencies (all are code bugs) | Use `/maestro-quick` or `/maestro-plan --gaps` instead |
282
+ | E004 | error | Overlay validation failed after 2 retries | Review generated JSON manually |
283
+ | W001 | warning | Some signals skipped (code bugs, not command gaps) | Route to appropriate fix command |
284
+ | W002 | warning | Target command has many existing overlays (≥3) | Consider consolidating overlays |
285
+ | W003 | warning | Scan found no recent workflow artifacts | Check `.workflow/` or provide explicit source |
286
+ </error_codes>
287
+
288
+ <success_criteria>
289
+ - [ ] Signal sources resolved and signals collected
290
+ - [ ] Each signal classified: command deficiency vs. code bug (only command deficiencies proceed)
291
+ - [ ] Signals mapped to target command + section + mode
292
+ - [ ] Pristine command sources read to verify sections and check existing overlays
293
+ - [ ] Section map with injection points shown and confirmed by user
294
+ - [ ] Overlay JSON written to `~/.maestro/overlays/amend-{slug}.json`
295
+ - [ ] Supplementary docs written to `~/.maestro/overlays/docs/` if needed
296
+ - [ ] `maestro overlay add` exited successfully for each overlay
297
+ - [ ] Target command files contain `<!-- maestro-overlay:amend-{slug}#N hash=... -->` markers
298
+ - [ ] Report shown with overlay details, source traceability, and skipped signals
299
+ - [ ] Skipped code-bug signals routed to appropriate alternative command
300
+ </success_criteria>
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: maestro-analyze
3
+ description: Multi-angle analysis with CLI-assisted exploration
4
+ argument-hint: "[phase|topic] [-y] [-c] [-q] [--gaps [ISS-ID]]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ Perform multi-dimensional analysis of a technical proposal, decision, or architecture choice through iterative CLI-assisted exploration and interactive discussion. Produces a discussion timeline (discussion.md) with evolving understanding, multi-perspective findings, Decision Recording Protocol, Intent Coverage tracking, and a final conclusions package with Go/No-Go recommendation.
17
+
18
+ Combines structured 6-dimension scoring with iterative deepening and decision extraction. Replaces both analysis and decision-capture workflows — produces analysis.md (scoring) AND context.md (Locked/Free/Deferred decisions for plan).
19
+
20
+ Use `-q` for quick decision extraction only (skip exploration + scoring).
21
+
22
+ Use `--gaps` for issue-focused root cause analysis (replaces manage-issue-analyze). Loads issues from issues.jsonl, performs CLI exploration against issue context/location, synthesizes root cause into issue.analysis, and outputs context.md for downstream `plan --gaps`.
23
+ </purpose>
24
+
25
+ <required_reading>
26
+ @~/.maestro/workflows/analyze.md
27
+ </required_reading>
28
+
29
+ <deferred_reading>
30
+ - [state.json](~/.maestro/templates/state.json) — read when registering artifact
31
+ - [issue-gaps-analyze.md](~/.maestro/workflows/issue-gaps-analyze.md) — read when --gaps is triggered
32
+ </deferred_reading>
33
+
34
+ <context>
35
+ $ARGUMENTS -- phase number for milestone-scoped, topic text for adhoc/standalone mode, no args for milestone-wide.
36
+
37
+ **Flags:**
38
+ - `-y` / `--yes`: Auto mode — skip interactive scoping, use recommended defaults, auto-deepen
39
+ - `-c` / `--continue`: Resume from existing session (auto-detect session folder + discussion.md)
40
+ - `-q` / `--quick`: Quick mode — skip exploration + scoring, go straight to decision extraction (context.md only)
41
+ - `--gaps [ISS-ID]`: Issue root cause analysis mode. If ISS-ID provided, analyze single issue. If omitted, analyze all open/registered issues from issues.jsonl.
42
+
43
+ Scope routing, output directory format, artifact registration schema, and output artifact listing are defined in workflow analyze.md (Scope Routing and Output Structure sections).
44
+ </context>
45
+
46
+ <execution>
47
+ Follow '~/.maestro/workflows/analyze.md' completely.
48
+
49
+ ### --gaps Mode (Issue Root Cause Analysis)
50
+
51
+ When `--gaps` flag is present, follow `~/.maestro/workflows/issue-gaps-analyze.md` instead of the standard analyze pipeline:
52
+
53
+ ```
54
+ Phase 1: Load issues from .workflow/issues/issues.jsonl
55
+ - If ISS-ID provided: load single issue
56
+ - If no ISS-ID: filter issues where status = open | registered
57
+ - Validate: at least 1 issue loaded, else error E_NO_ISSUES
58
+
59
+ Phase 2: CLI exploration per issue
60
+ - For each issue: build exploration prompt from issue.title, description, context, related_files
61
+ - Run maestro delegate --role analyze --mode analysis with codebase context
62
+ - Gather affected files, call chains, root cause evidence
63
+
64
+ Phase 3: Root cause synthesis → write issue.analysis
65
+ - Parse CLI output into analysis record: { root_cause, affected_files, impact_scope, fix_direction, confidence, analyzed_at, tool, depth }
66
+ - Write analysis record to issue in issues.jsonl
67
+ - Append history entry: { action: "analyzed", at: <ISO>, by: "maestro-analyze --gaps" }
68
+
69
+ Phase 4: Output context.md for downstream plan --gaps
70
+ - Aggregate all analyzed issues into context.md with root causes and fix directions
71
+ - Register ANL artifact in state.json
72
+ ```
73
+
74
+ **Handoff:** context.md is consumed by maestro-plan (loads Locked/Free/Deferred decisions). In --gaps mode, context.md contains issue root causes for `plan --gaps` consumption.
75
+
76
+ **Next-step routing on completion:**
77
+
78
+ Phase/Milestone scope:
79
+ - Go recommendation, UI work needed → `/maestro-ui-design {phase}`
80
+ - Go recommendation, ready to plan → `/maestro-plan` or `/maestro-plan {phase}`
81
+ - No-Go recommendation → revisit requirements or `/maestro-brainstorm {topic}`
82
+
83
+ Adhoc/Standalone scope:
84
+ - Ready to plan → `/maestro-plan --dir {scratch_dir}`
85
+ - Need more exploration → `/maestro-analyze {topic} -c`
86
+
87
+ Gaps scope:
88
+ - Issues analyzed → `/maestro-plan --gaps` (plan fix tasks linked to issues)
89
+ - Need more context → `/maestro-analyze --gaps {ISS-ID}` (re-analyze specific issue)
90
+ </execution>
91
+
92
+ <error_codes>
93
+ | Code | Severity | Condition | Recovery |
94
+ |------|----------|-----------|----------|
95
+ | E001 | error | No args and no roadmap (cannot determine scope) | Prompt user for topic text or create roadmap first |
96
+ | W001 | warning | CLI exploration failed | Continue with available context, note limitation |
97
+ | W002 | warning | CLI analysis timeout | Retry with shorter prompt, or skip perspective |
98
+ | W003 | warning | Insufficient evidence for scoring dimensions | Note low-confidence dimensions, proceed with available evidence |
99
+ | W004 | warning | Max rounds reached (5) | Force synthesis, offer continuation option |
100
+ | E_NO_ISSUES | error | --gaps but no open/registered issues found | Suggest `/manage-issue-discover` or `/manage-issue create` |
101
+ | E_ISSUE_NOT_FOUND | error | --gaps with ISS-ID but issue not found | Suggest `/manage-issue list` to find valid IDs |
102
+ </error_codes>
103
+
104
+ <success_criteria>
105
+ Full mode:
106
+ - [ ] CLI exploration completed with code anchors and call chains
107
+ - [ ] discussion.md created with full timeline, TOC, Current Understanding
108
+ - [ ] analysis.md written with all 6 dimensions scored with evidence
109
+ - [ ] conclusions.json created with recommendations and decision trail
110
+ - [ ] Intent Coverage tracked and verified (no unresolved ❌ items)
111
+ - [ ] Confidence tracking initialized (Step 4.6) and re-scored each round (Step 5.8)
112
+ - [ ] Readiness gate checked before synthesis (Step 5.10)
113
+ - [ ] Pressure pass completed ≥ 1 time before Step 6
114
+ - [ ] Confidence summary with factor decomposition written to analysis.md
115
+
116
+ Gaps mode:
117
+ - [ ] Issues loaded from issues.jsonl (all open/registered, or single ISS-ID)
118
+ - [ ] CLI exploration executed per issue with codebase context
119
+ - [ ] Analysis record attached to each issue in issues.jsonl
120
+ - [ ] context.md written with aggregated root causes for plan --gaps
121
+
122
+ Both modes (full + quick):
123
+ - [ ] context.md written with all decisions classified as Locked/Free/Deferred
124
+ - [ ] Gray areas identified through phase-specific analysis
125
+ - [ ] Decision Recording Protocol applied to all decisions
126
+ - [ ] Scope creep redirected to Deferred section
127
+ - [ ] Deferred items auto-created as issues (if any)
128
+ - [ ] Artifact registered in state.json with correct scope/milestone/phase
129
+ - [ ] Next step routed (ui-design/plan for Go, brainstorm for No-Go)
130
+ </success_criteria>
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: maestro-brainstorm
3
+ description: Brainstorm with auto pipeline or single-role analysis
4
+ argument-hint: "[topic|role-name] [--yes] [--count N] [--session ID] [--update] [--skip-questions] [--include-questions] [--style-skill PKG]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Agent
12
+ - AskUserQuestion
13
+ ---
14
+ <purpose>
15
+ Unified brainstorming combining interactive framework generation, multi-role parallel analysis, and cross-role synthesis. Two modes: Auto (full pipeline with guidance-specification → parallel role analysis → synthesis) and Single Role (individual role analysis for an existing session). Outputs structured artifacts in .brainstorming/ directory ready for downstream planning.
16
+ </purpose>
17
+
18
+ <required_reading>
19
+ @~/.maestro/workflows/brainstorm.md
20
+ </required_reading>
21
+
22
+ <deferred_reading>
23
+ - [scratch-index.json](~/.maestro/templates/scratch-index.json) — read when operating in scratch mode
24
+ - [index.json](~/.maestro/templates/index.json) — read when operating in phase mode
25
+ - [brainstorm-visualize.md](~/.maestro/workflows/brainstorm-visualize.md) — read when html-prototypes/ produced and user wants to browse them
26
+ </deferred_reading>
27
+
28
+ <context>
29
+ $ARGUMENTS -- topic text for auto mode, or role name for single role mode.
30
+
31
+ **Auto mode**: topic text (e.g., "Build real-time collaboration platform") triggers full pipeline.
32
+ **Single role mode**: valid role name (e.g., "system-architect") runs one role analysis.
33
+ **All output** goes to `.workflow/scratch/{YYYYMMDD}-brainstorm-{slug}/`.
34
+ **Artifact registration**: On completion, registers artifact (type=brainstorm) in state.json.
35
+ **Output boundary**: ALL file writes MUST target `{output_dir}/` or `.workflow/state.json` only. NEVER modify source code or files outside these paths.
36
+
37
+ **Valid roles**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
38
+
39
+ **Flags**:
40
+ - `--yes` / `-y`: Auto mode, skip interactive questions, use defaults
41
+ - `--count N`: Number of roles to select (default 3, max 9)
42
+ - `--session ID`: Use existing session
43
+ - `--update`: Update existing analysis (single role)
44
+ - `--skip-questions`: Skip context gathering questions
45
+ - `--include-questions`: Force context gathering even if analysis exists
46
+ - `--style-skill PKG`: Style package for ui-designer role
47
+ </context>
48
+
49
+ <execution>
50
+ Follow '~/.maestro/workflows/brainstorm.md' completely.
51
+
52
+ **Next-step routing on completion:**
53
+
54
+ Auto mode:
55
+ - Project not initialized → Skill({ skill: "maestro-init" })
56
+ - Project initialized, need spec package → Skill({ skill: "maestro-roadmap", args: "--mode full --from-brainstorm {session_id}" })
57
+ - Project initialized, quick roadmap → Skill({ skill: "maestro-roadmap", args: "--from-brainstorm {session_id}" })
58
+ - Need deeper analysis first → Skill({ skill: "maestro-analyze", args: "{topic}" })
59
+ - `html-prototypes/` produced with 2+ files and user wants to browse → load `~/.maestro/workflows/brainstorm-visualize.md` and launch visualizer server (optional, user-triggered)
60
+
61
+ Single role mode:
62
+ - More roles needed → Skill({ skill: "maestro-brainstorm", args: "{next_role} --session {session_id}" })
63
+ - All roles done, run synthesis → Skill({ skill: "maestro-brainstorm", args: "{topic} --session {session_id}" })
64
+ </execution>
65
+
66
+ <error_codes>
67
+ | Code | Severity | Condition | Recovery |
68
+ |------|----------|-----------|----------|
69
+ | E001 | error | Topic or role argument required | Prompt user for topic text or role name |
70
+ | E002 | error | No active session for single role mode | Guide user to run auto mode first |
71
+ | E003 | error | Invalid role name | Show valid roles list |
72
+ | W001 | warning | Fewer than 10 ideas in divergent phase | Proceed with available ideas |
73
+ | W002 | warning | Project context (.workflow/) not found | Continue without project context |
74
+ | W003 | warning | Role template not found | Use generic analysis structure |
75
+ | W004 | warning | Validation score < 60 | Log warning, suggest manual review |
76
+ | W005 | warning | External research agent failed | Continue without designResearchContext |
77
+ </error_codes>
78
+
79
+ <success_criteria>
80
+ **Auto mode**:
81
+ - [ ] guidance-specification.md with RFC 2119 keywords, terminology, non-goals, feature decomposition
82
+ - [ ] design-research.md persisted when Step 1.7 external research ran (fail-soft: absence not a failure)
83
+ - [ ] Spec Review Gate passed (Step 3.5) or `--yes` bypassed
84
+ - [ ] Role analysis files for each selected NON-UI role in `.brainstorming/{role}/`
85
+ - [ ] If `ui-designer` in selected_roles: `ui-designer/analysis.md` exists AND exactly one of `html-prototypes/` / `ascii-mockups/` / `api-sketches/` exists with `README.md` + ≥1 prototype file
86
+ - [ ] ui-designer/analysis.md references each prototype via `@-notation`
87
+ - [ ] HTML prototypes are self-contained (no external `<link>`/`<script src>` URLs — warn only)
88
+ - [ ] Feature specs in `.brainstorming/feature-specs/` (or synthesis-specification.md)
89
+ - [ ] UI-bearing feature specs reference the corresponding prototype in Section 3 (Interface Contract)
90
+ - [ ] feature-index.json and synthesis-changelog.md
91
+ - [ ] Final Output Gate passed (Step 5.5) or `--yes` bypassed
92
+ - [ ] All user decisions captured with Decision Recording Protocol
93
+ - [ ] Session metadata updated with completion status
94
+ - [ ] Confidence scored per role completion and after cross-role analysis
95
+ - [ ] Readiness gate checked before spec generation
96
+ - [ ] Pressure pass completed on at least 1 feature spec
97
+ - [ ] Confidence summary appended to synthesis-changelog.md
98
+
99
+ **Single role mode**:
100
+ - [ ] analysis.md written to `{output_dir}/{role}/`
101
+ - [ ] Feature-point organization used when feature list available
102
+ - [ ] Framework reference included when guidance-specification.md exists
103
+ - [ ] Session metadata updated
104
+ </success_criteria>