maestro-flow 0.4.11 → 0.4.13

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 (253) 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 +220 -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/learn-decompose/SKILL.md +6 -6
  8. package/.agents/skills/learn-follow/SKILL.md +4 -4
  9. package/.agents/skills/learn-investigate/SKILL.md +6 -6
  10. package/.agents/skills/learn-retro/SKILL.md +7 -7
  11. package/.agents/skills/learn-second-opinion/SKILL.md +4 -4
  12. package/.agents/skills/maestro/SKILL.md +61 -27
  13. package/.agents/skills/maestro-amend/SKILL.md +1 -0
  14. package/.agents/skills/maestro-analyze/SKILL.md +37 -4
  15. package/.agents/skills/maestro-blueprint/SKILL.md +133 -0
  16. package/.agents/skills/maestro-brainstorm/SKILL.md +120 -103
  17. package/.agents/skills/maestro-fork/SKILL.md +1 -1
  18. package/.agents/skills/maestro-guard/SKILL.md +3 -2
  19. package/.agents/skills/maestro-help/SKILL.md +48 -14
  20. package/.agents/skills/maestro-help/index/catalog.json +29 -11
  21. package/.agents/skills/maestro-help/phases/01-parse-intent.md +1 -1
  22. package/.agents/skills/maestro-help/phases/02-search-present.md +6 -4
  23. package/.agents/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  24. package/.agents/skills/maestro-impeccable/SKILL.md +13 -11
  25. package/.agents/skills/maestro-init/SKILL.md +3 -3
  26. package/.agents/skills/maestro-milestone-audit/SKILL.md +5 -3
  27. package/.agents/skills/maestro-milestone-complete/SKILL.md +7 -5
  28. package/.agents/skills/maestro-milestone-release/SKILL.md +1 -1
  29. package/.agents/skills/maestro-plan/SKILL.md +16 -4
  30. package/.agents/skills/maestro-ralph/SKILL.md +297 -226
  31. package/.agents/skills/maestro-ralph-execute/SKILL.md +82 -67
  32. package/.agents/skills/maestro-roadmap/SKILL.md +43 -81
  33. package/.agents/skills/manage-harvest/SKILL.md +1 -0
  34. package/.agents/skills/manage-issue-discover/SKILL.md +1 -1
  35. package/.agents/skills/manage-knowhow/SKILL.md +1 -1
  36. package/.agents/skills/manage-learn/SKILL.md +4 -4
  37. package/.agents/skills/quality-auto-test/SKILL.md +6 -6
  38. package/.agents/skills/quality-refactor/SKILL.md +1 -1
  39. package/.agents/skills/quality-retrospective/SKILL.md +2 -2
  40. package/.agents/skills/security-audit/SKILL.md +24 -0
  41. package/.agents/skills/spec-remove/SKILL.md +6 -2
  42. package/.agents/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  43. package/.agents/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  44. package/.agents/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  45. package/.agents/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  46. package/.agents/skills/team-lifecycle-v4/templates/epics.md +2 -2
  47. package/.agents/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  48. package/.agents/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  49. package/.agy/agents/cli-explore-agent.md +1 -3
  50. package/.agy/agents/cross-role-reviewer.md +170 -0
  51. package/.agy/agents/role-design-author.md +217 -0
  52. package/.agy/agents/ui-design-agent.md +1 -18
  53. package/.agy/agents/workflow-analyzer.md +1 -1
  54. package/.agy/agents/workflow-external-researcher.md +1 -1
  55. package/.agy/skills/learn-decompose/SKILL.md +6 -6
  56. package/.agy/skills/learn-follow/SKILL.md +4 -4
  57. package/.agy/skills/learn-investigate/SKILL.md +6 -6
  58. package/.agy/skills/learn-retro/SKILL.md +7 -7
  59. package/.agy/skills/learn-second-opinion/SKILL.md +4 -4
  60. package/.agy/skills/maestro/SKILL.md +61 -27
  61. package/.agy/skills/maestro-amend/SKILL.md +1 -0
  62. package/.agy/skills/maestro-analyze/SKILL.md +37 -4
  63. package/.agy/skills/maestro-blueprint/SKILL.md +133 -0
  64. package/.agy/skills/maestro-brainstorm/SKILL.md +120 -103
  65. package/.agy/skills/maestro-fork/SKILL.md +1 -1
  66. package/.agy/skills/maestro-guard/SKILL.md +3 -2
  67. package/.agy/skills/maestro-help/SKILL.md +48 -14
  68. package/.agy/skills/maestro-help/index/catalog.json +29 -11
  69. package/.agy/skills/maestro-help/phases/01-parse-intent.md +1 -1
  70. package/.agy/skills/maestro-help/phases/02-search-present.md +6 -4
  71. package/.agy/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  72. package/.agy/skills/maestro-impeccable/SKILL.md +13 -11
  73. package/.agy/skills/maestro-init/SKILL.md +3 -3
  74. package/.agy/skills/maestro-milestone-audit/SKILL.md +5 -3
  75. package/.agy/skills/maestro-milestone-complete/SKILL.md +7 -5
  76. package/.agy/skills/maestro-milestone-release/SKILL.md +1 -1
  77. package/.agy/skills/maestro-plan/SKILL.md +16 -4
  78. package/.agy/skills/maestro-ralph/SKILL.md +297 -226
  79. package/.agy/skills/maestro-ralph-execute/SKILL.md +82 -67
  80. package/.agy/skills/maestro-roadmap/SKILL.md +43 -81
  81. package/.agy/skills/manage-harvest/SKILL.md +1 -0
  82. package/.agy/skills/manage-issue-discover/SKILL.md +1 -1
  83. package/.agy/skills/manage-knowhow/SKILL.md +1 -1
  84. package/.agy/skills/manage-learn/SKILL.md +4 -4
  85. package/.agy/skills/quality-auto-test/SKILL.md +6 -6
  86. package/.agy/skills/quality-refactor/SKILL.md +1 -1
  87. package/.agy/skills/quality-retrospective/SKILL.md +2 -2
  88. package/.agy/skills/security-audit/SKILL.md +24 -0
  89. package/.agy/skills/spec-remove/SKILL.md +6 -2
  90. package/.agy/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  91. package/.agy/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  92. package/.agy/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  93. package/.agy/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  94. package/.agy/skills/team-lifecycle-v4/templates/epics.md +2 -2
  95. package/.agy/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  96. package/.agy/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  97. package/.claude/agents/cli-explore-agent.md +1 -3
  98. package/.claude/agents/cross-role-reviewer.md +171 -0
  99. package/.claude/agents/role-design-author.md +218 -0
  100. package/.claude/agents/ui-design-agent.md +1 -18
  101. package/.claude/agents/workflow-analyzer.md +1 -1
  102. package/.claude/agents/workflow-external-researcher.md +1 -1
  103. package/.claude/commands/learn-decompose.md +6 -6
  104. package/.claude/commands/learn-follow.md +4 -4
  105. package/.claude/commands/learn-investigate.md +6 -6
  106. package/.claude/commands/learn-retro.md +7 -7
  107. package/.claude/commands/learn-second-opinion.md +4 -4
  108. package/.claude/commands/maestro-amend.md +1 -0
  109. package/.claude/commands/maestro-analyze.md +37 -4
  110. package/.claude/commands/maestro-blueprint.md +131 -0
  111. package/.claude/commands/maestro-brainstorm.md +133 -116
  112. package/.claude/commands/maestro-fork.md +1 -1
  113. package/.claude/commands/maestro-guard.md +3 -2
  114. package/.claude/commands/maestro-impeccable.md +13 -11
  115. package/.claude/commands/maestro-init.md +3 -3
  116. package/.claude/commands/maestro-milestone-audit.md +5 -3
  117. package/.claude/commands/maestro-milestone-complete.md +7 -5
  118. package/.claude/commands/maestro-milestone-release.md +1 -1
  119. package/.claude/commands/maestro-plan.md +16 -4
  120. package/.claude/commands/maestro-ralph-execute.md +82 -67
  121. package/.claude/commands/maestro-ralph.md +297 -226
  122. package/.claude/commands/maestro-roadmap.md +43 -81
  123. package/.claude/commands/maestro.md +61 -27
  124. package/.claude/commands/manage-harvest.md +1 -0
  125. package/.claude/commands/manage-issue-discover.md +1 -1
  126. package/.claude/commands/manage-knowhow.md +1 -1
  127. package/.claude/commands/manage-learn.md +4 -4
  128. package/.claude/commands/quality-auto-test.md +6 -6
  129. package/.claude/commands/quality-refactor.md +1 -1
  130. package/.claude/commands/quality-retrospective.md +2 -2
  131. package/.claude/commands/security-audit.md +24 -0
  132. package/.claude/commands/spec-remove.md +6 -2
  133. package/.claude/skills/maestro-help/SKILL.md +48 -14
  134. package/.claude/skills/maestro-help/index/catalog.json +29 -11
  135. package/.claude/skills/maestro-help/phases/01-parse-intent.md +1 -1
  136. package/.claude/skills/maestro-help/phases/02-search-present.md +6 -4
  137. package/.claude/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  138. package/.claude/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  139. package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  140. package/.claude/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  141. package/.claude/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  142. package/.claude/skills/team-lifecycle-v4/templates/epics.md +2 -2
  143. package/.claude/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  144. package/.claude/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  145. package/.codex/skills/learn-decompose/SKILL.md +4 -4
  146. package/.codex/skills/learn-follow/SKILL.md +3 -3
  147. package/.codex/skills/learn-investigate/SKILL.md +3 -3
  148. package/.codex/skills/learn-retro/SKILL.md +3 -3
  149. package/.codex/skills/learn-second-opinion/SKILL.md +3 -3
  150. package/.codex/skills/maestro/SKILL.md +75 -38
  151. package/.codex/skills/maestro-amend/SKILL.md +157 -0
  152. package/.codex/skills/maestro-analyze/SKILL.md +72 -23
  153. package/.codex/skills/maestro-blueprint/SKILL.md +123 -0
  154. package/.codex/skills/maestro-brainstorm/SKILL.md +277 -46
  155. package/.codex/skills/maestro-composer/SKILL.md +1 -1
  156. package/.codex/skills/maestro-execute/SKILL.md +13 -4
  157. package/.codex/skills/maestro-fork/SKILL.md +2 -0
  158. package/.codex/skills/maestro-guard/SKILL.md +3 -2
  159. package/.codex/skills/maestro-help/SKILL.md +28 -18
  160. package/.codex/skills/maestro-help/catalog.json +29 -11
  161. package/.codex/skills/maestro-impeccable/SKILL.md +13 -11
  162. package/.codex/skills/maestro-init/SKILL.md +7 -7
  163. package/.codex/skills/maestro-plan/SKILL.md +27 -9
  164. package/.codex/skills/maestro-ralph/SKILL.md +740 -601
  165. package/.codex/skills/maestro-roadmap/SKILL.md +56 -72
  166. package/.codex/skills/maestro-update/SKILL.md +169 -0
  167. package/.codex/skills/maestro-verify/SKILL.md +11 -2
  168. package/.codex/skills/manage-codebase-rebuild/SKILL.md +9 -5
  169. package/.codex/skills/manage-harvest/SKILL.md +11 -3
  170. package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
  171. package/.codex/skills/manage-knowhow/SKILL.md +1 -1
  172. package/.codex/skills/manage-learn/SKILL.md +3 -3
  173. package/.codex/skills/quality-refactor/SKILL.md +2 -2
  174. package/.codex/skills/quality-retrospective/SKILL.md +12 -5
  175. package/.codex/skills/security-audit/SKILL.md +24 -0
  176. package/.codex/skills/spec-remove/SKILL.md +8 -2
  177. package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +2 -2
  178. package/.codex/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  179. package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  180. package/.codex/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  181. package/.codex/skills/team-lifecycle-v4/templates/epics.md +2 -2
  182. package/.codex/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  183. package/.codex/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  184. package/README.md +8 -8
  185. package/README.zh-CN.md +8 -8
  186. package/dashboard/dist-server/dashboard/src/server/routes/settings.js +3 -3
  187. package/dashboard/dist-server/dashboard/src/server/routes/settings.js.map +1 -1
  188. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  189. package/dist/src/agents/cli-agent-runner.js +13 -7
  190. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  191. package/dist/src/commands/spec.d.ts.map +1 -1
  192. package/dist/src/commands/spec.js +8 -1
  193. package/dist/src/commands/spec.js.map +1 -1
  194. package/dist/src/tools/spec-init.d.ts +16 -2
  195. package/dist/src/tools/spec-init.d.ts.map +1 -1
  196. package/dist/src/tools/spec-init.js +58 -187
  197. package/dist/src/tools/spec-init.js.map +1 -1
  198. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  199. package/dist/src/tools/spec-loader.js +16 -16
  200. package/dist/src/tools/spec-loader.js.map +1 -1
  201. package/dist/src/tools/spec-seeds.d.ts +33 -0
  202. package/dist/src/tools/spec-seeds.d.ts.map +1 -0
  203. package/dist/src/tools/spec-seeds.js +200 -0
  204. package/dist/src/tools/spec-seeds.js.map +1 -0
  205. package/dist/src/tools/spec-writer.d.ts.map +1 -1
  206. package/dist/src/tools/spec-writer.js +7 -9
  207. package/dist/src/tools/spec-writer.js.map +1 -1
  208. package/dist/src/utils/update-notices.js +12 -0
  209. package/dist/src/utils/update-notices.js.map +1 -1
  210. package/package.json +1 -1
  211. package/templates/business-test-report.json +1 -1
  212. package/templates/index.json +1 -1
  213. package/templates/roadmap.md +15 -9
  214. package/templates/state.json +18 -17
  215. package/workflows/agy-instructions.md +2 -0
  216. package/workflows/analyze.md +79 -11
  217. package/workflows/auto-test.md +12 -7
  218. package/workflows/blueprint.md +431 -0
  219. package/workflows/brainstorm.md +617 -496
  220. package/workflows/business-test.md +7 -7
  221. package/workflows/claude-instructions.md +2 -0
  222. package/workflows/codebase-rebuild.md +4 -4
  223. package/workflows/codex-instructions.md +16 -83
  224. package/workflows/debug.md +1 -1
  225. package/workflows/harvest.md +184 -10
  226. package/workflows/impeccable.md +2 -0
  227. package/workflows/init.md +9 -8
  228. package/workflows/issue-analyze.md +14 -100
  229. package/workflows/issue-discover.md +2 -3
  230. package/workflows/issue-execute.md +1 -1
  231. package/workflows/issue-gaps-analyze.md +2 -0
  232. package/workflows/learn.md +1 -1
  233. package/workflows/maestro-chain-execute.md +10 -228
  234. package/workflows/maestro.md +2 -1
  235. package/workflows/milestone-audit.md +12 -4
  236. package/workflows/milestone-complete.md +14 -9
  237. package/workflows/milestone-release.md +82 -0
  238. package/workflows/plan.md +91 -25
  239. package/workflows/retrospective.md +1 -1
  240. package/workflows/roadmap-common.md +1 -1
  241. package/workflows/roadmap.md +14 -4
  242. package/workflows/spec-generate.md +26 -13
  243. package/workflows/specs-add.md +6 -1
  244. package/workflows/specs-load.md +6 -1
  245. package/workflows/specs-setup.md +6 -1
  246. package/workflows/sync.md +13 -0
  247. package/workflows/tools-spec.md +4 -0
  248. package/workflows/ui-design.md +5 -5
  249. package/workflows/ui-style.md +1 -1
  250. package/workflows/wiki-manage.md +2 -0
  251. package/.agents/agents/conceptual-planning-agent.md +0 -247
  252. package/.agy/agents/conceptual-planning-agent.md +0 -244
  253. package/.claude/agents/conceptual-planning-agent.md +0 -245
