maestro-flow 0.4.11 → 0.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/.agents/agents/cli-explore-agent.md +1 -3
  2. package/.agents/agents/cross-role-reviewer.md +173 -0
  3. package/.agents/agents/role-design-author.md +218 -0
  4. package/.agents/agents/ui-design-agent.md +1 -18
  5. package/.agents/agents/workflow-analyzer.md +1 -1
  6. package/.agents/agents/workflow-external-researcher.md +1 -1
  7. package/.agents/skills/maestro/SKILL.md +61 -27
  8. package/.agents/skills/maestro-analyze/SKILL.md +30 -4
  9. package/.agents/skills/maestro-blueprint/SKILL.md +132 -0
  10. package/.agents/skills/maestro-brainstorm/SKILL.md +119 -103
  11. package/.agents/skills/maestro-help/SKILL.md +48 -14
  12. package/.agents/skills/maestro-help/index/catalog.json +29 -11
  13. package/.agents/skills/maestro-help/phases/01-parse-intent.md +1 -1
  14. package/.agents/skills/maestro-help/phases/02-search-present.md +6 -4
  15. package/.agents/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  16. package/.agents/skills/maestro-init/SKILL.md +3 -3
  17. package/.agents/skills/maestro-milestone-audit/SKILL.md +5 -3
  18. package/.agents/skills/maestro-milestone-complete/SKILL.md +7 -5
  19. package/.agents/skills/maestro-plan/SKILL.md +14 -4
  20. package/.agents/skills/maestro-ralph/SKILL.md +297 -226
  21. package/.agents/skills/maestro-ralph-execute/SKILL.md +81 -67
  22. package/.agents/skills/maestro-roadmap/SKILL.md +42 -81
  23. package/.agents/skills/quality-auto-test/SKILL.md +1 -1
  24. package/.agents/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  25. package/.agents/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  26. package/.agents/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  27. package/.agents/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  28. package/.agents/skills/team-lifecycle-v4/templates/epics.md +2 -2
  29. package/.agents/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  30. package/.agents/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  31. package/.agy/agents/cli-explore-agent.md +1 -3
  32. package/.agy/agents/cross-role-reviewer.md +170 -0
  33. package/.agy/agents/role-design-author.md +215 -0
  34. package/.agy/agents/ui-design-agent.md +1 -18
  35. package/.agy/agents/workflow-analyzer.md +1 -1
  36. package/.agy/agents/workflow-external-researcher.md +1 -1
  37. package/.agy/skills/maestro/SKILL.md +61 -27
  38. package/.agy/skills/maestro-analyze/SKILL.md +30 -4
  39. package/.agy/skills/maestro-blueprint/SKILL.md +132 -0
  40. package/.agy/skills/maestro-brainstorm/SKILL.md +119 -103
  41. package/.agy/skills/maestro-help/SKILL.md +48 -14
  42. package/.agy/skills/maestro-help/index/catalog.json +29 -11
  43. package/.agy/skills/maestro-help/phases/01-parse-intent.md +1 -1
  44. package/.agy/skills/maestro-help/phases/02-search-present.md +6 -4
  45. package/.agy/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  46. package/.agy/skills/maestro-init/SKILL.md +3 -3
  47. package/.agy/skills/maestro-milestone-audit/SKILL.md +5 -3
  48. package/.agy/skills/maestro-milestone-complete/SKILL.md +7 -5
  49. package/.agy/skills/maestro-plan/SKILL.md +14 -4
  50. package/.agy/skills/maestro-ralph/SKILL.md +297 -226
  51. package/.agy/skills/maestro-ralph-execute/SKILL.md +81 -67
  52. package/.agy/skills/maestro-roadmap/SKILL.md +42 -81
  53. package/.agy/skills/quality-auto-test/SKILL.md +1 -1
  54. package/.agy/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  55. package/.agy/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  56. package/.agy/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  57. package/.agy/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  58. package/.agy/skills/team-lifecycle-v4/templates/epics.md +2 -2
  59. package/.agy/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  60. package/.agy/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  61. package/.claude/agents/cli-explore-agent.md +1 -3
  62. package/.claude/agents/cross-role-reviewer.md +171 -0
  63. package/.claude/agents/role-design-author.md +216 -0
  64. package/.claude/agents/ui-design-agent.md +1 -18
  65. package/.claude/agents/workflow-analyzer.md +1 -1
  66. package/.claude/agents/workflow-external-researcher.md +1 -1
  67. package/.claude/commands/maestro-analyze.md +30 -4
  68. package/.claude/commands/maestro-blueprint.md +130 -0
  69. package/.claude/commands/maestro-brainstorm.md +132 -116
  70. package/.claude/commands/maestro-init.md +3 -3
  71. package/.claude/commands/maestro-milestone-audit.md +5 -3
  72. package/.claude/commands/maestro-milestone-complete.md +7 -5
  73. package/.claude/commands/maestro-plan.md +14 -4
  74. package/.claude/commands/maestro-ralph-execute.md +81 -67
  75. package/.claude/commands/maestro-ralph.md +297 -226
  76. package/.claude/commands/maestro-roadmap.md +42 -81
  77. package/.claude/commands/maestro.md +61 -27
  78. package/.claude/commands/quality-auto-test.md +1 -1
  79. package/.claude/skills/maestro-help/SKILL.md +48 -14
  80. package/.claude/skills/maestro-help/index/catalog.json +29 -11
  81. package/.claude/skills/maestro-help/phases/01-parse-intent.md +1 -1
  82. package/.claude/skills/maestro-help/phases/02-search-present.md +6 -4
  83. package/.claude/skills/maestro-help/phases/03-workflow-guide.md +60 -33
  84. package/.claude/skills/team-lifecycle-v4/roles/analyst/role.md +1 -1
  85. package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  86. package/.claude/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  87. package/.claude/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  88. package/.claude/skills/team-lifecycle-v4/templates/epics.md +2 -2
  89. package/.claude/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  90. package/.claude/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  91. package/.codex/skills/maestro/SKILL.md +75 -38
  92. package/.codex/skills/maestro-amend/SKILL.md +157 -0
  93. package/.codex/skills/maestro-analyze/SKILL.md +71 -23
  94. package/.codex/skills/maestro-blueprint/SKILL.md +122 -0
  95. package/.codex/skills/maestro-brainstorm/SKILL.md +135 -45
  96. package/.codex/skills/maestro-composer/SKILL.md +1 -1
  97. package/.codex/skills/maestro-execute/SKILL.md +13 -4
  98. package/.codex/skills/maestro-help/SKILL.md +28 -18
  99. package/.codex/skills/maestro-help/catalog.json +29 -11
  100. package/.codex/skills/maestro-init/SKILL.md +7 -7
  101. package/.codex/skills/maestro-plan/SKILL.md +27 -9
  102. package/.codex/skills/maestro-ralph/SKILL.md +740 -601
  103. package/.codex/skills/maestro-roadmap/SKILL.md +55 -72
  104. package/.codex/skills/maestro-update/SKILL.md +169 -0
  105. package/.codex/skills/maestro-verify/SKILL.md +11 -2
  106. package/.codex/skills/manage-codebase-rebuild/SKILL.md +2 -2
  107. package/.codex/skills/manage-harvest/SKILL.md +10 -2
  108. package/.codex/skills/quality-retrospective/SKILL.md +9 -2
  109. package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +2 -2
  110. package/.codex/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +2 -2
  111. package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
  112. package/.codex/skills/team-lifecycle-v4/templates/architecture.md +3 -3
  113. package/.codex/skills/team-lifecycle-v4/templates/epics.md +2 -2
  114. package/.codex/skills/team-lifecycle-v4/templates/product-brief.md +3 -3
  115. package/.codex/skills/team-lifecycle-v4/templates/requirements.md +2 -2
  116. package/README.md +8 -8
  117. package/README.zh-CN.md +8 -8
  118. package/dashboard/dist-server/dashboard/src/server/routes/settings.js +3 -3
  119. package/dashboard/dist-server/dashboard/src/server/routes/settings.js.map +1 -1
  120. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  121. package/dist/src/agents/cli-agent-runner.js +13 -7
  122. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  123. package/dist/src/commands/spec.d.ts.map +1 -1
  124. package/dist/src/commands/spec.js +8 -1
  125. package/dist/src/commands/spec.js.map +1 -1
  126. package/dist/src/tools/spec-init.d.ts +16 -2
  127. package/dist/src/tools/spec-init.d.ts.map +1 -1
  128. package/dist/src/tools/spec-init.js +58 -187
  129. package/dist/src/tools/spec-init.js.map +1 -1
  130. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  131. package/dist/src/tools/spec-loader.js +16 -16
  132. package/dist/src/tools/spec-loader.js.map +1 -1
  133. package/dist/src/tools/spec-seeds.d.ts +33 -0
  134. package/dist/src/tools/spec-seeds.d.ts.map +1 -0
  135. package/dist/src/tools/spec-seeds.js +200 -0
  136. package/dist/src/tools/spec-seeds.js.map +1 -0
  137. package/dist/src/tools/spec-writer.d.ts.map +1 -1
  138. package/dist/src/tools/spec-writer.js +7 -9
  139. package/dist/src/tools/spec-writer.js.map +1 -1
  140. package/dist/src/utils/update-notices.js +12 -0
  141. package/dist/src/utils/update-notices.js.map +1 -1
  142. package/package.json +1 -1
  143. package/templates/business-test-report.json +1 -1
  144. package/templates/index.json +1 -1
  145. package/templates/roadmap.md +15 -9
  146. package/templates/state.json +18 -17
  147. package/workflows/analyze.md +79 -11
  148. package/workflows/auto-test.md +6 -6
  149. package/workflows/blueprint.md +431 -0
  150. package/workflows/brainstorm.md +603 -496
  151. package/workflows/business-test.md +7 -7
  152. package/workflows/codebase-rebuild.md +4 -4
  153. package/workflows/harvest.md +184 -10
  154. package/workflows/init.md +9 -8
  155. package/workflows/maestro.md +1 -1
  156. package/workflows/milestone-audit.md +12 -4
  157. package/workflows/milestone-complete.md +11 -6
  158. package/workflows/plan.md +88 -22
  159. package/workflows/roadmap-common.md +1 -1
  160. package/workflows/roadmap.md +13 -3
  161. package/workflows/spec-generate.md +24 -13
  162. package/workflows/ui-design.md +2 -2
  163. package/workflows/ui-style.md +1 -1
  164. package/.agents/agents/conceptual-planning-agent.md +0 -247
  165. package/.agy/agents/conceptual-planning-agent.md +0 -244
  166. package/.claude/agents/conceptual-planning-agent.md +0 -245
