Community研究与数据分析github.com

nanopublication-claims

Turn a research paper PDF into atomic, evidence-bound nanopublications. Splits conclusions into single checkable assertions (subject / relation / object / qualifiers), binds each assertion to its minimal supporting quote with page and character anchors, records provenance back to the paper and the PDF hash, validates the case's output_contract, and exports result.json plus claims.jsonl and TriG/JSON-LD nanopublications. Use for atomic claim extraction, claim-evidence alignment, provenance chains, evidence-grounded structured reading, or nanopublication generation and export.

nanopublication-claims 是什么?

nanopublication-claims is a Claude Code agent skill that turn a research paper PDF into atomic, evidence-bound nanopublications. Splits conclusions into single checkable assertions (subject / relation / object / qualifiers), binds each assertion to its minimal supporting quote with page and character anchors, records provenance back to the paper and the PDF hash, validates the case's output_contract, and exports result.json plus claims.jsonl and TriG/JSON-LD nanopublications. Use for atomic claim extraction, claim-evidence alignment, provenance chains, evidence-grounded structured reading, or nanopublication generation and export.

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Sumnesoon/bohrium-reading-14-nanopublication/tree/HEAD

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

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Nanopublication claims

A skill for the four questions that decide whether a nanopublication is usable:

QuestionMechanism in this skill
拆得细 Can a conclusion be split into assertions that are each true or false on their own?clause-level decomposition rubric, atomicity_flags with reproducible criteria, one proposition per claim record
对得上 Does every assertion point at the minimal fragment that actually supports it?lexical+number binding over sentence units, span minimisation, quote == page_text[start:end] check
追得回 Can a stranger walk assertion -> evidence -> paper -> authors/version?evidence offsets, pdf_sha256, identifier, TriG provenance graph, provenance_gaps
读得懂 Can a downstream program parse the export without cleaning it?fixed claim schema, claims.jsonl, result.json, TriG + JSON-LD, contract validation

The skill does not invent paper content. Every quote is a slice of the extracted page text, so a reviewer can re-derive it byte for byte.


1. When to use it

Use when the task asks for any of: atomic claims / assertions from a paper, claim-evidence alignment, evidence snippets with page locations, provenance or traceability, nanopublications, knowledge units, structured reading with verifiable citations, or a JSON export that a downstream tool will consume.

Do not use it for: free-form summarisation with no evidence requirement, literature reviews across many papers, figure reproduction, or translation of whole documents.

2. Inputs

At run time the case supplies:

  • /input/case.json — case_id, title, language, materials, and an output_contract (a JSON-Schema subset: type, properties, required, items, enum, description). The contract is authoritative; field names differ between cases.
  • /input/task.md — the task statement and any evidence scope.
  • One or more PDFs (or another material). Read the actual files; never assume content from a filename or a label.

3. Operating procedure

Work under /app/work, write deliverables under /app/output. The skill scripts live next to this file; TOOL="$SKILL_ROOT/scripts/nanopub_tool.py".

Step 0 — capability probe (always)

python "$TOOL" doctor --work /app/work

It reports which PDF text backends exist (pymupdf, pypdf, PyPDF2, pdftotext, builtin). Record this honestly: a run that used OCR is not a run that used a text layer.

Step 1 — read the case and write an honest partial result

python "$TOOL" init \
  --case /input/case.json --task /input/task.md \
  --input-dir /input --work /app/work --output /app/output

This parses the contract, discovers materials, and writes a result.json with status=partial immediately. If the run is cut short by the budget, the deliverable exists and states what is missing.

Step 2 — acquire the text

python "$TOOL" extract --work /app/work                  # uses /input PDF automatically
python "$TOOL" extract --work /app/work --pdf input/paper.pdf --backend pypdf

If a platform PDF/OCR tool is available, prefer it and feed the records:

python "$TOOL" ingest --records /app/work/ocr_pages.jsonl --source dsh-pdf-text-tool --work /app/work

Accepted record shape: {"page": 3, "text": "..."} (one page) or {"page": 3, "text": "...", "kind": "text"} (one block). Check the summary: page count, block count, extracted characters. Zero characters means a scanned PDF - go to the failure matrix (§9), not to guesswork.

Step 3 — mine candidate spans

python "$TOOL" candidates --work /app/work --max 120

Writes work/candidates.jsonl: sentence spans that contain result verbs, numbers, causal markers or captions, each with page, char_start, char_end, clause_count, clauses and atomicity_flags. This is a map, not the answer: choose the spans that carry the paper's actual conclusions.

Step 4 — author the assertions (the semantic step)

