maestro-flow 0.4.11 → 0.4.12

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 (166) hide show
  1. package/.agents/agents/cli-explore-agent.md +1 -3
  2. package/.agents/agents/cross-role-reviewer.md +173 -0
  3. package/.agents/agents/role-design-author.md +218 -0
  4. package/.agents/agents/ui-design-agent.md +1 -18
  5. package/.agents/agents/workflow-analyzer.md +1 -1
  6. package/.agents/agents/workflow-external-researcher.md +1 -1
  7. package/.agents/skills/maestro/SKILL.md +61 -27
  8. package/.agents/skills/maestro-analyze/SKILL.md +30 -4
  9. package/.agents/skills/maestro-blueprint/SKILL.md +132 -0
  10. package/.agents/skills/maestro-brainstorm/SKILL.md +119 -103
  11. package/.agents/skills/maestro-help/SKILL.md +48 -14
  12. package/.agents/skills/maestro-help/index/catalog.json +29 -11
  13. package/.agents/skills/maestro-help/phases/01-parse-intent.md +1 -1
  14. package/.agents/skills/maestro-help/phases/02-search-present.md +6 -4
  15. package/.agents/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  16. package/.agents/skills/maestro-init/SKILL.md +3 -3
  17. package/.agents/skills/maestro-milestone-audit/SKILL.md +5 -3
  18. package/.agents/skills/maestro-milestone-complete/SKILL.md +7 -5
  19. package/.agents/skills/maestro-plan/SKILL.md +14 -4
  20. package/.agents/skills/maestro-ralph/SKILL.md +297 -226
  21. package/.agents/skills/maestro-ralph-execute/SKILL.md +81 -67
  22. package/.agents/skills/maestro-roadmap/SKILL.md +42 -81
  23. package/.agents/skills/quality-auto-test/SKILL.md +1 -1
  24. package/.agents/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  25. package/.agents/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  26. package/.agents/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  27. package/.agents/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  28. package/.agents/skills/team-lifecycle-v4/templates/epics.md +2 -2
  29. package/.agents/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  30. package/.agents/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  31. package/.agy/agents/cli-explore-agent.md +1 -3
  32. package/.agy/agents/cross-role-reviewer.md +170 -0
  33. package/.agy/agents/role-design-author.md +215 -0
  34. package/.agy/agents/ui-design-agent.md +1 -18
  35. package/.agy/agents/workflow-analyzer.md +1 -1
  36. package/.agy/agents/workflow-external-researcher.md +1 -1
  37. package/.agy/skills/maestro/SKILL.md +61 -27
  38. package/.agy/skills/maestro-analyze/SKILL.md +30 -4
  39. package/.agy/skills/maestro-blueprint/SKILL.md +132 -0
  40. package/.agy/skills/maestro-brainstorm/SKILL.md +119 -103
  41. package/.agy/skills/maestro-help/SKILL.md +48 -14
  42. package/.agy/skills/maestro-help/index/catalog.json +29 -11
  43. package/.agy/skills/maestro-help/phases/01-parse-intent.md +1 -1
  44. package/.agy/skills/maestro-help/phases/02-search-present.md +6 -4
  45. package/.agy/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  46. package/.agy/skills/maestro-init/SKILL.md +3 -3
  47. package/.agy/skills/maestro-milestone-audit/SKILL.md +5 -3
  48. package/.agy/skills/maestro-milestone-complete/SKILL.md +7 -5
  49. package/.agy/skills/maestro-plan/SKILL.md +14 -4
  50. package/.agy/skills/maestro-ralph/SKILL.md +297 -226
  51. package/.agy/skills/maestro-ralph-execute/SKILL.md +81 -67
  52. package/.agy/skills/maestro-roadmap/SKILL.md +42 -81
  53. package/.agy/skills/quality-auto-test/SKILL.md +1 -1
  54. package/.agy/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  55. package/.agy/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  56. package/.agy/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  57. package/.agy/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  58. package/.agy/skills/team-lifecycle-v4/templates/epics.md +2 -2
  59. package/.agy/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  60. package/.agy/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  61. package/.claude/agents/cli-explore-agent.md +1 -3
  62. package/.claude/agents/cross-role-reviewer.md +171 -0
  63. package/.claude/agents/role-design-author.md +216 -0
  64. package/.claude/agents/ui-design-agent.md +1 -18
  65. package/.claude/agents/workflow-analyzer.md +1 -1
  66. package/.claude/agents/workflow-external-researcher.md +1 -1
  67. package/.claude/commands/maestro-analyze.md +30 -4
  68. package/.claude/commands/maestro-blueprint.md +130 -0
  69. package/.claude/commands/maestro-brainstorm.md +132 -116
  70. package/.claude/commands/maestro-init.md +3 -3
  71. package/.claude/commands/maestro-milestone-audit.md +5 -3
  72. package/.claude/commands/maestro-milestone-complete.md +7 -5
  73. package/.claude/commands/maestro-plan.md +14 -4
  74. package/.claude/commands/maestro-ralph-execute.md +81 -67
  75. package/.claude/commands/maestro-ralph.md +297 -226
  76. package/.claude/commands/maestro-roadmap.md +42 -81
  77. package/.claude/commands/maestro.md +61 -27
  78. package/.claude/commands/quality-auto-test.md +1 -1
  79. package/.claude/skills/maestro-help/SKILL.md +48 -14
  80. package/.claude/skills/maestro-help/index/catalog.json +29 -11
  81. package/.claude/skills/maestro-help/phases/01-parse-intent.md +1 -1
  82. package/.claude/skills/maestro-help/phases/02-search-present.md +6 -4
  83. package/.claude/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  84. package/.claude/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  85. package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  86. package/.claude/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  87. package/.claude/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  88. package/.claude/skills/team-lifecycle-v4/templates/epics.md +2 -2
  89. package/.claude/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  90. package/.claude/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  91. package/.codex/skills/maestro/SKILL.md +75 -38
  92. package/.codex/skills/maestro-amend/SKILL.md +157 -0
  93. package/.codex/skills/maestro-analyze/SKILL.md +71 -23
  94. package/.codex/skills/maestro-blueprint/SKILL.md +122 -0
  95. package/.codex/skills/maestro-brainstorm/SKILL.md +135 -45
  96. package/.codex/skills/maestro-composer/SKILL.md +1 -1
  97. package/.codex/skills/maestro-execute/SKILL.md +13 -4
  98. package/.codex/skills/maestro-help/SKILL.md +28 -18
  99. package/.codex/skills/maestro-help/catalog.json +29 -11
  100. package/.codex/skills/maestro-init/SKILL.md +7 -7
  101. package/.codex/skills/maestro-plan/SKILL.md +27 -9
  102. package/.codex/skills/maestro-ralph/SKILL.md +740 -601
  103. package/.codex/skills/maestro-roadmap/SKILL.md +55 -72
  104. package/.codex/skills/maestro-update/SKILL.md +169 -0
  105. package/.codex/skills/maestro-verify/SKILL.md +11 -2
  106. package/.codex/skills/manage-codebase-rebuild/SKILL.md +2 -2
  107. package/.codex/skills/manage-harvest/SKILL.md +10 -2
  108. package/.codex/skills/quality-retrospective/SKILL.md +9 -2
  109. package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +2 -2
  110. package/.codex/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  111. package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  112. package/.codex/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  113. package/.codex/skills/team-lifecycle-v4/templates/epics.md +2 -2
  114. package/.codex/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  115. package/.codex/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  116. package/README.md +8 -8
  117. package/README.zh-CN.md +8 -8
  118. package/dashboard/dist-server/dashboard/src/server/routes/settings.js +3 -3
  119. package/dashboard/dist-server/dashboard/src/server/routes/settings.js.map +1 -1
  120. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  121. package/dist/src/agents/cli-agent-runner.js +13 -7
  122. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  123. package/dist/src/commands/spec.d.ts.map +1 -1
  124. package/dist/src/commands/spec.js +8 -1
  125. package/dist/src/commands/spec.js.map +1 -1
  126. package/dist/src/tools/spec-init.d.ts +16 -2
  127. package/dist/src/tools/spec-init.d.ts.map +1 -1
  128. package/dist/src/tools/spec-init.js +58 -187
  129. package/dist/src/tools/spec-init.js.map +1 -1
  130. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  131. package/dist/src/tools/spec-loader.js +16 -16
  132. package/dist/src/tools/spec-loader.js.map +1 -1
  133. package/dist/src/tools/spec-seeds.d.ts +33 -0
  134. package/dist/src/tools/spec-seeds.d.ts.map +1 -0
  135. package/dist/src/tools/spec-seeds.js +200 -0
  136. package/dist/src/tools/spec-seeds.js.map +1 -0
  137. package/dist/src/tools/spec-writer.d.ts.map +1 -1
  138. package/dist/src/tools/spec-writer.js +7 -9
  139. package/dist/src/tools/spec-writer.js.map +1 -1
  140. package/dist/src/utils/update-notices.js +12 -0
  141. package/dist/src/utils/update-notices.js.map +1 -1
  142. package/package.json +1 -1
  143. package/templates/business-test-report.json +1 -1
  144. package/templates/index.json +1 -1
  145. package/templates/roadmap.md +15 -9
  146. package/templates/state.json +18 -17
  147. package/workflows/analyze.md +79 -11
  148. package/workflows/auto-test.md +6 -6
  149. package/workflows/blueprint.md +431 -0
  150. package/workflows/brainstorm.md +603 -496
  151. package/workflows/business-test.md +7 -7
  152. package/workflows/codebase-rebuild.md +4 -4
  153. package/workflows/harvest.md +184 -10
  154. package/workflows/init.md +9 -8
  155. package/workflows/maestro.md +1 -1
  156. package/workflows/milestone-audit.md +12 -4
  157. package/workflows/milestone-complete.md +11 -6
  158. package/workflows/plan.md +88 -22
  159. package/workflows/roadmap-common.md +1 -1
  160. package/workflows/roadmap.md +13 -3
  161. package/workflows/spec-generate.md +24 -13
  162. package/workflows/ui-design.md +2 -2
  163. package/workflows/ui-style.md +1 -1
  164. package/.agents/agents/conceptual-planning-agent.md +0 -247
  165. package/.agy/agents/conceptual-planning-agent.md +0 -244
  166. package/.claude/agents/conceptual-planning-agent.md +0 -245
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: maestro-analyze
3
3
  description: Use when a topic needs structured multi-dimensional investigation before planning or decision-making
