| name | chapter-scan |
| description | 逐章反思,一次只扫一章,发现章节中遗漏的实体页面和改进建议。项目路径见 local/config/chapter-scan.config.md。 |
/chapter-scan — 逐章反思 Skill
核心约束
一次只扫一章,绝对禁止合并多章处理。
每次调用只处理进度文件中的下一章,完成后更新进度,等待下次调用。
工作目录
见 local/config/chapter-scan.config.md。
启动流程
步骤 1 · 检查进度
──────────────────────────────────
cat wiki/logs/chapter_scan_progress.json 2>/dev/null || echo '{"next": 1, "done": []}'
→ 获取 next 字段(下一章,1–16)
→ 若 next > 16 → 报告已全部完成,停止
步骤 2 · 读当前章节页
──────────────────────────────────
CHAPTER_NUM=$(printf "%02d" $NEXT)
# 兼容平铺和分桶:用 find 定位页面文件
chapter_page=$(find docs/wiki/pages -name "第${CHAPTER_NUM}章.md" | head -1)
cat "$chapter_page" 2>/dev/null || echo "[章节页不存在,将从全文提取]"
步骤 3 · 用 corpus_search 识别实体
──────────────────────────────────
# 扫描本章中可能的实体(人名、系统名、会议名、概念等)
python3 wiki/scripts/butler/corpus_search.py "关键词" --chapter $NEXT --max 10
扫描维度:
A. 人物姓名 — 有姓名的研究者/发明者
B. 系统/程序名 — 有专名的AI系统(DENDRAL、ELIZA等)
C. 概念/技术 — 有明确定义的技术概念
D. 事件/会议 — 有专名的重要事件
E. 机构/实验室 — 大学、研究所等
步骤 4 · 逐一核查是否已有词条
──────────────────────────────────
python3 -c "
import json
reg = json.load(open('docs/wiki/pages.json'))
ai = reg.get('alias_index', {})
for name in ['实体A', '实体B']:
print(name, '->', ai.get(name, 'MISSING'))
"
步骤 5 · 按命中数分类
──────────────────────────────────
≥3 hits → P1(优先新建完整页面)
1-2 hits → P2(新建 stub)
0 hits → 跳过
步骤 6 · 查相关插图(可选,images.json 不存在时跳过)
──────────────────────────────────
python3 -c "
import json, os
f = 'docs/wiki/images.json'
if not os.path.exists(f): exit(0)
imgs = json.load(open(f))
chapter_imgs = [i for i in imgs if str(i.get('chapter','')) == str($NEXT)][:3]
for img in chapter_imgs:
print(img.get('path',''), img.get('caption',''))
" 2>/dev/null
# 命中的图片路径格式为 images/<文件名>(RFC-memex-0044)
# 将候选路径写入队列注释供 butler 建页时参考
步骤 7 · 写入队列(仅P1/P2)
──────────────────────────────────
# 格式:- [ ] P1 create | 词条名 | 来自第N章扫描 | images: images/xxx.png(若步骤6有命中)
echo "- [ ] P1 create | 词条名 | 来自第N章扫描" >> wiki/logs/butler/queue.md
步骤 9 · 更新进度
──────────────────────────────────
python3 -c "
import json, os
f = 'wiki/logs/chapter_scan_progress.json'
d = json.load(open(f)) if os.path.exists(f) else {'next': 1, 'done': []}
d['done'].append(d['next'])
d['next'] = d['next'] + 1
json.dump(d, open(f,'w'), ensure_ascii=False, indent=2)
print(f'进度更新:下一章 第{d[\"next\"]}章')
"
参数
| 参数 | 说明 |
|---|
/chapter-scan | 处理进度文件中的下一章 |
/chapter-scan 5 | 强制扫描第5章(不推进进度) |
/chapter-scan --reset | 重置进度到第1章(慎用) |
禁止事项
- ❌ 禁止一次处理多章
- ❌ 禁止在本 skill 中直接建页(只写队列,建页由 /butler 执行)
- ❌ 禁止 git commit
输出格式
✓ 已扫描 第N章(N/16 章)
发现遗漏:X 个(P1:N P2:N)
加入队列:N 个
下一章:第M章