Write work/claims_draft.jsonl, one JSON object per line. This is where you, the reading agent, do the part no script can: decide what the paper claims. The record only needs the semantic core; the binder adds evidence, offsets, identifiers, confidence and flags.

{"claim_id": "np-c001",
 "text": "RefreshKV with QC=5 recovers 52% of full-attention performance on the HTML to TSV task for Llama-3.1-8B.",
 "subject": {"label": "RefreshKV (QC=5)", "type": "method"},
 "relation": {"id": "recovers", "surface": "recovers"},
 "object": {"label": "full-attention performance", "type": "metric", "value": "52%"},
 "qualifiers": {"task": "HTML to TSV", "model": "Llama-3.1-8B"},
 "claim_type": "empirical_result",
 "evidence_hint_page": 6}

Split rules (each is checked again by atomicity_flags):

  1. One proposition per record. "X improves A and reduces B" is two claims.
  2. Keep the conditions. Model, dataset, context length, metric and budget belong in qualifiers, never dropped and never stuffed into object.label.
  3. No pronouns. Resolve "it / this method / our approach" to the named subject - that is what makes the assertion checkable months later.
  4. Keep the paper's strength. A hedged sentence stays hedged (assertion_strength: "hedged"); an author-claimed cause stays causes only if the paper tested it, otherwise correlates_with or reports.
  5. One relation from the vocabulary. assets/relations.json is the allowed set; see references/relation-vocabulary.md. Do not invent relations.
  6. Tables and figures are evidence, not sentence text. For a value that exists only in a table, assert the row's meaning and let the binder cite the caption/table region; expect evidence_kind: table_region and record the visual check in uncertainty.
  7. Do not assert what the paper does not say. Reviewer-inferred readings go to uncertainty, not into a claim.

Useful target density: 6-20 assertions for a 8-20 page paper, covering the abstract's results, the main comparison, the ablation, and the stated limitations. Coverage beats volume: one assertion per conclusion that a reader would actually check.

Step 5 — bind evidence

python "$TOOL" bind --work /app/work --topk 3 --min-score 0.5

For each draft it scores every sentence unit (weighted content tokens, numbers, relation surface), takes the best candidates, shrinks each to the minimal clause that still contains the required terms (numbers, subject and object head terms), and re-ranks by support on the shrunk quote. Output: work/claims.jsonl with per-claim status:

  • supported — direct quote, all claim numbers verbatim, relation wording present;
  • partially_supported — evidence found but indirect or partially matching;
  • unsupported — no span met the threshold (the claim is not necessarily false, it is unproven here: keep it, and say so);
  • unverifiable — no page text at all.

Step 6 — validate and repair

python "$TOOL" validate --work /app/work

Read work/validation_report.json. Errors must be fixed (broken offsets, quote mismatches, missing pages). Warnings are decisions: either fix the claim, split it, add evidence, or record why the warning is acceptable with:

python "$TOOL" review --work /app/work --target np-c006 --code atomicity_many_numbers \
  --reviewer "reading agent" --rationale "the three thresholds are one comparison, not three findings"

Loop until errors are zero. Warnings that stay must be visible in uncertainty at export time.

Step 7 — fill the contract, export, self-check

Write work/contract_values.json with exactly the fields the case contract requires (nothing else is needed; unknown extra keys are ignored):

python "$TOOL" validate --work /app/work     # re-checks contract conformance
python "$TOOL" export --work /app/work --output /app/output
python "$TOOL" check --output /app/output --case /input/case.json

export merges contract fields at the top level of result.json, adds case_id, claims, evidence, sources, uncertainty, quality_report, artifacts, and writes the nanopublication serialisations. check re-reads its own output and fails loudly if a declared artifact is missing, a contract field is empty, a claim has no evidence, or the TriG graph count disagrees.

Contract mapping when a field is ambiguous: prefer the claims list for array-of-results fields, the evidence index for evidence fields, the paper metadata for provenance fields, and a plain string only when the description says so. If a required field cannot be filled honestly, leave it out and let the status become partial with the field named in uncertainty - never invent content to fill a field.

4. The assertion record

Condensed schema (full dictionary: references/field-dictionary.md):

claim_id, text, language, claim_type, assertion_strength, polarity
subject{label,type,mention?}, relation{id,surface}, object{label,type,value?,comparator?}
qualifiers{...free but typed: model, dataset, metric, context, task, budget...}
evidence[{quote, page, char_start, char_end, block_id, section, support_type,
          verification, support_check{coverage,numbers_matched,numbers_missing},
          quote_matches_page_text, evidence_kind}]
provenance{paper_id,title,authors,year,identifier,version,pdf_sha256,page,source}
identifiers{nanopub_id, assertion_id}
confidence{level,basis[]}, flags[], status, generated_at