4
- argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"<phase|topic> [-q|--quick] [--gaps [ISS-ID]]\""
4
+ argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] [--from <source>] \"<phase|topic> [-q|--quick] [--gaps [ISS-ID]]\""
5
5
  allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
@@ -10,6 +10,12 @@ Wave-based multi-dimensional analysis using `spawn_agents_on_csv`. Diamond topol
10
10
  Wave 1 (CLI exploration, parallel) -> Wave 2 (6-dimension scoring, parallel) -> Wave 3 (decision synthesis).
11
11
 
12
12
  **Tri-depth**: Full mode (all 3 waves), Quick mode (`-q`, Wave 3 only), Gaps mode (`--gaps`, issue root cause pipeline).
13
+
14
+ **Dual-layer scope (D-003)**:
15
+ - **Macro layer** (text argument, e.g. `analyze "auth refactor"`): broad impact exploration. Produces `scope_verdict ∈ {small, medium, large}` to drive downstream routing (roadmap vs plan).
16
+ - **Phase layer** (numeric argument, e.g. `analyze 1`): phase-scoped deep analysis under `current_milestone`. Milestone resolved via D-007 `phase_slugs` reverse lookup, NEVER direct `current_milestone` read.
17
+
18
+ Produces context-package.json (standardized cross-command context contract) in all modes.
13
19
  </purpose>
14
20
 
15
21
  <context>
@@ -21,11 +27,26 @@ $ARGUMENTS -- phase number, topic text, and optional flags.
21
27
  - `--continue`: Resume existing session
22
28
  - `-q, --quick`: Skip exploration + scoring, Wave 3 only
23
29
  - `--gaps [ISS-ID]`: Issue root cause analysis. If ISS-ID: single issue. If omitted: all open/registered from issues.jsonl.
30
+ - `--from <source>`: Load upstream context package (brainstorm:ID, analyze:ID, @file, or path). Resolves to context-package.json for upstream context inheritance.
24
31
 
25
32
  **Session**: `.workflow/.csv-wave/{YYYYMMDD}-analyze-{slug}/`
26
- **Output**: tasks.csv, results.csv, discoveries.ndjson, context.md (all modes), analysis.md + conclusions.json (full mode only)
33
+ **Output**: tasks.csv, results.csv, discoveries.ndjson, context.md, context-package.json (all modes), analysis.md + conclusions.json (full mode AND quick mode; quick writes minimal conclusions.json with `scope_verdict` + `implementation_scope[]` only)
27
34
  </context>
28
35
 
36
+ <interview_protocol>
37
+ Interview the user relentlessly until shared understanding is reached. Active only in interactive mode; skip when `-y/--yes`, `--continue`, or input is already specific (explicit phase number or unambiguous topic).
38
+
39
+ - One decision per turn via AskUserQuestion with 2–4 options + a (Recommended) default; every question must include a `Proceed now` option so the user can end the interview at any time.
40
+ - Never ask what code can verify — resolve via `state.json`, `roadmap.md`, `issues.jsonl`, `maestro spec load`, `maestro wiki search`, Grep, or Read.
41
+ - Walk the decision dependency tree strictly: scope → depth → dimensions → Go/No-Go threshold. Do not open the next branch until the current one is settled.
42
+ - Scope guard: only ask about decisions owned by `analyze`. Do not prejudge plan/execute concerns.
43
+
44
+ Decision points: scope (phase / topic / milestone-wide / adhoc / --gaps) → depth (quick / standard / deep) → dimensions (which of the 6 to keep) → Go/No-Go threshold.
45
+
46
+ Exit: on `Proceed now` or when all decision points are settled, write the table below into `context.md` under an `Interview Decisions` section (and mirror into `analysis.md` in full mode):
47
+ `| # | Decision | Choice | Source (user / code / default) |`
48
+ </interview_protocol>
49
+
29
50
  <csv_schema>
30
51
 
31
52
  ### tasks.csv
@@ -62,7 +83,9 @@ Available exploration dimensions: architecture, implementation, performance, sec
62
83
  5. **Quick mode shortcut**: -q generates only wave 3 task
63
84
  6. **Gaps mode pipeline**: --gaps follows: Load issues from issues.jsonl -> Classify & group by location/component -> CSV gen (W1: 1 explore row per issue, W2: 1 synthesis per group) -> Execute waves -> Write issue.analysis record per issue -> Append history `{ action: "analyzed", at: <ISO>, by: "maestro-analyze --gaps" }` -> Output context.md for plan --gaps
64
85
  7. **Graceful degradation**: Missing exploration reduces scoring quality; missing scoring reduces synthesis quality
