maestro-flow 0.5.44 → 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 +93 -0
- package/.agents/skills/maestro-ralph-cli/SKILL.md +21 -16
- package/.agents/skills/maestro-ralph-v2/SKILL.md +923 -0
- 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 +91 -0
- package/.agy/skills/maestro-ralph-cli/SKILL.md +21 -16
- package/.agy/skills/maestro-ralph-v2/SKILL.md +935 -0
- 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 +91 -0
- package/.claude/commands/maestro-ralph-cli.md +21 -16
- package/.claude/commands/maestro-ralph-v2.md +921 -0
- 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/.codex/skills/maestro-next/SKILL.md +1 -1
- 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
- package/.agents/skills/maestro-ralph-agent/SKILL.md +0 -697
- package/.agents/skills/maestro-ralph-agent-execute/SKILL.md +0 -461
- package/.agy/skills/maestro-ralph-agent/SKILL.md +0 -696
- package/.agy/skills/maestro-ralph-agent-execute/SKILL.md +0 -457
- package/.claude/commands/maestro-ralph-agent-execute.md +0 -459
- package/.claude/commands/maestro-ralph-agent.md +0 -695
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: maestro-ralph-agent-execute
|
|
3
|
-
description: Agent-native step executor — run skill, drift check, ralph complete, return status
|
|
4
|
-
argument-hint: "--session <id>"
|
|
5
|
-
allowed-tools:
|
|
6
|
-
- Read
|
|
7
|
-
- Write
|
|
8
|
-
- Edit
|
|
9
|
-
- Bash
|
|
10
|
-
- Glob
|
|
11
|
-
- Grep
|
|
12
|
-
- Skill
|
|
13
|
-
---
|
|
14
|
-
<purpose>
|
|
15
|
-
Agent-native execution wrapper for ralph-agent sessions.
|
|
16
|
-
|
|
17
|
-
Job: receive session ID → locate pending step → `maestro ralph next` → execute skill inline → extract signals → drift check → `maestro ralph complete`(agent 上报)→ check next → loop or return。
|
|
18
|
-
|
|
19
|
-
与 ralph-cli-execute 的关键区别:
|
|
20
|
-
1. **Agent 上报** — 执行 Agent 内部直接调 `maestro ralph complete`(非编排器解析 `---RESULT---` 后调用)
|
|
21
|
-
2. **Step 循环** — 自主循环处理连续的执行 step(如 ralph-execute),遇 decision/完成/失败时返回
|
|
22
|
-
3. **Drift 自治** — drift analysis 在执行侧完成,MAJOR_DRIFT 时自行 retry
|
|
23
|
-
4. **无 ---RESULT--- 输出** — 通过 `---AGENT-STATUS---` 块向编排器 Agent 返回结构化状态
|
|
24
|
-
|
|
25
|
-
Session management(创建/修改 session、决策评估、`ralph complete` 外的 status 变更)由编排器 `/maestro-ralph-agent` 负责。
|
|
26
|
-
</purpose>
|
|
27
|
-
|
|
28
|
-
<context>
|
|
29
|
-
$ARGUMENTS — `--session <id>` (必须)
|
|
30
|
-
|
|
31
|
-
**Parse:**
|
|
32
|
-
```
|
|
33
|
-
--session <id> → session_id
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
本命令仅 session mode,不支持 direct mode。
|
|
37
|
-
</context>
|
|
38
|
-
|
|
39
|
-
<invariants>
|
|
40
|
-
1. **Execute and report** — 执行 step + 调 `ralph complete` 上报,双动作为原子单元
|
|
41
|
-
2. **Step loop** — 连续执行 pending 执行 step,直到 decision/完成/失败
|
|
42
|
-
3. **Decision 不执行** — 遇到 decision step(`step.decision` 非空)立即返回,由编排器评估
|
|
43
|
-
4. **No session management** — 不创建/修改 session 元数据、不评估决策、不插入/删除 step
|
|
44
|
-
5. **Drift self-heal** — MAJOR_DRIFT + 未重试 → 自行 `ralph retry` + 重执行
|
|
45
|
-
6. **Required reading 由 CLI 负责** — `ralph next` 自动展开 + 加载 `<required_reading>`
|
|
46
|
-
7. **CLI 输出禁止截断** — `maestro ralph next` stdout 必须全量捕获
|
|
47
|
-
8. **STATUS 枚举受限** — 仅 `DONE | DONE_WITH_CONCERNS | NEEDS_RETRY | BLOCKED`
|
|
48
|
-
9. **Agent status 必输出** — 结束前必须输出 `---AGENT-STATUS---` 块
|
|
49
|
-
10. **禁止以上下文消耗为由中断循环** — harness 自动处理 context compression
|
|
50
|
-
</invariants>
|
|
51
|
-
|
|
52
|
-
<state_machine>
|
|
53
|
-
|
|
54
|
-
<states>
|
|
55
|
-
S_LOCATE — 读 status.json,定位 pending step PERSIST: —
|
|
56
|
-
S_RESOLVE_ARGS — 解析占位符 + 丰富参数 PERSIST: step.args (enriched)
|
|
57
|
-
S_LOAD_CONTEXT — 加载前序产出 + 发现 PERSIST: —
|
|
58
|
-
S_EXECUTE — `ralph next` + 内联执行 skill PERSIST: step.status = "running"
|
|
59
|
-
S_EXTRACT — 提取信号 + 组装 completion 参数 PERSIST: —
|
|
60
|
-
S_DRIFT — 产物 vs 目标偏离分析 PERSIST: step.drift_score
|
|
61
|
-
S_COMPLETE — 调 `ralph complete` 上报 PERSIST: step.completion_*
|
|
62
|
-
S_HANDLE_FAIL — 处理执行失败 PERSIST: step.status
|
|
63
|
-
S_OUTPUT — 输出 `---AGENT-STATUS---` 块 PERSIST: —
|
|
64
|
-
</states>
|
|
65
|
-
|
|
66
|
-
<transitions>
|
|
67
|
-
|
|
68
|
-
S_LOCATE:
|
|
69
|
-
→ S_RESOLVE_ARGS WHEN: pending 执行 step found (step.decision == null)
|
|
70
|
-
→ S_OUTPUT WHEN: pending decision step found (step.decision != null) RESULT=decision_pending
|
|
71
|
-
→ S_OUTPUT WHEN: no pending steps (all completed/skipped) RESULT=session_complete
|
|
72
|
-
→ S_OUTPUT WHEN: has failed step and no pending RESULT=step_failed
|
|
73
|
-
→ S_OUTPUT WHEN: no running session RESULT=step_failed
|
|
74
|
-
|
|
75
|
-
S_RESOLVE_ARGS:
|
|
76
|
-
→ S_LOAD_CONTEXT DO: A_RESOLVE_ARGS
|
|
77
|
-
|
|
78
|
-
S_LOAD_CONTEXT:
|
|
79
|
-
→ S_EXECUTE DO: A_LOAD_STEP_CONTEXT
|
|
80
|
-
|
|
81
|
-
S_EXECUTE:
|
|
82
|
-
→ S_EXTRACT WHEN: exit 0 + execution succeeded DO: A_EXEC_STEP
|
|
83
|
-
→ S_HANDLE_FAIL WHEN: exit 1 (required_reading/schema error) DO: A_EXEC_STEP
|
|
84
|
-
→ S_OUTPUT WHEN: exit 2 (no pending step) DO: RESULT=session_complete
|
|
85
|
-
→ S_HANDLE_FAIL WHEN: exit 3 (concurrency conflict) DO: A_HANDLE_CONCURRENCY
|
|
86
|
-
|
|
87
|
-
S_EXTRACT:
|
|
88
|
-
→ S_DRIFT DO: A_EXTRACT_SIGNALS
|
|
89
|
-
|
|
90
|
-
S_DRIFT:
|
|
91
|
-
→ S_COMPLETE WHEN: ALIGNED|MINOR_DRIFT DO: A_POST_ANALYZE_DRIFT
|
|
92
|
-
→ S_EXECUTE WHEN: MAJOR_DRIFT + not retried DO: A_POST_ANALYZE_DRIFT (ralph retry + re-execute)
|
|
93
|
-
→ S_COMPLETE WHEN: MAJOR_DRIFT + retried DO: A_POST_ANALYZE_DRIFT (DONE_WITH_CONCERNS)
|
|
94
|
-
|
|
95
|
-
S_COMPLETE:
|
|
96
|
-
→ S_LOCATE DO: A_AGENT_COMPLETE (loop to next step)
|
|
97
|
-
|
|
98
|
-
S_HANDLE_FAIL:
|
|
99
|
-
→ S_LOCATE WHEN: auto + not retried DO: A_RETRY (ralph retry N)
|
|
100
|
-
→ S_OUTPUT WHEN: auto + retried DO: RESULT=step_failed
|
|
101
|
-
→ S_LOCATE WHEN: interactive + user selects retry DO: A_RETRY
|
|
102
|
-
→ S_LOCATE WHEN: interactive + user selects skip DO: A_SKIP_STEP
|
|
103
|
-
→ S_OUTPUT WHEN: interactive + user selects abort DO: RESULT=step_failed
|
|
104
|
-
|
|
105
|
-
S_OUTPUT:
|
|
106
|
-
→ END DO: A_OUTPUT_STATUS
|
|
107
|
-
|
|
108
|
-
</transitions>
|
|
109
|
-
|
|
110
|
-
<actions>
|
|
111
|
-
|
|
112
|
-
### A_RESOLVE_ARGS
|
|
113
|
-
|
|
114
|
-
在 `ralph next` 之前解析占位符、注入 artifact 引用、丰富 skill args。
|
|
115
|
-
|
|
116
|
-
**1. Placeholder substitution:**
|
|
117
|
-
|
|
118
|
-
| Placeholder | Source |
|
|
119
|
-
|-------------|--------|
|
|
120
|
-
| `{phase}` | session.phase |
|
|
121
|
-
| `{milestone}` | session.milestone |
|
|
122
|
-
| `{intent}` | session.intent |
|
|
123
|
-
| `{description}` | session.intent (alias) |
|
|
124
|
-
| `{scratch_dir}` | session.context.scratch_dir or latest artifact path |
|
|
125
|
-
| `{plan_dir}` | session.context.plan_dir |
|
|
126
|
-
| `{analysis_dir}` | session.context.analysis_dir |
|
|
127
|
-
| `{issue_id}` | session.context.issue_id |
|
|
128
|
-
| `{milestone_num}` | session.context.milestone_num |
|
|
129
|
-
|
|
130
|
-
**2. Per-skill enrichment** (when args empty or minimal):
|
|
131
|
-
|
|
132
|
-
| Skill | Required context | Source |
|
|
133
|
-
|-------|-----------------|--------|
|
|
134
|
-
| maestro-brainstorm | topic | `"{intent}"` |
|
|
135
|
-
| maestro-roadmap | description | `"{intent}"` |
|
|
136
|
-
| maestro-analyze | phase or topic | `{phase}` or `"{intent}"` |
|
|
137
|
-
| maestro-plan | phase, --from, or --dir | see --from auto-injection below |
|
|
138
|
-
| maestro-execute | phase or --dir | see --from auto-injection below |
|
|
139
|
-
| quality-debug | gap context | Read previous step's error/gap |
|
|
140
|
-
| quality-* | phase | `{phase}` |
|
|
141
|
-
|
|
142
|
-
**3. --from auto-injection (phase-level artifact chaining):**
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
Read state.json.artifacts(含 milestone_history 内归档 artifacts)
|
|
146
|
-
→ filter by milestone={session.milestone} + phase={session.phase} + status=="completed"
|
|
147
|
-
|
|
148
|
-
plan step(含 {phase} 占位符,args 无 --from 且无 --dir):
|
|
149
|
-
1. 查同 phase+milestone 最新 completed type=="analyze" artifact → id = ANL-xxx
|
|
150
|
-
2. 命中 → args 追加 --from analyze:{id}
|
|
151
|
-
3. 写 step.source_artifact_ref = "analyze:{id}"
|
|
152
|
-
|
|
153
|
-
execute step(含 {phase} 占位符,args 无 --dir):
|
|
154
|
-
1. 查同 phase+milestone 最新 completed type=="plan" artifact → id = PLN-xxx, path = scratch/...
|
|
155
|
-
2. 命中 → args 追加 --dir .workflow/scratch/{path}
|
|
156
|
-
3. 写 step.source_artifact_ref = "plan:{id}"
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
兜底:查询无结果 → 不注入,由命令自身 discovery 逻辑处理。已有 `--from` 或 `--dir` 的 step 不覆盖。
|
|
160
|
-
|
|
161
|
-
**4. Goal context injection:**
|
|
162
|
-
|
|
163
|
-
当 `step.goal_ref` 非空且 `session.task_decomposition` 存在时:
|
|
164
|
-
```
|
|
165
|
-
goal = session.task_decomposition.find(g => g.id == step.goal_ref)
|
|
166
|
-
if goal:
|
|
167
|
-
goal_snippet = { id: goal.id, goal: goal.goal, done_when: goal.done_when,
|
|
168
|
-
boundary: goal.boundary, evidence: goal.evidence }
|
|
169
|
-
→ 传递给 A_EXEC_STEP 用于 goal context pre-injection
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
**5. Write** enriched args + source_artifact_ref back to status.json.
|
|
173
|
-
|
|
174
|
-
### A_LOAD_STEP_CONTEXT
|
|
175
|
-
|
|
176
|
-
加载前序产出和发现,为 inline execution 注入上下文。
|
|
177
|
-
|
|
178
|
-
1. **Previous step output** — 读前一 completed step 的 `completion_summary` + `completion_caveats` + `completion_decisions` + `completion_deferred`
|
|
179
|
-
2. **Artifacts** — 按 `session.context` 中的路径逐个 Read,提取与当前 step 相关的内容:
|
|
180
|
-
|
|
181
|
-
| 当前 stage | 加载什么 | Source |
|
|
182
|
-
|-----------|---------|--------|
|
|
183
|
-
| plan | analysis conclusions + scope_verdict | `{context.analysis_dir}/conclusions.json` |
|
|
184
|
-
| execute | task list + wave assignments | `{context.plan_dir}/TASK-*.json` |
|
|
185
|
-
| review | changed files + verification results | `{context.scratch_dir}/verification.json` |
|
|
186
|
-
| test | review findings | `review.json` |
|
|
187
|
-
| debug | error traces + failing test details | 前一 step 的 `completion_evidence` |
|
|
188
|
-
| brainstorm | grill report | `{context.grill_id}` report |
|
|
189
|
-
|
|
190
|
-
3. **Explore if needed** — 产物指向代码位置但缺少上下文 → `maestro explore` 补充(仅 execute/debug/test 且有文件路径引用时)
|
|
191
|
-
4. **Accumulated signals** — 遍历 ALL completed steps → 聚合 caveats + deferred
|
|
192
|
-
|
|
193
|
-
加载的内容进入会话上下文,后续 inline execution 自动受益。
|
|
194
|
-
|
|
195
|
-
### A_EXEC_STEP
|
|
196
|
-
|
|
197
|
-
1. Read status.json → 确认 session running,定位 pending 执行 step
|
|
198
|
-
2. **Load** — `Bash("maestro ralph next --session {session_id}")`
|
|
199
|
-
- **全量捕获 stdout,严禁截断管道**
|
|
200
|
-
- Exit 0 → 按 stdout 内联执行
|
|
201
|
-
- Exit 1 → set `failure_reason`,转 S_HANDLE_FAIL
|
|
202
|
-
- Exit 2 → RESULT=session_complete,skip to S_OUTPUT
|
|
203
|
-
- Exit 3 → A_HANDLE_CONCURRENCY
|
|
204
|
-
3. **Goal context pre-injection:**
|
|
205
|
-
- GUARD: `ralph_protocol_version >= "2"` → skip(session_anchor 已含 goal context)
|
|
206
|
-
- WHEN `ralph_protocol_version < "2"` 或缺失 AND `step.goal_ref` 非空 → 在 stdout 顶部前置:
|
|
207
|
-
```
|
|
208
|
-
<goal_context>
|
|
209
|
-
Sub-goal: {goal.id} — {goal.goal}
|
|
210
|
-
Done when: {goal.done_when}
|
|
211
|
-
Boundary: {goal.boundary}
|
|
212
|
-
Evidence target: {goal.evidence}
|
|
213
|
-
Execution criteria: {session.execution_criteria joined by '; '}
|
|
214
|
-
</goal_context>
|
|
215
|
-
```
|
|
216
|
-
4. **Deferred reading**: `ralph next` 将 `<deferred_reading>` 路径记录到 `step.load.deferred_files`,执行阶段按需 Read
|
|
217
|
-
5. **Inline execution** — 按 stdout 内容执行 skill 逻辑
|
|
218
|
-
6. Track: note start time, watch for errors
|
|
219
|
-
|
|
220
|
-
### A_EXTRACT_SIGNALS
|
|
221
|
-
|
|
222
|
-
执行完成后,提取结构化信号用于 completion 参数组装。
|
|
223
|
-
|
|
224
|
-
**Stage-specific extraction:**
|
|
225
|
-
|
|
226
|
-
| Stage | 提取什么 | 写入字段 |
|
|
227
|
-
|-------|---------|---------|
|
|
228
|
-
| analyze | `conclusions.json` scope_verdict + key_findings | `--summary`, context.analysis_dir |
|
|
229
|
-
| plan | TASK-*.json 数量 + 主要模块 + 波次 | `--summary`, context.plan_dir |
|
|
230
|
-
| execute | 修改文件数 + verification passed/failed | `--summary`, `--evidence`, context.scratch_dir |
|
|
231
|
-
| review | verdict + findings 数量 + severity | `--summary`, `--decisions` |
|
|
232
|
-
| test | pass/fail 统计 | `--summary`, `--evidence` |
|
|
233
|
-
| debug | root cause + 修复内容 | `--summary`, `--decisions` |
|
|
234
|
-
| grill | 核心质疑点数量 | `--summary`, `--caveats`, context.grill_id |
|
|
235
|
-
| brainstorm | 候选方案数 + 推荐方案 | `--summary`, `--decisions`, context.brainstorm_dir |
|
|
236
|
-
|
|
237
|
-
**Artifact scanning** — Use Glob 查找执行期间新增/修改的产物:
|
|
238
|
-
|
|
239
|
-
| Pattern | Signal |
|
|
240
|
-
|---------|--------|
|
|
241
|
-
| `conclusions.json` | `analysis_dir` |
|
|
242
|
-
| `TASK-*.json` | `plan_dir` |
|
|
243
|
-
| `verification.json` | `scratch_dir` |
|
|
244
|
-
| `review.json` | review stage |
|
|
245
|
-
| `test-results.json`, `uat.md` | test stage |
|
|
246
|
-
| `grill-report.md` | `grill_id` |
|
|
247
|
-
| `.brainstorming/*` | `brainstorm_dir` |
|
|
248
|
-
|
|
249
|
-
**Output text signal extraction** — 从 skill 执行输出文本中提取:
|
|
250
|
-
|
|
251
|
-
| Signal pattern | 写入 |
|
|
252
|
-
|----------------|------|
|
|
253
|
-
| `ANL-xxx` (artifact ID) | `session.analyze_macro_id` |
|
|
254
|
-
| `PLN-xxx` (artifact ID) | `context.plan_dir` |
|
|
255
|
-
| `BLP-xxx` (artifact ID) | `session.blueprint_id` |
|
|
256
|
-
| `scratch_dir:` 或 `.workflow/scratch/` 路径 | `context.scratch_dir` |
|
|
257
|
-
| `plan_dir:` 路径 | `context.plan_dir` |
|
|
258
|
-
| `PHASE: N` | `session.context.phase` |
|
|
259
|
-
|
|
260
|
-
**STATUS determination:**
|
|
261
|
-
|
|
262
|
-
| 条件 | STATUS |
|
|
263
|
-
|------|--------|
|
|
264
|
-
| Skill 正常完成 + 有产物 | `DONE` |
|
|
265
|
-
| 完成但有 warnings/concerns(review verdict partial, test 部分失败等) | `DONE_WITH_CONCERNS` |
|
|
266
|
-
| 执行出错但可重试(临时错误、网络问题、外部依赖不可用) | `NEEDS_RETRY` |
|
|
267
|
-
| 执行出错且无法重试(schema 错误、required_reading 缺失、command_path 不可达) | `BLOCKED` |
|
|
268
|
-
|
|
269
|
-
**Compose completion params:**
|
|
270
|
-
|
|
271
|
-
| Param | 规则 | 组装方法 |
|
|
272
|
-
|-------|------|---------|
|
|
273
|
-
| `--summary` | MUST。动词开头,≤100 字 | `"<动词><做了什么>,<量化结果>"` e.g. `"分析认证模块依赖图,发现 5 处 JWT 内联验证,scope=medium"` |
|
|
274
|
-
| `--decisions` | SHOULD。每条一个架构/技术决策 | 从执行中做出的非显而易见的选择。e.g. `"选择中间件模式而非装饰器"` |
|
|
275
|
-
| `--caveats` | SHOULD。后续 step 须知 | 发现但不属于本步解决的问题。e.g. `"session 存储层与 JWT 有隐式耦合"` |
|
|
276
|
-
| `--deferred` | SHOULD。推迟工作项 | 被主动推迟的项。e.g. `"性能基准测试留到 review 后"` |
|
|
277
|
-
| `--evidence` | SHOULD。验证产物路径 | 指向验证结果文件。e.g. `"verification.json"` |
|
|
278
|
-
| `--concerns` | COND。仅 DONE_WITH_CONCERNS 时 | CAVEATS 内容同时映射为 --concerns |
|
|
279
|
-
|
|
280
|
-
### A_POST_ANALYZE_DRIFT
|
|
281
|
-
|
|
282
|
-
产物 vs 目标偏离分析。A_EXTRACT_SIGNALS 后、A_AGENT_COMPLETE 前执行。
|
|
283
|
-
|
|
284
|
-
**1. 收集对照基准:**
|
|
285
|
-
|
|
286
|
-
| 基准来源 | 取值 |
|
|
287
|
-
|---------|------|
|
|
288
|
-
| `step.goal_ref` → goal.done_when | 子目标完成条件 |
|
|
289
|
-
| `session.boundary_contract.definition_of_done` | 全局验收标准 |
|
|
290
|
-
| `session.execution_criteria` | 执行准则 |
|
|
291
|
-
| `session.intent` | 原始意图 |
|
|
292
|
-
|
|
293
|
-
**2. 对比评分:**
|
|
294
|
-
|
|
295
|
-
| 维度 | 检查 |
|
|
296
|
-
|------|------|
|
|
297
|
-
| 覆盖度 | 产物是否覆盖 goal.done_when 每个条件 |
|
|
298
|
-
| 方向性 | decisions 是否与 intent/boundary 一致 |
|
|
299
|
-
| 完整性 | 预期产物类型是否齐全 |
|
|
300
|
-
|
|
301
|
-
**drift_score:**
|
|
302
|
-
- `ALIGNED` — 全部维度通过
|
|
303
|
-
- `MINOR_DRIFT` — 小缺口,不影响后续
|
|
304
|
-
- `MAJOR_DRIFT` — 方向性偏离或关键产物缺失
|
|
305
|
-
|
|
306
|
-
**3. 修正动作:**
|
|
307
|
-
|
|
308
|
-
| drift_score | 动作 |
|
|
309
|
-
|-------------|------|
|
|
310
|
-
| ALIGNED | 正常进入 S_COMPLETE |
|
|
311
|
-
| MINOR_DRIFT | 偏离项追加到 caveats,正常 complete |
|
|
312
|
-
| MAJOR_DRIFT + 未重试 | `Bash("maestro ralph retry {index}")` → 回到 S_EXECUTE 重执行(drift_correction 作修正上下文注入 prompt) |
|
|
313
|
-
| MAJOR_DRIFT + 已重试 | 以 DONE_WITH_CONCERNS complete |
|
|
314
|
-
|
|
315
|
-
**4. 写入:** `step.drift_score`, `step.drift_correction`
|
|
316
|
-
|
|
317
|
-
### A_AGENT_COMPLETE
|
|
318
|
-
|
|
319
|
-
Agent 上报:执行 Agent 直接调 CLI 完成 step。
|
|
320
|
-
|
|
321
|
-
1. 使用 A_EXTRACT_SIGNALS 组装的参数调用 `ralph complete`:
|
|
322
|
-
```
|
|
323
|
-
# DONE
|
|
324
|
-
Bash("maestro ralph complete {index} --status DONE --summary \"{SUMMARY}\" [--evidence ...] [--decisions ...] [--caveats ...] [--deferred ...]")
|
|
325
|
-
|
|
326
|
-
# DONE_WITH_CONCERNS — caveats 同时映射 --concerns
|
|
327
|
-
Bash("maestro ralph complete {index} --status DONE_WITH_CONCERNS --summary \"{SUMMARY}\" --concerns \"{CAVEATS}\" [--evidence ...] [--decisions ...] [--caveats ...] [--deferred ...]")
|
|
328
|
-
|
|
329
|
-
# NEEDS_RETRY
|
|
330
|
-
Bash("maestro ralph retry {index}")
|
|
331
|
-
|
|
332
|
-
# BLOCKED
|
|
333
|
-
Bash("maestro ralph complete {index} --status BLOCKED --reason \"{failure_reason}\"")
|
|
334
|
-
```
|
|
335
|
-
2. **Context signals propagation** — 将关键信号写入 `status.json.context`:
|
|
336
|
-
|
|
337
|
-
| Signal | 写入字段 |
|
|
338
|
-
|--------|---------|
|
|
339
|
-
| `analysis_dir` | `context.analysis_dir` |
|
|
340
|
-
| `plan_dir` | `context.plan_dir` |
|
|
341
|
-
| `scratch_dir` | `context.scratch_dir` |
|
|
342
|
-
| `grill_id` | `context.grill_id` |
|
|
343
|
-
| `brainstorm_dir` | `context.brainstorm_dir` |
|
|
344
|
-
| `blueprint_dir` | `context.blueprint_dir` |
|
|
345
|
-
| `ANL-xxx` | `session.analyze_macro_id` |
|
|
346
|
-
| `BLP-xxx` | `session.blueprint_id` |
|
|
347
|
-
| `phase` | `session.context.phase` |
|
|
348
|
-
|
|
349
|
-
3. Display: `[{index}/{total}] ✓ {step.skill} → {SUMMARY}`
|
|
350
|
-
4. **Increment** `completed_count` (for `---AGENT-STATUS---` reporting)
|
|
351
|
-
5. Loop back to S_LOCATE
|
|
352
|
-
|
|
353
|
-
### A_HANDLE_CONCURRENCY
|
|
354
|
-
|
|
355
|
-
Exit code 3 — `active_step_index` 被占用。
|
|
356
|
-
|
|
357
|
-
1. Display: `[{index}] ⚠ Concurrency conflict`
|
|
358
|
-
2. Wait 3 seconds, re-read status.json
|
|
359
|
-
3. Cleared → S_LOCATE (retry)
|
|
360
|
-
4. Still held after 2 attempts → `Bash("maestro ralph complete {index} --status BLOCKED --reason \"concurrency conflict unresolved\"")`, RESULT=step_failed
|
|
361
|
-
|
|
362
|
-
### A_RETRY
|
|
363
|
-
|
|
364
|
-
1. `Bash("maestro ralph retry {index}")` — CLI 设 `step.retried = true`, `step.status = "pending"`, 清 `active_step_index`
|
|
365
|
-
2. Display: `[{index}/{total}] ↻ {step.skill} retry`
|
|
366
|
-
3. Loop back to S_LOCATE
|
|
367
|
-
|
|
368
|
-
### A_SKIP_STEP
|
|
369
|
-
|
|
370
|
-
手动编辑 status.json:将 step `status` 设为 `"skipped"`,`completion_confirmed` 设为 `false`,清 `active_step_index`(若指向此 step)。
|
|
371
|
-
|
|
372
|
-
### A_OUTPUT_STATUS
|
|
373
|
-
|
|
374
|
-
输出 `---AGENT-STATUS---` 块并结束。
|
|
375
|
-
|
|
376
|
-
```
|
|
377
|
-
---AGENT-STATUS---
|
|
378
|
-
RESULT: decision_pending|session_complete|step_failed|steps_completed
|
|
379
|
-
LAST_STEP_INDEX: {last processed step index}
|
|
380
|
-
DECISION_NODE: {gate name, 仅 decision_pending 时}
|
|
381
|
-
COMPLETED_STEPS: {completed_count}
|
|
382
|
-
FAILURE_REASON: {仅 step_failed 时}
|
|
383
|
-
---END---
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
**RESULT 值语义:**
|
|
387
|
-
|
|
388
|
-
| RESULT | 含义 | 编排器动作 |
|
|
389
|
-
|--------|------|-----------|
|
|
390
|
-
| `decision_pending` | 下一个 step 是 decision 节点 | S_DECISION_EVAL |
|
|
391
|
-
| `session_complete` | 所有 step 已完成 | S_SESSION_DONE |
|
|
392
|
-
| `step_failed` | 执行失败 | S_HANDLE_FAIL |
|
|
393
|
-
| `steps_completed` | 完成了 N 个 step(兜底) | re-read status.json |
|
|
394
|
-
|
|
395
|
-
</actions>
|
|
396
|
-
|
|
397
|
-
</state_machine>
|
|
398
|
-
|
|
399
|
-
<appendix>
|
|
400
|
-
|
|
401
|
-
### 与 ralph-execute / ralph-cli-execute 对照
|
|
402
|
-
|
|
403
|
-
| 维度 | ralph-execute | ralph-cli-execute | ralph-agent-execute |
|
|
404
|
-
|------|---------------|-------------------|---------------------|
|
|
405
|
-
| 加载方式 | Skill() 自调用 | delegate CLI 加载 | Agent 内 Skill() 加载 |
|
|
406
|
-
| Step 循环 | 自调用链 | 单 step(编排器循环) | 内部循环(无自调用) |
|
|
407
|
-
| 完成上报 | `ralph complete` (自身调) | `---RESULT---` 输出(编排器调 complete) | `ralph complete` (自身调,agent 上报) |
|
|
408
|
-
| Decision 处理 | handoff Skill("maestro-ralph") | 不处理(无 decision step) | 不执行,返回编排器 |
|
|
409
|
-
| Drift 分析 | A_POST_ANALYZE_DRIFT (自身) | 无(编排器做) | A_POST_ANALYZE_DRIFT (自身) |
|
|
410
|
-
| 结果通信 | session 上下文传递 | `---RESULT---` stdout | `---AGENT-STATUS---` 块 |
|
|
411
|
-
|
|
412
|
-
### Arg Resolution
|
|
413
|
-
|
|
414
|
-
详见 action A_RESOLVE_ARGS(placeholder substitution、per-skill enrichment、--from auto-injection、goal context injection 完整规则均已内联于 action 中)。
|
|
415
|
-
|
|
416
|
-
### Error Codes
|
|
417
|
-
|
|
418
|
-
| Code | Severity | Description | Recovery |
|
|
419
|
-
|------|----------|-------------|----------|
|
|
420
|
-
| E006 | error | command_path 缺失/不可达 | RESULT=step_failed |
|
|
421
|
-
| E007 | error | required_reading 引用文件缺失 | RESULT=step_failed |
|
|
422
|
-
| E008 | error | active_step_index 与 complete idx 不匹配 | RESULT=step_failed |
|
|
423
|
-
| E009 | error | step.status ≠ running(重复 complete 或非法跳跃) | RESULT=step_failed |
|
|
424
|
-
| E010 | error | status.json schema 损坏 | RESULT=step_failed |
|
|
425
|
-
| W001 | warning | Step completed with concerns | STATUS=DONE_WITH_CONCERNS |
|
|
426
|
-
| W005 | warning | active_step_index 指向已 completed step | `ralph next` 自动清理后继续 |
|
|
427
|
-
| W007 | warning | step.skill ≠ command .md frontmatter.name | 提示但不阻塞 |
|
|
428
|
-
| — | info | exit 2 — 无 pending step | RESULT=session_complete |
|
|
429
|
-
| — | error | exit 3 — 并发冲突 | A_HANDLE_CONCURRENCY |
|
|
430
|
-
|
|
431
|
-
### Success Criteria
|
|
432
|
-
|
|
433
|
-
- [ ] 仅 session mode(`--session <id>`),不支持 direct mode
|
|
434
|
-
- [ ] `maestro ralph next --session {id}` 全量捕获 stdout,禁止截断
|
|
435
|
-
- [ ] Exit codes 完整处理:0→执行,1→S_HANDLE_FAIL,2→session_complete,3→A_HANDLE_CONCURRENCY
|
|
436
|
-
- [ ] Step 循环:连续执行 pending 执行 step,遇 decision/完成/失败时停止
|
|
437
|
-
- [ ] Decision step 不执行——返回 `decision_pending` + gate 名
|
|
438
|
-
- [ ] Agent 上报:执行 Agent 内部调 `maestro ralph complete` 更新 session 状态
|
|
439
|
-
- [ ] `--summary` 在 DONE/DONE_WITH_CONCERNS 时为 MUST(动词开头,≤100 字)
|
|
440
|
-
- [ ] DONE_WITH_CONCERNS 时 CAVEATS 同时映射 `--concerns` 参数
|
|
441
|
-
- [ ] Context signals 写入 status.json.context(analysis_dir/plan_dir/scratch_dir 等)
|
|
442
|
-
- [ ] Output text signal extraction:从执行输出中提取 ANL-xxx/PLN-xxx/BLP-xxx/PHASE:N 等信号
|
|
443
|
-
- [ ] Drift analysis:ALIGNED/MINOR_DRIFT → complete;MAJOR_DRIFT+未重试 → retry+重执行;MAJOR_DRIFT+已重试 → DONE_WITH_CONCERNS
|
|
444
|
-
- [ ] `---AGENT-STATUS---` 块始终输出(RESULT/LAST_STEP_INDEX/DECISION_NODE/COMPLETED_STEPS/FAILURE_REASON)
|
|
445
|
-
- [ ] S_RESOLVE_ARGS:placeholder substitution 完整(含 {description}/{milestone_num})
|
|
446
|
-
- [ ] Per-skill enrichment:8 个 skill 的 context 注入规则
|
|
447
|
-
- [ ] --from auto-injection:plan → analyze artifact,execute → plan artifact,含 state.json.artifacts 查询伪代码
|
|
448
|
-
- [ ] Goal context pre-injection:version >= 2 skip,< 2 注入 `<goal_context>` XML block
|
|
449
|
-
- [ ] S_LOAD_CONTEXT:前序 step output + stage-specific artifacts + explore + accumulated signals
|
|
450
|
-
- [ ] S_HANDLE_FAIL:auto+未重试→retry,auto+已重试→step_failed,interactive→retry/skip/abort
|
|
451
|
-
- [ ] A_SKIP_STEP:编辑 status.json 将 step 标为 skipped
|
|
452
|
-
- [ ] S_LOCATE 判断 session_complete 时校验无 pending 且无 failed(非仅 pending=0)
|
|
453
|
-
- [ ] Artifact scanning 含 `.brainstorming/*` pattern
|
|
454
|
-
- [ ] STATUS determination 4 路判定规则(DONE/DONE_WITH_CONCERNS/NEEDS_RETRY/BLOCKED)
|
|
455
|
-
- [ ] 不创建/修改 session 元数据、不评估决策、不插入/删除 step
|
|
456
|
-
- [ ] 禁止以上下文消耗为由中断循环
|
|
457
|
-
|
|
458
|
-
</appendix>
|
|
459
|
-
</output>
|