@@ -1,601 +1,740 @@
1
- ---
2
- name: maestro-ralph
3
- description: Use when the optimal command sequence is unclear and needs automated state-based determination
4
- argument-hint: "\"intent\" [-y] | status | continue | execute"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
- ---
7
-
8
- <purpose>
9
- Closed-loop decision engine for the maestro workflow lifecycle.
10
- Coordinator infers position -> decomposes intent into a goal-tracked sub-goal checklist ->
11
- builds chain -> **directly invokes each skill in-context** -> delegates evaluation at
12
- decision nodes -> dynamically grows the step chain until all sub-goals converge.
13
-
14
- Entry: `"intent"` (new session), `execute`/`continue` (resume), `status` (display).
15
- Node types: **skill** (direct in-context invocation) and **decision** (delegate / structural evaluate).
16
- Session at `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json`.
17
-
18
- Codex specifics:
19
- - **No agent spawning** skills run directly in coordinator context, sequentially, one step at a time.
20
- - **Goal created via built-in tool** — `create_goal` binds the decomposed sub-goal checklist as a
21
- hard objective; `update_plan` mirrors steps; `update_goal` releases on convergence.
22
-
23
- ### 执行方式 / Execution Flow
24
-
25
- ```
26
- $maestro-ralph "intent" ─▶ coordinator infer → decompose → build chain
27
- writes status.json (truth)
28
- renders goal-checklist.md (projection, Resume 区块指向 $maestro-ralph execute)
29
- │ create_goal({success_criteria: sub-goals})
30
-
31
- step loop (in-context, sequential)
32
- │ skill → run directly, read artifacts
33
- │ decisiondelegate analyze OR structural evaluate
34
- unmet sub-goals insert scoped mini-loops (steps[] grows)
35
- └─ persist status.json + update_plan after every step
36
- all_met update_goal(complete) → milestone-complete
37
- ```
38
-
39
- `status.json` 为唯一真源;checklist 为渲染视图;`steps[]` 按需生长(`post-goal-audit`、`post-verify/review/test` 决策节点)。Resume 入口统一走 `$maestro-ralph execute`(或 `continue`)。
40
- </purpose>
41
-
42
- <context>
43
- $ARGUMENTS -- intent text, flags, or keywords.
44
-
45
- **Parse**: `-y` -> auto_mode. `.md/.txt` path -> input_doc (supplementary, never substitutes lifecycle). Remaining -> intent.
46
-
47
- **`-y` downstream propagation**:
48
-
49
- | Skill | Flag | Effect |
50
- |-------|------|--------|
51
- | maestro-init | `-y` | skip interactive |
52
- | maestro-analyze | `-y` | skip scoping |
53
- | maestro-brainstorm | `-y` | skip questions |
54
- | maestro-roadmap | `-y` | skip choices |
55
- | maestro-plan | `-y` | skip confirmation |
56
- | maestro-execute | `-y` | skip confirmation, auto-continue blocked |
57
- | quality-auto-test | `-y` | skip plan confirmation |
58
- | quality-test | `-y --auto-fix` | auto gap-fix loop |
59
- | maestro-verify | `-y` | skip confirmation |
60
- | quality-review | `-y` | skip confirmation |
61
- | quality-debug | `-y` | skip confirmation |
62
- | maestro-milestone-complete | `-y` | skip knowledge promotion |
63
- | maestro-milestone-audit | `-y` | skip confirmation |
64
-
65
- **State files**: `.workflow/state.json`, `.workflow/roadmap.md`, `.workflow/.maestro/ralph-*/status.json`
66
- </context>
67
-
68
- <invariants>
69
- 1. **Skills invoked DIRECTLY in-context** — coordinator runs `$skill {resolved_args}` itself, sequentially. NO spawn_agents_on_csv, NO wave, NO worker CSV.
70
- 2. **Coordinator owns the loop** — infer -> decompose -> build -> for each step: resolve args -> invoke skill -> read result -> persist -> next.
71
- 3. **Decision nodes evaluate, never execute** quality-gate/goal-gate via `maestro delegate --role analyze`; structural decisions evaluated directly.
72
- 4. **Goal is tool-created, not prompt-emitted** — `A_DECOMPOSE_TASKS` calls `create_goal` with the sub-goal checklist as success criteria. `update_goal` on full convergence; never released while sub-goals unmet.
73
- 5. **task_decomposition drives DYNAMIC step growth** — sub-goals are the convergence spec; `steps[]` is a living array. `post-goal-audit` re-checks the checklist and **inserts scoped skill steps** for every unmet sub-goal (same insert+reindex+retry mechanism as fix-loops). Decomposition feeds adaptive branching, never freezes a plan.
74
- 6. **Status JSON: schema-additive + step-dynamic** — decomposition fields (`boundary_contract`, `execution_criteria`, `task_decomposition`, `goal_checklist_path`) are OPTIONAL; absent = old behavior. `steps[]` grows at runtime via decisions; `goal_ref` traces dynamically-added steps. Never remove/rename existing fields.
75
- 7. **Sequential execution** — one step at a time in index order; no parallelism (no spawning). Each step's result read before the next starts.
76
- 8. **Quality mode governs steps** — full/standard/quick determines quality stages.
77
- 9. **passed_gates skip** already-passed gates not re-run unless code changed.
78
- </invariants>
79
-
80
- <state_machine>
81
-
82
- <states>
83
- S_PARSE_ROUTE -- 解析参数、路由入口点 PERSIST: --
84
- S_STATUS -- 显示 session 进度后结束 PERSIST: --
85
- S_RESOLVE_PHASE -- 解析目标 phase + 标记 phase_is_new PERSIST: session.phase, session.phase_is_new
86
- S_INFER -- 基于已解析 phase 推断 lifecycle_position PERSIST: session.lifecycle_position
87
- S_QUALITY_MODE -- 确定质量模式 full/standard/quick PERSIST: session.quality_mode
88
- S_DECOMPOSE -- 边界澄清、写执行准则+子目标、建 goal PERSIST: session.boundary_contract, .execution_criteria, .task_decomposition
89
- S_BUILD_CHAIN -- 构建步骤链 PERSIST: session.steps[]
90
- S_CREATE_SESSION -- 写 status.json PERSIST: session (full)
91
- S_CONFIRM -- 用户确认(auto_mode skip) PERSIST: --
92
- S_LOAD_NEXT -- 找下一个 pending step PERSIST: --
93
- S_STEP_EXEC -- 直接调用 skill 执行该 step PERSIST: session.steps[], context
94
- S_DECISION_EVAL -- 评估质量门 / 目标门 PERSIST: --
95
- S_APPLY_VERDICT -- 应用裁决 PERSIST: passed_gates[], retry_count
96
- S_FIX_LOOP -- 插入修复步骤、重索引 PERSIST: session.steps[] (expanded)
97
- S_COMPLETE -- 标记完成 PERSIST: session.status = "completed"
98
- S_PAUSED -- 暂停等待人工 PERSIST: session.status = "paused"
99
- S_FALLBACK -- 请求用户输入 PERSIST: session.status = "paused"
100
- </states>
101
-
102
- <transitions>
103
-
104
- S_PARSE_ROUTE:
105
- -> S_STATUS WHEN: intent == "status"
106
- -> S_LOAD_NEXT WHEN: intent == "execute" | "continue"
107
- -> S_DECISION_EVAL WHEN: running session with decision step in "running"
108
- -> S_RESOLVE_PHASE WHEN: intent non-empty -- phase 必须先于 position
109
- -> S_FALLBACK WHEN: no intent AND no running session
110
-
111
- S_STATUS -> END DO: A_SHOW_STATUS
112
-
113
- S_RESOLVE_PHASE:
114
- -> S_INFER DO: A_RESOLVE_PHASE
115
-
116
- S_INFER:
117
- -> S_QUALITY_MODE WHEN: position resolved DO: A_INFER_POSITION
118
- -> S_FALLBACK WHEN: cannot infer
119
-
120
- S_QUALITY_MODE:
121
- -> S_DECOMPOSE DO: A_DETERMINE_QUALITY_MODE
122
-
123
- S_DECOMPOSE:
124
- -> S_BUILD_CHAIN DO: A_DECOMPOSE_TASKS
125
- GUARD: broad intent (重构/全面/重写/迁移/overhaul/migrate/rewrite) -> MUST clarify boundary even if auto_mode
126
- GUARD: narrow intent (single file/function/bug) -> auto-derive, skip questions
127
- GUARD: position in {brainstorm, init} -> skip decomposition (no concrete target yet)
128
-
129
- S_BUILD_CHAIN:
130
- -> S_CREATE_SESSION DO: A_BUILD_STEPS
131
-
132
- S_CREATE_SESSION:
133
- -> S_CONFIRM WHEN: not auto_mode DO: A_CREATE_SESSION
134
- -> S_LOAD_NEXT WHEN: auto_mode DO: A_CREATE_SESSION
135
-
136
- S_CONFIRM:
137
- -> S_LOAD_NEXT WHEN: "Proceed"
138
- -> S_BUILD_CHAIN WHEN: "Edit"
139
- -> S_QUALITY_MODE WHEN: "Change quality mode"
140
- -> S_PAUSED WHEN: "Cancel"
141
-
142
- S_LOAD_NEXT:
143
- -> S_DECISION_EVAL WHEN: next_step.type == "decision"
144
- -> S_STEP_EXEC WHEN: next_step.type == "skill"
145
- -> S_COMPLETE WHEN: no pending steps
146
-
147
- S_STEP_EXEC:
148
- -> S_LOAD_NEXT WHEN: success DO: A_EXEC_STEP
149
- -> S_PAUSED WHEN: failed GUARD: auto_mode retry once then pause
150
-
151
- S_DECISION_EVAL:
152
- -> S_APPLY_VERDICT WHEN: quality-gate DO: A_DELEGATE_EVALUATE
153
- -> S_APPLY_VERDICT WHEN: goal-gate DO: A_GOAL_AUDIT_EVALUATE
154
- -> S_APPLY_VERDICT WHEN: structural DO: A_STRUCTURAL_EVALUATE
155
-
156
- S_APPLY_VERDICT:
157
- -> S_LOAD_NEXT WHEN: proceed DO: add gate to passed_gates
158
- -> S_LOAD_NEXT WHEN: post-goal-audit + all sub-goals met DO: A_APPLY_GOAL_DONE
159
- -> S_LOAD_NEXT WHEN: post-goal-audit + unmet sub-goals DO: A_APPLY_GOAL_FIX
160
- -> S_FIX_LOOP WHEN: fix DO: clear passed_gates, increment retry
161
- -> S_PAUSED WHEN: escalate
162
- -> S_LOAD_NEXT WHEN: post-milestone + next milestone DO: A_ADVANCE_MILESTONE
163
- -> S_COMPLETE WHEN: post-milestone + no next
164
- -> S_PAUSED WHEN: post-debug-escalate (always, even -y)
165
- GUARD: retry >= max_retries -> force escalate
166
- GUARD: confidence < 60 AND proceed -> override to fix
167
- GUARD: confidence > 95 AND fix AND retry > 0 -> suggest proceed
168
-
169
- S_FIX_LOOP:
170
- -> S_LOAD_NEXT DO: A_INSERT_FIX_LOOP
171
-
172
- S_COMPLETE -> END DO: A_FINALIZE
173
- S_PAUSED -> END DO: A_PAUSE_SESSION
174
- S_FALLBACK -> S_PARSE_ROUTE WHEN: user input | -> END WHEN: cancel
175
-
176
- </transitions>
177
-
178
- <actions>
179
-
180
- ### A_INFER_POSITION
181
-
182
- **前置依赖**:A_RESOLVE_PHASE 已写入 `session.phase` 与 `session.phase_is_new`。
183
-
184
- **Intent-based override**: brainstorm pattern -> position = brainstorm.
185
-
186
- **Bootstrap detection**:
187
-
188
- | Condition | Position |
189
- |-----------|----------|
190
- | No .workflow/ + no source | brainstorm |
191
- | No .workflow/ + has source | init |
192
- | Has .workflow/ but no state.json | init |
193
- | Has state.json | phase-aware artifact inference |
194
-
195
- **Phase-aware artifact inference** (使用 `session.phase` + `session.phase_is_new`):
196
-
197
- | Condition | Position |
198
- |-----------|----------|
199
- | `phase_is_new == true` (intent 派生的新 phase, state.json 中无) | **`analyze`** (强制从头起) |
200
- | no milestones defined or no roadmap.md | `roadmap` |
201
- | `phase == null` (brainstorm/init/roadmap 已由 override 决定) | n/a |
202
- | phase 已存在 + no artifacts for that phase | `analyze` |
203
- | phase 已存在 + latest artifact = analyze | `plan` |
204
- | phase 已存在 + latest artifact = plan | `execute` |
205
- | phase 已存在 + latest artifact = execute | `verify` |
206
- | phase 已存在 + latest artifact = verify | refine from result files |
207
-
208
- **关键不变量**:artifact 过滤必须用 `session.phase`(A_RESOLVE_PHASE 已写入),而不是 state.json.current_phase。当 `phase_is_new` 时跳过过滤直接走 `analyze`,避免错用其他 phase artifact 推断位置。
209
-
210
- **Refine from verify results:**
211
-
212
- | Condition | Position |
213
- |-----------|----------|
214
- | verification.json: passed==false or gaps[] non-empty | `verify-failed` |
215
- | passed==true, no review.json, has auto-test report | `review` |
216
- | passed==true, no review.json, no auto-test report | `business-test` (full) / `review` (standard/quick) |
217
- | review.json: verdict=="BLOCK" | `review-failed` |
218
- | review.json: verdict!="BLOCK" | `test` |
219
- | uat.md: all passed | `milestone-audit` |
220
- | uat.md: has failures | `test-failed` |
221
-
222
- ### A_RESOLVE_PHASE
223
-
224
- **前置于 A_INFER_POSITION**——position 推断需要先知道 target phase 是否在 state.json 中已存在。
225
-
226
- **Priority (产出 `phase` + `phase_is_new` 二元组):**
227
-
228
- | Step | 行为 | phase_is_new |
229
- |------|------|--------------|
230
- | 1 | intent 匹配 `phase\s*(\d+)` 正则 → 取 state.json 中对应 phase | false |
231
- | 2 | intent 派生短语(如 "docs-site-redesign", "auth-refactor")→ 在 state.json.milestones[*].phases / artifacts[*].path 中查找 | false (匹配) / **true (无匹配)** |
232
- | 3 | 未派生 → 取最新 in-progress artifact 的 phase | false |
233
- | 4 | 仍无 → state.json 首个 incomplete phase | false |
234
- | 5 | position 将是 brainstorm/init/roadmap phase = null | n/a |
235
- | 6 | 仍模糊 `request_user_input`(新 phase / 已存在 phase 二选一) | 由用户回答 |
236
-
237
- **写入 session**: `phase` (string 或 null) + `phase_is_new` (bool)。`phase_is_new=true` 表示当前 milestone 下需要为该 phase 创建全套生命周期。
238
-
239
- **新派生 phase 时 milestone 处理**:
240
- - state.json 当前 milestone 仍 active → 沿用,仅新增 phase
241
- - intent 派生新 milestone 名 → 仅写入 session 作标签;state.json.milestones 由后续 `maestro-roadmap` / `maestro-milestone-release` 真实创建。禁止 session 层面虚构 milestone 直接改 state.json
242
-
243
- ### A_DETERMINE_QUALITY_MODE
244
-
245
- | Condition | Mode | Pipeline |
246
- |-----------|------|----------|
247
- | Has REQ-*.md + phase scope | full | verify -> business-test -> review -> test-gen -> test |
248
- | Default | standard | verify -> review -> test (test-gen if coverage < 80%) |
249
- | User --quality quick | quick | verify -> review --tier quick |
250
-
251
- ### A_DECOMPOSE_TASKS
252
-
253
- Build the boundary contract + outcome sub-goal checklist, then **register it as a Codex goal via the built-in tool**. Runs once at session creation, before chain build. Skipped when position in {brainstorm, init}.
254
-
255
- **1. Classify intent breadth:**
256
-
257
- | Pattern | Breadth | Clarify? |
258
- |---------|---------|----------|
259
- | 重构/全面/重写/重做/整体/迁移 · overhaul/migrate/rewrite/revamp | broad | MUST (ignores auto_mode) |
260
- | named single file/function/bug, "fix X", "add Y to Z" | narrow | skip — auto-derive |
261
- | otherwise | medium | clarify unless auto_mode |
262
-
263
- **2. Clarify boundary** (broad/medium) — `request_user_input`, ≤3 rounds, options pre-filled from intent + a quick Glob/Grep scan of the target module:
264
-
265
- | Round | Question | Drives |
266
- |-------|----------|--------|
267
- | Scope | 哪些目录/文件/层在范围内?明确排除什么? | boundary_contract.in_scope / out_of_scope |
268
- | Constraints | 必须向后兼容?公共 API 冻结?行为/性能预算?测试门槛? | boundary_contract.constraints + execution_criteria |
269
- | Done | 什么可观测结果算"完成"?(如:测试全绿 + 行为零变更 + X 指标) | boundary_contract.definition_of_done |
270
-
271
- narrow → derive defaults from intent + codebase, skip questions.
272
-
273
- **3. Derive `execution_criteria`** (执行准则 — 3-6 short imperative rules every step obeys): backward-compat stance, scope-freeze ("只改请求范围"), test/coverage bar, fix-don't-hide, incremental commit.
274
-
275
- **4. Derive `task_decomposition`** (子目标清单 — outcome-oriented, NOT lifecycle stages). Each entry:
276
- ```json
277
- { "id": "G1", "goal": "<deliverable>", "boundary": "<in/out note>",
278
- "done_when": "<objectively checkable condition>",
279
- "evidence": "verification.json|review.json|uat.md|<test path>",
280
- "lifecycle": ["analyze","execute","verify"], "status": "pending" }
281
- ```
282
- **Cleverness rule**: `done_when` MUST be objectively verifiable and SHOULD reference an artifact ralph already produces, so `post-goal-audit` can re-verify after context loss. Map each sub-goal to the lifecycle phase(s) producing its evidence — the existing pipeline becomes the machinery that satisfies the goals.
283
-
284
- **5. Persist** (additive) into session: `boundary_contract`, `execution_criteria`, `task_decomposition`, `goal_checklist_path` = `{session_dir}/goal-checklist.md`. Write the checklist file (see Appendix: Goal Checklist Template).
285
-
286
- **6. Register goal via `create_goal`:**
287
- ```
288
- create_goal({
289
- objective: "Ralph: {intent} — converge all {N} sub-goals within boundary",
290
- success_criteria: task_decomposition.map(g => `${g.id}: ${g.done_when}`),
291
- constraints: [...execution_criteria, "stay within boundary_contract"]
292
- })
293
- ```
294
- Goal stays bound until A_APPLY_GOAL_DONE / A_FINALIZE calls `update_goal`. Skipped feature → no create_goal beyond the default lifecycle goal in A_CREATE_SESSION.
295
-
296
- ### A_BUILD_STEPS
297
-
298
- **Lifecycle stages:**
299
-
300
- | Stage | Skill | Barrier | Quality Mode | Decision after |
301
- |-------|-------|---------|-------------|----------------|
302
- | brainstorm | maestro-brainstorm "{intent}" | yes | all | — |
303
- | init | maestro-init | no | all | — |
304
- | roadmap | maestro-roadmap "{intent}" | yes | all | — |
305
- | analyze | maestro-analyze {phase} | yes | all | — |
306
- | plan | maestro-plan {phase} | yes | all | — |
307
- | execute | maestro-execute {phase} | yes | all | — |
308
- | verify | maestro-verify {phase} | no | all | post-verify |
309
- | business-test | quality-auto-test {phase} | no | full only | post-business-test |
310
- | review | quality-review {phase} | no | all (quick: --tier quick) | post-review |
311
- | test-gen | quality-auto-test {phase} | no | full; standard if coverage<80% | — |
312
- | test | quality-test {phase} | no | full, standard | post-test |
313
- | milestone-audit | maestro-milestone-audit | no | all | |
314
- | goal-audit | *(decision-only, no skill)* | | all (only if decomposed) | post-goal-audit |
315
- | milestone-complete | maestro-milestone-complete | no | all | post-milestone |
316
-
317
- **Build rules (按顺序应用):**
318
- 1. **起点**:从 `session.lifecycle_position` 开始;不读 `state.json.current_phase`
319
- 2. **跳过已完成**:跳过 (session.phase + current_milestone) 下已完成的 artifact 对应 stage;artifact 过滤按 `session.phase`,不按 state.json 当前 phase
320
- 3. **quality_mode 过滤**:按 `session.quality_mode` 排除上表 Quality Mode 列不包含该模式的 stage
321
- 4. Quick mode 特例:`review` 追加 `--tier quick`;跳过 `business-test`, `test-gen`, `test`
322
- 5. **决策节点**:每个 Decision after 非空的 stage 之后插入 `{ type: "decision", decision: "<gate>", retry_count: 0, max_retries: 2 }`
323
- 6. **goal-audit 插入**:当且仅当 `task_decomposition` 存在 → 在最后一个 evidence-producing stage(verify/review/test)之后、`milestone-complete` 之前插入 `decision:post-goal-audit`
324
- 7. **终点硬约束**:chain 必须以 `milestone-complete` 步骤结尾(除非 `lifecycle_position` 已是 `milestone-complete` 之后的状态)。生成器在收尾时不论 quality_mode 都必须 append 该 step
325
- 8. **初始 goal_ref 传播**:若 `task_decomposition` 存在,遍历每个新建 step:
326
- - 计算 `step.stage`(execute/verify/review 等)
327
- - 对每个 `g task_decomposition`:若 `step.stage g.lifecycle` `step.goal_ref = g.id`
328
- - 多 G 匹配 → 取 id 字典序最小者;保证 verify/review 等共用 lifecycle 的 step 也有可追溯标签
329
- - decision 节点不打 goal_ref(goal-audit 自身除外)
330
- 9. Step type for runnable stages = `"skill"`(直接 in-context 执行,无 spawn);`barrier` 字段保留为可选 metadata,执行始终顺序
331
- 10. Args `{phase}`, `{intent}`, `{dirs}` 占位符 — 执行时解析
332
- 11. `auto_mode=true` 时给所有 skill args 追加 `-y`(见 -y propagation table)
333
- 12. 动态插入的 step(A_APPLY_GOAL_FIX / A_INSERT_FIX_LOOP)同样按规则 8 打 `goal_ref` —— A_APPLY_GOAL_FIX 用触发它的 G{n}
334
-
335
- ### A_CREATE_SESSION
336
-
337
- 1. Write `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json` (see Session JSON Schema) include decomposition fields only if produced (additive)
338
- 2. Initialize tracking:
339
- - If decomposed: goal already registered by A_DECOMPOSE_TASKS. Else: `create_goal({ objective: "Ralph lifecycle: {quality_mode} mode, {N} steps from {lifecycle_position}" })`
340
- - `update_plan({ plan: steps.map(step => ({ step, status: "pending" })) })`
341
- 3. If decomposed: display sub-goal checklist summary (path + G-ids + done_when). Display chain overview.
342
-
343
- ### A_EXEC_STEP
344
-
345
- Direct in-context skill invocation **replaces the old spawn/wave/CSV mechanism**.
346
-
347
- 1. Conditional step eval: `check_coverage` read validation.json, skip step if ≥ threshold
348
- 2. Resolve `{phase}` / `{intent}` / `{dirs}` placeholders; arg enrichment (plan → `--dir {analysis_dir}`, execute → `--dir {plan_dir}`); append `-y` if auto_mode
349
- 3. Mark step `status="running"`, persist status.json + `update_plan` (this step → in_progress)
350
- 4. **Invoke the skill directly**: execute `$skill {resolved_args}` in the coordinator's own context (NO spawn_agents_on_csv, NO worker). Read its produced artifacts directly.
351
- 5. On success: capture summary + artifacts; mark step `status="done"`; update context (analyze→analysis_dir, plan→plan_dir, execute→exec_status, brainstorm→brainstorm_dir, roadmap→spec_session_id)
352
- 6. On failure: mark `status="failed"`; auto_mode → retry once → still failed → S_PAUSED
353
- 7. Persist status.json + `update_plan` after every step
354
-
355
- ### A_DELEGATE_EVALUATE
356
-
357
- 1. Resolve result files per decision type (post-verify: verification.json, post-business-test: report.json, post-review: review.json, post-test: uat.md + test-results.json)
358
- 2. Execute `maestro delegate` with analysis prompt → parse verdict: STATUS (proceed/fix/escalate), REASON, GAP_SUMMARY, CONFIDENCE_SCORE, WEAKEST_DIMENSION
359
- 3. Confidence adjustment: score < 60 + proceed → fix; score > 95 + fix + retry > 0 → suggest proceed
360
-
361
- ### A_GOAL_AUDIT_EVALUATE
362
-
363
- Re-checks sub-goals against `status.json` (source of truth). Runs only when `task_decomposition` present.
364
-
365
- 1. Read `session.task_decomposition` from status.json (NOT from checklist — checklist is just a view)
366
- 2. For each sub-goal `status != "done"`: resolve `evidence` artifact under current phase scratch dir
367
- 3. Delegate read-only audit:
368
- ```
369
- maestro delegate "PURPOSE: 审计未完成子目标,判定哪些已达成、哪些仍需补步骤
370
- TASK:
371
- 1. 读取 status.json.task_decomposition 中每个 status!=done 的子目标
372
- 2. 打开其 evidence 产物,对照 done_when 严格判定
373
- 3. 输出 met / unmet,unmet 给出差距与应回补 target_phase
374
- CONTEXT:
375
- status.json = {session_dir}/status.json
376
- checklist = {goal_checklist_path} (人类视图,仅供参考)
377
- evidence = {evidence artifacts}
378
- 执行准则 = {execution_criteria}
379
- 边界契约 = {boundary_contract}
380
- EXPECTED (单行 verdict 块):
381
- ---VERDICT---
382
- STATUS=all_met|has_unmet
383
- UNMET=[{id:G2,gap:'...',target_phase:execute}, ...]
384
- CONFIDENCE_SCORE=0-100
385
- ---END---
386
- CONSTRAINTS:
387
- - 只评估,不修改任何文件
388
- - 严格按 done_when;evidence 缺失 → unmet
389
- - 不得超出 boundary_contract
390
- "
391
- --role analyze --mode analysis
392
- ```
393
- 4. On result: parse UNMET。**status.json 为写入目标** —— 对每个已达成子目标置 `task_decomposition[i].status="done"` + `completed_at=now`,然后从 status.json 重渲染 checklist(见 Sync Rule)
394
- 5. Verdict: `all_met` A_APPLY_GOAL_DONE;`has_unmet` → A_APPLY_GOAL_FIX
395
- GUARD: retry_count >= max_retries AND still unmet escalate(插入 quality-debug,S_PAUSED 等人)
396
-
397
- ### A_STRUCTURAL_EVALUATE
398
-
399
- **post-milestone**: Read state.json next milestone update session (milestone, phase, reset gates), re-infer quality_mode, insert lifecycle steps. No next → complete.
400
- **post-debug-escalate**: Pause (always, even -y). Display: max retries reached, manual intervention needed.
401
-
402
- ### A_INSERT_FIX_LOOP
403
-
404
- Insert fix template by decision type after current position, reindex:
405
- - **post-verify**: debug plan --gaps execute verify → decision:post-verify
406
- - **post-business-test**: debug --from-business-test plan --gaps → execute → verify → decision:post-verify → auto-test → decision:post-business-test
407
- - **post-review**: debug plan --gaps execute verify decision:post-verify review decision:post-review
408
- - **post-test**: debug --from-uatplan --gaps → execute → verify → decision:post-verify → [auto-test + decision:post-business-test (full)] review → decision:post-review → [auto-test (full; standard if <80%)] → test → decision:post-test
409
-
410
- ### A_APPLY_GOAL_FIX
411
-
412
- **Dynamic step-growth core.** For every unmet sub-goal, inject scoped skill steps so `steps[]` grows toward convergence:
413
-
414
- 1. For each `unmet` sub-goal `G{n}` (grouped by `target_phase` to avoid duplicate runs), insert before the `goal-audit` node a scoped mini-loop (see Appendix: Fix-Loop Templates → post-goal-audit), each inserted step tagged `goal_ref: "G{n}"`, type `"skill"`
415
- 2. Re-append a fresh `decision:post-goal-audit {retry+1}` after inserted steps (re-loops until all met or max retries)
416
- 3. Reindex steps, increment retry_count, persist status.json + `update_plan` (steps[] grew)
417
- 4. Display: ◆ Goal audit: {k} sub-goals unmet → +{N} steps inserted (G{ids}), retry {r}/{max}
418
-
419
- ### A_APPLY_GOAL_DONE
420
-
421
- 1. status.json(真源):全部 `task_decomposition[*].status="done"` + `completed_at=now` + 顶层 `task_decomposition_all_done=true`
422
- 2. status.json 重渲染 `goal-checklist.md`(见 Sync Rule)—— 复选框全 `[x]`,文件末追加 `ALL_GOALS_DONE` 哨兵
423
- 3. `update_goal({ status: "complete" })` —— 释放分解 goal 约束
424
- 4. 标记 goal-audit decision 完成;继续到 `milestone-complete`
425
- 5. Display: ◆ Goal audit: 全部子目标达成 ✓ — status.json + checklist + goal 已同步
426
-
427
- ### A_ADVANCE_MILESTONE
428
-
429
- Update session: milestone, phase, reset passed_gates. Re-infer quality_mode. Build + insert new lifecycle steps for next milestone (re-append goal-audit before milestone-complete if decomposed).
430
-
431
- ### A_FINALIZE
432
-
433
- 1. Set `session.status = "completed"`, write status.json
434
- 2. Sync `update_plan`: all steps → "completed"
435
- 3. `update_goal({ status: "complete" })` — release goal constraint (idempotent if already released by A_APPLY_GOAL_DONE)
436
- 4. Display completion report
437
-
438
- ### A_PAUSE_SESSION
439
-
440
- 1. Set `session.status = "paused"`, write status.json
441
- 2. Do NOT call `update_goal` — goal stays bound for `execute`/`continue` resume
442
- 3. Display: use `$maestro-ralph execute` to continue
443
-
444
- ### A_SHOW_STATUS
445
-
446
- 1. Find latest ralph session
447
- 2. Display: Session, Status, Position, Quality mode, Progress, Current step
448
- 3. List steps: [✓] done, [▸] running, [ ] pending, [◆] decision (with goal_ref if set)
449
- 4. If `task_decomposition` present (else 跳过 — 向后兼容):
450
- ```
451
- Sub-goals ({done}/{total}) source: {session_dir}/status.json#/task_decomposition
452
- [x] G1 done_when={done_when} evidence={evidence}
453
- [ ] G2 done_when={done_when} evidence={evidence} ◀ unmet
454
- Checklist view: {goal_checklist_path} (从 status.json 重渲染)
455
- ```
456
- 状态直读 `status.json.task_decomposition[*].status`;checklist 是视图,冲突以 JSON 为准。
457
-
458
- </actions>
459
-
460
- </state_machine>
461
-
462
- <appendix>
463
-
464
- ### Session JSON Schema
465
-
466
- ```json
467
- {
468
- "session_id": "ralph-{YYYYMMDD-HHmmss}",
469
- "source": "ralph", "intent": "", "status": "running|paused|completed",
470
- "lifecycle_position": "", "phase": null, "phase_is_new": false, "milestone": null,
471
- "auto_mode": false,
472
- "quality_mode": "standard", // "full" | "standard" | "quick" — 由 A_DETERMINE_QUALITY_MODE 写入
473
- "passed_gates": [],
474
- "context": { "issue_id": null, "scratch_dir": null, "plan_dir": null, "analysis_dir": null, "brainstorm_dir": null },
475
- "steps": [{ "index": 0, "type": "skill|decision", "skill": "", "args": "", "barrier": false, "status": "pending", "goal_ref": null }],
476
- "waves": [], "current_step": 0,
477
-
478
- "_comment": "↓ OPTIONAL additive decomposition block. Absent → no decomposition; readers MUST tolerate missing keys. Never remove/rename above fields.",
479
- "boundary_contract": { "in_scope": [], "out_of_scope": [], "constraints": [], "definition_of_done": "" },
480
- "execution_criteria": [],
481
- "task_decomposition": [
482
- { "id": "G1", "goal": "", "boundary": "", "done_when": "", "evidence": "", "lifecycle": [], "status": "pending|done", "completed_at": null }
483
- ],
484
- "task_decomposition_all_done": false,
485
- "goal_checklist_path": "",
486
- "goal_checklist_synced_at": null
487
- }
488
- ```
489
-
490
- **扩展约定**:
491
- - Schema 加字段 = 可选(缺省 = 旧行为);不删/不改既有字段名。
492
- - `steps[]` 是活数组:`post-goal-audit` 与 `post-verify/review/test` 等决策节点按需追加+重排,子目标收敛即停。`goal_ref`(可选)回溯每条动态插入步骤所属子目标。`waves` 保留为空数组(spawning 已移除)。
493
-
494
- ### Goal Checklist Template (status.json projection)
495
-
496
- `{session_dir}/goal-checklist.md` 是 `status.json` 的只读投影:不要手改,永远从 JSON 重渲染。文件名在 session 内稳定(`create_goal` 注册的 success_criteria 始终可追溯)。
497
-
498
- ```markdown
499
- # Ralph Goal Checklist — {session_id}
500
- <!-- AUTO-GENERATED from status.json. Source: ../status.json#/task_decomposition -->
501
-
502
- > Intent : {intent}
503
- > Source : `{session_dir}/status.json` (authoritative)
504
- > Last sync : {ISO} Phase: {phase} Milestone: {milestone}
505
-
506
- ## Resume / 恢复入口
507
- **不要直接执行 skill,调用入口:**
508
- ```
509
- $maestro-ralph execute # $maestro-ralph continue
510
- ```
511
- coordinator 评估下一步门控,按顺序在 in-context 中调用各 skill。
512
-
513
- ## 执行准则 / Execution Criteria
514
- <!-- status.json#/execution_criteria -->
515
- - {criterion 1}
516
- - {criterion 2}
517
-
518
- ## 边界契约 / Boundary Contract
519
- <!-- status.json#/boundary_contract -->
520
- - In scope : {in_scope}
521
- - Out of scope : {out_of_scope}
522
- - Constraints : {constraints}
523
- - Definition of Done : {definition_of_done}
524
-
525
- ## 子目标 / Sub-goals ({done}/{total})
526
- <!-- status.json#/task_decomposition -->
527
- - [ ] G1 — {goal}
528
- done_when : {done_when}
529
- evidence : {evidence}
530
- lifecycle : {lifecycle}
531
- <!-- ref: status.json#/task_decomposition/0 status=pending -->
532
- - [x] G2 {goal}
533
- done_when : {done_when}
534
- evidence : {evidence}
535
- <!-- ref: status.json#/task_decomposition/1 status=done completed_at={ISO} -->
536
-
537
- <!-- A_APPLY_GOAL_DONE 在全部 status=done 时在文件末追加 ALL_GOALS_DONE -->
538
- ```
539
-
540
- ### Sync Rule (status.json goal-checklist.md)
541
-
542
- 单向投影;status.json 为真源;冲突时直接重渲染,不合并。
543
-
544
- 1. 只有 ralph coordinator `task_decomposition[*].status`;markdown 不可写入状态。
545
- 2. `task_decomposition` / `execution_criteria` / `boundary_contract` 任一变化 → 立即重渲染 checklist。
546
- 3. 全部 `status="done"` 文件末追加 `ALL_GOALS_DONE`。
547
- 4. checklist 缺失或漂移直接重渲染覆盖;视 markdown 为可丢弃产物。
548
- 5. coordinator 在 lifecycle 覆盖某子目标的 step 完成后,校验 evidence;满足则置 `status="done"` + 重渲染 + `update_goal` 进度。
549
-
550
- ### Fix-Loop Templates
551
-
552
- - **post-verify**: `$quality-debug "{gap}"` `$maestro-plan --gaps {phase}` → `$maestro-execute {phase}` → `$maestro-verify {phase}` → decision:post-verify {retry+1}
553
- - **post-business-test**: debug --from-business-test → plan --gaps → execute → verify → decision:post-verify {0} auto-test → decision:post-business-test {retry+1}
554
- - **post-review**: debug → plan --gaps → execute → review → decision:post-review {retry+1}
555
- - **post-test**: debug --from-uat → plan --gaps → execute → verify → decision:post-verify {0} → auto-test → decision:post-business-test {0} → review → decision:post-review {0} → auto-test → test → decision:post-test {retry+1}
556
- - **post-goal-audit** (per unmet sub-goal group — dynamically grows steps[]):
557
- ```
558
- # for each unmet G{n}, scoped to its target_phase:
559
- $maestro-plan --gaps {target_phase} "G{n}: {gap}" [goal_ref: G{n}]
560
- $maestro-execute {target_phase} [goal_ref: G{n}]
561
- $maestro-verify {target_phase} [goal_ref: G{n}]
562
- # after all unmet groups inserted:
563
- decision:post-goal-audit {retry+1}
564
- ```
565
- Only unmet sub-goals' phases re-run (no full-pipeline replay); loop exits on `all_met` (→ A_APPLY_GOAL_DONE) or retry max (→ escalate). Growth bounded.
566
-
567
- ### Error Codes
568
-
569
- | Condition | Recovery |
570
- |-----------|----------|
571
- | No intent and no running session | Prompt for intent |
572
- | Cannot infer lifecycle position | Show raw state, ask user |
573
- | Artifact dir not found for decision | Show glob results, ask user |
574
- | Delegate verdict parse failed | Fallback: treat as "fix" |
575
- | Step skill invocation failed | Mark step failed; auto_mode retry once then pause |
576
- | No session for execute/continue | Suggest $maestro-ralph "intent" |
577
-
578
- ### Success Criteria
579
-
580
- - [ ] Phase 先于 position 解析(S_RESOLVE_PHASE → S_INFER → S_QUALITY_MODE);phase_is_new 标记写入 session
581
- - [ ] phase_is_new=true 时 lifecycle_position 强制为 `analyze`(禁用其他 phase 的 artifact 推断)
582
- - [ ] artifact 过滤始终按 session.phase(不读 state.json.current_phase)
583
- - [ ] Lifecycle position inferred from bootstrap + artifact chain + result files
584
- - [ ] Quality mode governs step generation
585
- - [ ] Decomposition runs as initial step; broad intent boundary-clarified via ≤3 questions (ignores auto_mode); narrow auto-derives
586
- - [ ] Goal registered via built-in `create_goal` with sub-goal success criteria
587
- - [ ] status.json enriched additively with boundary_contract + execution_criteria + task_decomposition; absent = old behavior preserved
588
- - [ ] status.json 为唯一真源;goal-checklist.md 是从 JSON 重渲染的投影视图(Resume 区块指向 `$maestro-ralph execute`)
589
- - [ ] task_decomposition 变更触发 checklist 重渲染;ALL_GOALS_DONE 仅在 all done 时追加;JSON pointer 注释回溯每个条目
590
- - [ ] post-goal-audit decision inserted before milestone-complete (only when decomposed)
591
- - [ ] Unmet sub-goals DYNAMICALLY grow steps[] via scoped per-goal mini-loops (goal_ref tagged), loop until all_met or max retries → escalate
592
- - [ ] Skills invoked DIRECTLY in-context — NO spawn_agents_on_csv, NO wave/CSV/worker
593
- - [ ] Sequential execution; status.json + update_plan persisted after every step and decision
594
- - [ ] Chain 末端硬约束:必须以 `milestone-complete` 结尾(goal-audit decision 紧前)
595
- - [ ] 初始构建按 task_decomposition[*].lifecycle 给每个 step 打 goal_ref(verify/review 等共用 lifecycle 的 step 也有标签)
596
- - [ ] Quality-gate / goal-gate decisions delegate-evaluated via maestro delegate --role analyze
597
- - [ ] Confidence-based verdict adjustment applied
598
- - [ ] -y: auto-follow verdict, no STOP (except post-debug-escalate)
599
- - [ ] update_goal released on convergence (A_APPLY_GOAL_DONE / A_FINALIZE); held while paused
600
-
601
- </appendix>
1
+ ---
2
+ name: maestro-ralph
3
+ description: Use when the optimal command sequence is unclear and needs automated state-based determination
4
+ argument-hint: "<intent> [-y] | status | continue"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+ <purpose>
8
+ Closed-loop decision engine for the maestro workflow lifecycle.
9
+ Reads project state infers position builds adaptive chain → delegates execution.
10
+
11
+ Entry points:
12
+ - **`/maestro-ralph "intent"`** New session: infer decompose build → execute
13
+ - **`/maestro-ralph continue`** — Resume via maestro-ralph-execute
14
+ - **`/maestro-ralph status`** Display session progress
15
+
16
+ Initial decomposition (S_DECOMPOSE): boundary-clarified via ≤3 questions for broad intents (重构/全面/迁移/重写). 写入 status.json 的 `boundary_contract` / `execution_criteria` / `task_decomposition`,附 `/goal` prompt。
17
+
18
+ Node types:
19
+ - **internal** (default): ralph-execute `Read({command_path})` 命令 .md,按内容内联执行
20
+ - **decision**: ralph 评估
21
+ - **external**: 仅在显式声明时使用(`maestro delegate --to claude`)
22
+
23
+ Key difference from maestro coordinator:
24
+ - maestro: static chain → one-time selection → runs all steps
25
+ - ralph: living chain → decision nodes re-evaluate → chain grows/shrinks dynamically
26
+
27
+ Session: `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json`
28
+ Mutual invocation with `/maestro-ralph-execute` forms a self-perpetuating work loop.
29
+
30
+ ### Execution Flow
31
+
32
+ ```
33
+ /maestro-ralph "intent" ─▶ ralph infer decompose build chain
34
+ resolves command_path per step
35
+ │ writes status.json
36
+ │ emits /goal prompt
37
+
38
+ ralph-execute ◀─┐ internal → Read(command_path) inline
39
+ │ │ decision Skill("maestro-ralph")
40
+ └─────────┘ writes step.completion_confirmed
41
+ loop until all completion_confirmed | paused
42
+ ```
43
+ </purpose>
44
+
45
+ <context>
46
+ $ARGUMENTS — intent text, flags, or keywords.
47
+
48
+ **Parse:**
49
+ ```
50
+ -y flag → auto_confirm = true
51
+ .md/.txt path input_doc (supplementary context only, NEVER substitutes lifecycle stages)
52
+ Remaining → intent
53
+ ```
54
+
55
+ **State files:**
56
+ - `.workflow/state.json` artifact registry, milestones, phases
57
+ - `.workflow/roadmap.md` milestone/phase structure
58
+ - `.workflow/.maestro/ralph-*/status.json` ralph session state
59
+ </context>
60
+
61
+ <invariants>
62
+ 1. **Ralph never executes steps** only creates sessions and evaluates decisions
63
+ 2. **Handoff via Skill("maestro-ralph-execute")** at session creation and after decision evaluation
64
+ 3. **Decision delegates read-only** — `maestro delegate --role analyze --mode analysis`
65
+ 4. **Default type = internal** `external` 仅显式标注时出现,build 不默认生成
66
+ 5. **status.json 是唯一真源** — 不生成 markdown 清单或侧文件
67
+ 6. **每个 step 必须 `completion_confirmed: true`** — 基于 `--- COMPLETION STATUS ---` 的 `STATUS: DONE`;缺失则视为未完成
68
+ 7. **command_path 在 A_BUILD_STEPS 解析** — 全局优先 `~/.claude/commands/{name}.md`,fallback 项目 `.claude/commands/{name}.md`,写入 status.json
69
+ 8. **Decomposition is outcome-oriented** — sub-goals 为可观测交付,禁止 lifecycle 复刻;`/goal` 用户绑定,ralph 只发提示词
70
+ 9. **planning_mode governs arg granularity** — `unified` skill args `{phase}`;`independent` `{phase}`
71
+ 10. **task_decomposition 驱动 steps[] 动态生长**`post-goal-audit` unmet 子目标插入 scoped mini-loop;字段可选/累加,既有字段不删不改
72
+ </invariants>
73
+
74
+ <state_machine>
75
+
76
+ <states>
77
+ S_PARSE_ROUTE — 解析参数、路由入口 PERSIST:
78
+ S_STATUS — 显示 session 进度 PERSIST: —
79
+ S_CONTINUE — 恢复执行 PERSIST: —
80
+ S_RESOLVE_PHASE — 解析 phase + phase_is_new + D-007 milestone PERSIST: session.phase, session.phase_is_new, session.milestone
81
+ S_INFER — 基于已解析 phase 推断 lifecycle_position PERSIST: session.lifecycle_position
82
+ S_RESOLVE_SCOPE — 读 macro analyze conclusions.scope_verdict PERSIST: session.scope_verdict, session.analyze_macro_id
83
+ S_QUALITY_MODE — 决定质量管线模式 PERSIST: session.quality_mode
84
+ S_PLANNING_MODE — 决定统一/独立规划模式 PERSIST: session.planning_mode
85
+ S_DECOMPOSE — 边界澄清、写执行准则+子目标清单 PERSIST: session.boundary_contract, .execution_criteria, .task_decomposition
86
+ S_BUILD_CHAIN — 构建步骤链 PERSIST: session.steps[]
87
+ S_CREATE_SESSION — status.json PERSIST: session (全量)
88
+ S_CONFIRM — 用户确认 PERSIST:
89
+ S_DISPATCH — 移交 maestro-ralph-execute PERSIST:
90
+ S_DECISION_EVAL — 委托评估质量门 PERSIST:
91
+ S_APPLY_VERDICT — 应用裁决 + 插入命令 PERSIST: session.steps[], session.passed_gates[]
92
+ S_FALLBACK — 请求用户输入 PERSIST:
93
+ </states>
94
+
95
+ <transitions>
96
+
97
+ S_PARSE_ROUTE:
98
+ S_STATUS WHEN: intent == "status"
99
+ S_CONTINUE WHEN: intent == "continue"
100
+ → S_DECISION_EVAL WHEN: running session with decision step in "running" status
101
+ → S_RESOLVE_PHASE WHEN: intent is non-empty ← phase 必须先于 position
102
+ → S_FALLBACK WHEN: no intent AND no running session
103
+
104
+ S_STATUS:
105
+ END DO: A_SHOW_STATUS
106
+
107
+ S_CONTINUE:
108
+ S_DISPATCH WHEN: running session found
109
+ S_FALLBACK WHEN: no running session DO: display "无运行中的 ralph 会话"
110
+
111
+ S_RESOLVE_PHASE:
112
+ → S_INFER WHEN: phase resolved or null DO: A_RESOLVE_PHASE
113
+ → S_FALLBACK WHEN: ambiguous
114
+ GUARD: auto_confirm does NOT skip phase ambiguity
115
+
116
+ S_INFER:
117
+ S_RESOLVE_SCOPE WHEN: position resolved DO: A_INFER_POSITION
118
+ S_FALLBACK WHEN: cannot infer
119
+
120
+ S_RESOLVE_SCOPE:
121
+ S_QUALITY_MODE DO: A_RESOLVE_SCOPE_VERDICT
122
+ GUARD: position ∈ {brainstorm, blueprint, init} → skip (scope_verdict = null)
123
+
124
+ S_QUALITY_MODE:
125
+ S_PLANNING_MODE DO: A_DETERMINE_QUALITY_MODE
126
+
127
+ S_PLANNING_MODE:
128
+ → S_DECOMPOSE DO: A_DETERMINE_PLANNING_MODE
129
+ GUARD: lifecycle_position ∈ {brainstorm, blueprint, init, analyze-macro, roadmap} → skip (force independent)
130
+
131
+ S_DECOMPOSE:
132
+ → S_BUILD_CHAIN DO: A_DECOMPOSE_TASKS
133
+ GUARD: broad intent → MUST clarify boundary even if auto_confirm
134
+ GUARD: narrow intent → auto-derive, skip questions
135
+ GUARD: position ∈ {brainstorm, blueprint, init} → skip decomposition
136
+
137
+ S_BUILD_CHAIN:
138
+ S_CREATE_SESSION DO: A_BUILD_STEPS
139
+
140
+ S_CREATE_SESSION:
141
+ → S_CONFIRM WHEN: not auto_confirm DO: A_CREATE_SESSION
142
+ → S_DISPATCH WHEN: auto_confirm DO: A_CREATE_SESSION
143
+
144
+ S_CONFIRM:
145
+ S_DISPATCH WHEN: user selects "Proceed"
146
+ → S_BUILD_CHAIN WHEN: user selects "Edit"
147
+ → END WHEN: user selects "Cancel"
148
+
149
+ S_DISPATCH:
150
+ → END DO: Skill({ skill: "maestro-ralph-execute" })
151
+
152
+ S_DECISION_EVAL:
153
+ S_APPLY_VERDICT WHEN: quality-gate (post-verify, post-business-test, post-review, post-test)
154
+ DO: A_DELEGATE_EVALUATE
155
+ → S_APPLY_VERDICT WHEN: goal-gate (post-goal-audit)
156
+ DO: A_GOAL_AUDIT_EVALUATE
157
+ S_APPLY_VERDICT WHEN: scope-gate (post-analyze-scope)
158
+ DO: A_SCOPE_EVALUATE
159
+ S_APPLY_VERDICT WHEN: structural (post-milestone, post-debug-escalate)
160
+ DO: A_STRUCTURAL_EVALUATE
161
+
162
+ S_APPLY_VERDICT:
163
+ S_DISPATCH WHEN: verdict == "proceed" DO: A_APPLY_PROCEED
164
+ S_DISPATCH WHEN: post-goal-audit + unmet sub-goals DO: A_APPLY_GOAL_FIX
165
+ → S_DISPATCH WHEN: post-goal-audit + all sub-goals met DO: A_APPLY_GOAL_DONE
166
+ → S_DISPATCH WHEN: post-analyze-scope DO: A_APPLY_SCOPE_VERDICT
167
+ → S_DISPATCH WHEN: verdict == "fix" DO: A_APPLY_FIX
168
+ → S_DISPATCH WHEN: verdict == "escalate" DO: A_APPLY_ESCALATE
169
+ → S_DISPATCH WHEN: post-milestone + next milestone DO: A_ADVANCE_MILESTONE
170
+ END WHEN: post-milestone + no next milestone DO: mark completed
171
+ → END WHEN: post-debug-escalate (always STOP) DO: A_PAUSE_ESCALATE
172
+ GUARD: retry_count >= max_retries → force escalate
173
+ GUARD: confidence_score < 60 AND proceed → override to fix
174
+ GUARD: confidence_score > 95 AND fix AND retry > 0 → suggest proceed
175
+ GUARD: auto_confirm → skip user prompt, apply adjusted verdict
176
+ GUARD: not auto_confirm → AskUserQuestion with override options
177
+
178
+ S_FALLBACK:
179
+ → S_PARSE_ROUTE WHEN: user provides input DO: AskUserQuestion
180
+ END WHEN: user cancels
181
+
182
+ </transitions>
183
+
184
+ <actions>
185
+
186
+ ### A_SHOW_STATUS
187
+
188
+ 1. Find latest ralph session (by created_at)
189
+ 2. Display: Session, Status, Position, Progress, Current step
190
+ 3. List steps: [✓] completion_confirmed, [▸] current, [ ] pending, [◆] decision;附 `command_scope`(global/project) + `command_path`
191
+ 4. If `task_decomposition` present (absent skip):
192
+ ```
193
+ Sub-goals ({done}/{total}) source: {session_dir}/status.json#/task_decomposition
194
+ [x] G1 done_when={done_when} evidence={evidence} confirmed={completion_confirmed}
195
+ [ ] G2 done_when={done_when} evidence={evidence} confirmed=false unmet
196
+ ```
197
+
198
+ ### A_RESOLVE_PHASE
199
+
200
+ 前置于 A_INFER_POSITION。产出 `phase` + `phase_is_new` + `milestone`(D-007 反查)三元组。
201
+
202
+ **Priority:**
203
+
204
+ | Step | 行为 | phase_is_new |
205
+ |------|------|--------------|
206
+ | 1 | intent 匹配 `phase\s*(\d+)` state.json 对应 phase | false |
207
+ | 2 | intent 派生短语 → 在 `state.json.milestones[*].phase_slugs` / `artifacts[*].path` 查找 | false (匹配) / true (无匹配) |
208
+ | 3 | 未派生 取最新 in-progress artifact phase | false |
209
+ | 4 | 仍无 → state.json 首个 incomplete phase | false |
210
+ | 5 | position 将是 brainstorm/blueprint/init/roadmap/analyze-macro → phase = null | n/a |
211
+ | 6 | 仍模糊 → `AskUserQuestion` | 由用户回答确定 |
212
+
213
+ **D-007 Phase→Milestone 反查**(数字 phase 已解析时):
214
+ ```
215
+ resolve_milestone(phase_number):
216
+ for ms in state.json.milestones:
217
+ if str(phase_number) in ms.phase_slugs: return ms.id
218
+ return state.json.current_milestone # fallback
219
+ ```
220
+ 写入 `session.milestone`;禁止直接使用 `current_milestone` 当做 phase 所属 milestone。
221
+
222
+ **写入 session**: `phase`, `phase_is_new`, `milestone`。
223
+
224
+ **新派生 phase milestone 处理**:
225
+ - state.json 当前 milestone 仍 active → 沿用,新增 phase
226
+ - intent 派生新 milestone 名 → 写入 session 仅作标签;`state.json.milestones``maestro-roadmap` / `maestro-milestone-release` 创建
227
+
228
+ ### A_INFER_POSITION
229
+
230
+ **Intent-based overrides** (按顺序匹配,先命中先用):
231
+
232
+ | Pattern | Position |
233
+ |---------|----------|
234
+ | brainstorm / 头脑风暴 / 探索 / ideate / 设计思路 | `brainstorm` |
235
+ | blueprint / 规格 / 正式文档 / spec-generate / 7-phase | `blueprint` |
236
+ | broad/medium intent 无数字 phase (重构/全面/重写/迁移/新功能 X) | `analyze-macro` |
237
+
238
+ **Bootstrap detection:**
239
+
240
+ | Condition | Position |
241
+ |-----------|----------|
242
+ | No `.workflow/` + no source files | `brainstorm` |
243
+ | No `.workflow/` + has source files | `init` |
244
+ | Has `.workflow/` but no state.json | `init` |
245
+ | Has state.json | phase-aware artifact inference |
246
+
247
+ **Phase-aware artifact inference** (使用 A_RESOLVE_PHASE 已写入的 `session.phase` + `session.phase_is_new`):
248
+
249
+ | Condition | Position |
250
+ |-----------|----------|
251
+ | `phase_is_new == true` (新 phase) | `analyze` |
252
+ | no milestones AND no roadmap.md AND has analyze macro artifact | `roadmap` |
253
+ | no milestones AND no roadmap.md AND no analyze artifact | `analyze-macro` |
254
+ | `phase == null` (brainstorm/blueprint/init/roadmap/analyze-macro override 已定) | n/a |
255
+ | phase 已存在 + 无任何 artifact | `analyze` |
256
+ | phase 已存在 + 最新 artifact = analyze | `plan` |
257
+ | phase 已存在 + 最新 artifact = plan | `execute` |
258
+ | phase 已存在 + 最新 artifact = execute | `verify` |
259
+ | phase 已存在 + 最新 artifact = verify | refine from result files |
260
+
261
+ **关键不变量**:artifact 过滤按 `session.phase`,不读 `state.json.current_phase`。`phase_is_new` 直接 `analyze`。
262
+
263
+ ### A_RESOLVE_SCOPE_VERDICT
264
+
265
+ 仅当 `lifecycle_position {analyze-macro, roadmap, plan}` 且存在最新 analyze artifact 时执行。
266
+
267
+ 1. 定位最新 macro analyze artifact(`type=="analyze"` 且 `scope=="macro"`,按 created_at DESC)→ 记 `session.analyze_macro_id = ANL-xxx`
268
+ 2. `{artifact_path}/conclusions.json` `scope_verdict` 字段(`large | medium | small`)
269
+ 3. 写入 `session.scope_verdict`;缺失时设 `unknown`
270
+ 4. 路由建议(A_BUILD_STEPS 据此决定是否插入 roadmap、plan 是否走 `--from`):
271
+
272
+ | scope_verdict | 链路 |
273
+ |---------------|------|
274
+ | `large` | analyze-macro → roadmap → analyze → plan → execute → ... |
275
+ | `medium` / `small` | analyze-macro plan --from analyze:{ANL_ID} → execute → ...(跳过 roadmap + analyze-phase) |
276
+ | `unknown` | 默认走 large 路径,post-analyze-scope 决策节点再纠正 |
277
+
278
+ **Refine from verify results:**
279
+
280
+ | Condition | Position |
281
+ |-----------|----------|
282
+ | verification.json: passed==false or gaps[] | `verify-failed` |
283
+ | passed==true, no review.json | `business-test` |
284
+ | review.json: verdict=="BLOCK" | `review-failed` |
285
+ | review.json: verdict!="BLOCK" | `test` |
286
+ | uat.md: all passed | `milestone-audit` |
287
+ | uat.md: has failures | `test-failed` |
288
+
289
+ ### A_DETERMINE_QUALITY_MODE
290
+
291
+ 决定下游质量管线长度。读 `session.quality_mode_override`(CLI 标志 `--quality`),无则按规则推断:
292
+
293
+ | Condition | Mode | Pipeline (verify 之后) |
294
+ |-----------|------|-------------------------|
295
+ | Has `specs/REQ-*.md` + 当前 phase 业务范围明确 | `full` | business-test → review → test-gen → test |
296
+ | Default | `standard` | review → test-gen (当 coverage<80%) → test |
297
+ | `--quality quick` | `quick` | review --tier quick |
298
+
299
+ 写入 `session.quality_mode`。A_BUILD_STEPS 据此过滤 stage(见下)。
300
+
301
+ ### A_DETERMINE_PLANNING_MODE
302
+
303
+ 决定里程碑的规划粒度:一次性规划整个里程碑(统一)还是逐 phase 走完整生命周期(独立)。
304
+
305
+ **Auto-resolve rules (按优先级):**
306
+
307
+ | Condition | Mode | Reason |
308
+ |-----------|------|--------|
309
+ | lifecycle_position {brainstorm, init, roadmap} | `independent` | 前期阶段不涉及多 phase 规划 |
310
+ | `phase_is_new == true` | `independent` | phase 尚无里程碑上下文 |
311
+ | intent 显式指定 phase 编号(如 "phase 2"、"P3") | `independent` | 用户明确针对单个 phase |
312
+ | milestone 仅含 1 phase(读 state.json) | `independent` | 统一无意义 |
313
+ | milestone 含多个 phase + `auto_confirm` | `unified` | 自动模式倾向高效 |
314
+ | milestone 含多个 phase + `auto_confirm` | AskUserQuestion | 征询用户选择 |
315
+
316
+ **AskUserQuestion** (仅当 milestone 含 ≥2 phase 且非 auto_confirm):
317
+
318
+ ```
319
+ question: "当前里程碑含 {N} phase,选择规划模式?"
320
+ options:
321
+ - label: "统一规划 (Recommended)"
322
+ description: "一次性分析+规划整个里程碑所有 phase,analyze/plan 走里程碑级,适合 phase 间关联紧密"
323
+ - label: "独立规划"
324
+ description: "逐个 phase 走完整生命周期(analyze→plan→execute→verify→...),适合 phase 间独立性高"
325
+ ```
326
+
327
+ 写入 `session.planning_mode`(`"unified"` `"independent"`)。`A_BUILD_STEPS` 据此决定 skill args 是否携带 `{phase}` 占位符。
328
+
329
+ ### A_DECOMPOSE_TASKS
330
+
331
+ Runs once before chain build; additive to status.json.
332
+
333
+ **1. Classify intent breadth:**
334
+
335
+ | Pattern | Breadth | Clarify? |
336
+ |---------|---------|----------|
337
+ | 重构/全面/重写/重做/整体/迁移 · overhaul/migrate/rewrite/revamp | broad | MUST (ignores auto_confirm) |
338
+ | named single file/function/bug, "fix X", "add Y to Z" | narrow | skip — auto-derive |
339
+ | otherwise | medium | clarify unless auto_confirm |
340
+
341
+ **2. Clarify boundary** (broad/medium) `AskUserQuestion`, ≤3 rounds, options pre-filled from intent + a quick Glob/Grep scan of the target module:
342
+
343
+ | Round | Question | Drives |
344
+ |-------|----------|--------|
345
+ | Scope | 哪些目录/文件/层在范围内?明确排除什么? | boundary_contract.in_scope / out_of_scope |
346
+ | Constraints | 必须向后兼容?公共 API 冻结?行为/性能预算?测试门槛? | boundary_contract.constraints + execution_criteria |
347
+ | Done | 什么可观测结果算"完成"?(如:测试全绿 + 行为零变更 + X 指标) | boundary_contract.definition_of_done |
348
+
349
+ narrow derive defaults from intent + codebase, skip questions.
350
+
351
+ **3. Derive `execution_criteria`**: backward-compat、scope-freeze、test/coverage bar、fix-don't-hide、incremental commit。
352
+
353
+ **4. Derive `task_decomposition`** (子目标清单 outcome-oriented, NOT lifecycle stages). Each entry:
354
+ ```json
355
+ { "id": "G1", "goal": "<deliverable>", "boundary": "<in/out note>",
356
+ "done_when": "<objectively checkable condition>",
357
+ "evidence": "verification.json|review.json|uat.md|<test path>",
358
+ "lifecycle": ["analyze","execute","verify"], "status": "pending" }
359
+ ```
360
+ `done_when` 必须客观可验证,且引用 ralph 已产出的 artifact;`lifecycle` 字段映射到产出 evidence 的生命周期 stage。
361
+
362
+ **5. Persist** (additive): `boundary_contract`, `execution_criteria`, `task_decomposition`。每个 sub-goal 含 `status: "pending"` + `completion_confirmed: false`。
363
+
364
+ **6. Stage** the Goal Prompt (Appendix) for A_CREATE_SESSION to emit.
365
+
366
+ ### A_BUILD_STEPS
367
+
368
+ Generate steps from `session.lifecycle_position` to `milestone-complete`.
369
+
370
+ | Stage | Skill (independent) | Skill (unified) | Type | Decision after | quality_mode |
371
+ |-------|---------------------|-----------------|------|----------------|--------------|
372
+ | brainstorm | `maestro-brainstorm "{intent}"` | *(same)* | internal | — | all |
373
+ | blueprint | `maestro-blueprint "{intent}"` | *(same)* | internal | — | all |
374
+ | init | `maestro-init` | *(same)* | internal | — | all |
375
+ | analyze-macro | `maestro-analyze "{intent}"` | *(same)* | internal | `post-analyze-scope` | all |
376
+ | roadmap | `maestro-roadmap --from analyze:{analyze_macro_id}` | *(same)* | internal | — | all |
377
+ | analyze | `maestro-analyze {phase}` | `maestro-analyze` | internal | — | all |
378
+ | plan | `maestro-plan {phase}` *(scope=phase)* / `maestro-plan --from analyze:{analyze_macro_id}` *(scope=standalone)* / `maestro-plan --from blueprint:{blueprint_id}` *(scope=standalone)* | `maestro-plan` | internal | — | all |
379
+ | execute | `maestro-execute {phase}` | `maestro-execute` | internal | — | all |
380
+ | verify | `maestro-verify {phase}` | `maestro-verify` | internal | `post-verify` | all |
381
+ | business-test | `quality-auto-test {phase}` | `quality-auto-test` | internal | `post-business-test` | full only |
382
+ | review | `quality-review {phase}` | `quality-review` | internal | `post-review` | all (quick: append `--tier quick`) |
383
+ | test-gen | `quality-auto-test {phase}` | `quality-auto-test` | internal | — | full / standard if coverage<80% |
384
+ | test | `quality-test {phase}` | `quality-test` | internal | `post-test` | full, standard |
385
+ | milestone-audit | `maestro-milestone-audit` | *(same)* | internal | — | all |
386
+ | goal-audit | *(decision-only)* | *(same)* | decision | `post-goal-audit` | all (only if decomposed) |
387
+ | milestone-complete | `maestro-milestone-complete` | *(same)* | internal | `post-milestone` | all |
388
+
389
+ **Build rules (按顺序应用):**
390
+
391
+ 0. **planning_mode 选列**:`unified` → Skill (unified) 列;`independent` → Skill (independent) 列
392
+ 1. **起点**:从 `session.lifecycle_position` 开始
393
+ 2. **跳过已完成**:跳过当前 milestone+phase 下已有 completed artifact stage(按 `session.phase` 过滤);unified milestone 过滤
394
+ 3. **quality_mode 过滤**:按 `session.quality_mode` 排除不匹配 stage
395
+ 4. **决策节点**:每个 Decision after 非空的 stage 之后插入 `{ type: "decision", decision: "<gate>", retry_count: 0, max_retries: 2 }`
396
+ 5. **goal-audit 插入**:`task_decomposition` 存在时,在最后一个 evidence-producing stage(verify/review/test)之后、`milestone-complete` 之前插入 `decision:post-goal-audit`
397
+ 6. **终点硬约束**:chain 以 `milestone-complete` 结尾
398
+ 7. **goal_ref 传播**:`task_decomposition` 存在时,每个 step 按 `step.stage ∈ g.lifecycle` 匹配 `step.goal_ref = g.id`(多匹配取字典序最小);decision 节点不打 goal_ref
399
+ 8. **占位符**:independent 保留 `{phase}` `{intent}`;unified 不带 `{phase}`
400
+ 9. **command_path 解析**(每个非 decision step):
401
+ - 取 skill 名(args 前的第一个 token)
402
+ - 全局优先:`~/.claude/commands/{name}.md` 存在 → `command_scope = "global"`
403
+ - Fallback:`.claude/commands/{name}.md` 存在 → `command_scope = "project"`
404
+ - 两者都缺 `command_scope = "missing"`, `command_path = null`,A_CREATE_SESSION 报错 E006
405
+ 10. **每个 step 初始化** `completion_confirmed: false`, `completion_status: null`, `completion_evidence: null`
406
+ 11. **scope_verdict gating**(仅当 chain 起点 = `analyze-macro`):
407
+ - `scope_verdict {medium, small}`跳过 `roadmap` + `analyze` stage;`plan` standalone 列(`--from analyze:{analyze_macro_id}`),不带 `{phase}`
408
+ - `scope_verdict == large`保留 `roadmap` + `analyze`;`plan` phase 列(`{phase}`)
409
+ - `scope_verdict == unknown` → 默认 large 路径;由 `post-analyze-scope` 决策节点在 macro analyze 完成后纠正(A_APPLY_SCOPE_VERDICT)
410
+ 12. **--from 自动注入**:
411
+ - `analyze_macro_id` 存在且当前 step 是 `roadmap` → args 改为 `--from analyze:{analyze_macro_id}`
412
+ - `analyze_macro_id` 存在且 `scope_verdict {medium, small}` 且当前 step `plan` args 改为 `--from analyze:{analyze_macro_id}`
413
+ - `blueprint_id` 存在 → 当前 step 是 `plan` → args 改为 `--from blueprint:{blueprint_id}`(优先级低于 phase 数字参数)
414
+ - 写入 `step.source_artifact_ref` 以便审计
415
+ 13. **D-007 Milestone-ref 标注**:每个含 `{phase}` 占位符的 step `step.milestone_id = session.milestone`(由 A_RESOLVE_PHASE 反查得出),禁止读 `current_milestone`
416
+ 14. **动态插入步骤**(A_APPLY_*)同样应用规则 7-13
417
+
418
+ ### A_CREATE_SESSION
419
+
420
+ 1. Validate: 所有 step 的 `command_scope != "missing"`;否则 raise E006 + 列出缺失 skill
421
+ 2. Write `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json` (Appendix: Session Schema)
422
+ 3. Display chain overview:每步显示 `{index}. {skill} [{type}] [{command_scope}]`
423
+ 4. If `task_decomposition` present: display the **Goal Prompt block** (Appendix: Goal Prompt Template)
424
+
425
+ ### A_DELEGATE_EVALUATE
426
+
427
+ 1. Resolve artifact dir: `.workflow/scratch/{artifact.path}/` with fallback glob
428
+ 2. Parse decision metadata: `{ decision, retry_count, max_retries }`
429
+ 3. Map result files:
430
+ | Decision | Files |
431
+ |----------|-------|
432
+ | post-verify | verification.json |
433
+ | post-business-test | .tests/auto-test/report.json |
434
+ | post-review | review.json |
435
+ | post-test | uat.md, .tests/test-results.json |
436
+ 4. Check artifact for confidence section → include as signal
437
+ 5. Execute delegate (run_in_background, STOP, wait for callback):
438
+ ```
439
+ maestro delegate "PURPOSE: 评估 {decision} 质量门结果
440
+ TASK: 读取结果 | 分析状态 | 评估严重性 | 给出建议
441
+ EXPECTED: ---VERDICT--- STATUS/REASON/GAP_SUMMARY/CONFIDENCE(high|medium|low)/CONFIDENCE_SCORE(0-100)/WEAKEST_DIMENSION ---END---
442
+ CONSTRAINTS: 只评估 | 置信度<60% 倾向 fix | retry {n}/{max} 达上限必须 escalate"
443
+ --role analyze --mode analysis
444
+ ```
445
+ 6. On callback: parse verdict; if parse fails → fallback STATUS="fix"
446
+ 7. Confidence adjustment: <60 + proceed → fix; >95 + fix + retry>0 → suggest proceed
447
+ 8. **Decision log**: Append to `{session_dir}/decisions.ndjson`:
448
+ ```json
449
+ { "id": "DEC-{timestamp}", "timestamp": "{ISO}", "source": "ralph",
450
+ "node_id": "{step.decision}", "type": "quality-gate",
451
+ "verdict": "{adjusted_verdict}", "confidence_score": {N},
452
+ "close_call": {N>=50 && N<=70}, "summary": "{REASON}" }
453
+ ```
454
+
455
+ ### A_STRUCTURAL_EVALUATE
456
+
457
+ **post-milestone:** Read state.json → next milestone? → insert lifecycle steps / complete
458
+ **post-debug-escalate:** Always STOP → set paused, display "请人工介入"
459
+
460
+ ### A_SCOPE_EVALUATE
461
+
462
+ 仅由 `post-analyze-scope` 决策节点触发;macro analyze 完成后读 `conclusions.json.scope_verdict` 决定下游链路。
463
+
464
+ 1. 定位刚完成的 macro analyze artifact → `analyze_macro_id`, `conclusions_path = {artifact_path}/conclusions.json`
465
+ 2. 读取 `conclusions.scope_verdict`(`large | medium | small`),缺失 → `unknown`
466
+ 3. 写入 `session.scope_verdict` + `session.analyze_macro_id`
467
+ 4. Append `{session_dir}/decisions.ndjson`:
468
+ ```json
469
+ { "id": "DEC-{timestamp}", "type": "scope-gate",
470
+ "source": "ralph", "node_id": "post-analyze-scope",
471
+ "verdict": "{scope_verdict}", "analyze_macro_id": "{ANL_ID}" }
472
+ ```
473
+ 5. → A_APPLY_SCOPE_VERDICT
474
+
475
+ ### A_GOAL_AUDIT_EVALUATE
476
+
477
+ Runs only when `task_decomposition` present.
478
+
479
+ 1. Read `session.task_decomposition` from status.json
480
+ 2. For each sub-goal `status != "done"`: resolve `evidence` artifact under current phase scratch dir
481
+ 3. Delegate read-only audit (run_in_background, STOP, wait):
482
+ ```
483
+ maestro delegate "PURPOSE: 审计未完成子目标,判定 met / unmet
484
+ TASK:
485
+ 1. 读取 status.json.task_decomposition 中 status!=done 的子目标
486
+ 2. 打开 evidence 产物,对照 done_when 严格判定
487
+ 3. 输出 met / unmet,unmet 给出 gap + target_phase
488
+ CONTEXT:
489
+ status.json = {session_dir}/status.json
490
+ evidence = {evidence artifacts}
491
+ execution_criteria = {execution_criteria}
492
+ boundary_contract = {boundary_contract}
493
+ EXPECTED:
494
+ ---VERDICT---
495
+ STATUS=all_met|has_unmet
496
+ UNMET=[{id:G2,gap:'...',target_phase:execute}, ...]
497
+ CONFIDENCE_SCORE=0-100
498
+ ---END---
499
+ CONSTRAINTS:
500
+ - 只评估,不修改文件
501
+ - 严格按 done_when 判定;evidence 缺失 → unmet
502
+ - 不得建议超出 boundary_contract 的修改
503
+ "
504
+ --role analyze --mode analysis
505
+ ```
506
+ 4. On callback: 对每个 met 子目标,set `task_decomposition[i].status="done"` + `completion_confirmed=true` + `completed_at=now`
507
+ 5. Append `{session_dir}/decisions.ndjson` with `"type": "goal-gate"`, `unmet_count`, `unmet_ids`
508
+ 6. Verdict: `all_met` → A_APPLY_GOAL_DONE; `has_unmet` → A_APPLY_GOAL_FIX
509
+ GUARD: retry_count >= max_retries AND still unmet → A_APPLY_ESCALATE
510
+
511
+ ### A_APPLY_PROCEED
512
+
513
+ 1. Mark decision completed, write status.json
514
+ 2. Display: ◆ Decision: {type} → proceed ({reason})
515
+
516
+ ### A_APPLY_FIX
517
+
518
+ 1. Insert fix-loop commands after current step (see Appendix: Fix-Loop Templates)
519
+ 2. Reindex steps, increment retry_count, write status.json
520
+ 3. Display: ◆ Decision: {type} → fix, +{N} commands inserted
521
+
522
+ ### A_APPLY_ESCALATE
523
+
524
+ 1. Insert `[quality-debug "{gap_summary}", decision:post-debug-escalate]`
525
+ 2. Increment retry_count, reindex, write status.json
526
+
527
+ ### A_APPLY_SCOPE_VERDICT
528
+
529
+ `post-analyze-scope` 触发,依据 `session.scope_verdict` 重塑下游链路。
530
+
531
+ 1. `session.scope_verdict`
532
+ 2. 路径 A(`large`):保持当前链;为后续 `roadmap` step 注入 `--from analyze:{analyze_macro_id}`;为后续 `plan` step 选 phase 列;继续推进
533
+ 3. 路径 B(`medium` / `small`):
534
+ - 删除 `goal-audit` 之前所有未完成的 `roadmap` + `analyze` (phase) step
535
+ - 把下一个未完成的 `plan` step 改为 `maestro-plan --from analyze:{analyze_macro_id}`,去掉 `{phase}`,`source_artifact_ref = analyze:{analyze_macro_id}`
536
+ - 后续 `execute` / `verify` 等沿用同一 standalone scope(不带 `{phase}`,由 plan 写出的 task 列表驱动)
537
+ 4. 路径 C(`unknown`):
538
+ - 非 auto_confirm → AskUserQuestion 二选一(large / medium-small);auto_confirm → 默认 large
539
+ 5. Reindex steps,标 decision completed,write status.json
540
+ 6. Display: Scope verdict: {verdict} → {kept|collapsed to standalone via analyze:{ANL_ID}}
541
+
542
+ ### A_APPLY_GOAL_FIX
543
+
544
+ 1. 对每个 unmet 子目标 `G{n}`(按 `target_phase` 分组去重):在 `goal-audit` 节点前插入 scoped mini-loop(见 Appendix: Fix-Loop Templates → post-goal-audit),每条插入 step `goal_ref: "G{n}"`,按 A_BUILD_STEPS 规则 9 解析 `command_path`
545
+ 2. 重新追加 `decision:post-goal-audit {retry+1}`
546
+ 3. Reindex steps, increment retry_count, write status.json
547
+ 4. Display: Goal audit: {k} unmet +{N} steps inserted (G{ids}), retry {r}/{max}
548
+
549
+ ### A_APPLY_GOAL_DONE
550
+
551
+ 1. status.json: set 每个 `task_decomposition[*].status="done"`, `completion_confirmed=true`, `completed_at=now`,顶层 `task_decomposition_all_done=true`
552
+ 2. Mark goal-audit decision completed;proceed to `milestone-complete`
553
+ 3. Display: Goal audit: all met
554
+
555
+ ### A_ADVANCE_MILESTONE
556
+
557
+ 1. Update session: milestone, phase, reset passed_gates
558
+ 2. Insert full lifecycle steps for next milestone
559
+ 3. Reindex, write status.json
560
+
561
+ ### A_PAUSE_ESCALATE
562
+
563
+ 1. Set session status = "paused", write status.json
564
+ 2. Display: ◆ 已达最大重试次数,debug 已执行。请人工介入。
565
+ 3. Display: /maestro-ralph continue 恢复
566
+
567
+ </actions>
568
+
569
+ </state_machine>
570
+
571
+ <appendix>
572
+
573
+ ### Session Schema
574
+
575
+ ```json
576
+ {
577
+ "session_id": "ralph-{YYYYMMDD-HHmmss}",
578
+ "source": "ralph", "status": "running",
579
+ "intent": "", "lifecycle_position": "",
580
+ "phase": null, "phase_is_new": false,
581
+ "milestone": "", // D-007 反查结果,禁止读 current_milestone
582
+ "auto_mode": false,
583
+ "quality_mode": "standard", // "full" | "standard" | "quick"
584
+ "planning_mode": "independent", // "unified" | "independent"
585
+ "scope_verdict": null, // "large" | "medium" | "small" | "unknown" | null
586
+ "analyze_macro_id": null, // "ANL-xxx" 来自最新 macro analyze
587
+ "blueprint_id": null, // "BLP-xxx" 若存在
588
+ "cli_tool": "claude", "passed_gates": [],
589
+ "context": { "issue_id": null, "scratch_dir": null, "plan_dir": null,
590
+ "analysis_dir": null, "brainstorm_dir": null, "blueprint_dir": null },
591
+ "steps": [{
592
+ "index": 0,
593
+ "type": "internal|external|decision",
594
+ "skill": "",
595
+ "args": "",
596
+ "stage": "", // brainstorm|blueprint|init|analyze-macro|roadmap|analyze|plan|execute|verify|...
597
+ "scope": null, // "phase"|"standalone"|"milestone"|null(plan 等需要)
598
+ "command_scope": "global|project|missing|null",
599
+ "command_path": "~/.claude/commands/{name}.md | .claude/commands/{name}.md | null",
600
+ "milestone_id": null, // D-007 反查注入;仅含 {phase} 占位符的 step 有
601
+ "source_artifact_ref": null, // "analyze:ANL-xxx" | "blueprint:BLP-xxx" | null
602
+ "status": "pending|running|completed|skipped|failed",
603
+ "goal_ref": null,
604
+ "completion_confirmed": false,
605
+ "completion_status": null,
606
+ "completion_evidence": null,
607
+ "completed_at": null
608
+ }],
609
+ "waves": [], "current_step": 0,
610
+
611
+ // Optional decomposition block (additive; absent → decomposition off)
612
+ "boundary_contract": {
613
+ "in_scope": [], "out_of_scope": [], "constraints": [], "definition_of_done": ""
614
+ },
615
+ "execution_criteria": [],
616
+ "task_decomposition": [
617
+ { "id": "G1", "goal": "", "boundary": "", "done_when": "",
618
+ "evidence": "", "lifecycle": [], "status": "pending|done",
619
+ "completion_confirmed": false, "completed_at": null }
620
+ ],
621
+ "task_decomposition_all_done": false
622
+ }
623
+ ```
624
+
625
+ 新增字段可选,缺省=旧行为;既有字段名不删不改。
626
+
627
+ ### Fix-Loop Templates
628
+
629
+ 所有插入 step 默认 `type: "internal"`,按 A_BUILD_STEPS 规则 9 解析 `command_path` + `command_scope`。
630
+
631
+ **post-verify:**
632
+ ```
633
+ quality-debug "{gap_summary}"
634
+ maestro-plan --gaps {phase}
635
+ maestro-execute {phase}
636
+ maestro-verify {phase}
637
+ decision:post-verify {retry+1}
638
+ ```
639
+
640
+ **post-business-test:**
641
+ ```
642
+ quality-debug --from-business-test "{gap_summary}"
643
+ maestro-plan --gaps {phase}
644
+ maestro-execute {phase}
645
+ maestro-verify {phase}
646
+ decision:post-verify {retry: 0}
647
+ quality-auto-test {phase}
648
+ decision:post-business-test {retry+1}
649
+ ```
650
+
651
+ **post-review:**
652
+ ```
653
+ quality-debug "{gap_summary}"
654
+ maestro-plan --gaps {phase}
655
+ maestro-execute {phase}
656
+ quality-review {phase}
657
+ decision:post-review {retry+1}
658
+ ```
659
+
660
+ **post-test:**
661
+ ```
662
+ quality-debug --from-uat "{gap_summary}"
663
+ maestro-plan --gaps {phase}
664
+ maestro-execute {phase}
665
+ maestro-verify {phase}
666
+ decision:post-verify {retry: 0}
667
+ quality-auto-test {phase}
668
+ decision:post-business-test {retry: 0}
669
+ quality-review {phase}
670
+ decision:post-review {retry: 0}
671
+ quality-auto-test {phase}
672
+ quality-test {phase}
673
+ decision:post-test {retry+1}
674
+ ```
675
+
676
+ **post-goal-audit:** (per unmet sub-goal group)
677
+ ```
678
+ # for each unmet sub-goal G{n}, scoped to target_phase:
679
+ maestro-plan --gaps {target_phase} "G{n}: {gap}" [goal_ref: G{n}]
680
+ maestro-execute {target_phase} [goal_ref: G{n}]
681
+ maestro-verify {target_phase} [goal_ref: G{n}]
682
+ # after all unmet groups inserted:
683
+ decision:post-goal-audit {retry+1}
684
+ ```
685
+
686
+ ### Goal Prompt Template
687
+
688
+ 链路概览后逐字显示(仅当 decomposition 已产出):
689
+
690
+ ```
691
+ 📋 任务分解完成。复制下面一行设定目标,会话在子目标全部达成前不停:
692
+
693
+ /goal 目标达成条件: {session_dir}/status.json 中 task_decomposition[*].status == "done" 且 task_decomposition[*].completion_confirmed == true 且 steps[*].completion_confirmed == true。未达成时:阅读 {session_dir}/status.json 取得 execution_criteria / boundary_contract / task_decomposition / steps 作为行动手册,调用 /maestro-ralph continue 推进;严禁手动执行 skill 或越界修改 status.json.boundary_contract.out_of_scope。
694
+
695
+ 随后运行 /maestro-ralph continue 立即开始执行。
696
+ ```
697
+
698
+ `/goal` 由用户输入;ralph 只输出此提示词。判据以 status.json 为权威。
699
+
700
+ ### Error Codes
701
+
702
+ | Code | Severity | Description | Recovery |
703
+ |------|----------|-------------|----------|
704
+ | E001 | error | No intent and no running session | Prompt for intent |
705
+ | E002 | error | Cannot infer lifecycle position | Show raw state, ask |
706
+ | E003 | error | Artifact dir not found for decision | Show glob, ask |
707
+ | E004 | error | Delegate verdict parse failed | Fallback: "fix" |
708
+ | E005 | error | Delegate execution failed | Fallback: "fix" |
709
+ | E006 | error | command_scope == "missing" for one or more steps | List missing skills, abort build |
710
+ | W001 | warning | Decision expanded chain | Auto-handled |
711
+ | W002 | warning | Max retries, escalating | Auto-handled |
712
+ | W003 | warning | Multiple running sessions | Use latest, warn |
713
+ | W004 | warning | Low delegate confidence | Show warning |
714
+
715
+ ### Success Criteria
716
+
717
+ - [ ] Phase 先于 position 解析;phase_is_new 标记写入 session
718
+ - [ ] D-007 反查:phase 数字 → `session.milestone`,禁止读 current_milestone;写入 step.milestone_id
719
+ - [ ] phase_is_new=true → lifecycle_position 强制 `analyze`
720
+ - [ ] Intent overrides 识别 brainstorm / blueprint / analyze-macro
721
+ - [ ] A_RESOLVE_SCOPE_VERDICT 读 macro analyze conclusions.scope_verdict,写入 session.scope_verdict + analyze_macro_id
722
+ - [ ] 链路起点 = analyze-macro 时:large→roadmap+analyze+plan(phase);medium/small→直跳 plan --from analyze:{ANL_ID}(跳过 roadmap+analyze)
723
+ - [ ] post-analyze-scope decision 节点在 macro analyze 之后插入;A_SCOPE_EVALUATE/A_APPLY_SCOPE_VERDICT 重塑链路
724
+ - [ ] plan step args 支持三路径:`{phase}` / `--from analyze:{ANL_ID}` / `--from blueprint:{BLP_ID}`,写入 step.source_artifact_ref
725
+ - [ ] roadmap step args 自动注入 `--from analyze:{analyze_macro_id}`(若存在)
726
+ - [ ] artifact 过滤按 session.phase;unified 按 milestone
727
+ - [ ] quality_mode 由 A_DETERMINE_QUALITY_MODE 决定,过滤 build steps
728
+ - [ ] Decomposition: broad intent ≤3 question clarify;narrow auto-derive
729
+ - [ ] status.json 唯一真源:boundary_contract + execution_criteria + task_decomposition;无外部清单
730
+ - [ ] 每个 step 默认 `type: "internal"`,含 `command_scope` + `command_path`(全局优先 fallback 项目)
731
+ - [ ] 每个 step 含 `completion_confirmed` + `completion_status` + `completion_evidence`(初始 false/null)
732
+ - [ ] 每个 sub-goal 含 `completion_confirmed`(初始 false)
733
+ - [ ] post-goal-audit decision 仅在 decomposed 时插入,位于 milestone-complete 之前
734
+ - [ ] Unmet sub-goals 动态 grow steps[](goal_ref tagged);max retries → escalate
735
+ - [ ] planning_mode 显式决定;unified=无 `{phase}`, independent=带 `{phase}`
736
+ - [ ] Chain 必须以 `milestone-complete` 结尾
737
+ - [ ] Decision nodes 由 maestro delegate --role analyze 评估
738
+ - [ ] Ralph 不执行 step,只 evaluate;Skill("maestro-ralph-execute") handoff
739
+
740
+ </appendix>