65
- 8. **Tri-output**: context.md always. analysis.md + conclusions.json full-mode only. Gaps mode writes to issues.jsonl + context.md
86
+ 8. **Tri-output**: context.md + context-package.json always. analysis.md (full only) + conclusions.json (full + quick — quick writes minimal with `scope_verdict` + `implementation_scope[]`). Gaps mode writes to issues.jsonl + context.md + context-package.json
87
+ 9. **D-007 milestone resolution**: numeric scope MUST reverse-lookup `state.json.milestones[].phase_slugs`. NEVER read `current_milestone` directly for phase-scoped artifact registration.
88
+ 10. **scope_verdict mandatory** (D-003): macro/adhoc/standalone scopes MUST produce `scope_verdict ∈ {small, medium, large}` in conclusions.json. Drives downstream chain (roadmap vs plan).
66
89
  </invariants>
67
90
 
68
91
  <state_machine>
@@ -80,21 +103,30 @@ S_AGGREGATE -- 注册 artifact、输出摘要 PERSIST: state
80
103
  <transitions>
81
104
 
82
105
  S_PARSE:
83
- -> S_CONTEXT WHEN: scope resolved (milestone/phase/adhoc/standalone/gaps)
106
+ -> S_CONTEXT WHEN: scope resolved (milestone/phase/macro/adhoc/standalone/gaps)
84
107
  -> ERROR(E001) WHEN: no args and no roadmap
85
108
 
86
- **Scope routing**:
87
- | Condition | Scope | Slug |
88
- |-----------|-------|------|
89
- | --gaps flag | gaps | ISS-ID slugified or "issue-gaps" |
90
- | Empty subject + milestone + roadmap | milestone | milestone name slugified |
91
- | Empty subject, no roadmap | ERROR E001 | -- |
92
- | Numeric + milestone + roadmap | phase | phase slug from roadmap |
93
- | Text subject + milestone | adhoc | subject slugified (max 40) |
94
- | Text subject, no milestone | standalone | subject slugified (max 40) |
109
+ **Scope routing** (text → macro layer, numeric → phase layer per D-003):
110
+ | Condition | Scope | Layer | Slug |
111
+ |-----------|-------|-------|------|
112
+ | --gaps flag | gaps | — | ISS-ID slugified or "issue-gaps" |
113
+ | Empty subject + milestone + roadmap | milestone | phase | milestone name slugified |
114
+ | Empty subject, no roadmap | ERROR E001 | — | -- |
115
+ | Numeric + milestone + roadmap | phase | phase | phase slug from roadmap |
116
+ | Text subject + milestone | macro | macro | subject slugified (max 40) |
117
+ | Text subject, no milestone | macro | macro | subject slugified (max 40) |
118
+
119
+ **D-007 milestone reverse lookup** (numeric scope only):
120
+ ```
121
+ resolve_milestone(phase_number):
122
+ for ms in state.json.milestones[]:
123
+ if str(phase_number) in ms.phase_slugs: return ms.id
124
+ return state.json.current_milestone # fallback (standalone)
125
+ ```
126
+ Write resolved milestone into `session.milestone` and artifact registration; NEVER use `current_milestone` directly for phase-scoped runs.
95
127
 
96
128
  S_CONTEXT:
97
- -> S_CSV_GEN DO: load project.md, roadmap.md, state.json, prior artifacts, specs
129
+ -> S_CSV_GEN DO: load project.md, roadmap.md, state.json, prior artifacts, specs, upstream context-package (if --from)
98
130
 
99
131
  S_CSV_GEN:
100
132
  -> S_WAVE_1 WHEN: full mode DO: generate N explore + 6 score + 1 synthesis rows
@@ -144,9 +176,18 @@ Merge results -> master tasks.csv.
144
176
  Filter wave==3 -> build prev_context from wave 2 scores (or project context for quick mode) -> spawn.
145
177
 
146
178
  **Synthesis agent**:
147
- - Full mode: analysis.md (executive summary, per-dimension scores, risk matrix, Go/No-Go), context.md (Locked/Free/Deferred decisions), conclusions.json
148
- - Quick mode: context.md only from available project context
149
- - Gaps mode: per-issue analysis records -> issues.jsonl + context.md for plan --gaps
179
+ - Full mode: analysis.md (executive summary, per-dimension scores, risk matrix, Go/No-Go), context.md (Locked/Free/Deferred decisions), context-package.json, conclusions.json (with `scope_verdict` + `implementation_scope[]`)
180
+ - Quick mode: context.md + context-package.json + **minimal conclusions.json** (`scope_verdict` + `implementation_scope[]` only seeds plan task generation per redesign §8.3)
181
+ - Gaps mode: per-issue analysis records -> issues.jsonl + context.md + context-package.json for plan --gaps
182
+
183
+ **`scope_verdict` evaluation** (D-003 §5.3, macro/standalone/adhoc scopes only):
184
+ | Verdict | Criteria |
185
+ |---------|----------|
186
+ | `large` | 3+ independent subsystems, OR hard dependencies requiring serialized verification points |
187
+ | `medium` | 1-2 subsystems, parallel-safe |
188
+ | `small` | Single file or few files, directly executable |
189
+
190
+ Write to `conclusions.json.scope_verdict` (all modes that produce conclusions); mirror into `context.md` and `context-package.json.source.scope_verdict`. Phase-scoped runs may omit (default null).
150
191
 
151
192
  Gray area detection: domain-aware (things users SEE/CALL/RUN/READ), phase-specific (skip prior decided areas).
152
193
 
@@ -156,17 +197,19 @@ Gray area detection: domain-aware (things users SEE/CALL/RUN/READ), phase-specif
156
197
  2. **Confidence scoring** (full mode): factors -- findings_depth(.30), evidence_strength(.25), coverage_breadth(.20), user_validation(.15), consistency(.10). Thresholds: <60% deeper, 60-80% optional, 80-95% converging, >95% converge.
157
198
  3. Auto-create issues from Deferred items -> issues.jsonl
158
199
  4. Spec enrichment: Locked decisions -> `maestro spec add arch`; code patterns -> `maestro spec add coding`
159
- 5. Register artifact in state.json (type: analyze)
200
+ 5. Register artifact in state.json (type: analyze, includes context_package field pointing to context-package.json)
160
201
  6. Copy outputs to scratchDir, display summary
161
- 7. **Next-step routing**:
202
+ 7. **Next-step routing** (D-003 §5.3 — macro scope uses `scope_verdict` for downstream chain selection):
162
203
 
163
204
  | Scope | Condition | Next |
164
205
  |-------|-----------|------|
165
206
  | Phase/Milestone | Go + UI work needed | `$maestro-impeccable build {target}` |
166
207
  | Phase/Milestone | Go + ready to plan | `$maestro-plan` or `$maestro-plan {phase}` |
167
208
  | Phase/Milestone | No-Go | `$maestro-brainstorm {topic}` |
168
- | Adhoc/Standalone | Ready to plan | `$maestro-plan --dir {scratch_dir}` |
169
- | Adhoc/Standalone | Need more exploration | `$maestro-analyze {topic} --continue` |
209
+ | Macro/Adhoc/Standalone | `scope_verdict == "large"` | `$maestro-roadmap --from analyze:{ANL_ID}` |
210
+ | Macro/Adhoc/Standalone | `scope_verdict == "medium"` | `$maestro-plan --from analyze:{ANL_ID}` |
211
+ | Macro/Adhoc/Standalone | `scope_verdict == "small"` | `$maestro-plan --from analyze:{ANL_ID}` |
212
+ | Macro/Adhoc/Standalone | Need more exploration | `$maestro-analyze {topic} --continue` |
170
213
  | Gaps | Issues analyzed | `$maestro-plan --gaps` |
