文獻筆記 — 證據錨定工作流
生成可驗證、章節對齊的文獻摘要、統一的論文卡片以及原子知識點,其中每個實質性聲明都綁定到不可變的來源錨點([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(Harbor 預算:64 次請求 / 900 秒 / 16,384 個 Token)
步驟 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{page}-B{seq}] 或 [D{doc}-P{page}-B{seq}](多文檔)。參考鎖定的章節不包含在封包中。
- 附錄總結表格:不要跳過結尾的
Appendix封包(例如packet_005/packet_006);檢查其中關鍵的總結表格(Table 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 | 對於任何未在文中陳述的事實,設為 "not_reported_in_source"(如會議/DOI/程式碼/基線/限制) |
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 個 key_point,每個都附有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": "簡潔的章節敘述...",
"key_points": [
{"text": "原子聲明...", "anchor_ids": ["P4-B015"], "verbatim_quote": "精確的原始摘錄"}
]}
]
}
03_knowledge_points.json:
{
"knowledge_points": [
{"kp_id": "KP-001", "category": "method_mechanism", "title": "...", "claim": "...",
"detail": "...", "anchor_ids": ["P3-B012"], "verbatim_quote": "精確的原始摘錄"}
]
}
語言與引用規則:
- 筆記遵循
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 個位置)中找到的數字,將其視為低嚴重性(非阻塞);只有整個章節都缺失的數字才被視為高嚴重性。