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外部依赖
| Kind | Dependency / Endpoint |
|---|---|
| cli | ripgrep (rg) |
| cli | lychee(可选外链检查器,brew/cargo install) |
| cli | git(git grep / git mv / git show 归档与恢复) |
4管控建议与判定依据
- scripts/: 执行本地脚本或命令: skill 自身无脚本;SKILL.md 指示 agent 在宿主执行 rg/git grep/lychee 等只读搜索与 git mv/文件改写
- 网络端点: 声明外部网络访问: 默认无;lychee 不带 --offline 时按文档会对文档内外部 URL 发请求(文档明示 'also checks external URLs
- 本地工作目录: 文件读写与工件输出: 按 Phase 3 计划修改/合并/删除文档文件;git mv 移入 _archive/ 归档;改写 CLAUDE.md/AGENTS.md 等同受治
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…