maestro-flow-one 0.2.20 → 0.2.21

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.
@@ -134,18 +134,19 @@ Next steps:
134
134
  /maestro-plan {phase} -- Re-plan with modifications
135
135
  ```
136
136
 
137
- **Completion status:**
137
+ **Completion (when invoked from ralph):**
138
+ End the step by calling the CLI (no `--- COMPLETION STATUS ---` text block):
138
139
  ```
139
- --- COMPLETION STATUS ---
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
- Status mapping:
147
- - **DONE** — Plan created/revised and confirmed → NEXT: /maestro-execute
148
- - **NEEDS_CONTEXT** — Ambiguous requirements, insufficient context to produce plan
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
 
@@ -0,0 +1,88 @@
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
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ 对称于 `manage-harvest`(写入入口)的知识淘汰入口。harvest 负责把 artifact 抽取为 spec/wiki/issue;audit 负责审查这三大存储中已积累的条目,识别矛盾、失效、老化、孤儿,并通过 keep/deprecate/delete 三态决策清理。
17
+
18
+ 覆盖 8 大场景类、28 子场景(显性/隐性矛盾、失效老化、元数据质量、Maestro 特化、时间线产物 T1-T6、knowhow 漂移、artifact 残留),定义见 workflow knowledge-audit.md。
19
+
20
+ **闭环**:harvest 写入 → audit 审查 → 三态淘汰;与 `harvest --prune`(物理 GC)互补:audit 做语义层判定,且删除未抽取的 artifact 前反向触发 harvest 抢救。
21
+ </purpose>
22
+
23
+ <required_reading>
24
+ @~/.maestro/workflows/knowledge-audit.md
25
+ </required_reading>
26
+
27
+ <deferred_reading>
28
+ - @~/.maestro/workflows/harvest.md (audit 检测的 artifact 是 harvest 的产物源)
29
+ - @~/.maestro/workflows/specs-add.md (deprecate 操作所需的 `<spec-entry>` 变形)
30
+ </deferred_reading>
31
+
32
+ <context>
33
+ Arguments: $ARGUMENTS
34
+
35
+ **Scope(必选):** `spec` | `knowhow` | `artifact` | `all`
36
+
37
+ **删除策略**默认 `--interactive`(三态面板逐项决策);非交互模式 `--mark`(仅打标)/ `--delete`(软删到 `.trash/`)/ `--purge`(物理擦除,仅 artifact 且需双重确认)。
38
+
39
+ Flag 全集、scope 对应的扫描路径、Stage 步骤、检测算法定义在 workflow knowledge-audit.md。
40
+ </context>
41
+
42
+ <execution>
43
+ Follow `~/.maestro/workflows/knowledge-audit.md` Stages 1-8 in order.
44
+
45
+ **Key invariants:**
46
+ 1. **Backup before mutate** — Stage 6 必须把待变更文件打包到 `.workflow/.trash/knowledge-audit-{timestamp}/`,备份失败禁止 Stage 7。
47
+ 2. **Deprecate over delete** — 文本存储(spec/knowhow)首选注入 `status="deprecated"` 保留历史;只有 artifact 物理残留才走 delete/purge。
48
+ 3. **Purge requires double confirmation** — `--purge` 仅作用于 artifact scope,且 Stage 5 必须显式 `[y/N]` 二次确认 + 输入 artifact id。
49
+ 4. **Rescue before delete** — 删除未抽取的 artifact 前(`harvest-log.jsonl` 无记录),强制提示 "是否先 `/manage-harvest`?"。
50
+
51
+ Scope 路径、8 类检测算法、三态决策面板、报告 schema 定义在 workflow knowledge-audit.md。
52
+
53
+ **Next-step routing on completion:**
54
+ - 复审淘汰记录 → `.workflow/.knowledge-audit/audit-report-{date}.md`
55
+ - 抢救未抽取 artifact → `/manage-harvest <artifact-id>`
56
+ - 验证 spec 现状 → `/spec-load --role implement`
57
+ - 周期巡检 → 每 milestone 结束跑 `--scope all --report`
58
+ </execution>
59
+
60
+ <error_codes>
61
+ | Code | Severity | Condition | Recovery |
62
+ |------|----------|-----------|----------|
63
+ | E001 | error | `.workflow/` 未初始化 | 先跑 `/maestro-init` |
64
+ | E002 | error | `--scope` 缺失或非法 | 提供 spec/knowhow/artifact/all |
65
+ | E003 | error | `--purge` 与 `--dry-run` 同用 | 二选一 |
66
+ | E004 | error | `--purge` 作用于非 artifact 范围 | purge 仅支持 artifact scope |
67
+ | E005 | error | 备份失败(`.trash/` 写入异常) | 检查磁盘空间与权限,重试 |
68
+ | W001 | warning | 检出冲突但用户选择 keep | 记入 report,不阻断 |
69
+ | W002 | warning | 待删 artifact 无 harvest-log 记录 | 提示先跑 manage-harvest |
70
+ | W003 | warning | 循环 supersedes 链 | 自动断环或交互选保留节点 |
71
+ | W004 | warning | 检测耗时 >120s(大规模 spec 库) | 建议加 `--scope` 收敛或 `--since` 增量 |
72
+ | W005 | warning | LLM detector 不可用 | 降级到正则+图算法子集,跳过 B/G 类语义场景 |
73
+ </error_codes>
74
+
75
+ <success_criteria>
76
+ - [ ] Scope 正确解析,互斥标志校验通过
77
+ - [ ] 三存储按 scope 加载完成,构建出统一 finding 池
78
+ - [ ] Stage 3 时间线索引建立(mtime ↔ session/milestone 状态)
79
+ - [ ] Stage 4 按 P0/P1/P2 输出 finding 列表
80
+ - [ ] 如非 `--report`:用户对每项做出三态决策
81
+ - [ ] 未 harvest 的 artifact 删除前触发抢救确认
82
+ - [ ] Stage 6 backup tarball 生成于 `.workflow/.trash/`
83
+ - [ ] `deprecate` 通过元数据注入完成(spec/knowhow 文件未被物理删除)
84
+ - [ ] `delete` 移动至 `.trash/`,索引同步更新
85
+ - [ ] `purge` 仅在双重确认通过后执行
86
+ - [ ] `audit-report-{date}.md` + `audit-log.jsonl` 写入完成
87
+ - [ ] 摘要展示三存储变更计数与下一步路由
88
+ </success_criteria>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow-one",
3
- "version": "0.2.20",
3
+ "version": "0.2.21",
4
4
  "description": "All Maestro workflow commands as a single Claude Code skill — intent routing, decision gates, minimal closed-loop chains",
5
5
  "bin": {
6
6
  "maestro-flow": "bin/maestro-flow.js"