@@ -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>
@@ -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,27 @@ $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. The user controls termination — keep interviewing until convergence; they can interrupt naturally at any time.
40
+ - Search-first when uncertain: before asking, resolve via `state.json`, `roadmap.md`, `issues.jsonl`, `maestro spec load`, `maestro wiki search`, Grep, Read, or — for open-ended multi-file scans — `maestro delegate ... --role explore`. Never ask what code or memory can verify; never bounce your own ambiguity back to the user — search first, then ask only what truly needs human judgment.
41
+ - Writeback cadence: each settled decision is immediately appended/updated in `context.md` "Interview Decisions" (and mirrored into `analysis.md` in full mode). Do NOT batch writeback to the end — partial decisions must already be on disk before the next question.
42
+ - 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.
43
+ - Scope guard: only ask about decisions owned by `analyze`. Do not prejudge plan/execute concerns.
44
+
45
+ Decision points: scope (phase / topic / milestone-wide / adhoc / --gaps) → depth (quick / standard / deep) → dimensions (which of the 6 to keep) → Go/No-Go threshold.
46
+
47
+ Exit: when all decision points are settled (or user explicitly signals to proceed), finalize session metadata. The decision table (populated incrementally during interview) uses this schema:
48
+ `| # | Decision | Choice | Source (user / code / default) |`
49
+ </interview_protocol>
50
+
29
51
  <csv_schema>
