literature-evidence-graph

Build and query an evidence-bound knowledge graph from one or more scientific papers. Use for literature entity/relation extraction, cross-paper alias alignment, paragraph-level provenance, conflict-preserving graph export, incremental updates, or evidence-backed graph queries. Do not trigger for a single-paper summary, generic question answering, or bibliographic formatting without a graph deliverable.

¿Qué es literature-evidence-graph?

literature-evidence-graph is a Claude Code agent skill that build and query an evidence-bound knowledge graph from one or more scientific papers. Use for literature entity/relation extraction, cross-paper alias alignment, paragraph-level provenance, conflict-preserving graph export, incremental updates, or evidence-backed graph queries. Do not trigger for a single-paper summary, generic question answering, or bibliographic formatting without a graph deliverable.

Compatible con~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/asdggjskd/reading15-literature-evidence-graph/tree/HEAD

Installed? Explore more Investigación y análisis de datos skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Literature Evidence Graph

Turn the supplied papers into a queryable graph without adding facts from prior knowledge. The Agent performs semantic reading; the bundled stdlib Python tool indexes paragraphs, verifies quotations, exports the graph, and executes queries. No network or third-party package is required.

Required workflow

  1. Read the actual contract and materials. Inspect /input/case.json, /input/task.md, corpus-manifest.json, the paper files, and any original output contract. Record the exact case_id, every original output_contract field and its type, requested entity/relation types, and requested queries. Treat root DOI, title, and authors as belonging only to the primary paper. Read the secondary paper's own manifest entry and text. Do not treat two formats of one paper as two papers.

  2. Save an honest partial result early. Under /app/output, create result.json with the original contract fields and case_id; use partial/the contract's equivalent with the current limitation, never placeholder success. Work in /app/work. Keep all final artifacts in /app/output.

  3. Index the paragraphs. Resolve this Skill's actual installation directory as SKILL_DIR (the platform uses /skills/weekly-skill), then run:

    python3 "$SKILL_DIR/scripts/graph_tool.py" index --input-dir /input --output /app/work/material-index.json
    

    Read the original papers for interpretation; use the index to obtain exact source_id, paragraph_id, and quotation text. These are organization-supplied JATS paragraph IDs, not PDF page numbers. If one file is unreadable, the index preserves the other readable paper and records the failure. Continue with a reduced partial candidate rather than losing the readable graph. If no usable indexed paragraphs remain, retain the partial result and identify the parser/material blockage; do not invent locators or manufactured index entries.

  4. Create the candidate graph. Read references/graph-format.md and write /app/work/candidate.json. assets/synthetic-candidate.json shows structure only; never copy its scientific content into a real result. For a complete run, include both papers, all task-required entities and supported relations, alignments, conflicts/different-object decisions, uncertainties, changes, and at least three queries from task.md (or scientifically meaningful queries when none are specified). For a partial run, include known metadata for each supplied paper, set the affected paper's availability to missing or unreadable, retain only evidence-backed nodes/edges from readable sources, explain the exact takeover point, and execute at least three meaningful queries on the available graph.

  5. Validate, export, and execute all queries. Use an empty or versioned output location so stale artifacts cannot be mistaken for current results:

    python3 "$SKILL_DIR/scripts/graph_tool.py" build --candidate /app/work/candidate.json --index /app/work/material-index.json --output-dir /app/output
    

    If a real prior graph is supplied, add --previous-graph /path/to/prior-graph.json and preserve unchanged node/edge IDs. A nonzero exit means the graph is not validated: read /app/output/validation.json, fix only evidenced candidate errors, and rerun. If the remaining problem is source/tool availability, retain the honest partial outputs instead of bypassing validation.

  6. Finish and check the original result contract. Update /app/output/result.json from the validated graph, executed query-results.json, and validation.json; do not replace original fields with a generic schema or change their types. Include the main graph, evidence/source locations, run status, uncertainties, and changes in the prescribed fields. Put additional detail in the graph artifacts if the contract is closed. Ensure queries in the result reflect actual returned subgraphs and evidence, not paraphrased unsupported answers. Then run the deterministic contract check:

    python3 "$SKILL_DIR/scripts/graph_tool.py" check-result --case /input/case.json --result /app/output/result.json --graph /app/output/graph.json --queries /app/output/query-results.json --validation /app/output/validation.json --output /app/output/final-validation.json
    

    A nonzero exit means the final contract is not verified; correct the concrete field/status/query mismatch and rerun. The checker does not judge scientific correctness or query relevance.

Scientific constraints

  • Every substantive node and edge needs at least one evidence object with an independent paper source_id, exact paragraph_id, and a short contiguous original quotation. Keep distinct evidence items for distinct papers. Do not use a generated page number, another paper's metadata, or an unverifiable summary as evidence.
  • Extract actual researchers, materials, methods, tasks, metrics, findings, and other requested objects. Use source wording for labels/aliases where practical. A label may be clarified for readability, but the quotation must establish the underlying object.
  • Create an edge only when the text supports its subject, predicate, object, direction, claim mode, and conditions. Co-occurrence is insufficient. Distinguish direct author claims, secondary reports about cited work, hypotheses, and negations. Do not silently convert a review attribution into the current paper's experimental result.
  • Keep conditions, samples, model instances, datasets, and numerical results scoped to their paper and experiment. Never merge different physical samples or combine different studies' conditions/numbers into one conclusion. Shared generic method/material terminology alone does not establish identity.
  • For each plausible cross-paper alignment, compare explicit abbreviation/full-name links, definitions, identifiers, and context. Record merged, kept_separate, or undetermined with evidence. Case folding and punctuation normalization are search aids, not proof of identity. Preserve contradictory assertions as separate edges plus a conflict record; never average or choose a winner without evidence.
  • Preserve unreported items and source-internal conflicts in uncertainties/conflicts. A query with no matching assertion means no graph result, not proof that the papers deny the relation.

Queries and outputs

The tool supports search_nodes, neighbors, paths, and find_relations. Execute at least three task-relevant queries. Each returned query includes answered, no_result, or ambiguous status, matches, and a result subgraph containing full evidence. For ambiguous anchors, inspect all candidates rather than silently selecting one. Add the scientific answer in result.json only by interpreting these returned matches and their conditions.

A validated build produces:

  • graph.json, graph.graphml, and graph.md: complete graph and readable exports;
  • query-results.json and query-results.md: all executed queries with evidence-bound subgraphs;
  • validation.json: counts, warnings/errors, and executed-query count;
  • final-validation.json: original-contract field/type, case identity, status, and query exposure checks.

result.json remains necessary even when these files exist. A result is success only when the required materials were read, required coverage is present, every substantive node/edge passed evidence validation, at least three queries actually ran, and no required task component remains unresolved. Otherwise use partial, unable_to_judge, or the exact contract status and identify the concrete missing file, unreadable paragraph, unresolved identity, or absent evidence.

Before finishing, verify that both paper identities are correct, both are represented by evidence, quotations are original and contiguous, no condition/source was mixed, all three query results contain their supporting subgraphs, and the change log describes actions actually performed. The visible response should state status, output paths, node/edge/query counts, and specific limitations.

Skills relacionados