1实现原理 · 为什么它能做到
这是纯指令型 skill(零脚本):全部机制写在 SKILL.md 正文,价值是一套『文档为什么会烂』的分类学与对应处置流程,执行者是 agent 本身。
They trace to one root cause: **a fact was written down in more places than it was defined.** Everything below follows from fixing that.
核心判别器是 Drift Test 三问(按序停在首个命中):值能否由已记录细节算出→derived 不写;不能算但别处有权威定义→copy 改链;否则若是『某时刻事实记录』→可写且不许当 drift 清掉。
ask these three questions **in order, and stop at the first hit**: **1. Can this be computed from details already recorded here or in the authoritative source?**
Mode 1(变更后治理)按 7 步序执行,顺序即论点:先从变更枚举受影响事实→定 SSOT→处理实现与文档分歧→对每份文档定 disposition(更新或归档)→改之前全仓找每个事实的副本→顺路清理 derived 值→按固定结构汇报。
**2. Identify the authoritative source (SSOT) for each affected fact.** Which file *defines* this port / path / procedure — as opposed to mentioning it?
删除被做成有纪律的仪式:归档=移出读者路径且保留历史(git mv 到 _archive/ 并重指所有入链),不许 status: deprecated 留在原地,不许对非本人文档未经确认就归档。
"Archive" means: out of the reader's path, still in history. Concretely: look for a convention the project already has (`_archive/`, `archive/`, `deprecated/`, or whatever it uses) and follow it; if there is none, create `_archive/` at the same level as the file. Either way move it with `git mv` so history follows
Mode 2(合并收敛)的防丢内容闸门:重写前先逐条产出『承重条目清单』(consequence 子句、症状→原因映射、顺序约束、作用域限定词、阈值必被单列),删除前的清单成为重写后校验的规格。
**The consequence clause.** "Roll back before retrying" is an instruction; "retrying on a half-applied migration corrupts the `events` table and there is nothing that repairs it automatically" is the reason anyone obeys it.
校验命令面有大量实测踩坑记录:rg 无路径会搜 stdin、-F/-U 才做字面与跨行、--no-ignore --hidden 与 -g '!.git' 的取舍、git grep 只看 tracked 文件、lychee '0 Total' 不算 pass。
`rg` skips VCS-ignored files *and* hidden ones by default, and `.github/` — full of documented commands — is hidden. A search without them is looking at a strict subset of the docs (measured: 4 files instead of 6).
功能边界内置:单文件过大的『分层压缩』归 claude-md-progressive-disclosurer(daymade-claude-code 套件),本 skill 只管真实性与去重。
That is what daymade-claude-code's `claude-md-progressive-disclosurer` skill is built for; prefer it when the problem is size and layering rather than truth or duplication.
2核心能力
3外部依赖
| 类型 | 依赖 |
|---|---|
| cli | ripgrep (rg) |
| cli | lychee(可选外链检查器,brew/cargo install) |
| cli | git(git grep / git mv / git show 归档与恢复) |
4风险提醒 风险提醒:黄色 · 留意使用
- 破坏性写面大:删除/归档/合并文档是功能本质 — 即使有 Phase 3 人门,agent 在获准后执行的合并删除仍可能误伤(保真清单防 recall 不防 judgment,文档自认)。必须在 git 仓库内使用以便回滚。
- 复杂度集中在超长 prompt,模型遵循度决定质量 — 48KB 正文全是规则与反模式;低遵循度模型可能跳过 Phase 3 直接删,或把 'stop at first hit' 的次序搞反。触发前应确认宿主模型足够强。
- rg 命令被要求全仓 --no-ignore --hidden 扫描 — 在大仓库会扫 node_modules/ 等(文档要求排除),成本与噪声需宿主评估;无人值守长时间搜索可能拖慢会话。
- 外链检查可能产生网络请求 — 若按非 --offline 的 lychee 用法执行会对文档内外部 URL 发请求,需按文档建议先用 --offline。
5第二遍独立确认
- [ok] 纯指令无脚本(资产面) — glob 全量文件:SKILL.md + references/value_analysis_template.md,无 scripts/ 目录。
- [ok] Drift Test 三问与顺序规则 — 原文 'in order, and stop at the first hit' 与 Q1/Q2/Q3 全在;第 3 问优先级说明亦逐字存在。
- [ok] Mode 1 七步与 SSOT 判定 — 步骤编号 1-7 与 SSOT 'defines vs mentioning' 判据原文在。
- [ok] 归档纪律(git mv + 不就地 deprecated) — 'out of the reader's path, still in history'、'git mv'、'do **not** settle for adding status: deprecated frontmatter' 均命中。
- [ok] 删除需人门 / 无人值守停手 — 'Present the Phase 3 plan and get agreement before step 3' 与 'Running unattended and cannot ask: leave the document untouched and report it' 存在。
- [ok] preservation check 防 recall 不防 judgment 的自评缺口 — 'It catches *recall* failures ... It cannot catch *judgment* failures' 原文在,未见自我拔高。
- [ok] 搜索命令面防坑(rg/lychee) — pathless-rg/stdin 陷阱、-F -U、--no-ignore --hidden、lychee '0 Total' 各段均在,附 measured 数字。
- [ok] 网络面仅 lychee 外链可选检查 — 代码零命中;唯一网络点是 SKILL 对 lychee 非 --offline 模式的说明,且推荐先 --offline。
6结论
91fa2a6f6082c893…d5c4678cb5