171
214
  | Gaps | Need more context | `$maestro-analyze --gaps {ISS-ID}` |
172
215
 
@@ -201,8 +244,12 @@ Protocol: read before analysis, append-only, dedup by type+key.
201
244
  </error_codes>
202
245
 
203
246
  <success_criteria>
247
+ - [ ] Interactive mode: interview decision table written to `context.md` "Interview Decisions" (mirrored into `analysis.md` in full mode)
204
248
  - [ ] All waves executed in order (or skipped per mode)
205
- - [ ] context.md produced (all modes); analysis.md + conclusions.json (full mode)
249
+ - [ ] context.md produced (all modes); analysis.md (full mode); conclusions.json (full mode AND quick mode with at minimum `scope_verdict` + `implementation_scope[]`)
250
+ - [ ] context-package.json produced (all modes) with constraints, requirements, insights, open_questions
251
+ - [ ] `scope_verdict ∈ {small, medium, large}` written into conclusions.json + context.md (macro/adhoc/standalone scopes)
252
+ - [ ] D-007 milestone reverse lookup applied for numeric scope; `session.milestone` populated via `phase_slugs`, never via direct `current_milestone` read
206
253
  - [ ] context.md contains all decisions classified as Locked/Free/Deferred
207
254
  - [ ] Decision Recording Protocol applied to all decisions
208
255
  - [ ] Confidence scored per dimension with factor-based model (full mode)
@@ -210,7 +257,8 @@ Protocol: read before analysis, append-only, dedup by type+key.
210
257
  - [ ] Pressure pass completed ≥ 1 time on highest-risk dimension before synthesis
211
258
  - [ ] Deferred items auto-created as issues
212
259
  - [ ] Scope creep redirected to Deferred section
213
- - [ ] Artifact registered in state.json
260
+ - [ ] Artifact registered in state.json (includes context_package field)
261
+ - [ ] Upstream context loaded via `--from` when specified
214
262
  - [ ] discoveries.ndjson append-only throughout
215
263
  - [ ] Next step routed (plan for Go, brainstorm for No-Go, plan --gaps for Gaps)
216
264
  </success_criteria>
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: maestro-blueprint
3
+ description: Generate formal specification package (Product Brief, PRD, Architecture, Epics) through 7-phase document chain (P0 Spec Study → P1 Discovery → P1.5 Req Expansion → P2 Product Brief → P3 PRD → P4 Architecture → P5 Epics → P6 Readiness Check)
4
+ argument-hint: "<idea or @file> [-y] [-c] [--from <source>]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, spawn_agents_on_csv, request_user_input
6
+ ---
7
+ <purpose>
8
+ Formal specification document chain producing a complete specification package through 7 sequential phases (P0–P6, plus P1.5 requirement expansion) with multi-CLI analysis and interactive refinement. Pure documentation — no code generation, no roadmap generation.
9
+
10
+ Parallel to `brainstorm` as an upstream origin command:
11
+ - **brainstorm** = divergent exploration (lightweight, multi-role creative)
12
+ - **blueprint** = convergent documentation (heavyweight, 7-phase formal spec chain)
13
+
14
+ Output: `.workflow/blueprint/BLP-{slug}-{date}/` containing Product Brief, PRD, Architecture, and Epics.
15
+ </purpose>
16
+
17
+ <required_reading>
18
+ @~/.maestro/workflows/blueprint.md
19
+ </required_reading>
20
+
21
+ <deferred_reading>
22
+ - [blueprint-config.json](~/.maestro/templates/blueprint-config.json) — read when initializing blueprint configuration
23
+ </deferred_reading>
24
+
25
+ <context>
26
+ $ARGUMENTS -- idea text, @file reference, or upstream context source.
27
+
28
+ **Flags:**
29
+ - `-y` / `--yes`: Auto mode — skip interactive questions, use recommended defaults
30
+ - `-c` / `--continue`: Resume from last checkpoint (reads blueprint-config.json)
31
+ - `--from <source>`: Load upstream context package (brainstorm:ID, @file, or path). Consumes context-package.json
32
+ - `--from-brainstorm SESSION-ID`: (backward compat alias for `--from brainstorm:ID`)
33
+
34
+ **Input types:**
35
+ - Direct text: `"Build a real-time collaboration platform with WebSocket"`
36
+ - File reference: `@requirements.md`
37
+ - Context import: `--from brainstorm:BRN-001` or `--from @requirements.md` or `--from path/`
38
+ - Resume: `-c` (resumes from first incomplete phase)
39
+
40
+ **Pipeline position:**
41
+ ```
42
+ maestro-brainstorm (optional upstream)
43
+ ↓ guidance-specification.md / context-package.json
44
+ maestro-blueprint
45
+ ↓ .workflow/blueprint/BLP-{slug}-{date}/
46
+ maestro-analyze → maestro-roadmap → maestro-plan
47
+ ```
48
+
49
+ **Output boundary**: ALL file writes MUST target `.workflow/blueprint/BLP-{slug}-{date}/` or `.workflow/state.json` only. NEVER modify source code or files outside these paths.
50
+
51
+ ### Pre-load specs
52
+ 1. **Architecture specs**: Run `maestro spec load --category arch` to load architecture constraints. Use as context for architecture decisions (Phase 4).
53
+ 2. Optional — proceed without if unavailable.
54
+ </context>
55
+
56
+ <interview_protocol>
57
+ Interview the user relentlessly about every aspect of the spec until shared understanding is reached. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one; if a question can be answered by exploring the codebase, explore the codebase instead. Active only in interactive mode; skip when `-y/--yes`, `-c/--continue`, or input is already specific (clear idea + scope).
58
+
59
+ - Ask one question per turn via request_user_input and wait for the user's feedback before continuing; every question must carry a recommended answer marked `(Recommended)`, 2–4 options total, and a `Proceed now` option.
60
+ - Never ask what code can verify — resolve via `state.json`, existing artifacts, `maestro spec load`, or direct codebase exploration (Glob/Grep/Read) instead of prompting.
61
+ - Walk the decision dependency tree depth-first: scope → spec type → focus areas → requirement priorities. Do not open the next branch until the current one is settled.
62
+ - Scope guard: only decide the shape of the specification. Do not pre-resolve roadmap phases or plan tasks — those belong to downstream commands.
63
+
64
+ Decision points: scope (full product / feature set / single feature) → spec type (service / api / library / platform) → focus areas → whether to run codebase exploration.
65
+
66
+ Exit: on consensus or `Proceed now`, persist decisions in blueprint-config.json and proceed to Phase 1.
67
+ </interview_protocol>
68
+
69
+ <execution>
70
+ Follow `~/.maestro/workflows/blueprint.md` completely.
71
+
72
+ ### Phase chain
73
+
74
+ ```
75
+ P0: Spec Study → P1: Discovery → P1.5: Req Expansion → P2: Product Brief → P3: PRD → P4: Architecture → P5: Epics → P6: Readiness Check
76
+ ```
77
+
78
+ P6 gate: Pass (>=80%) → Handoff | Review (60-79%) → Handoff w/caveats | Fail (<60%) → P6.5 Auto-Fix (max 2 iter) → re-check
79
+
80
+ ### Next-step routing on completion
81
+
82
+ | Condition | Suggestion |
83
+ |-----------|-----------|
84
+ | Need codebase analysis | /maestro-analyze {topic} --from blueprint:BLP-xxx |
85
+ | Ready for roadmap | /maestro-roadmap --from blueprint:BLP-xxx |
86
+ | Small scope, direct plan | /maestro-plan --from blueprint:BLP-xxx |
87
+ | Need project setup | /maestro-init |
88
+ </execution>
89
+
90
+ <error_codes>
91
+ | Code | Severity | Condition | Recovery |
92
+ |------|----------|-----------|----------|
93
+ | E001 | error | Idea text or @file required | Prompt user for input |
94
+ | E002 | error | Context source not found (--from) | Show available sessions/sources |
95
+ | E006 | error | `.workflow/` not initialized | Run maestro-init first |
96
+ | E007 | error | Phase 6 readiness Fail after 2 auto-fix iterations | Present manual fix options |
97
+ | W001 | warning | CLI analysis failed, using fallback | Continue with available data |
98
+ | W002 | warning | Codebase exploration failed | Continue without codebase context |
99
+ | W003 | warning | Glossary has < 5 terms | Note in readiness check |
100
+ | W004 | warning | Review-level readiness score (60-79%) | Proceed with caveats |
101
+ | W005 | warning | External research agent failed | Continue without apiResearchContext |
102
+ </error_codes>
103
+
104
+ <success_criteria>
105
+ - [ ] Interactive mode: interview decisions persisted in blueprint-config.json
106
+ - [ ] `blueprint-config.json` created with session metadata and phase tracking
107
+ - [ ] `product-brief.md` with vision, goals, scope, multi-perspective synthesis
108
+ - [ ] `glossary.json` with 5+ core terms for cross-document consistency
109
+ - [ ] `requirements/` directory with `_index.md` + individual `REQ-*.md` + `NFR-*.md` files
110
+ - [ ] All requirements have RFC 2119 keywords and acceptance criteria
111
+ - [ ] `architecture/` directory with `_index.md` + individual `ADR-*.md` files
112
+ - [ ] Architecture includes state machine, config model, error handling, observability (service type)
113
+ - [ ] `epics/` directory with `_index.md` + individual `EPIC-*.md` files
114
+ - [ ] Cross-Epic dependency map (Mermaid) and MVP subset tagged
115
+ - [ ] `readiness-report.md` with 4-dimension quality scores and traceability matrix
116
+ - [ ] `blueprint-summary.md` with one-page executive summary
117
+ - [ ] All documents have valid YAML frontmatter with session_id
118
+ - [ ] Glossary terms used consistently across all documents
119
+ - [ ] Readiness gate: Pass (>=80%) or Review (>=60%) with documented caveats
120
+ - [ ] Artifact registered in state.json (type=blueprint)
121
+ - [ ] context-package.json generated for downstream consumption
122
+ </success_criteria>
@@ -1,49 +1,74 @@
1
1
  ---
