文献笔记 — 证据锚定工作流
生成可验证、节对齐的文献摘要、统一论文卡片和原子知识点,其中每个实质性声明都绑定到不可变的源锚([P3-B014] 或 [D1-P3-B014]),在交付前由确定性代码审计。
环境与路径约定
- 定位已安装的技能目录(只读):
(回退:SKILL_DIR="/skills/weekly-skill" [ -d "$SKILL_DIR/scripts" ] || SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"find / -maxdepth 4 -name SKILL.md 2>/dev/null | head -1 | xargs dirname。) - 只读技能纪律:切勿将临时文件、补丁或
__pycache__写入$SKILL_DIR。始终使用python3 -B "$SKILL_DIR/scripts/..."调用。 - 运行时路径:从
/input/case.json、/input/task.md和/input/下的源文档读取输入。将中间工件写入/app/work/,最终交付物(result.json、literature_notes.md)写入/app/output/。
5 步确定性 SOP(预算:64 次请求 / 900 秒 / 16,384 Tokens)
步骤 1 — 索引文档骨架并构建阅读包
python3 -B "$SKILL_DIR/scripts/structure_indexer.py" \
--input-dir /input \
--work-dir /app/work \
--output-dir /app/output
检查 stdout 摘要并读取:
/app/work/reading_packets/manifest.json→ 包列表、字数预算、task_guidance(来自 task.md/case.json 的预期语言和重点)/app/work/paper_signals.json→ 元数据、图表、表格、公式、limitation_clues、quality_risk、quality_notices/app/work/draft_skeleton.json→ 早期保存的部分骨架 +output_contract
步骤 2 — 增量读取包并发出紧凑的 JSON 补丁
按顺序读取 /app/work/reading_packets/packet_001.md、packet_002.md ...(合并小于 1,200 词的相邻小包)。每个块标记为 [P{页}-B{序号}] 或 [D{文档}-P{页}-B{序号}](多文档)。引用锁定的节从包中排除。
- 附录摘要表:切勿跳过尾部的
Appendix包(例如packet_005/packet_006);检查它们是否有关键的摘要表(表 4、参数界限、延迟消融),并包含相关的经验行/KP。 - 合并单元格与 PUA 公式警告:当
quality_notices标记formula_pua_glyphs或表格包含多行合并单元格时,交叉检查paper_signals.json -> tables绑定,并在可用时通过table_formula_ocr.py/fitz检查渲染的页面裁剪。
将紧凑的 JSON 补丁写入 /app/work/patches/(例如 01_paper_card.json、02_sections_p1.json、03_knowledge_points.json)。
强制补丁字段:
| 字段 | 要求 |
|---|---|
anchor_ids | 每个实质性声明在包中观察到的 ≥ 1 个真实 anchor_id |
verbatim_quote | 源文档原始语言中的精确摘录,8–25 个词 |
provenance_status | 对任何未陈述的事实(venue/DOI/code/baseline/limit)标记为 "not_reported_in_source" |
section_alignment | 覆盖所有未锁定的正文区域;检查 paper_signals 中的 limitation_clues |
反薄弱笔记底线(由审计器强制执行 — 切勿低于此标准):
key_results:≥ 3 个条目,每个包含metric、value、baseline、condition、summary、≥ 1 个anchor_id、verbatim_quote(仅当源中确实缺失时标记为not_reported_in_source)section_summaries[*].key_points:每个摘要的正文节 ≥ 2 个关键点,每个包含verbatim_quote和 ≥ 1 个 anchor_idknowledge_points:8–15 个原子 KP,涵盖 7 个规范类别(concept_definition、method_mechanism、formula_algorithm、empirical_finding、dataset_metric、limitation_risk、future_direction)- 首先优先考虑
manifest.json → task_guidance中的指令(自定义用户重点)
最小补丁骨架(可复制粘贴 — 匹配 note_assembler.py 模式):
01_paper_card.json:
{
"paper_card": {
"one_line_takeaway": {"value": "...", "anchor_ids": ["P1-B002"]},
"research_problem": {"value": "...", "anchor_ids": ["P1-B003"]},
"methodology_summary": {"value": "...", "anchor_ids": ["P3-B010"]},
"limitations_and_assumptions": {"value": "...", "anchor_ids": ["P8-B041"]},
"key_results": [
{"result_id": "RES-001", "metric": "F1", "value": "92.3%", "baseline": "BERT",
"condition": "English NER", "summary": "...", "anchor_ids": ["P5-B020"], "verbatim_quote": "..."}
],
"tags": ["topic-a", "method-b"]
}
}
02_sections.json:
{
"section_summaries": [
{"section_id": "S03", "summary": "Concise section narrative...",
"key_points": [
{"text": "Atomic claim...", "anchor_ids": ["P4-B015"], "verbatim_quote": "exact source excerpt"}
]}
]
}
03_knowledge_points.json:
{
"knowledge_points": [
{"kp_id": "KP-001", "category": "method_mechanism", "title": "...", "claim": "...",
"detail": "...", "anchor_ids": ["P3-B012"], "verbatim_quote": "exact source excerpt"}
]
}
语言与引用规则:
- 笔记遵循
task_guidance中的语言(zh→ 中文散文;保留英文技术术语内联) verbatim_quote始终使用源文档的原始语言,无论笔记语言如何- 对于中文笔记关于英文论文:散文用中文写,
verbatim_quote保留英文
步骤 3 — 组装笔记并回填来源
python3 -B "$SKILL_DIR/scripts/note_assembler.py" \
--work-dir /app/work \
--patches-dir /app/work/patches
对于单补丁修复:
python3 -B "$SKILL_DIR/scripts/note_assembler.py" \
--work-dir /app/work \
--patch /app/work/repair_01.json
步骤 4 — 运行 4 重代码审计与定向修复(最多 2 轮)
python3 -B "$SKILL_DIR/scripts/note_auditor.py" --work-dir /app/work
检查:(1)幽灵锚与引用保真度,(2)数字/单位/交叉引用/否定极性,(3)未锁定正文节与局限性覆盖,(4)扫描/乱码诚实性与占位符泄漏。
如果 blocking_issues > 0,读取 /app/work/repair_queue.json(≤ 15 个优先项),编写定向修复补丁,仅修复标记的 section_id/kp_id/result_id,然后重新运行步骤 3–4。最多 2 轮修复。未声明的源缺陷(扫描页面)→ 记录在 uncertainties 和 manual_review_checklist 中。
步骤 5 — 渲染交付物并强制执行硬验证门
python3 -B "$SKILL_DIR/scripts/render_deliverables.py" \
--input-dir /input \
--work-dir /app/work \
--output-dir /app/output
python3 -B "$SKILL_DIR/scripts/validate_output.py" \
--output-dir /app/output \
--input-dir /input \
--work-dir /app/work \
--strict
在 validate_output.py --strict 以代码 0 退出之前,请勿完成。
硬纪律检查表
- 早期回退:
draft_skeleton.json在步骤 1 中保存;如果接近预算(900 秒 / 64 次请求),立即运行步骤 3 + 5,以便保留诚实的partial输出。 - 没有虚假的
success:当has_unreadable_source=true、blocking_issues > 0或body_section_coverage < 0.85时,切勿将status覆写为"success"。validate_output.py --strict以非零退出码拒绝不诚实的成功。 - 按需加载参考:仅当遇到扫描的 PDF、乱码字体、跨语言引用、超过 30 页的预算或多文档集合时,才读取
$SKILL_DIR/references/schema_and_patches.md以获取 JSON 补丁字段模板,或$SKILL_DIR/references/edge_cases_and_recovery.md。 - 未编号散文回退:对于白皮书、报告或没有编号标题的单栏散文,
structure_indexer.py自动注入一个合成正文节,以便body_section_coverage可以非零;不要在补丁中添加合成标题。 - 同节编号上下文:审计器接受在兄弟锚点(相同 section_id,±3 个位置)中找到的数字为低严重性(非阻塞);仅在整个节中都缺少的数字才属于高严重性。