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
@@ -33,36 +33,46 @@ const taskPatterns = [
33
33
 
34
34
  #### Step 4.2: 推荐工作流
35
35
 
36
- **新项目** (复杂度: 高):
36
+ **新项目 — Path A** (复杂度: 高):
37
37
 
38
38
  ```markdown
39
39
  ## 新项目工作流
40
40
 
41
- ### 路径 1: 最简路径(适合快速启动)
42
- 1. `/maestro-init` — 初始化 .workflow/ 目录
43
- 2. `/maestro-roadmap "项目目标" -y` — 生成路线图
44
- 3. 按里程碑执行: analyze → plan → execute → verify
41
+ ### 路径 A: 完整新项目
42
+ 1. `/maestro-brainstorm "项目描述"` — 发散探索,多角色创意
43
+ 2. `/maestro-blueprint` (可选) 7-phase 正式规格文档化
44
+ 3. `/maestro-init --from brainstorm:ID`
45
+ 4. `/maestro-analyze "topic"` — 宏观分析,探索影响面 → scope_verdict
46
+ 5. `/maestro-roadmap --from analyze:ANL-xxx` — 纯编排,Milestone > Phase 分解
47
+ 6. `/maestro-analyze 1` — 微观分析,Phase 级深入
48
+ 7. `/maestro-plan 1` → `/maestro-execute` → `/maestro-verify`
45
49
 
46
- ### 路径 2: 从头脑风暴开始(适合需要创意探索)
47
- 1. `/maestro-brainstorm "项目描述"` — 多角色头脑风暴
48
- 2. `/maestro-init --from-brainstorm ANL-xxx` — 基于分析初始化
49
- 3. `/maestro-roadmap "创建路线图" -y`
50
+ ### 路径 E: 纯规格文档(不进执行链)
51
+ 1. `/maestro-blueprint "project idea"` — 供人阅读和决策
50
52
 
51
- ### 路径 3: 完整规范链(适合大型项目)
52
- 1. `/maestro-init`
53
- 2. `/maestro-spec-generate` — 7 阶段规范生成
53
+ ### 路径 F: 纯探索(不进执行链)
54
+ 1. `/maestro-brainstorm "idea"` — 供人决策
54
55
  ```
55
56
 
56
- **功能开发** (复杂度: ):
57
+ **旧项目大功能 — Path B** (复杂度: ):
57
58
 
58
59
  ```markdown
59
- ## 功能开发工作流
60
+ ## 旧项目大功能工作流
60
61
 
61
- ### 主干管线(标准流程)
62
- 1. `/maestro-analyze [phase]` — 分析需求和现有代码
63
- 2. `/maestro-plan [phase]` — 生成执行计划
64
- 3. `/maestro-execute [phase]` 执行实现
65
- 4. `/maestro-verify [phase]` — 验证成果
62
+ 1. `/maestro-analyze "feature X"` — 宏观分析 → scope_verdict=large
63
+ 2. `/maestro-roadmap --from analyze:ANL-xxx` — Milestone > Phase 分解
64
+ 3. `/maestro-analyze 1` — 微观分析
65
+ 4. `/maestro-plan 1` `/maestro-execute` → `/maestro-verify`
66
+ ```
67
+
68
+ **中等功能 — Path C** (复杂度: 中,跳过 roadmap):
69
+
70
+ ```markdown
71
+ ## 中等功能工作流
72
+
73
+ 1. `/maestro-analyze "feature X"` — 宏观分析 → scope_verdict=medium
74
+ 2. `/maestro-plan --from analyze:ANL-xxx` — 直达规划,跳过 roadmap
75
+ 3. `/maestro-execute` → `/maestro-verify`
66
76
 
67
77
  ### 快速渠道(简单功能)
68
78
  1. `/maestro-quick "功能描述"` — 一键完成
@@ -71,13 +81,22 @@ const taskPatterns = [
71
81
  1. `/maestro -y "功能描述"` — 自动选择并执行完整流程
72
82
  ```
73
83
 
74
- **Bug 修复** (复杂度: 低-中):
84
+ **小改动 — Path D** (复杂度: ):
75
85
 
76
86
  ```markdown
77
- ## Bug 修复工作流
87
+ ## 小改动工作流
88
+
89
+ 1. `/maestro-plan "fix auth bug"` — 直接规划
90
+ 2. `/maestro-execute` → `/maestro-verify`
78
91
 
79
92
  ### 快速修复(已知问题)
80
93
  1. `/maestro-quick "修复 Bug 描述"`
94
+ ```
95
+
96
+ **Bug 追踪** (Issue 闭环):
97
+
98
+ ```markdown
99
+ ## Bug 追踪工作流
81
100
 
82
101
  ### Issue 闭环(需要追踪)
83
102
  1. `/manage-issue-discover by-prompt "问题描述"` — 发现 Issue
@@ -109,7 +128,10 @@ const taskPatterns = [
109
128
  对需要全景视角的用户,展示 Mermaid 图:
110
129
 
111
130
  ```
112
- 主干管线: analyze plan → execute → verify → quality (review/test) → milestone-audit → milestone-complete
131
+ 上游起源: brainstorm(发散) | blueprint(收敛) → 可选
132
+ 理解层: analyze "topic"(宏观) → scope_verdict 路由
133
+ 编排层: roadmap(可选,仅 scope_verdict=large 时建议)
134
+ 执行层: plan → execute → verify → quality → milestone-audit → milestone-complete
113
135
  快速渠道: maestro-quick → (直接完成)
114
136
  Issue 闭环: discover → create → analyze --gaps → plan --gaps → execute → close
115
137
  全自动: /maestro -y → (自动路由)
@@ -122,11 +144,16 @@ Issue 闭环: discover → create → analyze --gaps → plan --gaps → execute
122
144
  ```markdown
123
145
  ## 核心概念
124
146
 
125
- - **Milestone**: 项目阶段,包含多个 Phase
126
- - **Phase**: 单个工作单元,走 analyze → plan → execute → verify 生命周期
147
+ - **Roadmap**: 项目级常驻规划文档,包含多个 Milestone
148
+ - **Milestone**: 可独立交付的版本节点(v0.1.0-rc1),包含多个 Phase
149
+ - **Phase**: Milestone 内的同步屏障执行阶段,走 analyze → plan → execute → verify 生命周期
150
+ - **Task**: Phase 内的具体代码修改单元(wave DAG 管理并行)
151
+ - **Blueprint**: 正式规格文档化命令(7-phase 收敛),与 brainstorm 并列作为上游起源
152
+ - **Analyze 双层**: 宏观(文本参数)探索影响面产出 scope_verdict;微观(数字参数)Phase 级深入分析
153
+ - **scope_verdict**: analyze 宏观完成后的路由建议 — large→roadmap, medium/small→直达 plan
127
154
  - **Overlay**: 非侵入式命令补丁,扩展命令行为而不修改源文件
128
155
  - **Delegate**: 将子任务委派给外部 AI 工具(Gemini/Claude/Codex)
129
- - **Spec**: 项目规范,自动注入到工作流中作为约束
156
+ - **Spec**: 项目约束规则(coding/arch/debug/test),自动注入到工作流
130
157
  - **Wiki**: 知识图谱,存储详细技术文档
131
158
  - **Ralph**: 自适应决策引擎,动态调整执行链
132
159
  ```
@@ -146,14 +173,14 @@ Issue 闭环: discover → create → analyze --gaps → plan --gaps → execute
146
173
  |---|------|------|---------|
147
174
  | 1 | `/maestro` | 智能协调器 | 不确定用哪个命令时,告诉它你的目标 |
148
175
  | 2 | `/maestro-init` | 初始化项目 | 首次使用,创建 .workflow/ 结构 |
149
- | 3 | `/maestro-roadmap` | 生成路线图 | 初始化后,规划里程碑 |
150
- | 4 | `/maestro-analyze` | 分析 | 开始一个 Phase 的分析 |
151
- | 5 | `/maestro-plan` | 规划 | 分析完成后,生成执行计划 |
152
- | 6 | `/maestro-execute` | 执行 | 计划完成后,执行实现 |
153
- | 7 | `/maestro-verify` | 验证 | 执行完成后,检查成果 |
154
- | 8 | `/maestro-quick` | 快速任务 | 简单任务跳过管线 |
155
- | 9 | `/quality-review` | 代码审查 | 执行后进行质量检查 |
156
- | 10 | `/manage-issue` | Issue 管理 | 追踪和解决 Bug |
176
+ | 3 | `/maestro-brainstorm` | 头脑风暴 | 新项目发散探索、多角色创意 |
177
+ | 4 | `/maestro-blueprint` | 规格文档化 | 正式 7-phase 收敛规格链 |
178
+ | 5 | `/maestro-analyze` | 双层分析 | 宏观: `"topic"` 探索影响面;微观: `1` Phase 级深入 |
179
+ | 6 | `/maestro-roadmap` | 路线图编排 | scope_verdict=large 时,Milestone > Phase 分解 |
180
+ | 7 | `/maestro-plan` | 规划 | 分析完成后生成执行计划,支持 `--from analyze:ANL-xxx` 直达 |
181
+ | 8 | `/maestro-execute` | 执行 | 计划完成后,执行实现 |
182
+ | 9 | `/maestro-verify` | 验证 | 执行完成后,检查成果 |
183
+ | 10 | `/maestro-quick` | 快速任务 | 简单任务跳过管线 |
157
184
  ```
158
185
 
159
186
  #### Step 5.2: 快速入门路径
@@ -77,7 +77,7 @@ After codebase exploration, scan results for context-aware trigger signals (base
77
77
 
78
78
  ## Phase 4: Context Packaging
79
79
 
80
- 1. Write spec-config.json → <session>/spec/
80
+ 1. Write blueprint-config.json → <session>/spec/
81
81
  2. Write discovery-context.json → <session>/spec/
82
82
  3. Inline Discuss (DISCUSS-001):
83
83
  - Artifact: <session>/spec/discovery-context.json
@@ -22,7 +22,7 @@
22
22
  2. Load quality gate thresholds from specs/quality-gates.md
23
23
  3. Score each dimension
24
24
  4. Run cross-document validation
25
- 5. Generate readiness-report.md + spec-summary.md
25
+ 5. Generate readiness-report.md + blueprint-summary.md
26
26
  6. Run DISCUSS-003:
27
27
  - Artifact: <session>/spec/readiness-report.md
28
28
  - Perspectives: product, technical, quality, risk, coverage
@@ -41,4 +41,4 @@
41
41
 
42
42
  Write to <session>/artifacts/:
43
43
  - readiness-report.md: Dimension scores, issue list, traceability matrix
44
- - spec-summary.md: Executive summary of all spec docs
44
+ - blueprint-summary.md: Executive summary of all spec docs
@@ -50,7 +50,7 @@ Template-driven document generation with progressive dependency loading.
50
50
 
51
51
  ### Inputs
52
52
  - Template from routing table
53
- - spec-config.json from <session>/spec/
53
+ - blueprint-config.json from <session>/spec/
54
54
  - discovery-context.json from <session>/spec/
55
55
  - Prior decisions from context_accumulator (inner loop)
56
56
  - Discussion feedback from <session>/discussions/ (if exists)
@@ -32,7 +32,7 @@ status: draft
32
32
  generated_at: {timestamp}
33
33
  version: 1
34
34
  dependencies:
35
- - ../spec-config.json
35
+ - ../blueprint-config.json
36
36
  - ../product-brief.md
37
37
  - ../requirements/_index.md
38
38
  ---
@@ -246,9 +246,9 @@ date: {timestamp}
246
246
 
247
247
  | Variable | Source | Description |
248
248
  |----------|--------|-------------|
249
- | `{session_id}` | spec-config.json | Session identifier |
249
+ | `{session_id}` | blueprint-config.json | Session identifier |
250
250
  | `{timestamp}` | Runtime | ISO8601 generation timestamp |
251
251
  | `{product_name}` | product-brief.md | Product/feature name |
252
252
  | `{NNN}` | Auto-increment | ADR/requirement number |
253
253
  | `{slug}` | Auto-generated | Kebab-case from decision title |
254
- | `{has_codebase}` | spec-config.json | Whether existing codebase exists |
254
+ | `{has_codebase}` | blueprint-config.json | Whether existing codebase exists |
@@ -32,7 +32,7 @@ status: draft
32
32
  generated_at: {timestamp}
33
33
  version: 1
34
34
  dependencies:
35
- - ../spec-config.json
35
+ - ../blueprint-config.json
36
36
  - ../product-brief.md
37
37
  - ../requirements/_index.md
38
38
  - ../architecture/_index.md
@@ -187,7 +187,7 @@ status: draft
187
187
 
188
188
  | Variable | Source | Description |
189
189
  |----------|--------|-------------|
190
- | `{session_id}` | spec-config.json | Session identifier |
190
+ | `{session_id}` | blueprint-config.json | Session identifier |
191
191
  | `{timestamp}` | Runtime | ISO8601 generation timestamp |
192
192
  | `{product_name}` | product-brief.md | Product/feature name |
193
193
  | `{EPIC}` | Auto-increment | Epic number (3 digits) |
@@ -23,7 +23,7 @@ generated_at: {timestamp}
23
23
  stepsCompleted: []
24
24
  version: 1
25
25
  dependencies:
26
- - spec-config.json
26
+ - blueprint-config.json
27
27
  ---
28
28
 
29
29
  # Product Brief: {product_name}
@@ -117,7 +117,7 @@ dependencies:
117
117
 
118
118
  ## References
119
119
 
120
- - Derived from: [spec-config.json](spec-config.json)
120
+ - Derived from: [blueprint-config.json](blueprint-config.json)
121
121
  - Next: [Requirements PRD](requirements.md)
122
122
  ```
123
123
 
@@ -125,7 +125,7 @@ dependencies:
125
125
 
126
126
  | Variable | Source | Description |
127
127
  |----------|--------|-------------|
128
- | `{session_id}` | spec-config.json | Session identifier |
128
+ | `{session_id}` | blueprint-config.json | Session identifier |
129
129
  | `{timestamp}` | Runtime | ISO8601 generation timestamp |
130
130
  | `{product_name}` | Seed analysis | Product/feature name |
131
131
  | `{executive_summary}` | CLI synthesis | 2-3 sentence summary |
@@ -36,7 +36,7 @@ status: draft
36
36
  generated_at: {timestamp}
37
37
  version: 1
38
38
  dependencies:
39
- - ../spec-config.json
39
+ - ../blueprint-config.json
40
40
  - ../product-brief.md
41
41
  ---
42
42
 
@@ -215,7 +215,7 @@ status: draft
215
215
 
216
216
  | Variable | Source | Description |
217
217
  |----------|--------|-------------|
218
- | `{session_id}` | spec-config.json | Session identifier |
218
+ | `{session_id}` | blueprint-config.json | Session identifier |
219
219
  | `{timestamp}` | Runtime | ISO8601 generation timestamp |
220
220
  | `{product_name}` | product-brief.md | Product/feature name |
221
221
  | `{NNN}` | Auto-increment | Requirement number (zero-padded 3 digits) |
@@ -40,11 +40,14 @@ $ARGUMENTS — user intent text, or special flags.
40
40
  <invariants>
41
41
  1. **Skills invoked DIRECTLY in-context** — coordinator runs `$skill {resolved_args}` itself, sequentially. NO spawn_agents_on_csv, NO wave/CSV/worker.
42
42
  2. **Coordinator owns the loop** — classify → decompose → resolve chain → for each step: resolve args → invoke skill → read result → persist → next.
43
- 3. **Decomposition contract shared with maestro-ralph** — broad/lifecycle intents run S_DECOMPOSE producing the SAME additive block (`boundary_contract`, `execution_criteria`, `task_decomposition`, `goal_checklist_path`) + `goal-checklist.md`. Reference maestro-ralph `A_DECOMPOSE_TASKS`; do not duplicate logic.
44
- 4. **Goal is tool-created** — `A_DECOMPOSE_TASKS` calls `create_goal` with sub-goal success criteria. `update_goal` on convergence; held while aborted/paused.
45
- 5. **Status JSON: schema-additive + step-dynamic** decomposition fields OPTIONAL (absent → old flat-chain behavior); `steps[]` is a living array grown at runtime by `post-goal-audit`. `goal_ref` traces dynamically-added steps. Never remove/rename existing fields. `waves` kept as empty array for backward-compat (spawning removed).
46
- 6. **Sequential execution** — one step at a time in index order; each step's result read before the next starts.
47
- 7. **Abort on failure**failed step mark remaining skipped → report (goal stays bound for `--continue`).
43
+ 3. **Decomposition contract shared with maestro-ralph** — broad/lifecycle intents run S_DECOMPOSE producing the SAME additive block (`boundary_contract`, `execution_criteria`, `task_decomposition`). Reference maestro-ralph `A_DECOMPOSE_TASKS`
44
+ 4. **Goal is tool-created** — `A_DECOMPOSE_TASKS` calls `create_goal` with sub-goal success criteria. `update_goal` on convergence; held while aborted/paused
45
+ 5. **status.json 唯一真源**不生成 `goal-checklist.md`;step `command_scope` + `command_path` + `completion_confirmed`
46
+ 6. **Topology awareness** — chain catalog brainstorm / blueprint / analyze-macro(text) / analyze(numeric) / roadmap / plan(三路径) / execute / verify / ...
47
+ 7. **D-007 milestone 反查**数字 phase 步骤的 `milestone_id` `state.json.milestones[].phase_slugs` 反查
48
+ 8. **schema 向后兼容** — decomposition 字段可选;`steps[]` 由 post-goal-audit 动态生长(goal_ref tagged);既有字段不删不改;`waves` 保留空数组
49
+ 9. **Sequential execution** — one step at a time in index order; each step's result read before the next starts
50
+ 10. **Abort on failure** — failed step → mark remaining skipped → report (goal stays bound for `--continue`)
48
51
  </invariants>
49
52
 
50
53
  <state_machine>
@@ -152,9 +155,13 @@ Extract:
152
155
  | task_type | When user intent is about... |
153
156
  |-----------|---------------------------|
154
157
  | `quick` | Simple/small task, add a feature, quick change |
158
+ | `blueprint` | Formal spec generation (Product Brief / PRD / Architecture / Epics) |
159
+ | `analyze_macro` | Broad/medium intent w/o numeric phase — explore impact, produce scope_verdict |
160
+ | `plan_from_analyze` | Plan directly from analyze artifact (no roadmap, scope=standalone) |
161
+ | `plan_from_blueprint` | Plan directly from blueprint artifact (scope=standalone) |
155
162
  | `plan` | Plan, design, architect a phase |
156
163
  | `execute` | Implement, develop, code a phase |
157
- | `analyze` | Understand, investigate, evaluate code |
164
+ | `analyze` | Understand, investigate, evaluate code (numeric phase) |
158
165
  | `verify` | Check goals met, validate results |
159
166
  | `review` | Code quality review |
160
167
  | `test` | Run or create tests, UAT |
@@ -200,11 +207,16 @@ Extract:
200
207
  **Selection priorities:**
201
208
  1. `issue_id` present → prefer issue chains
202
209
  2. UI/design/界面/页面/原型 → prefer `ui_design`
203
- 3. Multiple lifecycle steps implied prefer multi-step chains
204
- 4. Single specific action prefer single-step chains
205
- 5. "问题" describing broken behavior `debug`; tracked item with ISS-ID → `issue`; ambiguous `debug`
206
- 6. Simple task, no lifecycle context → `quick`
207
- 7. Global fallback → `quick`
210
+ 3. 正式规格/spec-generate/7-phase`blueprint` (single-step) 或 `blueprint-driven`
211
+ 4. 头脑风暴/探索`brainstorm-driven`
212
+ 5. Broad/medium intent + 无数字 phase → `analyze_macro`(产 scope_verdict);后续 largeroadmap链;medium/small→`plan_from_analyze`
213
+ 6. 已有 analyze artifact 直达 plan → `plan_from_analyze`
214
+ 7. 已有 blueprint artifact 直达 plan → `plan_from_blueprint`
215
+ 8. Multiple lifecycle steps implied → prefer multi-step chains
216
+ 9. Single specific action → prefer single-step chains
217
+ 10. "问题" describing broken behavior → `debug`; tracked item with ISS-ID → `issue`
218
+ 11. Simple task, no lifecycle context → `quick`
219
+ 12. Global fallback → `quick`
208
220
 
209
221
  **Clarity scoring**: 3=task_type+scope+phase, 2=task_type+scope, 1=task_type only, 0=empty.
210
222
  If `clarity < 2` and not `auto_mode` → transition to A_CLARIFY_INTENT.
@@ -251,13 +263,13 @@ Read `.workflow/state.json` and route by condition:
251
263
 
252
264
  ### A_DECOMPOSE_TASKS
253
265
 
254
- 与 maestro-ralph `A_DECOMPOSE_TASKS` 共享分解契约 —— 引用该规范,不重复。Condensed:
266
+ 与 maestro-ralph `A_DECOMPOSE_TASKS` 共享分解契约。Condensed:
255
267
 
256
268
  1. 分类意图广度。narrow / 单步 / `{status,init,quick}` 链跳过
257
- 2. broad/medium → `AskUserQuestion` ≤3 轮:Scope(in/out)| Constraints(兼容/API/perf/test)| Definition of Done
258
- 3. 派生 `execution_criteria`(3-6 条命令式规则)+ `task_decomposition`(outcome 子目标,`done_when` 可校验,绑定到 ralph evidence 产物)
259
- 4. **status.json 为唯一真源**:写入 `boundary_contract` / `execution_criteria` / `task_decomposition` / `goal_checklist_path`;从 status.json 投影渲染 `{session_dir}/goal-checklist.md`(同 maestro-ralph Sync Rule,含 Resume 区块指向 `$maestro --continue`)
260
- 5. 链路末尾(evidence 产出步骤后、milestone-complete/close-out 前)追加 `{ type: "decision", decision: "post-goal-audit", retry_count: 0, max_retries: 2 }`。S_DECISION_EVAL 在该节点动态生长 `steps[]`
269
+ 2. broad/medium → `AskUserQuestion` ≤3 轮:Scope / Constraints / Definition of Done
270
+ 3. 派生 `execution_criteria` + `task_decomposition`(每个 sub-goal 含 `done_when` + `evidence` + `lifecycle` + `completion_confirmed: false`)
271
+ 4. **status.json 唯一真源**:写入 `boundary_contract` / `execution_criteria` / `task_decomposition`;不生成 markdown 清单
272
+ 5. 链路末尾(evidence 产出步骤后、milestone-complete/close-out 前)追加 `decision:post-goal-audit`。S_DECISION_EVAL 据此动态生长 `steps[]`
261
273
  6. **Register goal via `create_goal`:**
262
274
  ```
263
275
  create_goal({ objective: "Maestro {chain}: {intent} — converge {N} sub-goals within boundary",
@@ -267,24 +279,38 @@ Read `.workflow/state.json` and route by condition:
267
279
 
268
280
  ### A_CREATE_SESSION
269
281
 
270
- 1. Read `.workflow/state.json` for project context (current phase, milestone, workflow_name)
282
+ 1. Read `.workflow/state.json` 获取 phase / milestone(D-007 反查 `phase_slugs`);读最新 macro analyze artifact 注入 `scope_verdict` + `analyze_macro_id`;读最新 blueprint artifact 注入 `blueprint_id`
271
283
  2. Resolve chain's skill list from Chain Map (see appendix)
272
- 3. Create `.workflow/.maestro/maestro-{YYYYMMDD-HHMMSS}/status.json`:
284
+ 3. Create `.workflow/.maestro/maestro-{YYYYMMDD-HHMMSS}/status.json`(与 ralph 共用 schema):
273
285
  ```json
274
- { "session_id", "source": "maestro", "intent", "task_type", "chain_name",
275
- "phase", "milestone", "auto_mode", "context": { "issue_id", "scratch_dir",
276
- "plan_dir", "analysis_dir", "brainstorm_dir" },
277
- "steps": [{ "index", "type": "skill|decision", "skill", "args", "status": "pending", "goal_ref": null }],
286
+ {
287
+ "session_id", "source": "maestro", "intent", "task_type", "chain_name",
288
+ "phase", "phase_is_new": false, "milestone": "",
289
+ "scope_verdict": null, "analyze_macro_id": null, "blueprint_id": null,
290
+ "auto_mode": false,
291
+ "context": { "issue_id": null, "scratch_dir": null, "plan_dir": null,
292
+ "analysis_dir": null, "brainstorm_dir": null, "blueprint_dir": null },
293
+ "steps": [{
294
+ "index": 0, "type": "skill|decision",
295
+ "skill": "", "args": "",
296
+ "stage": "", "scope": null,
297
+ "command_scope": "global|project|missing|null",
298
+ "command_path": "~/.claude/commands/{name}.md | .claude/commands/{name}.md | null",
299
+ "milestone_id": null, "source_artifact_ref": null,
300
+ "status": "pending", "goal_ref": null,
301
+ "completion_confirmed": false, "completion_status": null,
302
+ "completion_evidence": null, "completed_at": null
303
+ }],
278
304
  "waves": [], "current_step": 0, "status": "running",
279
- "_comment": "↓ OPTIONAL additive block — present only if S_DECOMPOSE ran; absent → flat-chain behavior",
280
305
  "boundary_contract": {}, "execution_criteria": [],
281
- "task_decomposition": [{ "id": "G1", "goal": "", "done_when": "", "evidence": "", "status": "pending|done", "completed_at": null }],
282
- "task_decomposition_all_done": false,
283
- "goal_checklist_path": "", "goal_checklist_synced_at": null }
306
+ "task_decomposition": [{ "id": "G1", "goal": "", "done_when": "", "evidence": "",
307
+ "status": "pending|done", "completion_confirmed": false, "completed_at": null }],
308
+ "task_decomposition_all_done": false
309
+ }
284
310
  ```
285
311
  Decomposition fields written ONLY if A_DECOMPOSE_TASKS produced them (additive)
286
- 4. goal-checklist.md status.json 的投影:从 task_decomposition 渲染(同 maestro-ralph Sync Rule);Resume 区块写入 `$maestro --continue`
287
- 4. Initialize tracking:
312
+ 4. Validate: 所有 step `command_scope != "missing"`;否则 raise E006 列出缺失 skill
313
+ 5. Initialize tracking:
288
314
  - If decomposed: goal already registered by A_DECOMPOSE_TASKS. Else: `create_goal({ objective: "Maestro {chain}: {N} steps [{skill list}]" })`
289
315
  - `update_plan({ plan: steps.map(step => ({ step, status: "pending" })) })`
290
316
 
@@ -328,10 +354,9 @@ S_DECISION_EVAL 入口;镜像 maestro-ralph `A_GOAL_AUDIT_EVALUATE`。Condense
328
354
 
329
355
  ### A_APPLY_GOAL_DONE
330
356
 
331
- 1. status.json(真源):全部 `task_decomposition[*].status="done"` + `completed_at=now` + `task_decomposition_all_done=true`
332
- 2. status.json 重渲染 `goal-checklist.md`(见 Sync Rule);文件末追加 `ALL_GOALS_DONE`
333
- 3. `update_goal({ status: "complete" })` —— 释放分解 goal
334
- 4. 继续到 chain 的终结步骤
357
+ 1. status.json:全部 `task_decomposition[*].status="done"` + `completion_confirmed=true` + `completed_at=now` + `task_decomposition_all_done=true`
358
+ 2. `update_goal({ status: "complete" })`
359
+ 3. 继续到 chain 的终结步骤
335
360
 
336
361
  ### A_FINALIZE
337
362
 
@@ -361,9 +386,13 @@ S_DECISION_EVAL 入口;镜像 maestro-ralph `A_GOAL_AUDIT_EVALUATE`。Condense
361
386
  |-------|---------------|
362
387
  | `status` | `manage-status` |
363
388
  | `init` | `maestro-init` |
389
+ | `blueprint` | `maestro-blueprint "{intent}"` |
390
+ | `analyze_macro` | `maestro-analyze "{intent}"` |
364
391
  | `analyze` | `maestro-analyze {phase}` |
365
392
  | `ui_design` | `maestro-impeccable build "{phase}"` |
366
393
  | `plan` | `maestro-plan {phase}` |
394
+ | `plan_from_analyze` | `maestro-plan --from analyze:{analyze_macro_id}` |
395
+ | `plan_from_blueprint` | `maestro-plan --from blueprint:{blueprint_id}` |
367
396
  | `execute` | `maestro-execute {phase}` |
368
397
  | `verify` | `maestro-verify {phase}` |
369
398
  | `test_gen` | `quality-auto-test {phase}` |
@@ -413,7 +442,8 @@ S_DECISION_EVAL 入口;镜像 maestro-ralph `A_GOAL_AUDIT_EVALUATE`。Condense
413
442
  | `feature` | [B] maestro-plan → [B] maestro-execute → maestro-verify |
414
443
  | `quality-fix` | [B] maestro-analyze --gaps → [B] maestro-plan --gaps → [B] maestro-execute → maestro-verify |
415
444
  | `deploy` | maestro-verify → maestro-milestone-release |
416
- | `spec-driven` | maestro-init → [B] maestro-roadmap --mode full → [B] maestro-plan → [B] maestro-execute → maestro-verify |
445
+ | `blueprint-driven` | maestro-init → [B] maestro-blueprint → [B] maestro-plan --from blueprint:{BLP} → [B] maestro-execute → maestro-verify |
446
+ | `analyze-macro-driven` | [B] maestro-analyze "{intent}" → ◆ post-analyze-scope → (large: [B] maestro-roadmap --from analyze:{ANL} → [B] maestro-analyze {phase} → [B] maestro-plan {phase}) / (medium\|small: [B] maestro-plan --from analyze:{ANL}) → [B] maestro-execute → maestro-verify |
417
447
  | `brainstorm-driven` | [B] maestro-brainstorm → [B] maestro-plan → [B] maestro-execute → maestro-verify |
418
448
  | `ui-craft-build` | maestro-impeccable build → [B] maestro-plan → [B] maestro-execute → maestro-verify |
419
449
  | `roadmap-driven` | maestro-init → [B] maestro-roadmap → [B] maestro-plan → [B] maestro-execute → maestro-verify |
@@ -436,15 +466,17 @@ S_DECISION_EVAL 入口;镜像 maestro-ralph `A_GOAL_AUDIT_EVALUATE`。Condense
436
466
 
437
467
  | taskType | Chain |
438
468
  |----------|-------|
439
- | `spec_generate` | `spec-driven` |
469
+ | `spec_generate` | `blueprint-driven` |
470
+ | `spec-driven` | `blueprint-driven` |
440
471
  | `brainstorm` | `brainstorm-driven` |
441
472
  | `issue_execute` | `issue-full` |
473
+ | `analyze_macro` | `analyze-macro-driven` |
442
474
 
443
475
  ### Auto-Yes Flag Map
444
476
 
445
477
  | Skill | Flag |
446
478
  |-------|------|
447
- | maestro-init, maestro-analyze, maestro-brainstorm, maestro-impeccable, maestro-roadmap | `-y` |
479
+ | maestro-init, maestro-analyze, maestro-brainstorm, maestro-blueprint, maestro-impeccable, maestro-roadmap | `-y` |
448
480
  | maestro-plan, maestro-execute, maestro-milestone-complete | `-y` |
449
481
  | quality-auto-test, quality-retrospective | `-y` |
450
482
  | quality-test | `-y --auto-fix` |
@@ -462,15 +494,20 @@ S_DECISION_EVAL 入口;镜像 maestro-ralph `A_GOAL_AUDIT_EVALUATE`。Condense
462
494
  | E003 | error | Step skill invocation failed | auto_mode retry once, then abort chain |
463
495
  | E004 | error | Context artifact not found | Retry step once, then abort |
464
496
  | E005 | error | --continue: no session found | List sessions, prompt |
497
+ | E006 | error | command_scope == "missing" for one or more steps | List missing skills, abort build |
465
498
  | W001 | warning | Context artifact partial | Continue with available context |
466
499
 
467
500
  ### Success Criteria
468
501
 
469
502
  - [ ] Intent classified and chain resolved
470
- - [ ] Broad lifecycle intents decomposed (S_DECOMPOSE, ≤3 boundary questions) sharing maestro-ralph contract; narrow/single-step skip
503
+ - [ ] Chain catalog 覆盖 blueprint / analyze_macro / plan_from_analyze / plan_from_blueprint / blueprint-driven / analyze-macro-driven 等新拓扑路径
504
+ - [ ] D-007: 数字 phase 步骤的 `milestone_id` 通过 `state.json.milestones[].phase_slugs` 反查;写入 step
505
+ - [ ] plan step args 支持 `{phase}` / `--from analyze:{ANL_ID}` / `--from blueprint:{BLP_ID}` 三路径,`source_artifact_ref` 写入
506
+ - [ ] Broad lifecycle intents decomposed (≤3 boundary questions); narrow/single-step skip
471
507
  - [ ] Goal registered via built-in `create_goal`; status.json decomposition fields additive-only
472
- - [ ] status.json 为唯一真源;goal-checklist.md 是从 JSON 重渲染的投影视图(Resume 区块指向 `$maestro --continue`)
473
- - [ ] post-goal-audit node appended as final node (after evidence-producing steps); unmet sub-goals dynamically grow steps[] (goal_ref tagged)
508
+ - [ ] status.json 唯一真源;无 markdown 清单
509
+ - [ ] 每个 step `command_scope` + `command_path` + `completion_confirmed` 字段
510
+ - [ ] post-goal-audit node appended as final node; unmet sub-goals dynamically grow steps[] (goal_ref tagged)
474
511
  - [ ] Session dir initialized with status.json before first step
475
512
  - [ ] Every skill invoked DIRECTLY in-context — NO spawn_agents_on_csv, NO wave/CSV/worker
476
513
  - [ ] Sequential execution; status.json + update_plan persisted after every step
@@ -0,0 +1,157 @@
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: Read, Write, Bash, Glob, Grep, request_user_input
6
+ ---
7
+ <purpose>
8
+ Signal-driven overlay generator — collect workflow deficiency signals from multiple sources, diagnose which commands need amendment, batch-generate targeted overlays. All amendments use overlay system (`~/.maestro/overlays/*.json`) — non-invasive, idempotent, survives reinstall.
9
+
10
+ Differs from `/maestro-overlay` (single explicit intent). This command **discovers** what needs amending by analyzing workflow artifacts.
11
+ </purpose>
12
+
13
+ <required_reading>
14
+ @~/.maestro/workflows/overlays.md
15
+ @~/.maestro/cli-tools.json
16
+ </required_reading>
17
+
18
+ <context>
19
+ $ARGUMENTS — optional description and/or source flags.
20
+
21
+ **Signal sources**:
22
+
23
+ | Flag | Source | Collects |
24
+ |------|--------|----------|
25
+ | `--from-verify <dir>` | verification.json | Workflow gaps from verify failures |
26
+ | `--from-review <dir>` | review.json | Process deficiencies from code review |
27
+ | `--from-session <id>` | Session artifacts | Problems during workflow execution |
28
+ | `--from-issues ISS-xxx,...` | issues.jsonl | Issues tracing to command deficiency |
29
+ | `--scan` | Auto-scan .workflow/ | Discover all workflow-related signals |
30
+ | _(positional text)_ | User description | Direct observation |
31
+
32
+ Multiple combinable. No flags + no description → interactive (scan + AskUserQuestion).
33
+
34
+ **Control**: `--dry-run` (preview, don't install), `-y` (skip confirmations)
35
+
36
+ **CLI targeting**: `"cli": "claude"` (default, patches .claude/commands/), `"codex"` (patches .codex/skills/), `"both"` (both paths)
37
+
38
+ **Output**: `~/.maestro/overlays/amend-{slug}.json` + optional `~/.maestro/overlays/docs/amend-{slug}.md`
39
+ </context>
40
+
41
+ <state_machine>
42
+
43
+ <states>
44
+ S_COLLECT — 收集信号(从 flags / scan / description) PERSIST: —
45
+ S_DIAGNOSE — 映射信号到命令补丁 PERSIST: —
46
+ S_GROUP — 分组、规划 overlay 粒度 PERSIST: —
47
+ S_PREVIEW — 展示注入点地图、用户确认 PERSIST: —
48
+ S_DRAFT — 生成 overlay JSON PERSIST: overlay files
49
+ S_INSTALL — 安装 overlay PERSIST: command files
50
+ S_REPORT — 报告摘要 + post-patch routing PERSIST: —
51
+ </states>
52
+
53
+ <transitions>
54
+
55
+ S_COLLECT:
56
+ → S_DIAGNOSE WHEN: signals found DO: A_COLLECT_SIGNALS
57
+ → ERROR(E001) WHEN: no signals from any source
58
+
59
+ S_DIAGNOSE:
60
+ → S_GROUP WHEN: command deficiencies identified DO: A_DIAGNOSE_SIGNALS
61
+ → ERROR(E003) WHEN: all signals are code bugs (not command gaps)
62
+
63
+ S_GROUP:
64
+ → S_PREVIEW DO: A_GROUP_OVERLAYS
65
+
66
+ S_PREVIEW:
67
+ → S_DRAFT WHEN: user confirms "Apply all" or selects patches
68
+ → S_PREVIEW WHEN: user selects "Edit" DO: modify signal target/section
69
+ → END WHEN: user cancels
70
+
71
+ S_DRAFT:
72
+ → S_INSTALL WHEN: not --dry-run DO: A_DRAFT_OVERLAYS
73
+ → END WHEN: --dry-run DO: display JSON + section map preview
74
+
75
+ S_INSTALL:
76
+ → S_REPORT DO: A_INSTALL_OVERLAYS (`maestro overlay add`, retry max 2 on validation failure)
77
+
78
+ S_REPORT:
79
+ → END DO: display summary (signals collected/applied/skipped, overlay details, skipped code-bug routing)
80
+
81
+ </transitions>
82
+
83
+ <actions>
84
+
85
+ ### A_COLLECT_SIGNALS
86
+
87
+ **If source flags**: extract signals from each specified source.
88
+ **If --scan or interactive**: scan .workflow/ for:
89
+ - verification.json → must_have_failures, anti_patterns (filter for command gap direction)
90
+ - review.json → findings tagged "process" or "workflow"
91
+ - debug understanding.md → root causes with workflow/command cause_type
92
+ - issues.jsonl → status=open AND tags include "workflow"/"command"
93
+ - execution summaries → plan deviations suggesting missing command step
94
+
95
+ **If only description**: parse for affected command(s), what's missing, expected behavior.
96
+
97
+ ### A_DIAGNOSE_SIGNALS
98
+
99
+ Per signal, determine:
100
+ - signal_id, source, description, target_command, target_section, patch_mode, fix_direction, severity
101
+
102
+ **Section mapping**:
103
+
104
+ | Signal pattern | Section | Mode |
105
+ |---------------|---------|------|
106
+ | Missing pre-check/gate | execution | prepend |
107
+ | Missing post-step/verification | execution | append |
108
+ | Missing reading/context | required_reading / deferred_reading | append |
109
+ | Incomplete success criteria | success_criteria | append |
110
+ | Missing error handling | error_codes | append |
111
+ | Scope/context gap | context | append |
112
+ | Entirely new concern | _(new section)_ | new-section |
113
+
114
+ Read pristine source from `$PKG_ROOT/.claude/commands/<name>.md` to confirm section.
115
+ Classify: command deficiency → proceed; code bug → skip (suggest /maestro-quick).
116
+
117
+ ### A_GROUP_OVERLAYS
118
+
119
+ Group by target command + section (merge same command+section).
120
+ Granularity: 1-2 signals → `patch-{command}-{slug}.json`; 3+ cross-command → `amend-{slug}.json`.
121
+ Read target commands to verify sections exist, check existing overlays.
122
+
123
+ Display section map with injection points per target command.
124
+
125
+ ### A_DRAFT_OVERLAYS
126
+
127
+ Build overlay JSON per schema: name, description, targets[], cli, priority (60), enabled, patches[{section, mode, content}].
128
+ Content rules: heading includes `(patch: SIG-NNN)`, concise, supplementary doc to `~/.maestro/overlays/docs/` if >10 lines.
129
+
130
+ ### A_INSTALL_OVERLAYS
131
+
132
+ ```bash
133
+ maestro overlay add ~/.maestro/overlays/amend-{slug}.json
134
+ ```
135
+ On validation failure: fix JSON, retry (max 2).
136
+
137
+ </actions>
138
+
139
+ </state_machine>
140
+
141
+ <error_codes>
142
+ | Code | Condition | Recovery |
143
+ |------|-----------|----------|
144
+ | E001 | No signals from any source | Verify artifact paths or provide description |
145
+ | E003 | All signals are code bugs, not command gaps | Use /maestro-quick or /maestro-plan --gaps |
146
+ | E004 | Overlay validation failed after 2 retries | Review JSON manually |
147
+ | W001 | Some signals skipped (code bugs) | Route to appropriate fix command |
148
+ | W002 | Target command has >= 3 existing overlays | Consider consolidating |
149
+ </error_codes>
150
+
151
+ <success_criteria>
152
+ - [ ] Signals classified: command deficiency vs code bug
153
+ - [ ] Pristine command sources read to verify injection points
154
+ - [ ] Section map with injection points confirmed by user
155
+ - [ ] Overlay JSON installed successfully; command files contain overlay markers
156
+ - [ ] Skipped code-bug signals routed to alternatives
157
+ </success_criteria>