2
2
  name: maestro-brainstorm
3
3
  description: Use when exploring ideas, evaluating approaches, or needing multi-perspective analysis before implementation
4
- argument-hint: "[topic] [-y|--yes] [-c|--concurrency N] [--continue] [--count N] [--skip-questions]"
4
+ argument-hint: "[topic] [-y|--yes] [-c|--concurrency N] [--continue] [--count N] [--skip-questions] [--review-only]"
5
5
  allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
6
  ---
7
7
 
8
8
  <purpose>
9
9
  Wave-based multi-role brainstorming via `spawn_agents_on_csv`. Diamond topology:
10
- Wave 1 (guidance spec) → Wave 2 (parallel role analysis, 3-9 agents) → Wave 3 (synthesis + feature index).
10
+ Wave 1 (guidance spec) → Wave 2 (parallel role analysis, 3-9 agents) → Wave 3 (cross-role review + resolution writeback).
11
+ Wave 2 agents produce multi-file analysis per role under `{role}/` (analysis.md index + per-feature files + findings).
12
+ Wave 3 compares Decision Digests from each role's `analysis.md` §2 and patches the role files. Audit trail appended to `guidance-specification.md` §12.
11
13
  </purpose>
12
14
 
13
15
  <context>
14
16
  $ARGUMENTS — topic text and optional flags.
15
17
 
16
- **Flags**: `-y` (auto), `-c N` (concurrency, default 6), `--continue` (resume), `--count N` (roles, default 3 max 9), `--skip-questions`
18
+ **Flags**: `-y` (auto), `-c N` (concurrency, default 6), `--continue` (resume), `--count N` (roles, default 3 max 9), `--skip-questions`, `--review-only` (skip Wave 1/2; run Wave 3 only against existing */analysis.md)
17
19
 
18
20
  **9 valid roles**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
19
21
 
20
22
  ### Pre-load specs
21
- 1. **Architecture specs**: `maestro spec load --category arch` — load architecture constraints as context for multi-role analysis (roles respect documented decisions).
23
+ 1. **Architecture specs**: `maestro spec load --category arch` — load architecture constraints as context for multi-role design (roles respect documented decisions).
22
24
  2. **Role Knowledge**: `maestro wiki list --category arch` → identify relevant entries → `maestro wiki load <id1> [id2...]`
23
25
  3. Both optional — proceed without if unavailable.
24
26
 
25
27
  **Session**: `.workflow/.csv-wave/{YYYYMMDD}-brainstorm-{slug}/`
26
- **Output**: tasks.csv, results.csv, discoveries.ndjson, context.md, `.brainstorming/` (guidance-specification.md, feature-index.json, synthesis-changelog.md, feature-specs/, {role}/analysis*.md)
28
+
29
+ **Output** (per session):
30
+ - `guidance-specification.md` — machine contract (Wave 1; consumed by downstream roadmap/analyze/blueprint). §11 Decision Tracking, §12 Cross-Role Resolutions.
31
+ - `design-research.md` — optional, external research from Wave 1
32
+ - `{role}/analysis.md` — index + Decision Digest + cross-cutting foundations per selected role (Wave 2)
33
+ - `{role}/analysis-F-{id}-{slug}.md` — per-feature analysis files (Wave 2)
34
+ - `{role}/findings-{slug}.md` — additional discoveries (Wave 2, optional)
35
+ - `context-package.json` — standardized context contract (context-package/1.0 schema) for downstream commands
36
+ - `tasks.csv`, `results.csv`, `discoveries.ndjson`, `context.md` — wave-engine bookkeeping
27
37
  </context>
28
38
 
39
+ <interview_protocol>
40
+ Interview the user relentlessly until shared understanding is reached. Active only in interactive mode; skip when `-y/--yes`, `--skip-questions`, `--continue` (existing session), or input is already specific.
41
+
42
+ - One decision per turn via request_user_input with 2–4 options + a (Recommended) default; every question must include a `Proceed now` option.
43
+ - Never ask what code can verify — resolve via `state.json`, the session directory, `maestro spec load`, or `maestro wiki search`.
44
+ - Branch jumps allowed: the user may switch freely between mode / role / upstream / sub-pipeline branches; sequence is not enforced, but every decision point must end with a definite answer.
45
+ - Scope guard: only ask about decisions owned by `brainstorm`. Do not pre-resolve roadmap/plan choices.
46
+
47
+ Decision points: mode (auto / single-role / review-only) / role selection and `--count` / `--from` upstream source / whether to enable design-research and the DESIGN.md sub-pipeline.
48
+
49
+ Exit: on consensus or `Proceed now`, write the table below into `guidance-specification.md` §11 and session metadata:
50
+ `| # | Decision | Choice | Source (user / code / default) |`
51
+ </interview_protocol>
52
+
29
53
  <csv_schema>
