Community研究與資料分析github.com

文獻筆記-證據錨定工作流

用於證據錨定的科學文獻摘要與結構化筆記記錄。適用於閱讀、總結、提取論文卡片、建立章節對齊筆記、提取原子知識點、比較多篇論文,或匯出可驗證且帶有準確頁碼/章節/區塊來源的 Markdown/JSON 文獻筆記。

文獻筆記-證據錨定工作流 是什麼?

這個技能提供一個完整的、確定性的 SOP,用於生成可驗證、章節對齊的文獻摘要與原子知識點。其核心機制是將每個實質性聲明綁定到不可變的來源錨點(如 `[P3-B014]`),並在交付前通過代碼審計確保引用忠誠度。技能支援處理多種文檔格式(PDF、LaTeX、DOCX、HTML 等),並能處理複雜的排版問題(如掃描頁面、合併儲存格、混淆字型)。它嚴格遵循一個 5 步驟流程:索引文檔骨架、增量讀取封包、組裝筆記、執行 4 層代碼審計(最多 2 輪修復),最後通過硬性驗證閘門。此技能設計用於在受限資源(如 Harbor 環境)中高效運行,並確保輸出格式符合自定義的 `output_contract` 模式。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/1139596193/scientific-pdf-parser-skill/tree/HEAD/reading-06-literature-notes

Installed? Explore more 研究與資料分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

文獻筆記 — 證據錨定工作流

生成可驗證、章節對齊的文獻摘要、統一的論文卡片以及原子知識點,其中每個實質性聲明都綁定到不可變的來源錨點([P3-B014] 或 [D1-P3-B014]),並在交付前通過確定性代碼進行審計。

環境與路徑慣例

  1. 定位已安裝的技能目錄(唯讀):
    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。)
  2. 唯讀技能紀律:切勿將臨時檔案、修補檔案或 __pycache__ 寫入 $SKILL_DIR。始終使用 python3 -B "$SKILL_DIR/scripts/..." 來呼叫。
  3. 運行時路徑:從 /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_id
  • knowledge_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 個位置)中找到的數字,將其視為低嚴重性(非阻塞);只有整個章節都缺失的數字才被視為高嚴重性。

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

相關技能