30
52
 
31
53
  ### tasks.csv
@@ -62,7 +84,9 @@ Available exploration dimensions: architecture, implementation, performance, sec
62
84
  5. **Quick mode shortcut**: -q generates only wave 3 task
63
85
  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
86
  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
87
+ 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
88
+ 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.
89
+ 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
90
  </invariants>
67
91
 
68
92
  <state_machine>
@@ -80,21 +104,30 @@ S_AGGREGATE -- 注册 artifact、输出摘要 PERSIST: state
80
104
  <transitions>
81
105
 
82
106
  S_PARSE:
83
- -> S_CONTEXT WHEN: scope resolved (milestone/phase/adhoc/standalone/gaps)
107
+ -> S_CONTEXT WHEN: scope resolved (milestone/phase/macro/adhoc/standalone/gaps)
84
108
  -> ERROR(E001) WHEN: no args and no roadmap
85
109
 
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) |
110
+ **Scope routing** (text → macro layer, numeric → phase layer per D-003):
111
+ | Condition | Scope | Layer | Slug |
112
+ |-----------|-------|-------|------|
113
+ | --gaps flag | gaps | — | ISS-ID slugified or "issue-gaps" |
114
+ | Empty subject + milestone + roadmap | milestone | phase | milestone name slugified |
115
+ | Empty subject, no roadmap | ERROR E001 | — | -- |
116
+ | Numeric + milestone + roadmap | phase | phase | phase slug from roadmap |
117
+ | Text subject + milestone | macro | macro | subject slugified (max 40) |
118
+ | Text subject, no milestone | macro | macro | subject slugified (max 40) |
119
+
120
+ **D-007 milestone reverse lookup** (numeric scope only):
121
+ ```
122
+ resolve_milestone(phase_number):
123
+ for ms in state.json.milestones[]:
124
+ if str(phase_number) in ms.phase_slugs: return ms.id
125
+ return state.json.current_milestone # fallback (standalone)
126
+ ```
127
+ Write resolved milestone into `session.milestone` and artifact registration; NEVER use `current_milestone` directly for phase-scoped runs.
95
128
 