30
54
  ```csv
31
- id,title,description,role,topic,guidance_spec,deps,context_from,wave,status,findings,analysis_file,error
55
+ id,title,description,role,topic,guidance_spec,deps,context_from,wave,status,findings,output_file,error
32
56
  "1","Guidance Spec","...","guidance-generator","<topic>","","","","1","","","",""
33
- "2","System Architect","...","system-architect","<topic>","","1","1","2","","","",""
34
- "3","UI Designer","...","ui-designer","<topic>","","1","1","2","","","",""
35
- "4","Synthesis","...","synthesis","<topic>","","2;3","2;3","3","","","",""
57
+ "2","System Architect","...","system-architect","<topic>","","1","1","2","","","system-architect/analysis.md",""
58
+ "3","UI Designer","...","ui-designer","<topic>","","1","1","2","","","ui-designer/analysis.md",""
59
+ "4","Cross-Role Review","...","cross-role-reviewer","<topic>","","2;3","2;3","3","","","",""
36
60
  ```
37
- Wave 1: 1 guidance row. Wave 2: N role rows (parallel). Wave 3: 1 synthesis row.
61
+ Wave 1: 1 guidance row. Wave 2: N role rows (parallel) — each writes `{role}/analysis.md` + `{role}/analysis-F-*.md` + `{role}/findings-*.md`. Wave 3: 1 reviewer row (reads analysis.md §2 Decision Digests; emits structured findings consumed by orchestrator).
38
62
  </csv_schema>
39
63
 
40
64
  <invariants>
41
- 1. **Wave order sacred**: Guidance (W1) MUST complete before roles (W2)
42
- 2. **CSV source of truth**: Master tasks.csv holds all state
43
- 3. **Discovery board append-only**: Never modify/delete discoveries.ndjson
44
- 4. **Skip on failure**: Guidance fails → abort. All roles fail → skip synthesis.
65
+ 1. **Wave order sacred**: Guidance (W1) MUST complete before role design (W2); review (W3) MUST run only after all W2 rows complete.
66
+ 2. **CSV source of truth**: Master tasks.csv holds all state.
67
+ 3. **Discovery board append-only**: Never modify/delete discoveries.ndjson.
68
+ 4. **Skip on failure**: Guidance fails → abort. All W2 roles fail → skip review.
45
69
  5. **9 valid roles only**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
46
- 6. **DO NOT STOP**: Continuous until all waves complete; only pause at [CHECKPOINT] (skipped with -y)
70
+ 6. **Wave 3 is read-only at the agent boundary**: the reviewer emits structured findings (conflicts / gaps / synergies with `patch_targets[]`). The orchestrator (not the agent) applies the patches via Edit.
71
+ 7. **DO NOT STOP**: Continuous until all waves complete; only pause at [CHECKPOINT] (skipped with -y).
47
72
  </invariants>
48
73
 
49
74
  <state_machine>
@@ -55,16 +80,21 @@ S_CSV_GEN — 生成 tasks.csv PERSIST: tasks.cs
55
80
  S_WAVE_1 — Guidance Spec (single agent) PERSIST: guidance-specification.md
56
81
  S_CHECK_1 — Checkpoint: 用户审阅 guidance(-y 跳过) PERSIST: —
57
82
  S_DESIGN — 视觉风格确定 (impeccable teach + explore) PERSIST: DESIGN.md
58
- S_WAVE_2 — Role Analysis (parallel spawn) PERSIST: role analyses
59
- S_CHECK_2 — Checkpoint: 用户审阅 roles(-y 跳过) PERSIST: —
60
- S_WAVE_3 — Synthesis + Feature Index (single agent) PERSIST: synthesis artifacts
83
+ S_WAVE_2 — Role Analysis (parallel spawn) PERSIST: {role}/ multi-file × N
84
+ S_CHECK_2 — Checkpoint: 用户审阅分析结果(-y 跳过) PERSIST: —
85
+ S_WAVE_3 — Cross-Role Review (single agent, read-only) PERSIST: review_findings (in-memory)
86
+ S_RESOLVE — Apply Resolutions (orchestrator-side) PERSIST: */analysis.md edits + guidance §12
61
87
  S_AGGREGATE — 生成报告、注册 artifact PERSIST: context.md + results.csv
62
88
  </states>
63
89
 
64
90
  <transitions>
65
- S_PARSE → S_ROLES DO: parse args, detect mode (phase/scratch), load specs
91
+ S_PARSE → S_ROLES DO: parse args, detect mode (phase/scratch/review-only), load specs
66
92
  S_ROLES → S_CSV_GEN DO: select roles (-y: auto top N; interactive: request_user_input)
67
- S_CSV_GEN → S_WAVE_1 DO: generate tasks.csv (1 guidance + N roles + 1 synthesis)
93
+ S_CSV_GEN → S_WAVE_1 DO: generate tasks.csv (1 guidance + N roles + 1 reviewer)
94
+
95
+ # --review-only path: skip W1/W2, jump straight to W3
96
+ S_PARSE → S_WAVE_3 WHEN: --review-only AND existing session has guidance-specification.md AND */analysis.md
97
+ S_PARSE → END WHEN: --review-only AND missing prerequisites (E006/E007)
68
98
 
69
99
  S_WAVE_1 → S_CHECK_1 WHEN: completed DO: spawn wave-1, merge results, read guidance-spec
70
100
  S_WAVE_1 → END WHEN: failed DO: abort pipeline
@@ -78,13 +108,16 @@ S_DESIGN → S_WAVE_2 WHEN: DESIGN.md exists OR explore completed DO: A_DE
78
108
  S_DESIGN → S_WAVE_2 WHEN: DESIGN.md already exists (skip explore)
79
109
  S_DESIGN → S_WAVE_2 WHEN: explore failed → W004 → continue without
80
110
 
81
- S_WAVE_2 → S_CHECK_2 DO: spawn wave-2 (parallel), merge results
82
- S_WAVE_2 → S_WAVE_3 WHEN: all failed DO: skip synthesis
111
+ S_WAVE_2 → S_CHECK_2 DO: spawn wave-2 (parallel), merge results — each agent writes {role}/analysis.md + sub-files
112
+ S_WAVE_2 → S_AGGREGATE WHEN: all failed DO: skip review
83
113
 
84
114
  S_CHECK_2 → S_WAVE_3 WHEN: -y OR user "Proceed"
85
115
  S_CHECK_2 → S_WAVE_2 WHEN: user "Add Roles" DO: add new role rows, spawn only new
86
116
 
87
- S_WAVE_3 → S_AGGREGATE DO: spawn wave-3, merge results
117
+ S_WAVE_3 → S_RESOLVE DO: spawn wave-3, capture review_findings (conflicts/gaps/synergies with patch_targets)
118
+ S_WAVE_3 → S_AGGREGATE WHEN: zero findings DO: log "No cross-role issues detected", skip resolve
119
+
120
+ S_RESOLVE → S_AGGREGATE DO: A_APPLY_RESOLUTIONS (orchestrator iterates patch_targets and applies Edits)
88
121
 
89
122
  S_AGGREGATE → END DO: A_AGGREGATE
90
123
  </transitions>
@@ -93,11 +126,48 @@ S_AGGREGATE → END DO: A_AGGREGATE
93
126
 
94
127
  ### Wave agent responsibilities
95
128
 