quote is always pages.jsonl[page].text[char_start:char_end].

5. Controlled relations

assets/relations.json holds 30 relations with direction, inverse and usage notes. Mapping guidance and the "use reports when the paper only tabulates" rule are in references/relation-vocabulary.md. An unknown relation is not an error: it surfaces as relation_outside_vocabulary so a reviewer sees it.

6. Quality criteria (reproducible, not vibes)

Every check has an id, a criterion and a remedy; see references/quality-checks.md. Highlights:

  • compound_predicate — two result verbs in one assertion;
  • contrast_bundled — while/whereas/but joining two findings;
  • claim_too_long — more than 45 words;
  • many_numbers — four or more result values in one assertion;
  • evidence_below_threshold — coverage below 0.55 after minimisation;
  • number_not_in_any_quote — a number in the assertion is absent from its evidence;
  • evidence_quote_mismatch — the stored quote no longer matches the page text;
  • duplicate_claim — Jaccard similarity >= 0.85 with another assertion;
  • provenance_incomplete — missing title/authors/year/identifier/hash.

7. Budget

The platform budget is 64 model requests / 900 s / 16k tokens per response. Extraction, binding, validation and export are local and take seconds. A case typically needs 3-6 model calls: read task, read candidates, write assertions, maybe one repair pass, write contract values. Log batches with nanopub_tool.py request --work ... --stage ...; check status for elapsed time. Write the partial result early and improve incrementally rather than saving everything for the end.

8. Output files

FileContent
result.jsoncontract fields + case_id, status, claims, evidence, sources, uncertainty, quality_report
claims.jsonlone assertion per line, full record
nanopublications.trigTriG: head / assertion / provenance / pubinfo graph per claim
nanopublications.jsonldsame content, JSON-LD
evidence_table.mdhuman review table: assertion -> quote -> page [start,end)
validation_report.jsonevery check with code, path and detail
README.mdrun report: paper, backend, counts, how to re-verify

9. Failure handling

SituationDetectionHandling
Scanned PDF, no text layerextract reports 0 chars / extraction_unavailablerun an OCR pass, ingest the records, or return status=unable naming the missing text layer. Never guess page content.
PDF missing or unreadableresolve_pdf exits non-zerostatus=unable, status_reason names the path; keep the partial skeleton.
Paper identifier not detecteddoc_meta.identifier emptyprovenance_incomplete warning; state it in uncertainty; do not fabricate a DOI.
Authors not detecteddoc_meta.authors emptysame; a reports-style claim with unknown authors is still allowed but flagged.
Evidence only in a figure/tableevidence_kind: table_region, no prose spankeep the claim, cite the table region, add uncertainty: "value read from a table region; visual check required".
Assertion has no supporting spanunsupported / no_evidencekeep the record with its status, or delete the claim if it was your over-reading. Never let it become supported.
Conflicting spanstwo evidence quotes disagreeattach both, set flags: ["conflicting_evidence"], explain in uncertainty; do not silently pick one.
Contract field unknownrequired field with an unusual nameread its description; map by meaning (§3 step 7); if still unclear, leave it and report partial.
Budget exhaustedstatus shows elapsed close to 900 sexport the partial result immediately.

10. Honesty rules

  • status is one of success, partial, unable, refused; success only when every required contract field is filled and no validation errors remain.
  • An assertion's status describes its evidence, not the paper's truth.
  • uncertainty.items lists what a reviewer must not assume: undetected metadata, table-only values, unsupported claims, warnings you accepted.
  • Do not claim a benchmark, score, comparison or reproducibility result you did not run.

11. Files in this skill

SKILL.md                        this file
USAGE.md                        operator manual: copy-paste commands per case
REVIEWER_GUIDE.md               5-minute audit path for a reviewer
references/field-dictionary.md  every field, type, allowed values
references/relation-vocabulary.md  how to choose and map relations
references/evidence-anchors.md  anchor format and verification procedure
references/quality-checks.md    check ids, criteria, remedies
assets/relations.json           controlled relation vocabulary (30 entries)
assets/claim.schema.json        machine-readable claim schema
assets/contract_values.template.json  dissection of a contract-filling task
examples/minimal_example.md     one worked example (marked as example)
scripts/nanopub_tool.py         CLI: doctor/init/extract/ingest/candidates/bind/validate/export/check/compare
scripts/nanopub_core.py         text, binding, quality and serialisation primitives
scripts/pdf_text.py             PDF text backends, ingest, metadata heuristics
scripts/check_package.py        skill package limits and frontmatter check
scripts/self_test.py            dependency-free regression tests on synthetic fixtures

相关技能