96
129
  S_CONTEXT:
97
- -> S_CSV_GEN DO: load project.md, roadmap.md, state.json, prior artifacts, specs
130
+ -> S_CSV_GEN DO: load project.md, roadmap.md, state.json, prior artifacts, specs, upstream context-package (if --from)
98
131
 
99
132
  S_CSV_GEN:
100
133
  -> S_WAVE_1 WHEN: full mode DO: generate N explore + 6 score + 1 synthesis rows
@@ -144,9 +177,18 @@ Merge results -> master tasks.csv.
144
177
  Filter wave==3 -> build prev_context from wave 2 scores (or project context for quick mode) -> spawn.
145
178
 
146
179
  **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
180
+ - 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[]`)
181
+ - Quick mode: context.md + context-package.json + **minimal conclusions.json** (`scope_verdict` + `implementation_scope[]` only seeds plan task generation per redesign §8.3)
182
+ - Gaps mode: per-issue analysis records -> issues.jsonl + context.md + context-package.json for plan --gaps
183
+
184
+ **`scope_verdict` evaluation** (D-003 §5.3, macro/standalone/adhoc scopes only):
185
+ | Verdict | Criteria |
186
+ |---------|----------|
187
+ | `large` | 3+ independent subsystems, OR hard dependencies requiring serialized verification points |
188
+ | `medium` | 1-2 subsystems, parallel-safe |
189
+ | `small` | Single file or few files, directly executable |
190
+
191
+ 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
192
 
151
193
  Gray area detection: domain-aware (things users SEE/CALL/RUN/READ), phase-specific (skip prior decided areas).
152
194
 
@@ -156,17 +198,19 @@ Gray area detection: domain-aware (things users SEE/CALL/RUN/READ), phase-specif
156
198
  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
199
  3. Auto-create issues from Deferred items -> issues.jsonl
158
200
  4. Spec enrichment: Locked decisions -> `maestro spec add arch`; code patterns -> `maestro spec add coding`
159
- 5. Register artifact in state.json (type: analyze)
201
+ 5. Register artifact in state.json (type: analyze, includes context_package field pointing to context-package.json)
160
202
  6. Copy outputs to scratchDir, display summary
161
- 7. **Next-step routing**:
203
+ 7. **Next-step routing** (D-003 §5.3 — macro scope uses `scope_verdict` for downstream chain selection):
162
204
 
163
205
  | Scope | Condition | Next |
164
206
  |-------|-----------|------|
165
207
  | Phase/Milestone | Go + UI work needed | `$maestro-impeccable build {target}` |
166
208
  | Phase/Milestone | Go + ready to plan | `$maestro-plan` or `$maestro-plan {phase}` |
167
209
  | 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` |