96
- **Guidance (W1)**: Analyze topic → extract 5-10 terms → define non-goals → decompose features (max 8, F-{3digit}) → RFC 2119 keywords → write guidance-specification.md
129
+ **Guidance (W1, agent role `guidance-generator`)**: Analyze topic → extract 5-10 terms → define non-goals → decompose features (max 8, F-{3digit}) → RFC 2119 keywords → write `guidance-specification.md` with §1-§12 (§11 Decision Tracking, §12 Cross-Role Resolutions initially empty — populated later by S_RESOLVE).
130
+
131
+ **Role Analysis (W2, agent role = the role name itself)**: Read guidance-spec → produce multi-file analysis under `{role}/`:
132
+ - `analysis.md` — INDEX with §1 Role Mandate (≤ 200 words), §2 Decision Digest (4 tables: Decisions, Interfaces, Cross-Cutting Positions, Findings Summary), §3 Cross-Cutting Foundations, §4 File Index, §5 Outstanding TODOs
133
+ - `analysis-F-{id}-{slug}.md` — one per feature (< 2000 words each)
134
+ - `findings-{slug}.md` — additional discoveries (0 or more, < 1000 words)
135
+
136
+ system-architect MUST include in §3: Data Model, State Machine, Error Handling, Observability, Configuration, Boundary Scenarios.
97
137
 
98
- **Role (W2)**: Read guidance-spec → analyze through role lens → feature-point organization (analysis.md index + analysis-cross-cutting.md + per-feature analysis-F-{id}.md) or fallback single analysis.md. system-architect MUST include: Data Model, State Machine, Error Handling, Observability, Config Model.
138
+ The agent MUST write files. The agent MUST NOT return analysis as text.
99
139
 
100
- **Synthesis (W3)**: Cross-role consensus/conflicts/unique conflict tags [RESOLVED]/[SUGGESTED]/[UNRESOLVED] feature-specs or synthesis-specification.md → feature-index.json + synthesis-changelog.md. Four-layer: Direct Reference Structured Extraction Conflict Distillation → Cross-Feature Annotation.
140
+ **Cross-Role Review (W3, agent role `cross-role-reviewer`)**: Read ALL `{role}/analysis.md` files (§2 Decision Digests) + guidance-specification.md → emit structured report (NOT files):
141
+
142
+ ```
143
+ ## Conflicts (need user decision)
144
+ ### C-001: ...
145
+ patch_targets:
146
+ - target_file: {role-A}/analysis-F-{id}-{slug}.md # or {role-A}/analysis.md for cross-cutting
147
+ target_heading: ## {exact heading text}
148
+ edit_type: annotate_and_strikeout
149
+ edit_content: > **Cross-Role Resolution (C-001)**: {1-line resolution}
150
+ - target_file: {role-B}/analysis-F-{id}-{slug}.md
151
+ target_heading: ## {exact heading text}
152
+ edit_type: annotate_and_strikeout
153
+
154
+ ## Gaps
155
+ ### G-001: ...
156
+ patch_targets:
157
+ - target_file: {ref-role}/analysis.md edit_type: annotate_after_heading # §2 Interfaces table
158
+ - target_file: {owner-role}/analysis.md edit_type: append_to_section # §2 Decisions table
159
+
160
+ ## Synergy Opportunities
161
+ ### S-001: ...
162
+ patch_targets:
163
+ - target_file: {role-A}/analysis-F-{id}-{slug}.md edit_type: annotate_after_heading
164
+ - target_file: {role-B}/analysis-F-{id}-{slug}.md edit_type: annotate_after_heading
165
+
166
+ ## Summary
167
+ conflicts_count / gaps_count / synergies_count / review_confidence
168
+ ```
169
+
170
+ `edit_type` vocabulary is closed: `annotate_after_heading` / `annotate_and_strikeout` / `append_to_section`. The orchestrator MUST refuse any patch outside this set.
101
171
 
102
172
  ### A_DESIGN_EXPLORE
103
173
 
@@ -108,14 +178,29 @@ When ui-designer is among selected roles, establish visual direction before Wave
108
178
  3. If both already exist → skip (visual direction already locked)
109
179
 
110
180
  explore generates multi-style HTML prototypes, visual comparison, user selection/mix, and produces DESIGN.md.
111
- ui-designer agents in Wave 2 then focus on UX analysis only (interaction flows, state design), not visual styling.
181
+ ui-designer agents in Wave 2 then focus on UX/visual design referencing DESIGN.md.
182
+
183
+ ### A_APPLY_RESOLUTIONS
184
+
185
+ For each finding in `review_findings`:
186
+
187
+ 1. **Confirm with user** (skip if -y): present finding + suggested resolution; user picks `Accept` / `Pick A` / `Pick B` (conflict only) / `Skip` / `Defer to TODO`.
188
+ 2. **Iterate `patch_targets[]`**: for each target, locate `target_heading` verbatim in `target_file`; apply the edit per `edit_type`.
189
+ 3. **Heading drift fallback**: if `target_heading` not found verbatim, log W006 and skip that target. Never invent or fuzzy-match headings.
190
+ 4. **Append audit row** to `guidance-specification.md` §12 "Cross-Role Resolutions":
191
+ ```
192
+ | C-001 | conflict | system-architect/analysis-F-*.md "<heading>" / subject-matter-expert/analysis-F-*.md "<heading>" | {resolution} | both annotated+superseded |
193
+ ```
194
+
195
+ If zero findings, S_RESOLVE is bypassed and `guidance §12` is unchanged.
112
196
 
113
197
  ### A_AGGREGATE
114
198
 
115
199
  1. Export results.csv
116
- 2. Generate context.md (summary, guidance, per-role findings, synthesis, feature index, next steps)
117
- 3. Confidence scoring: 5 dimensions (role_coverage, cross_role_consistency, feature_completeness, spec_quality, design_feasibility). Quality gate: >3 UNRESOLVED → warn.
118
- 4. Copy artifacts to target .brainstorming/
200
+ 1.5. Generate context-package.json (extract from guidance-specification.md + {role}/analysis.md §2 Digests standardized schema per context-package/1.0)
201
+ 2. Generate context.md (summary, guidance, per-role analyses, review_findings_count, resolutions_applied, patches_skipped, next steps)
202
+ 3. Confidence scoring: 5 dimensions (role_coverage, cross_role_consistency, feature_completeness, spec_quality, design_feasibility). Quality gate: cross_role_consistency < 0.4 → warn.
203
+ 4. Copy artifacts to target session directory (preserve `{role}/` subdirs).
119
204
  5. Next-step routing: DESIGN.md established → `maestro-impeccable build <feature>`; else UI features detected → `maestro-impeccable build <feature>`; else → maestro-analyze / maestro-plan / maestro-roadmap
120
205
 
121
206
  </actions>
