maestro-flow 0.4.15 → 0.4.16
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/skills/maestro/SKILL.md +17 -17
- package/.agents/skills/maestro-plan/SKILL.md +10 -9
- package/.agents/skills/maestro-ralph/SKILL.md +21 -17
- package/.agents/skills/maestro-ralph-execute/SKILL.md +54 -71
- package/.agents/skills/manage-knowledge-audit/SKILL.md +90 -0
- package/.agy/skills/maestro/SKILL.md +17 -17
- package/.agy/skills/maestro-plan/SKILL.md +10 -9
- package/.agy/skills/maestro-ralph/SKILL.md +21 -17
- package/.agy/skills/maestro-ralph-execute/SKILL.md +54 -71
- package/.agy/skills/manage-knowledge-audit/SKILL.md +90 -0
- package/.claude/commands/maestro-plan.md +10 -9
- package/.claude/commands/maestro-ralph-execute.md +54 -71
- package/.claude/commands/maestro-ralph.md +21 -17
- package/.claude/commands/maestro.md +17 -17
- package/.claude/commands/manage-knowledge-audit.md +88 -0
- package/dist/src/cli.js +1 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/font-guide.d.ts +13 -0
- package/dist/src/commands/font-guide.d.ts.map +1 -0
- package/dist/src/commands/font-guide.js +114 -0
- package/dist/src/commands/font-guide.js.map +1 -0
- package/dist/src/commands/install.d.ts.map +1 -1
- package/dist/src/commands/install.js +5 -0
- package/dist/src/commands/install.js.map +1 -1
- package/dist/src/commands/ralph.d.ts +6 -0
- package/dist/src/commands/ralph.d.ts.map +1 -0
- package/dist/src/commands/ralph.js +133 -0
- package/dist/src/commands/ralph.js.map +1 -0
- package/dist/src/core/manifest.d.ts +2 -0
- package/dist/src/core/manifest.d.ts.map +1 -1
- package/dist/src/core/manifest.js.map +1 -1
- package/dist/src/hooks/statusline.d.ts.map +1 -1
- package/dist/src/hooks/statusline.js +189 -81
- package/dist/src/hooks/statusline.js.map +1 -1
- package/dist/src/ralph/cmd-check.d.ts +9 -0
- package/dist/src/ralph/cmd-check.d.ts.map +1 -0
- package/dist/src/ralph/cmd-check.js +53 -0
- package/dist/src/ralph/cmd-check.js.map +1 -0
- package/dist/src/ralph/cmd-complete.d.ts +10 -0
- package/dist/src/ralph/cmd-complete.d.ts.map +1 -0
- package/dist/src/ralph/cmd-complete.js +91 -0
- package/dist/src/ralph/cmd-complete.js.map +1 -0
- package/dist/src/ralph/cmd-next.d.ts +5 -0
- package/dist/src/ralph/cmd-next.d.ts.map +1 -0
- package/dist/src/ralph/cmd-next.js +158 -0
- package/dist/src/ralph/cmd-next.js.map +1 -0
- package/dist/src/ralph/cmd-session.d.ts +5 -0
- package/dist/src/ralph/cmd-session.d.ts.map +1 -0
- package/dist/src/ralph/cmd-session.js +52 -0
- package/dist/src/ralph/cmd-session.js.map +1 -0
- package/dist/src/ralph/cmd-skills.d.ts +6 -0
- package/dist/src/ralph/cmd-skills.d.ts.map +1 -0
- package/dist/src/ralph/cmd-skills.js +55 -0
- package/dist/src/ralph/cmd-skills.js.map +1 -0
- package/dist/src/ralph/skill-resolver.d.ts +40 -0
- package/dist/src/ralph/skill-resolver.d.ts.map +1 -0
- package/dist/src/ralph/skill-resolver.js +162 -0
- package/dist/src/ralph/skill-resolver.js.map +1 -0
- package/dist/src/ralph/skill-scanner.d.ts +15 -0
- package/dist/src/ralph/skill-scanner.d.ts.map +1 -0
- package/dist/src/ralph/skill-scanner.js +122 -0
- package/dist/src/ralph/skill-scanner.js.map +1 -0
- package/dist/src/ralph/status-checker.d.ts +7 -0
- package/dist/src/ralph/status-checker.d.ts.map +1 -0
- package/dist/src/ralph/status-checker.js +139 -0
- package/dist/src/ralph/status-checker.js.map +1 -0
- package/dist/src/ralph/status-schema.d.ts +94 -0
- package/dist/src/ralph/status-schema.d.ts.map +1 -0
- package/dist/src/ralph/status-schema.js +9 -0
- package/dist/src/ralph/status-schema.js.map +1 -0
- package/dist/src/ralph/status-store.d.ts +20 -0
- package/dist/src/ralph/status-store.d.ts.map +1 -0
- package/dist/src/ralph/status-store.js +70 -0
- package/dist/src/ralph/status-store.js.map +1 -0
- package/dist/src/tui/install-ui/ExecutionView.d.ts.map +1 -1
- package/dist/src/tui/install-ui/ExecutionView.js +1 -0
- package/dist/src/tui/install-ui/ExecutionView.js.map +1 -1
- package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallExecution.js +2 -0
- package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
- package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallFlow.js +28 -14
- package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
- package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallResult.js +1 -1
- package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
- 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/workflows/knowledge-audit.md +358 -0
|
@@ -24,7 +24,7 @@ Entry points:
|
|
|
24
24
|
Initial decomposition (S_DECOMPOSE): boundary-clarified via ≤3 questions for broad intents (重构/全面/迁移/重写). 写入 status.json 的 `boundary_contract` / `execution_criteria` / `task_decomposition`,附 `/goal` prompt。
|
|
25
25
|
|
|
26
26
|
Step kinds:
|
|
27
|
-
- **执行 step**: ralph-execute `
|
|
27
|
+
- **执行 step**: ralph-execute 调 `run_command("maestro ralph next")` 加载 command .md + required_reading 全文,按 stdout 内联执行
|
|
28
28
|
- **decision step**: `step.decision` 字段非空;回 ralph 评估(CLI 只读分析)
|
|
29
29
|
|
|
30
30
|
Key difference from maestro coordinator:
|
|
@@ -42,9 +42,9 @@ Mutual invocation with `/maestro-ralph-execute` forms a self-perpetuating work l
|
|
|
42
42
|
│ writes status.json
|
|
43
43
|
│ emits /goal prompt
|
|
44
44
|
▼
|
|
45
|
-
ralph-execute ◀─┐ 执行 step →
|
|
45
|
+
ralph-execute ◀─┐ 执行 step → `maestro ralph next` + inline + `ralph complete`
|
|
46
46
|
│ │ decision step → Skill("maestro-ralph")
|
|
47
|
-
└─────────┘ writes step.completion_confirmed
|
|
47
|
+
└─────────┘ CLI writes step.completion_confirmed
|
|
48
48
|
loop until all completion_confirmed | paused
|
|
49
49
|
```
|
|
50
50
|
</purpose>
|
|
@@ -69,11 +69,11 @@ Remaining → intent
|
|
|
69
69
|
1. **Ralph never executes steps** — only creates sessions and evaluates decisions
|
|
70
70
|
2. **Handoff via Skill("maestro-ralph-execute")** — 创建 session 后始终自动 handoff;decision 评估后始终 handoff
|
|
71
71
|
3. **Decision delegates read-only** — `maestro delegate --role analyze --mode analysis`
|
|
72
|
-
4. **执行 step 通过
|
|
72
|
+
4. **执行 step 通过 `maestro ralph next` CLI 加载并内联执行**(详见 invariant 8)
|
|
73
73
|
5. **status.json 是唯一真源** — 不生成 markdown 清单或侧文件
|
|
74
|
-
6. **每个 step 必须 `completion_confirmed: true`** —
|
|
75
|
-
7. **command_path 在 A_BUILD_STEPS 解析** —
|
|
76
|
-
8. **执行 step 加载契约** — ralph
|
|
74
|
+
6. **每个 step 必须 `completion_confirmed: true`** — 由 `maestro ralph complete N --status DONE`(或 DONE_WITH_CONCERNS)写入;CLI 是唯一合法写入路径
|
|
75
|
+
7. **command_path 在 A_BUILD_STEPS 解析** — 通过 `maestro ralph skills --json --quiet` 预校验(project 覆盖 global),命中即写绝对路径到 status.json;未命中标 `command_scope = "missing"`
|
|
76
|
+
8. **执行 step 加载契约** — 由 `maestro ralph next` CLI 在执行期完成:解析 frontmatter + `<required_reading>` + `<deferred_reading>`,自动读取 required 文件全文并拼入 prompt;缺失 required → 退出码 1(E007),pause session。ralph build 阶段只通过 `maestro ralph skills` 校验路径存在性,不读 .md 内容
|
|
77
77
|
9. **Decomposition is outcome-oriented** — sub-goals 为可观测交付,禁止 lifecycle 复刻;`/goal` 用户绑定,ralph 输出提示词后继续 handoff,用户可在执行过程中随时输入 `/goal`
|
|
78
78
|
10. **planning_mode governs arg granularity** — `unified` → skill args 无 `{phase}`;`independent` → 含 `{phase}`
|
|
79
79
|
11. **task_decomposition 驱动 steps[] 动态生长** — `post-goal-audit` 按 unmet 子目标插入 scoped mini-loop;字段可选/累加,既有字段不删不改
|
|
@@ -395,7 +395,7 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
|
|
|
395
395
|
| goal-audit | *(decision-only)* | *(same)* | `post-goal-audit` | all (only if decomposed) |
|
|
396
396
|
| milestone-complete | `maestro-milestone-complete` | *(same)* | `post-milestone` | all |
|
|
397
397
|
|
|
398
|
-
> 所有执行 stage 统一通过
|
|
398
|
+
> 所有执行 stage 统一通过 `maestro ralph next` CLI 加载 + 内联执行;decision 节点单独作为独立 step 插入(见规则 4)。
|
|
399
399
|
|
|
400
400
|
**Build rules (按顺序应用):**
|
|
401
401
|
|
|
@@ -410,11 +410,12 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
|
|
|
410
410
|
8. **占位符**:independent 保留 `{phase}` `{intent}`;unified 不带 `{phase}`
|
|
411
411
|
9. **command_path 解析**(每个执行 step,decision 节点跳过):
|
|
412
412
|
- 取 skill 名(args 前的第一个 token)
|
|
413
|
-
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
413
|
+
- **预校验通过 `run_command("maestro ralph skills --json --quiet")`** 一次性拉取所有可用 commands + skills(global + project,project 覆盖 global),匹配 skill 名得到:
|
|
414
|
+
- 命中 commands → `command_scope = "global" | "project"`,`command_path = <绝对路径>`
|
|
415
|
+
- 命中 skills → 同上(type=skill)
|
|
416
|
+
- 未命中 → `command_scope = "missing"`, `command_path = null`,A_CREATE_SESSION 报错 E006
|
|
417
|
+
- **不在 build 阶段读取 .md 内容**;`<required_reading>` / `<deferred_reading>` 解析与加载由 `maestro ralph next` CLI 在执行期完成
|
|
418
|
+
10. **每个 step 初始化** `completion_confirmed: false`, `completion_status: null`, `completion_evidence: null`, `deferred_reads: []`, `load: null`(由 `ralph next` 写入)
|
|
418
419
|
11. **scope_verdict gating**(仅当 chain 起点 = `analyze-macro`):
|
|
419
420
|
- `scope_verdict ∈ {medium, small}` → 跳过 `roadmap` + `analyze` 两 stage;`plan` 选 standalone 列(`--from analyze:{analyze_macro_id}`),不带 `{phase}`
|
|
420
421
|
- `scope_verdict == large` → 保留 `roadmap` + `analyze`;`plan` 选 phase 列(`{phase}`)
|
|
@@ -593,6 +594,8 @@ Runs only when `task_decomposition` present.
|
|
|
593
594
|
{
|
|
594
595
|
"session_id": "ralph-{YYYYMMDD-HHmmss}",
|
|
595
596
|
"source": "ralph", "status": "running",
|
|
597
|
+
"ralph_protocol_version": "1", // CLI-driven; absent/0 → legacy inline ralph-execute
|
|
598
|
+
"active_step_index": null, // CLI-managed; only one step held at a time
|
|
596
599
|
"intent": "", "lifecycle_position": "",
|
|
597
600
|
"phase": null, "phase_is_new": false,
|
|
598
601
|
"milestone": "", // D-007 反查结果,禁止读 current_milestone
|
|
@@ -615,7 +618,7 @@ Runs only when `task_decomposition` present.
|
|
|
615
618
|
"retry_count": 0, // decision 节点专用
|
|
616
619
|
"max_retries": 2, // decision 节点专用
|
|
617
620
|
"command_scope": "global|project|missing|null", // 执行 step;decision 节点固定 null
|
|
618
|
-
"command_path": "
|
|
621
|
+
"command_path": "<absolute path resolved by `maestro ralph skills --json --quiet`> | null",
|
|
619
622
|
"milestone_id": null, // D-007 反查注入;仅含 {phase} 占位符的 step 有
|
|
620
623
|
"source_artifact_ref": null, // "analyze:ANL-xxx" | "blueprint:BLP-xxx" | null
|
|
621
624
|
"status": "pending|running|completed|skipped|failed",
|
|
@@ -624,7 +627,8 @@ Runs only when `task_decomposition` present.
|
|
|
624
627
|
"completion_status": null,
|
|
625
628
|
"completion_evidence": null,
|
|
626
629
|
"completed_at": null,
|
|
627
|
-
"deferred_reads": []
|
|
630
|
+
"deferred_reads": [], // 由 ralph next CLI 解析 .md 时填充
|
|
631
|
+
"load": null // { loaded_at, required_files[], deferred_files[], resolve_version } —— 由 ralph next 写入
|
|
628
632
|
}],
|
|
629
633
|
"waves": [], "current_step": 0,
|
|
630
634
|
|
|
@@ -745,8 +749,8 @@ decision:post-goal-audit {retry+1}
|
|
|
745
749
|
- [ ] quality_mode 由 A_DETERMINE_QUALITY_MODE 决定,过滤 build steps
|
|
746
750
|
- [ ] Decomposition: broad intent ≤3 question clarify;narrow auto-derive
|
|
747
751
|
- [ ] status.json 唯一真源:boundary_contract + execution_criteria + task_decomposition;无外部清单
|
|
748
|
-
- [ ] 执行 step 含 `command_scope` + `command_path
|
|
749
|
-
- [ ] Ralph build
|
|
752
|
+
- [ ] 执行 step 含 `command_scope` + `command_path`(通过 `maestro ralph skills --json --quiet` 预校验,project 覆盖 global);decision step 通过 `step.decision` 字段标识
|
|
753
|
+
- [ ] Ralph build 阶段只通过 `ralph skills` 校验路径存在性,不读 .md 内容;`<required_reading>` 加载由 `maestro ralph next` CLI 完成
|
|
750
754
|
- [ ] 每个 step 含 `completion_confirmed` + `completion_status` + `completion_evidence` + `deferred_reads`(初始 false/null/[])
|
|
751
755
|
- [ ] 每个 sub-goal 含 `completion_confirmed`(初始 false)
|
|
752
756
|
- [ ] post-goal-audit decision 仅在 decomposed 时插入,位于 milestone-complete 之前
|
|
@@ -32,24 +32,24 @@ Also read `session.auto_mode` from status.json — if true, treat as `-y`.
|
|
|
32
32
|
| Kind | Identifier | Execution | Flow after |
|
|
33
33
|
|------|-----------|-----------|------------|
|
|
34
34
|
| decision step | `step.decision` 非空 | `Skill("maestro-ralph")` | Execution ends here |
|
|
35
|
-
| 执行 step | `step.decision == null` | `
|
|
35
|
+
| 执行 step | `step.decision == null` | `run_command("maestro ralph next")` → 内联按其 stdout 执行 → `run_command("maestro ralph complete N --status ...")` | Self-invoke next |
|
|
36
36
|
|
|
37
37
|
HARD RULES:
|
|
38
|
-
- 执行 step
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
- `
|
|
42
|
-
- 每个 step 必须产出 `--- COMPLETION STATUS ---` 块,否则视为 NEEDS_RETRY
|
|
38
|
+
- 执行 step:**统一通过 `maestro ralph next` CLI 加载**。CLI 负责读 command_path、解析 `<required_reading>` + `<deferred_reading>`、拼接 prompt、写 `step.load.*` + `active_step_index` + `step.status="running"`。不要再在会话里手动 Read + 解析 required_reading
|
|
39
|
+
- decision step:A_EXEC_DECISION 通过 `view_file(AbsolutePath="<agy-skills-dir>/maestro-ralph/SKILL.md") + execute inline` handoff 给 ralph 评估(不走 CLI)
|
|
40
|
+
- `command_path` 由 ralph 在 A_BUILD_STEPS 写入 status.json(缺失 → ralph next 返回 E006/E007 并拒绝执行)
|
|
41
|
+
- 每个 step 结束必须调用 `maestro ralph complete N --status <S>` 或 `maestro ralph retry N`。STATUS 仅 4 个合法值:`DONE | DONE_WITH_CONCERNS | NEEDS_RETRY | BLOCKED`(**`NEEDS_CONTEXT` 已废除**,context 容量由 harness 自动压缩处理)
|
|
43
42
|
</context>
|
|
44
43
|
|
|
45
44
|
<invariants>
|
|
46
|
-
1. **执行 =
|
|
47
|
-
2. **Required reading
|
|
48
|
-
3. **Deferred reading recorded only** — `<deferred_reading>`
|
|
49
|
-
4.
|
|
50
|
-
5.
|
|
45
|
+
1. **执行 = `ralph next` + inline + `ralph complete`** — 调 `maestro ralph next` 拿到 skill 内容,按 stdout 内联执行
|
|
46
|
+
2. **Required reading 由 CLI 负责** — `ralph next` 自动展开 + 加载 `<required_reading>` 引用的所有文件,缺失 → 退出码 1(E007),不写 active_step_index,不进入执行
|
|
47
|
+
3. **Deferred reading recorded only** — `<deferred_reading>` 路径由 CLI 记录到 `step.load.deferred_files`,执行阶段按需 Read
|
|
48
|
+
4. **一致性取代锁** — 同一 session 同时最多一个 step 持 `active_step_index`;CLI 校验失败直接退出码 3,不静默推进
|
|
49
|
+
5. **Completion 通过 CLI 调用** — 每个 step 末尾调 `maestro ralph complete N --status <S>` 或 `maestro ralph retry N`,由 CLI 写 `completion_*` + 清 `active_step_index`
|
|
51
50
|
6. **Self-invocation chain** — 持续直到全部 `completion_confirmed` 或 paused
|
|
52
|
-
7. **status.json
|
|
51
|
+
7. **status.json 每步骤后由 CLI 原子写盘** — resume-safe
|
|
52
|
+
8. **STATUS 枚举受限** — 仅 `DONE | DONE_WITH_CONCERNS | NEEDS_RETRY | BLOCKED`;`NEEDS_CONTEXT` 已废除
|
|
53
53
|
</invariants>
|
|
54
54
|
|
|
55
55
|
<state_machine>
|
|
@@ -76,11 +76,12 @@ S_RESOLVE_ARGS:
|
|
|
76
76
|
|
|
77
77
|
S_EXECUTE:
|
|
78
78
|
→ END WHEN: step.decision != null DO: A_EXEC_DECISION
|
|
79
|
-
→ S_POST_EXEC WHEN: step.decision == null +
|
|
80
|
-
→ S_HANDLE_FAIL WHEN: step.decision == null +
|
|
79
|
+
→ S_POST_EXEC WHEN: step.decision == null + ralph complete invoked with DONE|DONE_WITH_CONCERNS DO: A_EXEC_STEP
|
|
80
|
+
→ S_HANDLE_FAIL WHEN: step.decision == null + ralph next exit≠0 OR ralph complete with NEEDS_RETRY|BLOCKED DO: A_EXEC_STEP
|
|
81
81
|
|
|
82
82
|
S_POST_EXEC:
|
|
83
|
-
→ S_LOCATE DO:
|
|
83
|
+
→ S_LOCATE DO: run_command("maestro ralph complete ...") + Skill("maestro-ralph-execute")
|
|
84
|
+
NOTE: CLI 已写完 completion_*, status, active_step_index;无需额外写盘
|
|
84
85
|
|
|
85
86
|
S_HANDLE_FAIL:
|
|
86
87
|
→ S_LOCATE WHEN: auto + not retried DO: A_RETRY
|
|
@@ -103,8 +104,8 @@ S_FALLBACK:
|
|
|
103
104
|
|
|
104
105
|
1. If session_id provided → load `.workflow/.maestro/{session_id}/status.json`
|
|
105
106
|
2. Else: scan `.workflow/.maestro/*/status.json`, filter `status == "running"`, sort DESC, take first
|
|
106
|
-
3. Extract: session_id, source, steps[],
|
|
107
|
-
4.
|
|
107
|
+
3. Extract: session_id, source, steps[], phase, milestone, intent, auto_mode, context, cli_tool, active_step_index
|
|
108
|
+
4. **不在此处选 pending step**——pending 选择由 `maestro ralph next` CLI 内部完成;A_LOCATE_SESSION 只确认 session 存在且 running,由 A_EXEC_STEP 调 CLI 推进
|
|
108
109
|
|
|
109
110
|
### A_RESOLVE_ARGS
|
|
110
111
|
|
|
@@ -152,54 +153,35 @@ Write enriched args back to status.json.
|
|
|
152
153
|
|
|
153
154
|
### A_EXEC_STEP
|
|
154
155
|
|
|
155
|
-
1.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
7. 计算 `effective_args`:`step.args` + (`auto ? " -y" : ""`)
|
|
170
|
-
8. 按读到的指令在本会话中**内联执行**:调用允许的工具完成命令所规定的工作;执行过程中如触发 deferred_reading 引用的资源 → 按需 Read
|
|
171
|
-
9. 执行结束:要求最后一段必须包含 `--- COMPLETION STATUS ---` 块(见 A_MARK_COMPLETE)
|
|
172
|
-
10. Return success / failure
|
|
173
|
-
|
|
174
|
-
### A_MARK_COMPLETE
|
|
175
|
-
|
|
176
|
-
1. 从 step 输出中提取 `--- COMPLETION STATUS ---` 块(required)
|
|
177
|
-
2. 解析并写入:
|
|
178
|
-
- `STATUS: DONE` → `step.status = "completed"`, `step.completion_confirmed = true`, `step.completion_status = "DONE"`
|
|
179
|
-
- `STATUS: DONE_WITH_CONCERNS` → `step.status = "completed"`, `step.completion_confirmed = true`, `step.completion_status = "DONE_WITH_CONCERNS"`, `step.concerns = <CONCERNS>`
|
|
180
|
-
- `STATUS: NEEDS_RETRY` → `step.status = "pending"`, `step.retried = true`, `step.completion_confirmed = false`, → S_HANDLE_FAIL
|
|
181
|
-
- `STATUS: BLOCKED` / `NEEDS_CONTEXT` → `session.status = "paused"`, `step.completion_status` 记录原因, `step.completion_confirmed = false`
|
|
182
|
-
- 缺失 `--- COMPLETION STATUS ---` 块 → 视为 NEEDS_RETRY(不允许 heuristic fallback)
|
|
183
|
-
3. 写入 `step.completion_evidence`(artifact 路径 / 关键输出节选)
|
|
184
|
-
4. 扫描输出抓取 context 信号:`PHASE: N` → session.phase;`scratch_dir: path` → context.scratch_dir;`BLP-xxx` → context.blueprint_session_id
|
|
185
|
-
5. `step.completed_at = now`,写 status.json
|
|
186
|
-
6. **Sub-goal evidence 校验**(task_decomposition 存在时):若 `step.goal_ref` 对应子目标的 `lifecycle` 覆盖当前 stage 且 evidence artifact 已生成 → 暂不直接置 done,仍交由 post-goal-audit 决策;仅在 step 显式确认时更新 `task_decomposition[*].completion_confirmed = false` 占位(保持 pending)
|
|
187
|
-
7. Display: `[{index}/{total}] ✓ {step.skill} completed (confirmed)`
|
|
156
|
+
1. **Load** — `run_command("maestro ralph next")`
|
|
157
|
+
- 退出码 0 → 按 stdout 内联执行
|
|
158
|
+
- 退出码 2 → 交给 S_LOCATE
|
|
159
|
+
- 退出码 3 → active_step_index 已被占用
|
|
160
|
+
- 退出码 1 → pause session
|
|
161
|
+
2. **Inline execution** — 按 stdout 执行;deferred_reading 按需 Read
|
|
162
|
+
3. **Complete**:
|
|
163
|
+
- `run_command("maestro ralph complete N --status DONE [--evidence <path>]")`
|
|
164
|
+
- `run_command("maestro ralph complete N --status DONE_WITH_CONCERNS --concerns \"...\"")`
|
|
165
|
+
- `run_command("maestro ralph retry N")`
|
|
166
|
+
- `run_command("maestro ralph complete N --status BLOCKED --reason \"...\"")`
|
|
167
|
+
4. **Propagate context signals** — 关键信号 (`PHASE: N` / `scratch_dir: path` / `BLP-xxx`) 写入 `status.json.context`
|
|
168
|
+
|
|
169
|
+
完成后 S_LOCATE 触发 `view_file(AbsolutePath="<agy-skills-dir>/maestro-ralph-execute/SKILL.md") + execute inline` 自调用。
|
|
188
170
|
|
|
189
171
|
### A_RETRY
|
|
190
172
|
|
|
191
|
-
1. `step.retried = true`, `step.status = "pending"`, `step.
|
|
192
|
-
2.
|
|
173
|
+
1. `run_command("maestro ralph retry N")` — CLI 设 `step.retried = true`, `step.status = "pending"`, `step.completion_confirmed = false`, 清 `active_step_index`
|
|
174
|
+
2. Display: `[{index}/{total}] ↻ {step.skill} retry`
|
|
193
175
|
|
|
194
176
|
### A_SKIP_STEP
|
|
195
177
|
|
|
196
|
-
|
|
197
|
-
|
|
178
|
+
跳过执行 step — 手动编辑 `status.json`:将该 step `status` 设为 `"skipped"`,`completion_confirmed` 设为 `false`,并清 `active_step_index`(若指向此 step)。
|
|
179
|
+
(不提供 CLI 子命令;跳过是非常规操作,避免自动化误用。)
|
|
198
180
|
|
|
199
181
|
### A_PAUSE_SESSION
|
|
200
182
|
|
|
201
|
-
|
|
202
|
-
|
|
183
|
+
通常由 `ralph complete N --status BLOCKED --reason "..."` 触发,CLI 已写 `session.status = "paused"`。手动 pause 场景下直接编辑 status.json。
|
|
184
|
+
Display: `[{index}/{total}] ✗ {step.skill} 失败,会话已暂停。/maestro-ralph continue 恢复。`
|
|
203
185
|
|
|
204
186
|
### A_COMPLETE_SESSION
|
|
205
187
|
|
|
@@ -234,29 +216,30 @@ Write enriched args back to status.json.
|
|
|
234
216
|
| Code | Severity | Description | Recovery |
|
|
235
217
|
|------|----------|-------------|----------|
|
|
236
218
|
| E001 | error | No running session found | Suggest /maestro or /maestro-ralph |
|
|
237
|
-
|
|
|
238
|
-
|
|
|
239
|
-
|
|
|
240
|
-
|
|
|
219
|
+
| E006 | error | command_path missing/unreachable for 执行 step | `ralph next` 拒绝;编辑 status.json 或重 build |
|
|
220
|
+
| E007 | error | required_reading 引用文件缺失 | `ralph next` 拒绝;CLI stderr 列出缺失路径 |
|
|
221
|
+
| E008 | error | `ralph complete` idx ≠ active_step_index | 编辑 status.json 修正一致性 |
|
|
222
|
+
| E009 | error | `ralph complete` step.status ≠ running | 重复 complete 或非法跳跃;编辑 status.json |
|
|
223
|
+
| E010 | error | status.json schema 损坏 | `ralph check` 显示具体损坏字段 |
|
|
241
224
|
| W001 | warning | Step completed with concerns | Log and continue |
|
|
242
|
-
|
|
|
225
|
+
| W005 | warning | active_step_index 指向已 completed step | `ralph next` 自动清理后继续 |
|
|
226
|
+
| W007 | warning | step.skill ≠ command .md frontmatter.name | 提示但不阻塞 |
|
|
243
227
|
|
|
244
228
|
### Success Criteria
|
|
245
229
|
|
|
246
230
|
- [ ] Session discovery covers maestro-* and ralph-*
|
|
247
231
|
- [ ] `-y` parsed from args 或 session.auto_mode;auto=true 时透传 `-y` 到 skill args
|
|
248
232
|
- [ ] Placeholders resolved;per-skill enrichment 正确
|
|
249
|
-
- [ ] Decision 节点(`step.decision != null
|
|
250
|
-
- [ ] 执行 step 通过
|
|
251
|
-
- [ ]
|
|
252
|
-
- [ ] `<deferred_reading>`
|
|
253
|
-
- [ ]
|
|
254
|
-
- [ ]
|
|
255
|
-
- [ ]
|
|
256
|
-
- [ ] step.completion_evidence
|
|
257
|
-
- [ ] Context signals
|
|
233
|
+
- [ ] Decision 节点(`step.decision != null`)走 Skill("maestro-ralph") handoff(**不调 ralph next CLI**)
|
|
234
|
+
- [ ] 执行 step 通过 `run_command("maestro ralph next")` 加载;CLI 返回拼好的 prompt + completion 协议
|
|
235
|
+
- [ ] required_reading 由 CLI 自动加载并拼入 prompt;缺失 → CLI 退出码 1,pause session
|
|
236
|
+
- [ ] `<deferred_reading>` 由 CLI 记录到 `step.load.deferred_files`,执行阶段按需 Read
|
|
237
|
+
- [ ] 每个 step 末尾必须调 `maestro ralph complete N --status <S>` 或 `maestro ralph retry N`
|
|
238
|
+
- [ ] STATUS 枚举仅 `DONE | DONE_WITH_CONCERNS | NEEDS_RETRY | BLOCKED`;CLI 拒绝 `NEEDS_CONTEXT`
|
|
239
|
+
- [ ] active_step_index 一致性由 CLI 维护;E008/E009 直接退出,不静默推进
|
|
240
|
+
- [ ] step.completion_evidence 通过 `--evidence` 传入并记录
|
|
241
|
+
- [ ] Context signals 由执行 step 显式写回 status.json.context(非 ralph-execute 内嵌扫描)
|
|
258
242
|
- [ ] Auto mode: retry 一次后 pause;interactive 提供 retry/skip/abort
|
|
259
243
|
- [ ] 自调用持续到全部 completion_confirmed 或 paused
|
|
260
|
-
- [ ] A_COMPLETE_SESSION 校验全部 step confirmed + sub-goal all_done
|
|
261
244
|
|
|
262
245
|
</appendix>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-knowledge-audit
|
|
3
|
+
description: Audit and prune knowledge across spec / knowhow / artifact stores
|
|
4
|
+
argument-hint: --scope <spec|knowhow|artifact|all> [--level P0|P1|P2] [--timeline T1..T6] [--since YYYY-MM-DD] [--milestone <name>] [--include-archive] [--interactive] [--mark|--delete|--purge] [--dry-run] [--report]
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- ask_question
|
|
7
|
+
- define_subagent
|
|
8
|
+
- grep_search
|
|
9
|
+
- invoke_subagent
|
|
10
|
+
- manage_subagents
|
|
11
|
+
- replace_file_content
|
|
12
|
+
- run_command
|
|
13
|
+
- send_message
|
|
14
|
+
- view_file
|
|
15
|
+
- write_to_file
|
|
16
|
+
---
|
|
17
|
+
<purpose>
|
|
18
|
+
对称于 `manage-harvest`(写入入口)的知识淘汰入口。harvest 负责把 artifact 抽取为 spec/wiki/issue;audit 负责审查这三大存储中已积累的条目,识别矛盾、失效、老化、孤儿,并通过 keep/deprecate/delete 三态决策清理。
|
|
19
|
+
|
|
20
|
+
覆盖 8 大场景类、28 子场景(显性/隐性矛盾、失效老化、元数据质量、Maestro 特化、时间线产物 T1-T6、knowhow 漂移、artifact 残留),定义见 workflow knowledge-audit.md。
|
|
21
|
+
|
|
22
|
+
**闭环**:harvest 写入 → audit 审查 → 三态淘汰;与 `harvest --prune`(物理 GC)互补:audit 做语义层判定,且删除未抽取的 artifact 前反向触发 harvest 抢救。
|
|
23
|
+
</purpose>
|
|
24
|
+
|
|
25
|
+
<required_reading>
|
|
26
|
+
@~/.maestro/workflows/knowledge-audit.md
|
|
27
|
+
</required_reading>
|
|
28
|
+
|
|
29
|
+
<deferred_reading>
|
|
30
|
+
- @~/.maestro/workflows/harvest.md (audit 检测的 artifact 是 harvest 的产物源)
|
|
31
|
+
- @~/.maestro/workflows/specs-add.md (deprecate 操作所需的 `<spec-entry>` 变形)
|
|
32
|
+
</deferred_reading>
|
|
33
|
+
|
|
34
|
+
<context>
|
|
35
|
+
Arguments: $ARGUMENTS
|
|
36
|
+
|
|
37
|
+
**Scope(必选):** `spec` | `knowhow` | `artifact` | `all`
|
|
38
|
+
|
|
39
|
+
**删除策略**默认 `--interactive`(三态面板逐项决策);非交互模式 `--mark`(仅打标)/ `--delete`(软删到 `.trash/`)/ `--purge`(物理擦除,仅 artifact 且需双重确认)。
|
|
40
|
+
|
|
41
|
+
Flag 全集、scope 对应的扫描路径、Stage 步骤、检测算法定义在 workflow knowledge-audit.md。
|
|
42
|
+
</context>
|
|
43
|
+
|
|
44
|
+
<execution>
|
|
45
|
+
Follow `~/.maestro/workflows/knowledge-audit.md` Stages 1-8 in order.
|
|
46
|
+
|
|
47
|
+
**Key invariants:**
|
|
48
|
+
1. **Backup before mutate** — Stage 6 必须把待变更文件打包到 `.workflow/.trash/knowledge-audit-{timestamp}/`,备份失败禁止 Stage 7。
|
|
49
|
+
2. **Deprecate over delete** — 文本存储(spec/knowhow)首选注入 `status="deprecated"` 保留历史;只有 artifact 物理残留才走 delete/purge。
|
|
50
|
+
3. **Purge requires double confirmation** — `--purge` 仅作用于 artifact scope,且 Stage 5 必须显式 `[y/N]` 二次确认 + 输入 artifact id。
|
|
51
|
+
4. **Rescue before delete** — 删除未抽取的 artifact 前(`harvest-log.jsonl` 无记录),强制提示 "是否先 `/manage-harvest`?"。
|
|
52
|
+
|
|
53
|
+
Scope 路径、8 类检测算法、三态决策面板、报告 schema 定义在 workflow knowledge-audit.md。
|
|
54
|
+
|
|
55
|
+
**Next-step routing on completion:**
|
|
56
|
+
- 复审淘汰记录 → `.workflow/.knowledge-audit/audit-report-{date}.md`
|
|
57
|
+
- 抢救未抽取 artifact → `/manage-harvest <artifact-id>`
|
|
58
|
+
- 验证 spec 现状 → `/spec-load --role implement`
|
|
59
|
+
- 周期巡检 → 每 milestone 结束跑 `--scope all --report`
|
|
60
|
+
</execution>
|
|
61
|
+
|
|
62
|
+
<error_codes>
|
|
63
|
+
| Code | Severity | Condition | Recovery |
|
|
64
|
+
|------|----------|-----------|----------|
|
|
65
|
+
| E001 | error | `.workflow/` 未初始化 | 先跑 `/maestro-init` |
|
|
66
|
+
| E002 | error | `--scope` 缺失或非法 | 提供 spec/knowhow/artifact/all |
|
|
67
|
+
| E003 | error | `--purge` 与 `--dry-run` 同用 | 二选一 |
|
|
68
|
+
| E004 | error | `--purge` 作用于非 artifact 范围 | purge 仅支持 artifact scope |
|
|
69
|
+
| E005 | error | 备份失败(`.trash/` 写入异常) | 检查磁盘空间与权限,重试 |
|
|
70
|
+
| W001 | warning | 检出冲突但用户选择 keep | 记入 report,不阻断 |
|
|
71
|
+
| W002 | warning | 待删 artifact 无 harvest-log 记录 | 提示先跑 manage-harvest |
|
|
72
|
+
| W003 | warning | 循环 supersedes 链 | 自动断环或交互选保留节点 |
|
|
73
|
+
| W004 | warning | 检测耗时 >120s(大规模 spec 库) | 建议加 `--scope` 收敛或 `--since` 增量 |
|
|
74
|
+
| W005 | warning | LLM detector 不可用 | 降级到正则+图算法子集,跳过 B/G 类语义场景 |
|
|
75
|
+
</error_codes>
|
|
76
|
+
|
|
77
|
+
<success_criteria>
|
|
78
|
+
- [ ] Scope 正确解析,互斥标志校验通过
|
|
79
|
+
- [ ] 三存储按 scope 加载完成,构建出统一 finding 池
|
|
80
|
+
- [ ] Stage 3 时间线索引建立(mtime ↔ session/milestone 状态)
|
|
81
|
+
- [ ] Stage 4 按 P0/P1/P2 输出 finding 列表
|
|
82
|
+
- [ ] 如非 `--report`:用户对每项做出三态决策
|
|
83
|
+
- [ ] 未 harvest 的 artifact 删除前触发抢救确认
|
|
84
|
+
- [ ] Stage 6 backup tarball 生成于 `.workflow/.trash/`
|
|
85
|
+
- [ ] `deprecate` 通过元数据注入完成(spec/knowhow 文件未被物理删除)
|
|
86
|
+
- [ ] `delete` 移动至 `.trash/`,索引同步更新
|
|
87
|
+
- [ ] `purge` 仅在双重确认通过后执行
|
|
88
|
+
- [ ] `audit-report-{date}.md` + `audit-log.jsonl` 写入完成
|
|
89
|
+
- [ ] 摘要展示三存储变更计数与下一步路由
|
|
90
|
+
</success_criteria>
|
|
@@ -134,18 +134,19 @@ Next steps:
|
|
|
134
134
|
/maestro-plan {phase} -- Re-plan with modifications
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
**Completion
|
|
137
|
+
**Completion (when invoked from ralph):**
|
|
138
|
+
End the step by calling the CLI (no `--- COMPLETION STATUS ---` text block):
|
|
138
139
|
```
|
|
139
|
-
|
|
140
|
-
STATUS: DONE|NEEDS_CONTEXT
|
|
141
|
-
CONCERNS: {description if applicable}
|
|
142
|
-
NEXT: /maestro-execute
|
|
143
|
-
--- END STATUS ---
|
|
140
|
+
maestro ralph complete <idx> --status DONE [--evidence scratch/{YYYYMMDD}-plan-P{N}-{slug}/plan.json]
|
|
144
141
|
```
|
|
145
142
|
|
|
146
|
-
|
|
147
|
-
- **DONE** — Plan created/revised and confirmed →
|
|
148
|
-
- **
|
|
143
|
+
STATUS verdicts (CLI-enforced enum):
|
|
144
|
+
- **DONE** — Plan created/revised and confirmed → next step picks up automatically
|
|
145
|
+
- **DONE_WITH_CONCERNS** — Plan produced but with explicit caveats; pass `--concerns "..."`
|
|
146
|
+
- **NEEDS_RETRY** — Plan failed (tooling error, transient issue); ralph will retry
|
|
147
|
+
- **BLOCKED** — External hard blocker (e.g., upstream artifact missing, dependency unavailable); pass `--reason "..."`
|
|
148
|
+
|
|
149
|
+
> Ambiguous requirements are NOT a completion status — resolve them in-place via `AskUserQuestion` during planning (≤3 rounds), then proceed to DONE. `NEEDS_CONTEXT` has been removed; context shortage is handled by the harness's automatic compaction.
|
|
149
150
|
|
|
150
151
|
### Mode: Revise / Check
|
|
151
152
|
|