maestro-flow 0.5.44 → 0.5.45
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.
- package/.agents/agents/ralph-executor.md +48 -0
- package/.agents/skills/maestro-ralph-cli/SKILL.md +21 -16
- package/.agents/skills/{maestro-ralph-agent → maestro-ralph-v2}/SKILL.md +337 -174
- package/.agy/agents/ralph-executor.md +44 -0
- package/.agy/skills/maestro-ralph-cli/SKILL.md +21 -16
- package/.agy/skills/{maestro-ralph-agent → maestro-ralph-v2}/SKILL.md +351 -174
- package/.claude/agents/ralph-executor.md +46 -0
- package/.claude/commands/maestro-ralph-cli.md +21 -16
- package/.claude/commands/{maestro-ralph-agent.md → maestro-ralph-v2.md} +337 -174
- package/.codex/skills/maestro-next/SKILL.md +1 -1
- package/package.json +1 -1
- package/.agents/skills/maestro-ralph-agent-execute/SKILL.md +0 -461
- package/.agy/skills/maestro-ralph-agent-execute/SKILL.md +0 -457
- package/.claude/commands/maestro-ralph-agent-execute.md +0 -459
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: maestro-ralph-
|
|
3
|
-
description:
|
|
2
|
+
name: maestro-ralph-v2
|
|
3
|
+
description: Adaptive lifecycle orchestrator — compose, dispatch ralph-executor agent, evaluate decision, loop
|
|
4
4
|
argument-hint: <intent> [-y] [--amend [change]] [--roadmap] | status | continue
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- ask_question
|
|
@@ -13,13 +13,25 @@ allowed-tools:
|
|
|
13
13
|
- send_message
|
|
14
14
|
- view_file
|
|
15
15
|
- write_to_file
|
|
16
|
+
agy-subagents:
|
|
17
|
+
- ralph-executor
|
|
16
18
|
---
|
|
17
|
-
<purpose>
|
|
18
|
-
Agent-orchestrated variant of maestro-ralph. Same chain-building logic — but execution via Claude Agent instead of CLI delegation: compose prompt → dispatch invoke_subagent(maestro-ralph-agent-execute) → agent runs step loop → returns on decision/complete/fail → evaluate decision inline via Agent → re-dispatch → loop.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
## Sub-Agent Registration (Antigravity)
|
|
21
|
+
|
|
22
|
+
Before any `invoke_subagent` call below, register each sub-agent type once per session by reading the system_prompt from `<agy-agents-dir>/<name>.md` and passing it to `define_subagent`. The `<agy-agents-dir>` is:
|
|
23
|
+
- global install: `~/.gemini/antigravity-cli/agents/`
|
|
24
|
+
- workspace install: `<project>/.agents/agents/`
|
|
25
|
+
|
|
26
|
+
- `define_subagent(name="ralph-executor", description="<from agents/ralph-executor.md frontmatter>", system_prompt=<contents of agents/ralph-executor.md body>, enable_write_tools=true, enable_mcp_tools=true, enable_subagent_tools=false)`
|
|
21
27
|
|
|
22
|
-
|
|
28
|
+
**ConversationId tracking**: `invoke_subagent` returns a ConversationId per spawned instance. Subsequent `send_message(Recipient=<ConversationId>, Message=...)` calls require that ConversationId — never use the role name as the recipient.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
<purpose>
|
|
32
|
+
Adaptive lifecycle orchestrator: locate step → resolve args → load context → dispatch invoke_subagent(ralph-executor) per step (agent 调 `ralph next` + 执行) → extract signals → drift check → ralph complete → evaluate decision → next step → loop.
|
|
33
|
+
|
|
34
|
+
Session: `.workflow/.maestro/ralph-v2-{YYYYMMDD-HHmmss}/status.json`
|
|
23
35
|
</purpose>
|
|
24
36
|
|
|
25
37
|
<deferred_reading>
|
|
@@ -41,25 +53,31 @@ Remaining → intent (amend_mode 时为 change_request)
|
|
|
41
53
|
|
|
42
54
|
**State files**:
|
|
43
55
|
- `.workflow/state.json` — artifact registry
|
|
44
|
-
- `.workflow/.maestro/ralph-
|
|
56
|
+
- `.workflow/.maestro/ralph-v2-*/status.json` — session state
|
|
45
57
|
</context>
|
|
46
58
|
|
|
47
59
|
<invariants>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
1. **Ralph-v2 owns the full loop** — locate step → resolve args → load context → dispatch agent → extract signals → drift → complete,全部在本命令内完成
|
|
61
|
+
2. **One agent per step** — 每个执行 step 派发一个 executor agent,agent 执行完返回,主流程解析结果后决定下一步
|
|
62
|
+
3. **Agent is a thin wrapper** — executor agent 调 `ralph next` 获取 skill prompt 并执行,返回输出;arg resolution、context loading、signal extraction、drift analysis、ralph complete 均由主流程完成
|
|
63
|
+
4. **Synchronous dispatch** — invoke_subagent() 调用是同步的(等待返回),不需要 STOP/callback 模式
|
|
64
|
+
5. **主流程调 `ralph complete`** — 每个 step 完成后由主流程调 `maestro ralph complete`,非 agent 上报
|
|
65
|
+
6. **Decision evaluation inline** — decision 节点不 handoff,通过 `invoke_subagent()` 启动分析 Agent 在本循环内评估
|
|
66
|
+
7. **No CLI delegation** — 本命令不使用 `maestro delegate`;执行和评估均通过 invoke_subagent() 完成
|
|
67
|
+
8. **Decision delegates read-only** — 评估 Agent 通过 prompt 中的 CONSTRAINTS 约束为只读
|
|
68
|
+
9. **执行 step 通过 `maestro ralph next` CLI 加载并内联执行**(由 execute Agent 完成)
|
|
69
|
+
10. **status.json 是唯一真源** — 不生成 markdown 清单或侧文件
|
|
70
|
+
11. **每个 step 必须 `completion_confirmed: true`** — 由 `maestro ralph complete N --status DONE`(或 DONE_WITH_CONCERNS)写入;CLI 是唯一合法写入路径
|
|
71
|
+
12. **command_path 在 A_BUILD_STEPS 解析** — 通过 `maestro ralph skills --platform agy --json --quiet` 预校验
|
|
72
|
+
13. **执行 step 加载契约** — 由 `maestro ralph next` CLI 在执行期完成
|
|
73
|
+
14. **Decomposition is outcome-oriented** — sub-goals 为可观测交付,禁止 lifecycle 复刻
|
|
74
|
+
15. **planning_mode governs arg granularity** — `unified` → skill args 无 `{phase}`;`independent` → 含 `{phase}`
|
|
75
|
+
16. **task_decomposition 驱动 steps[] 动态生长** — `post-goal-audit` 按 unmet 子目标插入 scoped mini-loop
|
|
76
|
+
17. **Invariant violation = BLOCK** — 违反上述任一 invariant 即阻断当前操作
|
|
77
|
+
18. **Evaluate fallback 必须标记** — 评估 Agent 解析 verdict 失败时 fallback 为 "fix",MUST 在 decisions.ndjson 记录 `"parse_failed": true, "confidence_score": 0`
|
|
78
|
+
19. **auto_confirm 单一来源** — `auto_confirm` 仅由用户 `-y` 标志设定
|
|
79
|
+
20. **分解契约单一所有者** — `boundary_contract` / `task_decomposition` 由 session 创建者拥有
|
|
80
|
+
21. **控制权优先级(范式治理)** — FSM 独占 session 生命周期 + step 排序 + retry/fix/escalate + cross-step decision 节点
|
|
63
81
|
</invariants>
|
|
64
82
|
|
|
65
83
|
<state_machine>
|
|
@@ -80,8 +98,12 @@ S_BUILD_CHAIN — 构建步骤链(build rules 0-14)
|
|
|
80
98
|
S_CREATE_SESSION — 写 status.json PERSIST: session (全量)
|
|
81
99
|
S_CONFIRM — 用户确认
|
|
82
100
|
|
|
83
|
-
|
|
84
|
-
|
|
101
|
+
S_STEP_LOCATE — 找下一个 pending step PERSIST: —
|
|
102
|
+
S_STEP_RESOLVE — 解析占位符 + 丰富参数 PERSIST: step.args (enriched)
|
|
103
|
+
S_STEP_DISPATCH — 组装上下文 + 派发 executor agent 执行单步 PERSIST: step.agent_exec_name, step.status = "running"
|
|
104
|
+
S_STEP_ANALYZE — 提取信号 + 组装 completion 参数 PERSIST: —
|
|
105
|
+
S_STEP_DRIFT — 产物 vs 目标偏离分析 PERSIST: step.drift_score
|
|
106
|
+
S_STEP_COMPLETE — 调 `ralph complete` 上报 PERSIST: step.completion_*
|
|
85
107
|
S_DECISION_EVAL — 启动分析 Agent 评估质量门 PERSIST: —
|
|
86
108
|
S_APPLY_VERDICT — 应用裁决 PERSIST: session.steps[]
|
|
87
109
|
S_SESSION_DONE — 所有 step 完成 PERSIST: session.status
|
|
@@ -105,31 +127,48 @@ S_STATUS:
|
|
|
105
127
|
→ END DO: A_SHOW_STATUS
|
|
106
128
|
|
|
107
129
|
S_CONTINUE:
|
|
108
|
-
→
|
|
130
|
+
→ S_STEP_LOCATE WHEN: running session found
|
|
109
131
|
→ S_FALLBACK WHEN: no running session
|
|
110
132
|
|
|
111
133
|
S_AMEND_GOAL:
|
|
112
|
-
→
|
|
134
|
+
→ S_STEP_LOCATE WHEN: change applied + user confirmed DO: A_AMEND_GOAL
|
|
113
135
|
→ END WHEN: user cancels
|
|
114
136
|
GUARD: RISK_LEVEL=high → auto_confirm 无效
|
|
115
137
|
|
|
116
138
|
S_CREATE_SESSION:
|
|
117
|
-
→ S_CONFIRM
|
|
118
|
-
→
|
|
139
|
+
→ S_CONFIRM WHEN: not auto_confirm
|
|
140
|
+
→ S_STEP_LOCATE WHEN: auto_confirm
|
|
119
141
|
|
|
120
142
|
S_CONFIRM:
|
|
121
|
-
→
|
|
122
|
-
→ S_BUILD_CHAIN
|
|
123
|
-
→ END
|
|
143
|
+
→ S_STEP_LOCATE WHEN: user confirms
|
|
144
|
+
→ S_BUILD_CHAIN WHEN: user edits
|
|
145
|
+
→ END WHEN: user cancels
|
|
146
|
+
|
|
147
|
+
S_STEP_LOCATE:
|
|
148
|
+
→ S_STEP_RESOLVE WHEN: pending execution step found (step.decision == null)
|
|
149
|
+
→ S_DECISION_EVAL WHEN: pending decision step found (step.decision != null)
|
|
150
|
+
→ S_SESSION_DONE WHEN: no pending steps (all completed/skipped)
|
|
151
|
+
→ S_HANDLE_FAIL WHEN: has failed step and no pending
|
|
152
|
+
→ S_FALLBACK WHEN: no running session
|
|
124
153
|
|
|
125
|
-
|
|
126
|
-
→
|
|
154
|
+
S_STEP_RESOLVE:
|
|
155
|
+
→ S_STEP_DISPATCH DO: A_STEP_RESOLVE_ARGS
|
|
127
156
|
|
|
128
|
-
|
|
129
|
-
→
|
|
130
|
-
→
|
|
131
|
-
|
|
132
|
-
|
|
157
|
+
S_STEP_DISPATCH:
|
|
158
|
+
→ S_STEP_ANALYZE WHEN: agent returned output DO: A_STEP_DISPATCH
|
|
159
|
+
→ S_HANDLE_FAIL WHEN: agent returned error/null DO: A_STEP_DISPATCH
|
|
160
|
+
|
|
161
|
+
S_STEP_ANALYZE:
|
|
162
|
+
→ S_STEP_DRIFT WHEN: STATUS == DONE|DONE_WITH_CONCERNS DO: A_STEP_EXTRACT
|
|
163
|
+
→ S_HANDLE_FAIL WHEN: STATUS == NEEDS_RETRY|BLOCKED DO: A_STEP_EXTRACT
|
|
164
|
+
|
|
165
|
+
S_STEP_DRIFT:
|
|
166
|
+
→ S_STEP_COMPLETE WHEN: ALIGNED|MINOR_DRIFT DO: A_STEP_DRIFT_ANALYZE
|
|
167
|
+
→ S_STEP_DISPATCH WHEN: MAJOR_DRIFT + not retried DO: A_STEP_DRIFT_ANALYZE (ralph retry + re-execute)
|
|
168
|
+
→ S_STEP_COMPLETE WHEN: MAJOR_DRIFT + retried DO: A_STEP_DRIFT_ANALYZE (DONE_WITH_CONCERNS)
|
|
169
|
+
|
|
170
|
+
S_STEP_COMPLETE:
|
|
171
|
+
→ S_STEP_LOCATE DO: A_STEP_COMPLETE (loop to next step)
|
|
133
172
|
|
|
134
173
|
S_DECISION_EVAL: (decision 节点 == `step.decision` 非空)
|
|
135
174
|
→ S_APPLY_VERDICT WHEN: quality-gate (post-execute, post-business-test, post-review, post-test, post-frontend-verify)
|
|
@@ -144,20 +183,20 @@ S_DECISION_EVAL: (decision 节点 == `step.decision` 非空)
|
|
|
144
183
|
DO: A_STRUCTURAL_EVALUATE
|
|
145
184
|
|
|
146
185
|
S_APPLY_VERDICT:
|
|
147
|
-
→
|
|
148
|
-
→
|
|
149
|
-
→
|
|
186
|
+
→ S_STEP_LOCATE WHEN: verdict == "proceed" DO: A_APPLY_PROCEED
|
|
187
|
+
→ S_STEP_LOCATE WHEN: post-goal-audit + has_unmet DO: A_APPLY_GOAL_FIX
|
|
188
|
+
→ S_STEP_LOCATE WHEN: post-goal-audit + all_met + INTENT_ALIGNED=true DO: A_APPLY_GOAL_DONE
|
|
150
189
|
→ END WHEN: post-goal-audit + all_met + INTENT_ALIGNED=false DO: A_REGROUND_HALT
|
|
151
|
-
→
|
|
152
|
-
→
|
|
153
|
-
→
|
|
154
|
-
→
|
|
190
|
+
→ S_STEP_LOCATE WHEN: post-analyze-scope DO: A_APPLY_SCOPE_VERDICT
|
|
191
|
+
→ S_STEP_LOCATE WHEN: verdict == "fix" DO: A_APPLY_FIX
|
|
192
|
+
→ S_STEP_LOCATE WHEN: verdict == "escalate" DO: A_APPLY_ESCALATE
|
|
193
|
+
→ S_STEP_LOCATE WHEN: post-milestone + standard + next milestone DO: A_ADVANCE_MILESTONE
|
|
155
194
|
→ END WHEN: post-milestone + standard + no next milestone
|
|
156
195
|
→ END WHEN: post-milestone + adhoc DO: mark completed (set current_milestone = null)
|
|
157
196
|
→ END WHEN: post-debug-escalate DO: A_PAUSE_ESCALATE
|
|
158
197
|
→ END WHEN: post-reground + drifted + confidence >= 60 DO: A_REGROUND_HALT
|
|
159
|
-
→
|
|
160
|
-
→
|
|
198
|
+
→ S_STEP_LOCATE WHEN: post-reground + aligned DO: A_APPLY_PROCEED
|
|
199
|
+
→ S_STEP_LOCATE WHEN: post-reground + drifted + confidence < 60 DO: A_APPLY_PROCEED (标 LOW CONFIDENCE)
|
|
161
200
|
GUARD: retry_count >= max_retries → force escalate
|
|
162
201
|
GUARD: confidence_score < 60 AND proceed → override to fix
|
|
163
202
|
GUARD: confidence_score > 95 AND fix AND retry > 0 → suggest proceed
|
|
@@ -166,10 +205,10 @@ S_APPLY_VERDICT:
|
|
|
166
205
|
GUARD: post-reground + drifted + confidence >= 60 → A_REGROUND_HALT(auto_confirm 不跳过)
|
|
167
206
|
|
|
168
207
|
S_HANDLE_FAIL:
|
|
169
|
-
→
|
|
208
|
+
→ S_STEP_LOCATE WHEN: auto + not retried DO: A_RETRY
|
|
170
209
|
→ END WHEN: auto + retried DO: A_PAUSE_SESSION
|
|
171
|
-
→
|
|
172
|
-
→
|
|
210
|
+
→ S_STEP_LOCATE WHEN: interactive + retry
|
|
211
|
+
→ S_STEP_LOCATE WHEN: interactive + skip
|
|
173
212
|
→ END WHEN: interactive + abort
|
|
174
213
|
|
|
175
214
|
S_SESSION_DONE:
|
|
@@ -180,19 +219,109 @@ S_SESSION_DONE:
|
|
|
180
219
|
<actions>
|
|
181
220
|
|
|
182
221
|
### A_CREATE_SESSION
|
|
183
|
-
1. `session_id` format: `ralph-
|
|
222
|
+
1. `session_id` format: `ralph-v2-{YYYYMMDD-HHmmss}`
|
|
184
223
|
2. Additional fields: `execution_mode: "agent"`,无 `cli_tool` 字段
|
|
185
|
-
3. Each step: `agent_exec_name: null
|
|
224
|
+
3. Each step: `agent_exec_name: null`(执行 Agent 名称标识)
|
|
186
225
|
4. Step mode/role/rule assigned per stage (see Stage Mapping table)
|
|
187
226
|
|
|
188
|
-
###
|
|
227
|
+
### A_STEP_RESOLVE_ARGS
|
|
228
|
+
|
|
229
|
+
解析占位符 + 丰富参数。在 `ralph next` 之前执行。
|
|
230
|
+
|
|
231
|
+
**1. Placeholder substitution:**
|
|
232
|
+
|
|
233
|
+
| Placeholder | Source |
|
|
234
|
+
|-------------|--------|
|
|
235
|
+
| `{phase}` | session.phase |
|
|
236
|
+
| `{milestone}` | session.milestone |
|
|
237
|
+
| `{intent}` | session.intent |
|
|
238
|
+
| `{description}` | session.intent (alias) |
|
|
239
|
+
| `{scratch_dir}` | session.context.scratch_dir or latest artifact path |
|
|
240
|
+
| `{plan_dir}` | session.context.plan_dir |
|
|
241
|
+
| `{analysis_dir}` | session.context.analysis_dir |
|
|
242
|
+
| `{issue_id}` | session.context.issue_id |
|
|
243
|
+
| `{milestone_num}` | session.context.milestone_num |
|
|
244
|
+
|
|
245
|
+
**2. Per-skill enrichment** (when args empty or minimal):
|
|
246
|
+
|
|
247
|
+
| Skill | Required context | Source |
|
|
248
|
+
|-------|-----------------|--------|
|
|
249
|
+
| maestro-brainstorm | topic | `"{intent}"` |
|
|
250
|
+
| maestro-roadmap | description | `"{intent}"` |
|
|
251
|
+
| maestro-analyze | phase or topic | `{phase}` or `"{intent}"` |
|
|
252
|
+
| maestro-plan | phase, --from, or --dir | see --from auto-injection below |
|
|
253
|
+
| maestro-execute | phase or --dir | see --from auto-injection below |
|
|
254
|
+
| quality-debug | gap context | Read previous step's error/gap |
|
|
255
|
+
| quality-* | phase | `{phase}` |
|
|
256
|
+
|
|
257
|
+
**3. --from auto-injection (phase-level artifact chaining):**
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
Read state.json.artifacts(含 milestone_history 内归档 artifacts)
|
|
261
|
+
→ filter by milestone={session.milestone} + phase={session.phase} + status=="completed"
|
|
262
|
+
|
|
263
|
+
plan step(含 {phase} 占位符,args 无 --from 且无 --dir):
|
|
264
|
+
1. 查同 phase+milestone 最新 completed type=="analyze" artifact → id = ANL-xxx
|
|
265
|
+
2. 命中 → args 追加 --from analyze:{id}
|
|
266
|
+
3. 写 step.source_artifact_ref = "analyze:{id}"
|
|
267
|
+
|
|
268
|
+
execute step(含 {phase} 占位符,args 无 --dir):
|
|
269
|
+
1. 查同 phase+milestone 最新 completed type=="plan" artifact → id = PLN-xxx, path = scratch/...
|
|
270
|
+
2. 命中 → args 追加 --dir .workflow/scratch/{path}
|
|
271
|
+
3. 写 step.source_artifact_ref = "plan:{id}"
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
兜底:查询无结果 → 不注入,由命令自身 discovery 逻辑处理。已有 `--from` 或 `--dir` 的 step 不覆盖。
|
|
275
|
+
|
|
276
|
+
**4. Goal context injection:**
|
|
277
|
+
|
|
278
|
+
当 `step.goal_ref` 非空且 `session.task_decomposition` 存在时:
|
|
279
|
+
```
|
|
280
|
+
goal = session.task_decomposition.find(g => g.id == step.goal_ref)
|
|
281
|
+
if goal:
|
|
282
|
+
goal_snippet = { id: goal.id, goal: goal.goal, done_when: goal.done_when,
|
|
283
|
+
boundary: goal.boundary, evidence: goal.evidence }
|
|
284
|
+
→ 传递给 A_STEP_DISPATCH 注入 agent prompt
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**5. Write** enriched args + source_artifact_ref back to status.json.
|
|
288
|
+
|
|
289
|
+
### A_STEP_DISPATCH
|
|
290
|
+
|
|
291
|
+
加载前序产出 + 组装上下文 + 派发 executor agent 执行单步。Agent 内部调 `maestro ralph next` 获取 skill prompt 并执行。
|
|
292
|
+
|
|
293
|
+
**1. Load previous step context:**
|
|
189
294
|
|
|
190
|
-
|
|
295
|
+
- 读前一 completed step 的 `completion_summary` + `completion_caveats` + `completion_decisions` + `completion_deferred`
|
|
296
|
+
- 按 `session.context` 中的路径逐个 Read,提取与当前 step 相关的内容:
|
|
191
297
|
|
|
192
|
-
|
|
193
|
-
|
|
298
|
+
| 当前 stage | 加载什么 | Source |
|
|
299
|
+
|-----------|---------|--------|
|
|
300
|
+
| plan | analysis conclusions + scope_verdict | `{context.analysis_dir}/conclusions.json` |
|
|
301
|
+
| execute | task list + wave assignments | `{context.plan_dir}/TASK-*.json` |
|
|
302
|
+
| review | changed files + verification results | `{context.scratch_dir}/verification.json` |
|
|
303
|
+
| test | review findings | `review.json` |
|
|
304
|
+
| debug | error traces + failing test details | 前一 step 的 `completion_evidence` |
|
|
305
|
+
| brainstorm | grill report | `{context.grill_id}` report |
|
|
194
306
|
|
|
195
|
-
|
|
307
|
+
- Explore if needed — 产物指向代码位置但缺少上下文 → `maestro explore` 补充(仅 execute/debug/test 且有文件路径引用时)
|
|
308
|
+
- Accumulated signals — 遍历 ALL completed steps → 聚合 caveats + deferred
|
|
309
|
+
|
|
310
|
+
**2. Goal context pre-injection:**
|
|
311
|
+
|
|
312
|
+
- GUARD: `ralph_protocol_version >= "2"` → skip(session_anchor 已含 goal context)
|
|
313
|
+
- WHEN `ralph_protocol_version < "2"` 或缺失 AND `step.goal_ref` 非空 → 组装 `<goal_context>` 块注入 prompt:
|
|
314
|
+
```
|
|
315
|
+
<goal_context>
|
|
316
|
+
Sub-goal: {goal.id} — {goal.goal}
|
|
317
|
+
Done when: {goal.done_when}
|
|
318
|
+
Boundary: {goal.boundary}
|
|
319
|
+
Evidence target: {goal.evidence}
|
|
320
|
+
Execution criteria: {session.execution_criteria joined by '; '}
|
|
321
|
+
</goal_context>
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**3. Resolve agent name:** `{stage_prefix}-{session_id_short}-{HHmmss}`
|
|
196
325
|
|
|
197
326
|
| Stage | Prefix |
|
|
198
327
|
|-------|--------|
|
|
@@ -207,97 +336,160 @@ S_SESSION_DONE:
|
|
|
207
336
|
| debug | `dbg` |
|
|
208
337
|
| Other | `run` |
|
|
209
338
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
```xml
|
|
213
|
-
<execution_context>
|
|
214
|
-
<intent>{session.intent}</intent>
|
|
215
|
-
<phase>{session.phase}</phase>
|
|
216
|
-
<milestone>{session.milestone}</milestone>
|
|
217
|
-
<boundary_contract>
|
|
218
|
-
<in_scope>{boundary_contract.in_scope}</in_scope>
|
|
219
|
-
<out_of_scope>{boundary_contract.out_of_scope}</out_of_scope>
|
|
220
|
-
<definition_of_done>{boundary_contract.definition_of_done}</definition_of_done>
|
|
221
|
-
</boundary_contract>
|
|
222
|
-
<execution_criteria>{session.execution_criteria}</execution_criteria>
|
|
223
|
-
<active_goals>{task_decomposition WHERE status != "superseded"; superseded 目标仅一行标注}</active_goals>
|
|
224
|
-
<prior_step_context>
|
|
225
|
-
{最近 5 个已完成 step 的 completion_summary + completion_caveats}
|
|
226
|
-
</prior_step_context>
|
|
227
|
-
<accumulated_signals>
|
|
228
|
-
{聚合所有已完成 step 的 caveats + deferred}
|
|
229
|
-
</accumulated_signals>
|
|
230
|
-
<stage_context>
|
|
231
|
-
{按下一个 pending step 的目标 skill 类型选择性注入,见下表;仅在有实际内容时加入}
|
|
232
|
-
</stage_context>
|
|
233
|
-
</execution_context>
|
|
339
|
+
**4. Dispatch:**
|
|
340
|
+
|
|
234
341
|
```
|
|
342
|
+
invoke_subagent({
|
|
343
|
+
subagent_type: "ralph-executor",
|
|
344
|
+
name: "{resolved_agent_name}",
|
|
345
|
+
description: "执行 step {index}: {step.skill}",
|
|
346
|
+
prompt: `Session: {session_id}
|
|
235
347
|
|
|
236
|
-
|
|
348
|
+
{goal_context 块,仅 protocol < 2 时}
|
|
237
349
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
| execute | task list + dependencies + wave + caveats from plan |
|
|
243
|
-
| review | changed files + verification results + execution decisions |
|
|
244
|
-
| test | review findings + execution artifacts + coverage data |
|
|
245
|
-
| debug | error details + failing tests + execution trace |
|
|
246
|
-
| brainstorm/grill | challenged assumptions + risks + prior findings |
|
|
350
|
+
{loaded_step_context}
|
|
351
|
+
`
|
|
352
|
+
})
|
|
353
|
+
```
|
|
247
354
|
|
|
248
|
-
|
|
355
|
+
Agent 内部调 `maestro ralph next --session {session_id}` 获取 skill prompt 并执行。
|
|
356
|
+
|
|
357
|
+
5. Write `step.agent_exec_name` to status.json
|
|
358
|
+
6. Display: `[{index}/{total}] ⟶ {step.skill} → Agent:{name}`
|
|
359
|
+
7. Agent 同步返回 → `agent_output` = 返回文本;返回 null → STATUS=BLOCKED
|
|
249
360
|
|
|
250
|
-
|
|
251
|
-
invoke_subagent({
|
|
252
|
-
name: "{resolved_agent_name}",
|
|
253
|
-
description: "执行 ralph session steps",
|
|
254
|
-
prompt: `执行 ralph-agent session {session_id} 的 pending steps。
|
|
361
|
+
### A_STEP_EXTRACT
|
|
255
362
|
|
|
256
|
-
|
|
257
|
-
maestro-ralph-agent-execute 会自动循环执行 pending 执行 step,遇到 decision/完成/失败时返回。
|
|
363
|
+
从 agent 返回的执行输出中提取结构化信号,用于 completion 参数组装。
|
|
258
364
|
|
|
259
|
-
|
|
365
|
+
**1. Stage-specific signal extraction:**
|
|
260
366
|
|
|
261
|
-
|
|
367
|
+
| Stage | 提取什么 | 写入字段 |
|
|
368
|
+
|-------|---------|---------|
|
|
369
|
+
| analyze | `conclusions.json` scope_verdict + key_findings | `--summary`, context.analysis_dir |
|
|
370
|
+
| plan | TASK-*.json 数量 + 主要模块 + 波次 | `--summary`, context.plan_dir |
|
|
371
|
+
| execute | 修改文件数 + verification passed/failed | `--summary`, `--evidence`, context.scratch_dir |
|
|
372
|
+
| review | verdict + findings 数量 + severity | `--summary`, `--decisions` |
|
|
373
|
+
| test | pass/fail 统计 | `--summary`, `--evidence` |
|
|
374
|
+
| debug | root cause + 修复内容 | `--summary`, `--decisions` |
|
|
375
|
+
| grill | 核心质疑点数量 | `--summary`, `--caveats`, context.grill_id |
|
|
376
|
+
| brainstorm | 候选方案数 + 推荐方案 | `--summary`, `--decisions`, context.brainstorm_dir |
|
|
262
377
|
|
|
263
|
-
|
|
378
|
+
**2. Artifact scanning** — Use Glob 查找执行期间新增/修改的产物:
|
|
264
379
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
380
|
+
| Pattern | Signal |
|
|
381
|
+
|---------|--------|
|
|
382
|
+
| `conclusions.json` | `analysis_dir` |
|
|
383
|
+
| `TASK-*.json` | `plan_dir` |
|
|
384
|
+
| `verification.json` | `scratch_dir` |
|
|
385
|
+
| `review.json` | review stage |
|
|
386
|
+
| `test-results.json`, `uat.md` | test stage |
|
|
387
|
+
| `grill-report.md` | `grill_id` |
|
|
388
|
+
| `.brainstorming/*` | `brainstorm_dir` |
|
|
389
|
+
|
|
390
|
+
**3. Output text signal extraction** — 从执行输出文本中提取:
|
|
391
|
+
|
|
392
|
+
| Signal pattern | 写入 |
|
|
393
|
+
|----------------|------|
|
|
394
|
+
| `ANL-xxx` (artifact ID) | `session.analyze_macro_id` |
|
|
395
|
+
| `PLN-xxx` (artifact ID) | `context.plan_dir` |
|
|
396
|
+
| `BLP-xxx` (artifact ID) | `session.blueprint_id` |
|
|
397
|
+
| `scratch_dir:` 或 `.workflow/scratch/` 路径 | `context.scratch_dir` |
|
|
398
|
+
| `plan_dir:` 路径 | `context.plan_dir` |
|
|
399
|
+
| `PHASE: N` | `session.context.phase` |
|
|
274
400
|
|
|
275
|
-
|
|
276
|
-
6. Display: `⟶ Agent:{name} dispatched for session {session_id}`
|
|
401
|
+
**4. STATUS determination:**
|
|
277
402
|
|
|
278
|
-
|
|
403
|
+
| 条件 | STATUS |
|
|
404
|
+
|------|--------|
|
|
405
|
+
| Skill 正常完成 + 有产物 | `DONE` |
|
|
406
|
+
| 完成但有 warnings/concerns | `DONE_WITH_CONCERNS` |
|
|
407
|
+
| 执行出错但可重试(临时错误、网络问题) | `NEEDS_RETRY` |
|
|
408
|
+
| 执行出错且无法重试(schema 错误、command_path 不可达) | `BLOCKED` |
|
|
409
|
+
| Agent 返回 null(崩溃/超时) | `BLOCKED` |
|
|
279
410
|
|
|
280
|
-
|
|
411
|
+
**5. Compose completion params:**
|
|
281
412
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
413
|
+
| Param | 规则 | 组装方法 |
|
|
414
|
+
|-------|------|---------|
|
|
415
|
+
| `--summary` | MUST。动词开头,≤100 字 | `"<动词><做了什么>,<量化结果>"` |
|
|
416
|
+
| `--decisions` | SHOULD。每条一个架构/技术决策 | 从执行中做出的非显而易见的选择 |
|
|
417
|
+
| `--caveats` | SHOULD。后续 step 须知 | 发现但不属于本步解决的问题 |
|
|
418
|
+
| `--deferred` | SHOULD。推迟工作项 | 被主动推迟的项 |
|
|
419
|
+
| `--evidence` | SHOULD。验证产物路径 | 指向验证结果文件 |
|
|
420
|
+
| `--concerns` | COND。仅 DONE_WITH_CONCERNS 时 | CAVEATS 内容同时映射为 --concerns |
|
|
421
|
+
|
|
422
|
+
### A_STEP_DRIFT_ANALYZE
|
|
423
|
+
|
|
424
|
+
产物 vs 目标偏离分析。A_STEP_EXTRACT 后、A_STEP_COMPLETE 前执行。
|
|
425
|
+
|
|
426
|
+
**1. 收集对照基准:**
|
|
427
|
+
|
|
428
|
+
| 基准来源 | 取值 |
|
|
429
|
+
|---------|------|
|
|
430
|
+
| `step.goal_ref` → goal.done_when | 子目标完成条件 |
|
|
431
|
+
| `session.boundary_contract.definition_of_done` | 全局验收标准 |
|
|
432
|
+
| `session.execution_criteria` | 执行准则 |
|
|
433
|
+
| `session.intent` | 原始意图 |
|
|
434
|
+
|
|
435
|
+
**2. 对比评分:**
|
|
436
|
+
|
|
437
|
+
| 维度 | 检查 |
|
|
438
|
+
|------|------|
|
|
439
|
+
| 覆盖度 | 产物是否覆盖 goal.done_when 每个条件 |
|
|
440
|
+
| 方向性 | decisions 是否与 intent/boundary 一致 |
|
|
441
|
+
| 完整性 | 预期产物类型是否齐全 |
|
|
442
|
+
|
|
443
|
+
**drift_score:**
|
|
444
|
+
- `ALIGNED` — 全部维度通过
|
|
445
|
+
- `MINOR_DRIFT` — 小缺口,不影响后续
|
|
446
|
+
- `MAJOR_DRIFT` — 方向性偏离或关键产物缺失
|
|
447
|
+
|
|
448
|
+
**3. 修正动作:**
|
|
449
|
+
|
|
450
|
+
| drift_score | 动作 |
|
|
451
|
+
|-------------|------|
|
|
452
|
+
| ALIGNED | 正常进入 S_STEP_COMPLETE |
|
|
453
|
+
| MINOR_DRIFT | 偏离项追加到 caveats,正常 complete |
|
|
454
|
+
| MAJOR_DRIFT + 未重试 | `run_command("maestro ralph retry {index}")` → 回到 S_STEP_DISPATCH 重执行(drift_correction 作修正上下文注入 prompt) |
|
|
455
|
+
| MAJOR_DRIFT + 已重试 | 以 DONE_WITH_CONCERNS complete |
|
|
456
|
+
|
|
457
|
+
**4. 写入:** `step.drift_score`, `step.drift_correction`
|
|
458
|
+
|
|
459
|
+
### A_STEP_COMPLETE
|
|
460
|
+
|
|
461
|
+
调 `ralph complete` 上报 + 传播上下文信号 + 循环。
|
|
462
|
+
|
|
463
|
+
1. 使用 A_STEP_EXTRACT 组装的参数调用 `ralph complete`:
|
|
464
|
+
```
|
|
465
|
+
run_command("maestro ralph complete {index} --status DONE --summary \"{SUMMARY}\" [--evidence ...] [--decisions ...] [--caveats ...] [--deferred ...]")
|
|
466
|
+
```
|
|
467
|
+
DONE_WITH_CONCERNS 时 caveats 同时映射 `--concerns`。BLOCKED 时用 `--reason`。
|
|
468
|
+
|
|
469
|
+
2. **Context signals propagation** — 将关键信号写入 `status.json.context`:
|
|
470
|
+
|
|
471
|
+
| Signal | 写入字段 |
|
|
472
|
+
|--------|---------|
|
|
473
|
+
| `analysis_dir` | `context.analysis_dir` |
|
|
474
|
+
| `plan_dir` | `context.plan_dir` |
|
|
475
|
+
| `scratch_dir` | `context.scratch_dir` |
|
|
476
|
+
| `grill_id` | `context.grill_id` |
|
|
477
|
+
| `brainstorm_dir` | `context.brainstorm_dir` |
|
|
478
|
+
| `blueprint_dir` | `context.blueprint_dir` |
|
|
479
|
+
| `ANL-xxx` | `session.analyze_macro_id` |
|
|
480
|
+
| `BLP-xxx` | `session.blueprint_id` |
|
|
481
|
+
| `phase` | `session.context.phase` |
|
|
482
|
+
|
|
483
|
+
3. Display: `[{index}/{total}] ✓ {step.skill} → {SUMMARY}`
|
|
484
|
+
4. Loop back to S_STEP_LOCATE
|
|
293
485
|
|
|
294
486
|
### A_AGENT_EVALUATE
|
|
295
487
|
|
|
296
|
-
通过 Agent
|
|
488
|
+
通过 Agent 在本循环内评估质量门。
|
|
297
489
|
|
|
298
490
|
1. Resolve artifact dir: `.workflow/scratch/{artifact.path}/` with fallback glob
|
|
299
491
|
2. Parse decision metadata: `{ decision, retry_count, max_retries }`
|
|
300
|
-
3. Map result files
|
|
492
|
+
3. Map result files:
|
|
301
493
|
|
|
302
494
|
| Decision | Files |
|
|
303
495
|
|----------|-------|
|
|
@@ -328,11 +520,11 @@ FAILURE_REASON: {仅 step_failed 时}
|
|
|
328
520
|
CONSTRAINTS: 只评估不修改文件 | 置信度<60%倾向 fix | retry {n}/{max} 达上限必须 escalate"
|
|
329
521
|
})
|
|
330
522
|
```
|
|
331
|
-
5. On return: parse `---VERDICT---` block — STATUS must match strict enum `PASS|FAIL|PARTIAL|BLOCKED`; parse failure → fallback STATUS="fix", `parse_failed: true`, `confidence_score: 0` (invariant
|
|
523
|
+
5. On return: parse `---VERDICT---` block — STATUS must match strict enum `PASS|FAIL|PARTIAL|BLOCKED`; parse failure → fallback STATUS="fix", `parse_failed: true`, `confidence_score: 0` (invariant 18)
|
|
332
524
|
6. Confidence adjustment: <60 + proceed → fix; >95 + fix + retry>0 → suggest proceed
|
|
333
525
|
7. **Decision log**: Append to `{session_dir}/decisions.ndjson`:
|
|
334
526
|
```json
|
|
335
|
-
{ "id": "DEC-{timestamp}", "timestamp": "{ISO}", "source": "ralph-
|
|
527
|
+
{ "id": "DEC-{timestamp}", "timestamp": "{ISO}", "source": "ralph-v2",
|
|
336
528
|
"node_id": "{step.decision}", "type": "quality-gate",
|
|
337
529
|
"verdict": "{adjusted_verdict}", "confidence_score": {N},
|
|
338
530
|
"parse_failed": false,
|
|
@@ -341,7 +533,7 @@ FAILURE_REASON: {仅 step_failed 时}
|
|
|
341
533
|
|
|
342
534
|
### A_AGENT_GOAL_AUDIT
|
|
343
535
|
|
|
344
|
-
通过 Agent
|
|
536
|
+
通过 Agent 审计子目标完成情况。
|
|
345
537
|
|
|
346
538
|
1. Read `session.task_decomposition` from status.json
|
|
347
539
|
2. Dispatch audit Agent:
|
|
@@ -378,7 +570,7 @@ FAILURE_REASON: {仅 step_failed 时}
|
|
|
378
570
|
|
|
379
571
|
### A_AGENT_REGROUND
|
|
380
572
|
|
|
381
|
-
通过 Agent
|
|
573
|
+
通过 Agent 执行意图保真检查。
|
|
382
574
|
|
|
383
575
|
1. Read status.json:intent, boundary_contract, completed steps, done goals
|
|
384
576
|
2. Dispatch reground Agent:
|
|
@@ -420,7 +612,7 @@ FAILURE_REASON: {仅 step_failed 时}
|
|
|
420
612
|
1. 定位刚完成的 macro analyze artifact → `analyze_macro_id`, `conclusions_path`
|
|
421
613
|
2. 读取 `conclusions.scope_verdict`(`large | medium | small`),缺失 → `unknown`
|
|
422
614
|
3. 写入 `session.scope_verdict` + `session.analyze_macro_id`
|
|
423
|
-
4. Append `{session_dir}/decisions.ndjson`:`{ "type": "scope-gate", "source": "ralph-
|
|
615
|
+
4. Append `{session_dir}/decisions.ndjson`:`{ "type": "scope-gate", "source": "ralph-v2", "verdict": "{scope_verdict}", "analyze_macro_id": "{ANL_ID}" }`
|
|
424
616
|
|
|
425
617
|
### A_STRUCTURAL_EVALUATE
|
|
426
618
|
|
|
@@ -433,7 +625,7 @@ FAILURE_REASON: {仅 step_failed 时}
|
|
|
433
625
|
|
|
434
626
|
### A_SHOW_STATUS
|
|
435
627
|
|
|
436
|
-
1. Find latest `ralph-
|
|
628
|
+
1. Find latest `ralph-v2-*` session(by created_at)
|
|
437
629
|
2. Display: Session, Status, Position, Progress, Current step
|
|
438
630
|
3. List steps: [✓] confirmed, [▸] current, [ ] pending, [◆] decision;执行 step 附 `command_scope` + `command_path`
|
|
439
631
|
4. If `task_decomposition` present → 显示 sub-goals 进度(done/total)
|
|
@@ -477,7 +669,7 @@ FAILURE_REASON: {仅 step_failed 时}
|
|
|
477
669
|
|-------|------|------|
|
|
478
670
|
| 1. 快照 | 读 `task_decomposition` + `boundary_contract` + 已完成 steps 的 `completion_summary` | Display: 目标列表 + 进度 |
|
|
479
671
|
| 2. 解析 | `change_request` 非空 → 直接用;为空 → ask_question(修改/新增/移除/调整边界) | `change_type` + `change_request` |
|
|
480
|
-
| 3. Mini Grill | Agent
|
|
672
|
+
| 3. Mini Grill | Agent 评估影响 | RISK_LEVEL + AFFECTED_GOALS + INVALIDATED_STEPS + NEW_GAPS |
|
|
481
673
|
| 4. 确认 | ask_question:应用并继续 / 仅改目标 / 取消 | 用户选择 |
|
|
482
674
|
| 5. 应用 | 归档旧目标(`superseded`)→ 写入新目标(`origin: CHG-xxx`)→ 重建链路 → write status.json | re-dispatch |
|
|
483
675
|
|
|
@@ -514,9 +706,9 @@ GUARD: 已完成(`status: "done"`)的目标不可 supersede(skip + warn)
|
|
|
514
706
|
|
|
515
707
|
### A_RETRY / A_PAUSE_SESSION / A_COMPLETE_SESSION
|
|
516
708
|
|
|
517
|
-
- **A_RETRY**: `run_command("maestro ralph retry {index}")` —
|
|
518
|
-
- **A_PAUSE_SESSION**: `ralph complete N --status BLOCKED --reason "..."` —
|
|
519
|
-
- **A_COMPLETE_SESSION**: 校验所有 step `completion_confirmed == true` + `task_decomposition_all_done == true
|
|
709
|
+
- **A_RETRY**: `run_command("maestro ralph retry {index}")` — CLI 设 `step.retried = true`, `step.status = "pending"`, 清 `active_step_index`
|
|
710
|
+
- **A_PAUSE_SESSION**: `ralph complete N --status BLOCKED --reason "..."` — CLI 写 `session.status = "paused"`
|
|
711
|
+
- **A_COMPLETE_SESSION**: 校验所有 step `completion_confirmed == true` + `task_decomposition_all_done == true`(若存在),通过后写 `session.status = "completed"`
|
|
520
712
|
|
|
521
713
|
</actions>
|
|
522
714
|
|
|
@@ -524,21 +716,9 @@ GUARD: 已完成(`status: "done"`)的目标不可 supersede(skip + warn)
|
|
|
524
716
|
|
|
525
717
|
<appendix>
|
|
526
718
|
|
|
527
|
-
### Agent vs CLI-Delegate 对照
|
|
528
|
-
|
|
529
|
-
| 维度 | ralph-cli (CLI-delegate) | ralph-agent (Agent) |
|
|
530
|
-
|------|-------------------------|---------------------|
|
|
531
|
-
| 执行分发 | `maestro delegate` (Bash bg) | `invoke_subagent()` (同步) |
|
|
532
|
-
| 执行包装器 | `maestro-ralph-cli-execute` (delegate 加载) | `maestro-ralph-agent-execute` (Agent 内 Skill 加载) |
|
|
533
|
-
| 结果通信 | `---RESULT---` 文本块 (从 delegate output 解析) | Agent 返回文本 + `---AGENT-STATUS---` 块 |
|
|
534
|
-
| 回调模式 | STOP → re-invocation callback | 同步等待 Agent 返回(无 STOP) |
|
|
535
|
-
| 决策评估 | `maestro delegate --mode analysis` (Bash bg + STOP) | `invoke_subagent()` 同步分析(无 STOP) |
|
|
536
|
-
| 完成上报 | 编排器调 `ralph complete`(解析 RESULT 后) | 执行 Agent 内调 `ralph complete`(agent 上报) |
|
|
537
|
-
| session 字段 | `execution_mode: "cli-delegate"`, `cli_tool`, `delegate_exec_id` | `execution_mode: "agent"`, `agent_exec_name` |
|
|
538
|
-
|
|
539
719
|
### Stage Mapping
|
|
540
720
|
|
|
541
|
-
|
|
721
|
+
执行 Agent 始终拥有完整工具集(read + write),由 skill 自身约束行为。Decision 评估 Agent 通过 prompt 中的 CONSTRAINTS 约束为只读。
|
|
542
722
|
|
|
543
723
|
| Stage | Skill (independent) | Skill (unified) | Decision after | quality_mode |
|
|
544
724
|
|-------|---------------------|-----------------|----------------|--------------|
|
|
@@ -567,7 +747,7 @@ Build rules 0-14 全部适用,包括 spec-setup 预检(rule 0.5)、grill a
|
|
|
567
747
|
|
|
568
748
|
```json
|
|
569
749
|
{
|
|
570
|
-
"session_id": "ralph-
|
|
750
|
+
"session_id": "ralph-v2-{YYYYMMDD-HHmmss}",
|
|
571
751
|
"source": "ralph", "status": "running",
|
|
572
752
|
"execution_mode": "agent",
|
|
573
753
|
"ralph_protocol_version": "2",
|
|
@@ -646,7 +826,7 @@ Build rules 0-14 全部适用,包括 spec-setup 预检(rule 0.5)、grill a
|
|
|
646
826
|
|
|
647
827
|
### Fix-Loop Templates
|
|
648
828
|
|
|
649
|
-
6 套 fix-loop templates(post-execute / post-business-test / post-review / post-test / post-frontend-verify / post-goal-audit
|
|
829
|
+
6 套 fix-loop templates(post-execute / post-business-test / post-review / post-test / post-frontend-verify / post-goal-audit)。插入的 step 通过 A_STEP_DISPATCH 派发 executor agent 逐步执行,由主流程调 `ralph complete` 上报。
|
|
650
830
|
|
|
651
831
|
### Error Codes
|
|
652
832
|
|
|
@@ -655,29 +835,30 @@ E001–E006, W001–W004 适用。Agent 新增:
|
|
|
655
835
|
| Code | Severity | Description | Recovery |
|
|
656
836
|
|------|----------|-------------|----------|
|
|
657
837
|
| E014 | error | Agent execution failed (Agent returned null) | Retry once, then BLOCKED |
|
|
658
|
-
| E015 | error | `---AGENT-STATUS---` block not found | Fallback: re-read status.json 推断 |
|
|
659
838
|
| E016 | error | Evaluation Agent verdict parse failed | Fallback fix + parse_failed: true |
|
|
660
839
|
|
|
661
840
|
### Success Criteria
|
|
662
841
|
|
|
663
|
-
- [ ] ralph-
|
|
664
|
-
- [ ]
|
|
665
|
-
- [ ] Agent
|
|
842
|
+
- [ ] ralph-v2 owns full step loop: locate → resolve → dispatch → extract → drift → complete → next
|
|
843
|
+
- [ ] One agent per step — `invoke_subagent([{ TypeName: "ralph-executor", Role: "<Role>", Prompt: "<Prompt>", Workspace: "inherit" }])` 每步派发一个
|
|
844
|
+
- [ ] Agent 内调 `maestro ralph next` 获取 skill prompt 并执行,返回执行输出
|
|
845
|
+
- [ ] 主流程调 `maestro ralph complete` 上报(非 agent 上报)
|
|
846
|
+
- [ ] 主流程负责 arg resolution、context loading、signal extraction、drift analysis
|
|
847
|
+
- [ ] Agent 返回执行输出文本,主流程从中提取信号和状态
|
|
848
|
+
- [ ] Agent 崩溃(返回 null)→ STATUS=BLOCKED,转 S_HANDLE_FAIL
|
|
666
849
|
- [ ] 无 STOP/callback 模式 — invoke_subagent() 同步等待返回
|
|
667
|
-
- [ ]
|
|
668
|
-
- [ ] 执行 Agent 内部调 `maestro ralph complete` 上报(agent 上报,非编排器上报)
|
|
669
|
-
- [ ] A_PARSE_AGENT_RETURN 验证 status.json:agent 上报写入确认 + session.status 一致性
|
|
670
|
-
- [ ] Decision evaluation 通过 invoke_subagent() 同步完成(非 maestro delegate)
|
|
850
|
+
- [ ] Decision evaluation 通过 invoke_subagent() 同步完成
|
|
671
851
|
- [ ] Verdict 解析保持 `---VERDICT---` 格式,parse 失败 → fallback fix + parse_failed: true
|
|
672
|
-
- [ ] decisions.ndjson 追加:source 字段为 `"ralph-
|
|
673
|
-
- [ ] Session schema: `execution_mode: "agent"`,`agent_exec_name
|
|
674
|
-
- [ ] Chain building(S_RESOLVE_PHASE through S_BUILD_CHAIN
|
|
675
|
-
- [ ]
|
|
676
|
-
- [ ] execution_context 中 boundary_contract 不截断;superseded 目标仅一行标注
|
|
852
|
+
- [ ] decisions.ndjson 追加:source 字段为 `"ralph-v2"`
|
|
853
|
+
- [ ] Session schema: `execution_mode: "agent"`,`agent_exec_name`(执行 Agent 名称标识),含 `artifacts_produced`
|
|
854
|
+
- [ ] Chain building(S_RESOLVE_PHASE through S_BUILD_CHAIN)自包含执行
|
|
855
|
+
- [ ] A_STEP_DISPATCH 含前序产出加载(滑动窗口 5 step + accumulated signals + stage-specific artifacts)
|
|
677
856
|
- [ ] Agent name 含 stage prefix(grl/brn/anm/ana/pln/exe/rev/tst/dbg)
|
|
678
|
-
- [ ]
|
|
679
|
-
- [ ]
|
|
680
|
-
- [ ]
|
|
857
|
+
- [ ] `--summary` 在 DONE/DONE_WITH_CONCERNS 时为 MUST(动词开头,≤100 字)
|
|
858
|
+
- [ ] CAVEATS 在 DONE_WITH_CONCERNS 时同时映射 --concerns
|
|
859
|
+
- [ ] A_STEP_EXTRACT 从 agent 输出提取 artifact IDs、path signals、phase signals
|
|
860
|
+
- [ ] A_STEP_DRIFT_ANALYZE:ALIGNED/MINOR_DRIFT → complete;MAJOR_DRIFT+未重试 → retry;MAJOR_DRIFT+已重试 → DONE_WITH_CONCERNS
|
|
861
|
+
- [ ] A_STEP_COMPLETE 将 context signals 写入 status.json.context
|
|
681
862
|
- [ ] A_AMEND_GOAL:完整 5 步流程 + deferred_reading ralph-amend-goal.md + Agent mini grill 含完整 prompt
|
|
682
863
|
- [ ] 旧目标标 superseded(superseded_by + superseded_at),新目标 origin: "CHG-xxx"
|
|
683
864
|
- [ ] goal_changelog 含完整 before/after + impact_assessment
|
|
@@ -685,12 +866,8 @@ E001–E006, W001–W004 适用。Agent 新增:
|
|
|
685
866
|
- [ ] spec-setup 预检(build rule 0.5)
|
|
686
867
|
- [ ] post-milestone adhoc 分支:mark completed + set current_milestone = null
|
|
687
868
|
- [ ] post-reground + drifted + confidence < 60 → A_APPLY_PROCEED (LOW CONFIDENCE)
|
|
688
|
-
- [ ] Fix-loop 插入的 step 通过
|
|
869
|
+
- [ ] Fix-loop 插入的 step 通过 A_STEP_DISPATCH 逐步执行
|
|
689
870
|
- [ ] re-grounding 3-step 插入规则(build rule 5.5)不变
|
|
690
871
|
- [ ] A_REGROUND_HALT 漂移熔断(auto_confirm 不跳过)不变
|
|
691
|
-
- [ ] `---AGENT-STATUS---` 块缺失时 fallback:re-read status.json 推断状态
|
|
692
|
-
- [ ] Agent 超时/崩溃 → A_PARSE_AGENT_RETURN fallback 推断 + S_HANDLE_FAIL 路径
|
|
693
872
|
|
|
694
873
|
</appendix>
|
|
695
|
-
</output>
|
|
696
|
-
</output>
|