@@ -128,7 +213,8 @@ ui-designer agents in Wave 2 then focus on UX analysis only (interaction flows,
128
213
  | non_goal | title | {title, rationale} |
129
214
  | feature_candidate | id | {id, slug, description, roles[], priority} |
130
215
  | role_insight | role+topic | {role, topic, insight, confidence} |
131
- | cross_role_conflict | area | {area, roles[], positions[], resolution} |
216
+ | cross_role_finding | finding_id | {kind: conflict\|gap\|synergy, finding_id: C-/G-/S-XXX, patch_targets[]} |
217
+ | resolution_applied | finding_id | {finding_id, decision, patched_files[], skipped_targets[]} |
132
218
 
133
219
  Protocol: read before analysis, append-only, dedup by type+key.
134
220
  </discovery_board>
@@ -137,23 +223,27 @@ Protocol: read before analysis, append-only, dedup by type+key.
137
223
  | Condition | Recovery |
138
224
  |-----------|----------|
139
225
  | Guidance agent failed | Abort pipeline (W2 depends on guidance) |
140
- | All role agents failed | Skip synthesis, report partial |
141
- | Synthesis failed | Use W2 results directly |
226
+ | All role agents failed | Skip review, report partial |
227
+ | Review agent failed | Use analysis files directly, no resolution writeback |
142
228
  | Role count > 9 | Cap at 9 with warning |
229
+ | E006 --review-only but no */analysis.md | Run auto mode or single roles first |
230
+ | E007 --review-only but missing guidance-specification.md | Run auto mode first |
231
+ | W006 patch heading drift (no verbatim match) | Skip that patch, surface in final report |
143
232
  </error_codes>
144
233
 
145
234
  <success_criteria>
146
- - [ ] 3 waves executed: guidance parallel roles → synthesis
147
- - [ ] guidance-specification.md with RFC 2119 keywords, terminology, non-goals, feature decomposition
148
- - [ ] Role analysis files for each selected NON-UI role
149
- - [ ] If ui-designer selected: DESIGN.md established via impeccable explore; analysis.md with UX analysis
150
- - [ ] Feature specs in `.brainstorming/feature-specs/` or synthesis-specification.md
151
- - [ ] UI-bearing feature specs reference DESIGN.md for visual constraints
152
- - [ ] feature-index.json + synthesis-changelog.md + context.md generated
153
- - [ ] All user decisions captured with Decision Recording Protocol
154
- - [ ] Confidence scored per role and after cross-role analysis
155
- - [ ] Readiness gate checked before spec generation (wave 3)
156
- - [ ] Pressure pass completed on at least 1 feature spec
235
+ - [ ] Interactive mode: interview decision table written to `guidance-specification.md` §11 and session metadata
236
+ - [ ] guidance-specification.md with RFC 2119 keywords, terminology, non-goals, feature decomposition (§10), decision tracking (§11)
237
+ - [ ] If ui-designer selected: DESIGN.md established via impeccable explore
238
+ - [ ] {role}/analysis.md written for each selected role with §1 Role Mandate / §2 Decision Digest (4 tables) / §3 Cross-Cutting Foundations / §4 File Index / §5 Outstanding TODOs
239
+ - [ ] {role}/analysis-F-{id}-{slug}.md written per feature (< 2000 words)
240
+ - [ ] system-architect/analysis.md §3 includes Data Model + State Machine when system-architect selected
241
+ - [ ] Each {role}/analysis.md §2 Decisions table has ≥ 1 row per feature
242
+ - [ ] Cross-role review (W3) executed; reviewer output includes `patch_targets[]` for every finding
243
+ - [ ] If findings: resolutions applied via Edit AND logged in guidance §12 "Cross-Role Resolutions"
244
+ - [ ] If zero findings: final report explicitly notes "No cross-role issues detected"; guidance §12 unchanged
245
+ - [ ] Heading-drift patch failures surfaced (not silently dropped)
246
+ - [ ] context-package.json generated with per-item `ref` traceability
157
247
  - [ ] discoveries.ndjson append-only throughout
158
- - [ ] Conflict quality gate: >3 UNRESOLVED warn
248
+ - [ ] context.md aggregates session results with next-step routing
159
249
  </success_criteria>
@@ -125,7 +125,7 @@ If spec not found, use built-in fallback:
125
125
  | `verify` | skill | `maestro-verify` |
126
126
  | `refactor` | skill | `quality-refactor` |
127
127
  | `debug` | skill | `quality-debug` |
128
- | `spec` | skill | `maestro-roadmap --mode full` |
128
+ | `spec` | skill | `maestro-blueprint` |
129
129
  | `checkpoint` | checkpoint | — |
130
130
 
131
131
  **Step 2.1** — Load `intent.json`, map each step to executor.
@@ -206,12 +206,21 @@ If exit code is 1, present warnings and ask whether to proceed.
206
206
 
207
207
  | Input | Resolution |
208
208
  |-------|------------|
209
- | `--dir <path>` | Use path directly (scratch plan dir) |
209
+ | `--dir <path>` | Use path directly (scratch plan dir); scope=standalone |
210
210
  | No args | Find all pending plans for current milestone from state.json.artifacts[] |
211
- | Number (e.g., `3`) | Find pending plans for phase N from state.json.artifacts[] |
211
+ | Number (e.g., `3`) | Find pending plans for phase N from state.json.artifacts[]; **resolve milestone via D-007 reverse lookup** |
212
212
 
213
213
  For multi-plan: execute sequentially. Each plan is a full CSV session.
214
214
 
215
+ **D-007 milestone reverse lookup** (numeric arg only):
216
+ ```
217
+ resolve_milestone(phase_number):
218
+ for ms in state.json.milestones[]:
219
+ if str(phase_number) in ms.phase_slugs: return ms.id
220
+ return state.json.current_milestone # fallback
221
+ ```
222
+ Use the resolved milestone for EXC artifact registration (`milestone` field) and artifact filtering. NEVER read `current_milestone` directly for phase-scoped runs — phase N may belong to a milestone different from current.
223
+
215
224
  2. **Load plan**: Read `{PLAN_DIR}/plan.json` for wave structure and task assignments
216
225
 
217
226
  3. **Detect completed tasks (breakpoint resume)**: Read `.task/TASK-{NNN}.json` for each task; exclude completed ones from CSV. Log resume count.
@@ -279,7 +288,7 @@ Blocked/failed tasks cascade: mark all downstream dependents as `skipped` with e
279
288
  - All task_refs completed -> `issue.status = "resolved"`; any failed -> `"in_progress"`
280
289
  - Append history entry: `{ action: "executed", at: <ISO>, by: "maestro-execute", summary: "TASK-{NNN} {status}" }`
281
290
 
282
- 4. **Register EXC artifact in state.json**: Find matching plan artifact, create `{ id: "EXC-{next_id}", type: "execute", milestone, phase, scope, path, status: "completed", depends_on: plan_artifact.id, harvested: false, created_at, completed_at }`
291
+ 4. **Register EXC artifact in state.json**: Find matching plan artifact, create `{ id: "EXC-{next_id}", type: "execute", milestone, phase, scope, path, status: "completed", depends_on: plan_artifact.id, harvested: false, created_at, completed_at }`. `milestone` MUST come from D-007 `phase_slugs` reverse lookup (numeric phase) — inherit from matching plan artifact if available, otherwise reverse-lookup directly.
283
292
 
284
293
  5. **Extract incremental specs**: Read `.summaries/`, use `maestro spec add` CLI:
285
294
  - Learnings/pitfalls → `maestro spec add learning "<title>" "<content>" --keywords ... --source execute:{PLAN_DIR}`
@@ -356,7 +365,7 @@ echo '{"ts":"<ISO>","worker":"TASK-001","type":"code_pattern","data":{"name":"Re
356
365
  - [ ] All waves executed in order with cross-wave context propagation
357
366
  - [ ] Completed tasks have .summaries/TASK-{NNN}-summary.md
358
367
  - [ ] .task/TASK-*.json statuses updated to match execution results
359
- - [ ] state.json updated with EXC artifact
368
+ - [ ] state.json updated with EXC artifact (numeric scope: milestone resolved via D-007 `phase_slugs` reverse lookup, NOT direct `current_milestone` read)
360
369
  - [ ] Issue status synced for tasks with issue_id (all completed → resolved, any failed → in_progress)
361
370
  - [ ] Incremental specs extracted from summaries (learnings, design rationale, root causes)
362
371
  - [ ] Post-task knowledge inquiry triggered when applicable (deviation, retry>=2, design rationale)