maestro-flow 0.5.45 → 0.5.46
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 +51 -6
- package/.agents/skills/maestro-ralph-v2/SKILL.md +124 -61
- package/.agents/skills/odyssey-debug/SKILL.md +338 -253
- package/.agents/skills/odyssey-improve/SKILL.md +367 -281
- package/.agents/skills/odyssey-planex/SKILL.md +490 -420
- package/.agents/skills/odyssey-review-test-fix/SKILL.md +336 -251
- package/.agents/skills/odyssey-ui/SKILL.md +332 -247
- package/.agy/agents/ralph-executor.md +53 -6
- package/.agy/skills/maestro-ralph-v2/SKILL.md +123 -61
- package/.agy/skills/odyssey-debug/SKILL.md +338 -253
- package/.agy/skills/odyssey-improve/SKILL.md +367 -281
- package/.agy/skills/odyssey-planex/SKILL.md +490 -420
- package/.agy/skills/odyssey-review-test-fix/SKILL.md +336 -251
- package/.agy/skills/odyssey-ui/SKILL.md +332 -247
- package/.claude/agents/ralph-executor.md +51 -6
- package/.claude/commands/maestro-ralph-v2.md +124 -61
- package/.claude/commands/odyssey-debug.md +352 -267
- package/.claude/commands/odyssey-improve.md +381 -295
- package/.claude/commands/odyssey-planex.md +504 -434
- package/.claude/commands/odyssey-review-test-fix.md +350 -265
- package/.claude/commands/odyssey-ui.md +346 -261
- package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +3 -3
- package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +4 -4
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
- package/dashboard/dist-server/src/graph/kg/db/queries.d.ts +6 -0
- package/dashboard/dist-server/src/graph/kg/db/queries.js +141 -19
- package/dashboard/dist-server/src/graph/kg/db/queries.js.map +1 -1
- package/dashboard/dist-server/src/graph/kg/extraction/code/svelte-extractor.js +1 -1
- package/dashboard/dist-server/src/graph/kg/extraction/code/svelte-extractor.js.map +1 -1
- package/dashboard/dist-server/src/graph/kg/extraction/code/tree-sitter.js +2 -2
- package/dashboard/dist-server/src/graph/kg/extraction/code/tree-sitter.js.map +1 -1
- package/dashboard/dist-server/src/graph/kg/extraction/code/vue-extractor.js +1 -1
- package/dashboard/dist-server/src/graph/kg/extraction/code/vue-extractor.js.map +1 -1
- package/dashboard/dist-server/src/graph/kg/extraction/code/wasm-stability.js +1 -1
- package/dashboard/dist-server/src/graph/kg/extraction/code/wasm-stability.js.map +1 -1
- package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js +2 -2
- package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js.map +1 -1
- package/dashboard/dist-server/src/graph/kg/surface/hook-injector.js +1 -1
- package/dashboard/dist-server/src/graph/kg/surface/hook-injector.js.map +1 -1
- package/dashboard/dist-server/src/hooks/keyword-spec-injector.js +35 -0
- package/dashboard/dist-server/src/hooks/keyword-spec-injector.js.map +1 -1
- package/dashboard/dist-server/src/hooks/spec-analytics.d.ts +1 -0
- package/dashboard/dist-server/src/hooks/spec-analytics.js.map +1 -1
- package/dashboard/dist-server/src/hooks/wiki-search-bridge.d.ts +32 -0
- package/dashboard/dist-server/src/hooks/wiki-search-bridge.js +71 -0
- package/dashboard/dist-server/src/hooks/wiki-search-bridge.js.map +1 -0
- package/dist/src/agents/api-explore/agent-loop.d.ts +15 -2
- package/dist/src/agents/api-explore/agent-loop.d.ts.map +1 -1
- package/dist/src/agents/api-explore/agent-loop.js +6 -5
- package/dist/src/agents/api-explore/agent-loop.js.map +1 -1
- package/dist/src/agents/api-explore/config.d.ts +56 -0
- package/dist/src/agents/api-explore/config.d.ts.map +1 -1
- package/dist/src/agents/api-explore/config.js +34 -0
- package/dist/src/agents/api-explore/config.js.map +1 -1
- package/dist/src/agents/api-explore/llm.d.ts +5 -1
- package/dist/src/agents/api-explore/llm.d.ts.map +1 -1
- package/dist/src/agents/api-explore/llm.js +10 -8
- package/dist/src/agents/api-explore/llm.js.map +1 -1
- package/dist/src/agents/api-explore/moa-cache.d.ts +12 -0
- package/dist/src/agents/api-explore/moa-cache.d.ts.map +1 -0
- package/dist/src/agents/api-explore/moa-cache.js +50 -0
- package/dist/src/agents/api-explore/moa-cache.js.map +1 -0
- package/dist/src/agents/api-explore/moa-loop.d.ts +49 -0
- package/dist/src/agents/api-explore/moa-loop.d.ts.map +1 -0
- package/dist/src/agents/api-explore/moa-loop.js +43 -0
- package/dist/src/agents/api-explore/moa-loop.js.map +1 -0
- package/dist/src/agents/api-explore/moa-pipeline.d.ts +43 -0
- package/dist/src/agents/api-explore/moa-pipeline.d.ts.map +1 -0
- package/dist/src/agents/api-explore/moa-pipeline.js +276 -0
- package/dist/src/agents/api-explore/moa-pipeline.js.map +1 -0
- package/dist/src/agents/api-explore/runner.d.ts +3 -0
- package/dist/src/agents/api-explore/runner.d.ts.map +1 -1
- package/dist/src/agents/api-explore/runner.js +24 -7
- package/dist/src/agents/api-explore/runner.js.map +1 -1
- package/dist/src/agents/api-explore/session.d.ts +15 -0
- package/dist/src/agents/api-explore/session.d.ts.map +1 -1
- package/dist/src/agents/api-explore/session.js.map +1 -1
- package/dist/src/cli.js +1 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/explore.d.ts.map +1 -1
- package/dist/src/commands/explore.js +16 -1
- package/dist/src/commands/explore.js.map +1 -1
- package/dist/src/commands/moa.d.ts +3 -0
- package/dist/src/commands/moa.d.ts.map +1 -0
- package/dist/src/commands/moa.js +202 -0
- package/dist/src/commands/moa.js.map +1 -0
- package/dist/src/graph/kg/db/queries.d.ts +6 -0
- package/dist/src/graph/kg/db/queries.d.ts.map +1 -1
- package/dist/src/graph/kg/db/queries.js +141 -19
- package/dist/src/graph/kg/db/queries.js.map +1 -1
- package/dist/src/graph/kg/extraction/code/svelte-extractor.js +1 -1
- package/dist/src/graph/kg/extraction/code/svelte-extractor.js.map +1 -1
- package/dist/src/graph/kg/extraction/code/tree-sitter.js +2 -2
- package/dist/src/graph/kg/extraction/code/tree-sitter.js.map +1 -1
- package/dist/src/graph/kg/extraction/code/vue-extractor.js +1 -1
- package/dist/src/graph/kg/extraction/code/vue-extractor.js.map +1 -1
- package/dist/src/graph/kg/extraction/code/wasm-stability.js +1 -1
- package/dist/src/graph/kg/extraction/code/wasm-stability.js.map +1 -1
- package/dist/src/graph/kg/extraction/orchestrator.js +2 -2
- package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -1
- package/dist/src/graph/kg/surface/hook-injector.js +1 -1
- package/dist/src/graph/kg/surface/hook-injector.js.map +1 -1
- package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -1
- package/dist/src/hooks/keyword-spec-injector.js +35 -0
- package/dist/src/hooks/keyword-spec-injector.js.map +1 -1
- package/dist/src/hooks/spec-analytics.d.ts +1 -0
- package/dist/src/hooks/spec-analytics.d.ts.map +1 -1
- package/dist/src/hooks/spec-analytics.js.map +1 -1
- package/dist/src/hooks/wiki-search-bridge.d.ts +33 -0
- package/dist/src/hooks/wiki-search-bridge.d.ts.map +1 -0
- package/dist/src/hooks/wiki-search-bridge.js +71 -0
- package/dist/src/hooks/wiki-search-bridge.js.map +1 -0
- package/dist/src/utils/update-notices.js +12 -0
- package/dist/src/utils/update-notices.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ralph-executor
|
|
3
|
-
description: Single-step executor — ralph next + inline skill execution,
|
|
3
|
+
description: Single-step executor — ralph next + inline skill execution, multi-agent orchestration via SendMessage
|
|
4
4
|
allowed-tools:
|
|
5
5
|
- read_file
|
|
6
6
|
- write_file
|
|
@@ -9,6 +9,8 @@ allowed-tools:
|
|
|
9
9
|
- find_files
|
|
10
10
|
- search
|
|
11
11
|
- invoke_skill
|
|
12
|
+
- delegate_subagent
|
|
13
|
+
- send_message
|
|
12
14
|
---
|
|
13
15
|
<!-- Open-standard mirror generated by scripts/build-agents-standard.mjs — do not edit; re-run after editing .claude/ source. -->
|
|
14
16
|
|
|
@@ -17,18 +19,43 @@ allowed-tools:
|
|
|
17
19
|
|
|
18
20
|
## Role
|
|
19
21
|
|
|
20
|
-
Single-step skill executor. Call `maestro ralph next` to load the skill prompt, execute it inline, return execution output. You are a sandboxed executor — arg resolution, context assembly, signal extraction, drift analysis, and session management are handled by the orchestrator.
|
|
22
|
+
Single-step skill executor with multi-agent orchestration capability. Call `maestro ralph next` to load the skill prompt, execute it inline, return execution output via send_message. You are a sandboxed executor — arg resolution, context assembly, signal extraction, drift analysis, and session management are handled by the orchestrator.
|
|
21
23
|
|
|
22
24
|
## Process
|
|
23
25
|
|
|
26
|
+
**立即自启动**:你是 named mailbox teammate。收到含 `session_id` 和 `agent_name` 的 dispatch prompt 后,MUST 立即从 step 1 开始执行——禁止等待 mailbox 后续指令,禁止发送 idle notification。
|
|
27
|
+
|
|
24
28
|
1. Call `shell("maestro ralph next --session {session_id}")` — **全量捕获 stdout,严禁截断管道**
|
|
25
29
|
- Exit 0 → skill_prompt = stdout,继续执行
|
|
26
|
-
- Exit 1 →
|
|
27
|
-
- Exit 2 →
|
|
28
|
-
- Exit 3 →
|
|
30
|
+
- Exit 1 → send_message 错误信息给 main,结束
|
|
31
|
+
- Exit 2 → send_message "所有 step 已完成" 给 main,结束
|
|
32
|
+
- Exit 3 → send_message "并发冲突" 给 main,结束
|
|
29
33
|
2. Execute the skill prompt inline — follow all instructions faithfully
|
|
30
34
|
3. Handle `<deferred_reading>` paths: Read files on demand during execution, do not batch-load upfront
|
|
31
|
-
4.
|
|
35
|
+
4. send_message({to: "main"}) 返回执行产物路径 + 摘要
|
|
36
|
+
|
|
37
|
+
## Multi-Agent Orchestration
|
|
38
|
+
|
|
39
|
+
当 skill prompt 需要多 agent 编排时(如 `maestro-execute` 的 wave 并行派发):
|
|
40
|
+
|
|
41
|
+
1. **派发 named worker**:调用 `delegate_subagent({name})` 派发 worker 为 named teammate,确保长时间任务存活:
|
|
42
|
+
```
|
|
43
|
+
worker name 格式: {agent_name}-w{index}(如 exe-v2-001-w1, exe-v2-001-w2)
|
|
44
|
+
```
|
|
45
|
+
> **必须传 name**:匿名 agent 执行完当前任务会 came to rest(死亡),后台任务完成通知无法唤醒。Named teammate 只会 idle,可被后台任务通知或 send_message 唤醒。
|
|
46
|
+
2. **等待结果**:worker 通过 send_message 回传结果到 executor 的 mailbox
|
|
47
|
+
3. **收集汇总**:接收所有 worker 的 send_message,汇总执行结果
|
|
48
|
+
4. **回报主流程**:通过 `send_message({to: "main"})` 返回最终执行输出
|
|
49
|
+
|
|
50
|
+
### Worker Dispatch Template
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
delegate_subagent({
|
|
54
|
+
name: "{agent_name}-w{index}",
|
|
55
|
+
description: "执行子任务: {task_description}",
|
|
56
|
+
prompt: "你是 worker agent。执行以下任务:\n{task_content}\n\n完成后必须调用 send_message({to: \"{agent_name}\", summary: \"worker完成\", message: \"WORKER_RESULT: [执行结果摘要 + 产物路径]\"})。"
|
|
57
|
+
})
|
|
58
|
+
```
|
|
32
59
|
|
|
33
60
|
## Input
|
|
34
61
|
|
|
@@ -37,12 +64,30 @@ Single-step skill executor. Call `maestro ralph next` to load the skill prompt,
|
|
|
37
64
|
| Field | Required | Description |
|
|
38
65
|
|-------|----------|-------------|
|
|
39
66
|
| `session_id` | Yes | ralph session ID |
|
|
67
|
+
| `agent_name` | Yes | 本 agent 的 name,用于 sub-agent send_message 回传 |
|
|
40
68
|
| execution context | No | 编排器注入的上下文(intent、boundary、goals、prior steps 等) |
|
|
41
69
|
|
|
70
|
+
## Output
|
|
71
|
+
|
|
72
|
+
通过 `send_message({to: "main"})` 返回,格式:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
EXECUTOR_OUTPUT:
|
|
76
|
+
- status: DONE|DONE_WITH_CONCERNS|ERROR
|
|
77
|
+
- summary: <执行摘要>
|
|
78
|
+
- artifacts: <产物路径列表>
|
|
79
|
+
- concerns: <关注点,仅 DONE_WITH_CONCERNS 时>
|
|
80
|
+
- error: <错误信息,仅 ERROR 时>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
失败时也必须 send_message,禁止静默崩溃。
|
|
84
|
+
|
|
42
85
|
## Constraints
|
|
43
86
|
|
|
87
|
+
- 禁止无故空转——收到 session_id 即开始执行,不等待编排器的后续 mailbox 指令。等待 worker send_message 回传期间的 idle 是正常行为(平台自动触发 idle_notification,不可抑制)
|
|
44
88
|
- Execute exactly one step per invocation
|
|
45
89
|
- Do not call `maestro ralph complete` — completion is handled by the orchestrator
|
|
46
90
|
- Do not read or modify `status.json` — session management is the orchestrator's responsibility
|
|
47
91
|
- Do not skip execution steps or short-circuit — execute the full skill content
|
|
48
92
|
- Do not insert/delete/reorder steps or evaluate decision nodes
|
|
93
|
+
- 所有执行结果必须通过 send_message({to: "main"}) 回报,直接文本输出主流程看不到
|
|
@@ -12,6 +12,7 @@ allowed-tools:
|
|
|
12
12
|
- invoke_skill
|
|
13
13
|
- ask_user
|
|
14
14
|
- delegate_subagent
|
|
15
|
+
- send_message
|
|
15
16
|
---
|
|
16
17
|
<!-- Open-standard mirror generated by scripts/build-agents-standard.mjs — do not edit; re-run after editing .claude/ source. -->
|
|
17
18
|
|
|
@@ -44,13 +45,16 @@ Remaining → intent (amend_mode 时为 change_request)
|
|
|
44
45
|
</context>
|
|
45
46
|
|
|
46
47
|
<invariants>
|
|
47
|
-
1. **Ralph-v2 owns the full loop** — locate step → resolve args → load context → dispatch agent → extract signals → drift → complete,全部在本命令内完成
|
|
48
|
-
2. **One agent per step** — 每个执行 step 派发一个 executor agent,agent
|
|
49
|
-
3. **Agent is a thin wrapper** — executor agent 调 `ralph next` 获取 skill prompt
|
|
50
|
-
4. **
|
|
48
|
+
1. **Ralph-v2 owns the full loop** — locate step → resolve args → load context → dispatch agent → wait for send_message → receive → extract signals → drift → complete,全部在本命令内完成
|
|
49
|
+
2. **One agent per step** — 每个执行 step 派发一个 named executor agent,agent 通过 send_message 回传结果,主流程解析结果后决定下一步
|
|
50
|
+
3. **Agent is a thin wrapper** — executor agent 调 `ralph next` 获取 skill prompt 并执行,通过 send_message 回传输出;arg resolution、context loading、signal extraction、drift analysis、ralph complete 均由主流程完成
|
|
51
|
+
4. **Dual dispatch model** — 执行 Agent 与评估 Agent 使用不同派发模式:
|
|
52
|
+
- **执行 Agent**(A_STEP_DISPATCH):`delegate_subagent({name: "exe-xxx"})` — named mailbox teammate,支持内部多 agent 编排,通过 `send_message({to: "main"})` 回传结果
|
|
53
|
+
- **评估 Agent**(A_AGENT_EVALUATE / A_AGENT_GOAL_AUDIT / A_AGENT_REGROUND):`delegate_subagent()` 不传 `name` — 同步阻塞,直接返回结果(评估 agent 只读不需要多 agent)
|
|
54
|
+
- `agent_exec_name` 既用于 display/日志,也作为执行 Agent 的 `name` 参数
|
|
51
55
|
5. **主流程调 `ralph complete`** — 每个 step 完成后由主流程调 `maestro ralph complete`,非 agent 上报
|
|
52
|
-
6. **Decision evaluation inline** — decision 节点不 handoff,通过
|
|
53
|
-
7. **
|
|
56
|
+
6. **Decision evaluation inline** — decision 节点不 handoff,通过 Agent 或 CLI delegate 在本循环内评估
|
|
57
|
+
7. **CLI delegation for evaluation only** — CLI delegate(`maestro delegate --mode analysis`)仅限评估环节;执行仍通过 executor Agent 完成
|
|
54
58
|
8. **Decision delegates read-only** — 评估 Agent 通过 prompt 中的 CONSTRAINTS 约束为只读
|
|
55
59
|
9. **执行 step 通过 `maestro ralph next` CLI 加载并内联执行**(由 execute Agent 完成)
|
|
56
60
|
10. **status.json 是唯一真源** — 不生成 markdown 清单或侧文件
|
|
@@ -87,7 +91,8 @@ S_CONFIRM — 用户确认
|
|
|
87
91
|
|
|
88
92
|
S_STEP_LOCATE — 找下一个 pending step PERSIST: —
|
|
89
93
|
S_STEP_RESOLVE — 解析占位符 + 丰富参数 PERSIST: step.args (enriched)
|
|
90
|
-
S_STEP_DISPATCH — 组装上下文 + 派发 executor agent
|
|
94
|
+
S_STEP_DISPATCH — 组装上下文 + 派发 named executor agent PERSIST: step.agent_exec_name, step.status = "running"
|
|
95
|
+
S_STEP_WAIT_MSG — 等待 executor 的 send_message 回传 PERSIST: —
|
|
91
96
|
S_STEP_ANALYZE — 提取信号 + 组装 completion 参数 PERSIST: —
|
|
92
97
|
S_STEP_DRIFT — 产物 vs 目标偏离分析 PERSIST: step.drift_score
|
|
93
98
|
S_STEP_COMPLETE — 调 `ralph complete` 上报 PERSIST: step.completion_*
|
|
@@ -142,8 +147,12 @@ S_STEP_RESOLVE:
|
|
|
142
147
|
→ S_STEP_DISPATCH DO: A_STEP_RESOLVE_ARGS
|
|
143
148
|
|
|
144
149
|
S_STEP_DISPATCH:
|
|
145
|
-
→
|
|
146
|
-
|
|
150
|
+
→ S_STEP_WAIT_MSG WHEN: executor dispatched DO: A_STEP_DISPATCH
|
|
151
|
+
|
|
152
|
+
S_STEP_WAIT_MSG:
|
|
153
|
+
→ S_STEP_ANALYZE WHEN: received agent-message with EXECUTOR_OUTPUT DO: A_STEP_RECEIVE
|
|
154
|
+
→ S_HANDLE_FAIL WHEN: received agent-message with status=ERROR DO: A_STEP_RECEIVE
|
|
155
|
+
→ S_HANDLE_FAIL WHEN: executor idle without send_message(崩溃检测) DO: mark BLOCKED
|
|
147
156
|
|
|
148
157
|
S_STEP_ANALYZE:
|
|
149
158
|
→ S_STEP_DRIFT WHEN: STATUS == DONE|DONE_WITH_CONCERNS DO: A_STEP_EXTRACT
|
|
@@ -323,14 +332,17 @@ Execution criteria: {session.execution_criteria joined by '; '}
|
|
|
323
332
|
| debug | `dbg` |
|
|
324
333
|
| Other | `run` |
|
|
325
334
|
|
|
326
|
-
**4. Dispatch
|
|
335
|
+
**4. Dispatch(named mailbox executor):**
|
|
336
|
+
|
|
337
|
+
> 执行 Agent 使用 `name` 参数派发为 named mailbox teammate,支持内部多 agent 编排。executor 通过 `send_message({to: "main"})` 回传执行结果。`resolved_agent_name` 同时用于 display 和 Agent `name` 参数。
|
|
327
338
|
|
|
328
339
|
```
|
|
329
340
|
delegate_subagent({
|
|
330
|
-
subagent_type: "ralph-executor",
|
|
331
341
|
name: "{resolved_agent_name}",
|
|
342
|
+
subagent_type: "ralph-executor",
|
|
332
343
|
description: "执行 step {index}: {step.skill}",
|
|
333
344
|
prompt: `Session: {session_id}
|
|
345
|
+
Agent name: {resolved_agent_name}
|
|
334
346
|
|
|
335
347
|
{goal_context 块,仅 protocol < 2 时}
|
|
336
348
|
|
|
@@ -339,11 +351,24 @@ delegate_subagent({
|
|
|
339
351
|
})
|
|
340
352
|
```
|
|
341
353
|
|
|
342
|
-
Agent 内部调 `maestro ralph next --session {session_id}` 获取 skill prompt 并执行。
|
|
343
|
-
|
|
344
354
|
5. Write `step.agent_exec_name` to status.json
|
|
345
|
-
6. Display: `[{index}/{total}] ⟶ {step.skill} →
|
|
346
|
-
7.
|
|
355
|
+
6. Display: `[{index}/{total}] ⟶ {step.skill} → {resolved_agent_name}`
|
|
356
|
+
7. delegate_subagent() 立即返回(named teammate 异步启动)→ 进入 S_STEP_WAIT_MSG 等待 executor 的 send_message
|
|
357
|
+
|
|
358
|
+
### A_STEP_RECEIVE
|
|
359
|
+
|
|
360
|
+
从 executor 的 `agent-message` 中提取执行输出。
|
|
361
|
+
|
|
362
|
+
1. 接收到 `<agent-message from="{resolved_agent_name}">` 后,提取 message 内容
|
|
363
|
+
2. 解析 `EXECUTOR_OUTPUT` 格式:
|
|
364
|
+
- `status: DONE` → agent_output = message 内容,继续 S_STEP_ANALYZE
|
|
365
|
+
- `status: DONE_WITH_CONCERNS` → agent_output = message 内容,继续 S_STEP_ANALYZE
|
|
366
|
+
- `status: ERROR` → STATUS=BLOCKED,转 S_HANDLE_FAIL
|
|
367
|
+
3. idle_notification 处理(区分正常等待与崩溃):
|
|
368
|
+
- 首次收到 `idle_notification`:executor 可能在等待 worker 回传,正常现象,继续等待
|
|
369
|
+
- 连续收到 2 次 `idle_notification` 且中间无 `agent-message`:向 executor 发送 `send_message({to: "{resolved_agent_name}", message: "请回报执行状态"})` 询问
|
|
370
|
+
- 询问后仍只收到 `idle_notification` 无 `agent-message`:STATUS=BLOCKED,转 S_HANDLE_FAIL
|
|
371
|
+
4. `agent_output` = 提取的 message 内容
|
|
347
372
|
|
|
348
373
|
### A_STEP_EXTRACT
|
|
349
374
|
|
|
@@ -472,10 +497,12 @@ Agent 内部调 `maestro ralph next --session {session_id}` 获取 skill prompt
|
|
|
472
497
|
|
|
473
498
|
### A_AGENT_EVALUATE
|
|
474
499
|
|
|
475
|
-
通过 Agent
|
|
500
|
+
通过 Agent 和/或 CLI delegate 评估质量门。评估模式由 `step.evaluate_via` 决定。
|
|
501
|
+
|
|
502
|
+
**1. Common setup:**
|
|
476
503
|
|
|
477
504
|
1. Resolve artifact dir: `.workflow/scratch/{artifact.path}/` with fallback glob
|
|
478
|
-
2. Parse decision metadata: `{ decision, retry_count, max_retries }`
|
|
505
|
+
2. Parse decision metadata: `{ decision, retry_count, max_retries, evaluate_via }`
|
|
479
506
|
3. Map result files:
|
|
480
507
|
|
|
481
508
|
| Decision | Files |
|
|
@@ -486,33 +513,65 @@ Agent 内部调 `maestro ralph next --session {session_id}` 获取 skill prompt
|
|
|
486
513
|
| post-test | uat.md, .tests/test-results.json |
|
|
487
514
|
| post-frontend-verify | e2e-results.json |
|
|
488
515
|
|
|
489
|
-
4.
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
516
|
+
4. `evaluate_via` 默认值:`"agent"`(未设置时)
|
|
517
|
+
|
|
518
|
+
**2. Dispatch by mode:**
|
|
519
|
+
|
|
520
|
+
**Mode: `agent`(默认)** — 同步 Agent 评估:
|
|
521
|
+
|
|
522
|
+
```
|
|
523
|
+
delegate_subagent({
|
|
524
|
+
description: "评估 {decision} 质量门(同步评估 Agent,不传 name)",
|
|
525
|
+
prompt: "PURPOSE: 评估 {decision} 质量门结果
|
|
526
|
+
TASK: 读取以下结果文件 | 分析状态 | 评估严重性 | 给出建议
|
|
527
|
+
FILES: {result_file_paths}
|
|
528
|
+
SESSION: {session_dir}/status.json
|
|
529
|
+
EXPECTED: 输出以下格式:
|
|
530
|
+
---VERDICT---
|
|
531
|
+
STATUS: PASS|FAIL|PARTIAL|BLOCKED
|
|
532
|
+
REASON: <一句话原因>
|
|
533
|
+
GAP_SUMMARY: <差距摘要>
|
|
534
|
+
CONFIDENCE: high|medium|low
|
|
535
|
+
CONFIDENCE_SCORE: 0-100
|
|
536
|
+
WEAKEST_DIMENSION: <最弱维度>
|
|
537
|
+
---END---
|
|
538
|
+
CONSTRAINTS: 只评估不修改文件 | 置信度<60%倾向 fix | retry {n}/{max} 达上限必须 escalate"
|
|
539
|
+
})
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
**Mode: `cli`** — CLI delegate 评估(异步后台):
|
|
543
|
+
|
|
544
|
+
```
|
|
545
|
+
shell({
|
|
546
|
+
command: `maestro delegate "PURPOSE: 评估 ${decision} 质量门结果\nTASK: 读取 ${result_file_paths} | 分析状态 | 评估严重性\nEXPECTED: ---VERDICT--- 格式(STATUS/REASON/GAP_SUMMARY/CONFIDENCE_SCORE)\nCONSTRAINTS: 只评估不修改文件" --mode analysis --rule analysis-review-code-quality`,
|
|
547
|
+
run_in_background: true
|
|
548
|
+
})
|
|
549
|
+
```
|
|
550
|
+
等待 delegate 完成 → `maestro delegate output {exec_id}` 获取结果 → 解析 `---VERDICT---`
|
|
551
|
+
|
|
552
|
+
**Mode: `dual`** — Agent + CLI 并行评估,交叉验证:
|
|
553
|
+
|
|
554
|
+
1. 先派发 CLI delegate(`run_in_background: true`)
|
|
555
|
+
2. 同时派发同步 Agent(阻塞等待)
|
|
556
|
+
3. Agent 返回后,检查 CLI delegate 状态(`maestro delegate status {exec_id}`)
|
|
557
|
+
4. 合并裁决:
|
|
558
|
+
|
|
559
|
+
| Agent 结果 | CLI 结果 | 合并策略 |
|
|
560
|
+
|-----------|---------|---------|
|
|
561
|
+
| 两者一致 | — | 采用共识,confidence_score 取较高值 |
|
|
562
|
+
| Agent=PASS, CLI=FAIL | — | 降级为 PARTIAL,confidence_score 取平均值 |
|
|
563
|
+
| Agent=FAIL, CLI=PASS | — | 维持 FAIL(保守策略) |
|
|
564
|
+
| CLI 未返回 | — | 使用 Agent 结果,标 `"cli_pending": true` |
|
|
565
|
+
|
|
566
|
+
**3. Verdict parse + adjustment(所有模式通用):**
|
|
567
|
+
|
|
568
|
+
5. 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)
|
|
511
569
|
6. Confidence adjustment: <60 + proceed → fix; >95 + fix + retry>0 → suggest proceed
|
|
512
570
|
7. **Decision log**: Append to `{session_dir}/decisions.ndjson`:
|
|
513
571
|
```json
|
|
514
572
|
{ "id": "DEC-{timestamp}", "timestamp": "{ISO}", "source": "ralph-v2",
|
|
515
573
|
"node_id": "{step.decision}", "type": "quality-gate",
|
|
574
|
+
"evaluate_via": "{mode}", "cli_exec_id": "{exec_id|null}",
|
|
516
575
|
"verdict": "{adjusted_verdict}", "confidence_score": {N},
|
|
517
576
|
"parse_failed": false,
|
|
518
577
|
"close_call": {N>=50 && N<=70}, "summary": "{REASON}" }
|
|
@@ -520,14 +579,13 @@ Agent 内部调 `maestro ralph next --session {session_id}` 获取 skill prompt
|
|
|
520
579
|
|
|
521
580
|
### A_AGENT_GOAL_AUDIT
|
|
522
581
|
|
|
523
|
-
通过 Agent
|
|
582
|
+
通过 Agent 和/或 CLI delegate 审计子目标完成情况。支持 `evaluate_via` 三种模式(同 A_AGENT_EVALUATE)。
|
|
524
583
|
|
|
525
584
|
1. Read `session.task_decomposition` from status.json
|
|
526
|
-
2. Dispatch audit
|
|
585
|
+
2. Dispatch audit(按 `evaluate_via` 模式,默认 `agent`):
|
|
527
586
|
```
|
|
528
587
|
delegate_subagent({
|
|
529
|
-
|
|
530
|
-
description: "审计子目标完成情况",
|
|
588
|
+
description: "审计子目标完成情况(同步评估 Agent,不传 name)",
|
|
531
589
|
prompt: "PURPOSE: 审计未完成子目标,判定 met / unmet
|
|
532
590
|
TASK:
|
|
533
591
|
1. 读取 {session_dir}/status.json 中 task_decomposition 的 status!=done 子目标
|
|
@@ -551,20 +609,19 @@ Agent 内部调 `maestro ralph next --session {session_id}` 获取 skill prompt
|
|
|
551
609
|
})
|
|
552
610
|
```
|
|
553
611
|
3. On return: parse verdict, update task_decomposition status
|
|
554
|
-
4. Append `{session_dir}/decisions.ndjson`:`{ "type": "goal-gate", "unmet_count": N, "unmet_ids": [...] }`
|
|
612
|
+
4. Append `{session_dir}/decisions.ndjson`:`{ "type": "goal-gate", "evaluate_via": "{mode}", "unmet_count": N, "unmet_ids": [...] }`
|
|
555
613
|
5. Verdict routing: `all_met` + `INTENT_ALIGNED=true` → A_APPLY_GOAL_DONE;`all_met` + `INTENT_ALIGNED=false` → A_REGROUND_HALT;`has_unmet` → A_APPLY_GOAL_FIX
|
|
556
614
|
GUARD: retry_count >= max_retries AND still unmet → A_APPLY_ESCALATE
|
|
557
615
|
|
|
558
616
|
### A_AGENT_REGROUND
|
|
559
617
|
|
|
560
|
-
通过 Agent
|
|
618
|
+
通过 Agent 和/或 CLI delegate 执行意图保真检查。支持 `evaluate_via` 三种模式(同 A_AGENT_EVALUATE)。
|
|
561
619
|
|
|
562
620
|
1. Read status.json:intent, boundary_contract, completed steps, done goals
|
|
563
|
-
2. Dispatch reground
|
|
621
|
+
2. Dispatch reground(按 `evaluate_via` 模式,默认 `agent`):
|
|
564
622
|
```
|
|
565
623
|
delegate_subagent({
|
|
566
|
-
|
|
567
|
-
description: "意图保真检查",
|
|
624
|
+
description: "意图保真检查(同步评估 Agent,不传 name)",
|
|
568
625
|
prompt: "PURPOSE: 意图保真检查 — 对照 intent 验证累积执行是否漂移
|
|
569
626
|
TASK:
|
|
570
627
|
1. 读取 intent + boundary_contract.definition_of_done
|
|
@@ -663,8 +720,7 @@ Agent 内部调 `maestro ralph next --session {session_id}` 获取 skill prompt
|
|
|
663
720
|
**Phase 3 Agent prompt:**
|
|
664
721
|
```
|
|
665
722
|
delegate_subagent({
|
|
666
|
-
|
|
667
|
-
description: "Amend impact analysis",
|
|
723
|
+
description: "Amend impact analysis(同步评估 Agent,不传 name)",
|
|
668
724
|
prompt: "PURPOSE: 评估目标修改对 running session 的影响
|
|
669
725
|
TASK:
|
|
670
726
|
1. 读取 {session_dir}/status.json 的 task_decomposition + boundary_contract + 已完成 steps
|
|
@@ -695,7 +751,10 @@ GUARD: 已完成(`status: "done"`)的目标不可 supersede(skip + warn)
|
|
|
695
751
|
|
|
696
752
|
- **A_RETRY**: `shell("maestro ralph retry {index}")` — CLI 设 `step.retried = true`, `step.status = "pending"`, 清 `active_step_index`
|
|
697
753
|
- **A_PAUSE_SESSION**: `ralph complete N --status BLOCKED --reason "..."` — CLI 写 `session.status = "paused"`
|
|
698
|
-
- **A_COMPLETE_SESSION**: 校验所有 step `completion_confirmed == true` + `task_decomposition_all_done == true`(若存在),通过后写 `session.status = "completed"
|
|
754
|
+
- **A_COMPLETE_SESSION**: 校验所有 step `completion_confirmed == true` + `task_decomposition_all_done == true`(若存在),通过后写 `session.status = "completed"`。完成后向所有 idle executor 发送 shutdown_request 清理:
|
|
755
|
+
```
|
|
756
|
+
遍历 steps[].agent_exec_name → send_message({to: name, message: {type: "shutdown_request"}})
|
|
757
|
+
```
|
|
699
758
|
|
|
700
759
|
</actions>
|
|
701
760
|
|
|
@@ -762,6 +821,7 @@ Build rules 0-14 全部适用,包括 spec-setup 预检(rule 0.5)、grill a
|
|
|
762
821
|
"stage": "",
|
|
763
822
|
"scope": null,
|
|
764
823
|
"decision": null,
|
|
824
|
+
"evaluate_via": "agent|cli|dual",
|
|
765
825
|
"retry_count": 0,
|
|
766
826
|
"max_retries": 2,
|
|
767
827
|
"command_scope": "global|project|missing|null",
|
|
@@ -826,24 +886,27 @@ E001–E006, W001–W004 适用。Agent 新增:
|
|
|
826
886
|
|
|
827
887
|
### Success Criteria
|
|
828
888
|
|
|
829
|
-
- [ ] ralph-v2 owns full step loop: locate → resolve → dispatch → extract → drift → complete → next
|
|
830
|
-
- [ ] One agent per step — `delegate_subagent({ subagent_type: "ralph-executor" })` 每步派发一个
|
|
831
|
-
- [ ]
|
|
889
|
+
- [ ] ralph-v2 owns full step loop: locate → resolve → dispatch → wait → receive → extract → drift → complete → next
|
|
890
|
+
- [ ] One agent per step — `delegate_subagent({ name, subagent_type: "ralph-executor" })` 每步派发一个 named executor
|
|
891
|
+
- [ ] Executor 内调 `maestro ralph next` 获取 skill prompt 并执行,支持内部多 agent 编排
|
|
892
|
+
- [ ] Executor 通过 `send_message({to: "main"})` 回传 `EXECUTOR_OUTPUT` 格式结果
|
|
832
893
|
- [ ] 主流程调 `maestro ralph complete` 上报(非 agent 上报)
|
|
833
894
|
- [ ] 主流程负责 arg resolution、context loading、signal extraction、drift analysis
|
|
834
|
-
- [ ]
|
|
835
|
-
- [ ]
|
|
836
|
-
- [ ]
|
|
837
|
-
- [ ] Decision evaluation
|
|
895
|
+
- [ ] A_STEP_RECEIVE 从 executor 的 agent-message 中提取执行输出
|
|
896
|
+
- [ ] Executor 崩溃(idle 无 send_message)→ 询问 2 次后 STATUS=BLOCKED,转 S_HANDLE_FAIL
|
|
897
|
+
- [ ] Dual dispatch: 执行 Agent 传 `name`(async + send_message),评估 Agent 不传 `name`(sync)或 CLI delegate
|
|
898
|
+
- [ ] Decision evaluation 支持三种模式:agent(同步)、cli(CLI delegate)、dual(并行交叉验证)
|
|
899
|
+
- [ ] `evaluate_via` 字段控制评估模式,默认 `"agent"`
|
|
900
|
+
- [ ] dual 模式合并策略:一致取共识、分歧保守降级、CLI 未返回用 Agent 结果
|
|
838
901
|
- [ ] Verdict 解析保持 `---VERDICT---` 格式,parse 失败 → fallback fix + parse_failed: true
|
|
839
902
|
- [ ] decisions.ndjson 追加:source 字段为 `"ralph-v2"`
|
|
840
|
-
- [ ] Session schema: `execution_mode: "agent"`,`agent_exec_name`(执行 Agent
|
|
903
|
+
- [ ] Session schema: `execution_mode: "agent"`,`agent_exec_name`(执行 Agent name + display),含 `artifacts_produced`
|
|
841
904
|
- [ ] Chain building(S_RESOLVE_PHASE through S_BUILD_CHAIN)自包含执行
|
|
842
905
|
- [ ] A_STEP_DISPATCH 含前序产出加载(滑动窗口 5 step + accumulated signals + stage-specific artifacts)
|
|
843
|
-
- [ ]
|
|
906
|
+
- [ ] `agent_exec_name` 含 stage prefix(grl/brn/anm/ana/pln/exe/rev/tst/dbg)——同时用于 Agent name 参数和 display
|
|
844
907
|
- [ ] `--summary` 在 DONE/DONE_WITH_CONCERNS 时为 MUST(动词开头,≤100 字)
|
|
845
908
|
- [ ] CAVEATS 在 DONE_WITH_CONCERNS 时同时映射 --concerns
|
|
846
|
-
- [ ] A_STEP_EXTRACT 从
|
|
909
|
+
- [ ] A_STEP_EXTRACT 从 executor 输出提取 artifact IDs、path signals、phase signals
|
|
847
910
|
- [ ] A_STEP_DRIFT_ANALYZE:ALIGNED/MINOR_DRIFT → complete;MAJOR_DRIFT+未重试 → retry;MAJOR_DRIFT+已重试 → DONE_WITH_CONCERNS
|
|
848
911
|
- [ ] A_STEP_COMPLETE 将 context signals 写入 status.json.context
|
|
849
912
|
- [ ] A_AMEND_GOAL:完整 5 步流程 + deferred_reading ralph-amend-goal.md + Agent mini grill 含完整 prompt
|