210
+ | Macro/Adhoc/Standalone | `scope_verdict == "large"` | `$maestro-roadmap --from analyze:{ANL_ID}` |
211
+ | Macro/Adhoc/Standalone | `scope_verdict == "medium"` | `$maestro-plan --from analyze:{ANL_ID}` |
212
+ | Macro/Adhoc/Standalone | `scope_verdict == "small"` | `$maestro-plan --from analyze:{ANL_ID}` |
213
+ | Macro/Adhoc/Standalone | Need more exploration | `$maestro-analyze {topic} --continue` |
170
214
  | Gaps | Issues analyzed | `$maestro-plan --gaps` |
171
215
  | Gaps | Need more context | `$maestro-analyze --gaps {ISS-ID}` |
172
216
 
@@ -201,8 +245,12 @@ Protocol: read before analysis, append-only, dedup by type+key.
201
245
  </error_codes>
202
246
 
203
247
  <success_criteria>
248
+ - [ ] Interactive mode: interview decision table written to `context.md` "Interview Decisions" (mirrored into `analysis.md` in full mode)
204
249
  - [ ] All waves executed in order (or skipped per mode)
205
- - [ ] context.md produced (all modes); analysis.md + conclusions.json (full mode)
250
+ - [ ] context.md produced (all modes); analysis.md (full mode); conclusions.json (full mode AND quick mode with at minimum `scope_verdict` + `implementation_scope[]`)
251
+ - [ ] context-package.json produced (all modes) with constraints, requirements, insights, open_questions
252
+ - [ ] `scope_verdict ∈ {small, medium, large}` written into conclusions.json + context.md (macro/adhoc/standalone scopes)
253
+ - [ ] D-007 milestone reverse lookup applied for numeric scope; `session.milestone` populated via `phase_slugs`, never via direct `current_milestone` read
206
254
  - [ ] context.md contains all decisions classified as Locked/Free/Deferred
207
255
  - [ ] Decision Recording Protocol applied to all decisions
208
256
  - [ ] Confidence scored per dimension with factor-based model (full mode)
@@ -210,7 +258,8 @@ Protocol: read before analysis, append-only, dedup by type+key.
210
258
  - [ ] Pressure pass completed ≥ 1 time on highest-risk dimension before synthesis
211
259
  - [ ] Deferred items auto-created as issues
212
260
  - [ ] Scope creep redirected to Deferred section
213
- - [ ] Artifact registered in state.json
261
+ - [ ] Artifact registered in state.json (includes context_package field)
262
+ - [ ] Upstream context loaded via `--from` when specified
214
263
  - [ ] discoveries.ndjson append-only throughout
215
264
  - [ ] Next step routed (plan for Go, brainstorm for No-Go, plan --gaps for Gaps)
216
265
  </success_criteria>