csag-extraction
Skill9 starsChanged 4 months agoMITView on GitHub
Extract a Conditional Scientific Argumentation Graph and grounded Q&A from a manuscript. Use when representing assertions, contexts, evidence links, and inference steps in machine-readable form.
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- ai-scientist-evaluatorSkill
- arxiv-searchSkill
- beautiful-data-vizSkill
- bio-annotationSkill
- bio-assembly-qcSkill
- bio-binning-qcSkill
- bio-fasta-database-curatorSkill
- bio-foundation-housekeepingSkill
- bio-gene-callingSkill
- bioinformatics-projectSkill
- bio-interdomain-hgtSkill
- bio-logicSkill
- bio-phylogenomicsSkill
- bio-prefect-dask-nextflowSkill
- bio-protein-clustering-pangenomeSkill
- bio-reads-qc-mappingSkill
- biorxiv-searchSkill
- bio-stats-ml-reportingSkill
- bio-structure-annotationSkill
- bio-viromicsSkill
- bio-workflow-methods-docwriterSkill
- crossref-lookupSkill
- exploratory-data-analysisSkill
- manuscript-review-councilSkill
- notebooksSkill
- pdf-to-mdSkill
- plotly-dashboard-skillSkill
- polars-dovmedSkill
- proposal-reviewSkill
- public-db-lookupSkill
- scientific-impact-assessmentSkill
- scientific-writingSkill
- tracking-taxonomy-updatesSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. About 0 are common, 5 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 45
Every Assertion MUST have normalization_status:
- Distinctive: line 56
When a model is used to assist extraction, prefer a two-step workflow:
- Very specific: line 65
Do not rely on a model to perform all final bookkeeping in one pass.
- Distinctive: line 70
Use the validator as a feedback loop:
- Very specific: line 98
If one or both cannot be resolved, record explicit doi_status / pmid_status entries in extraction_activities.parameters with resolved or …
- Very specific: line 108
Create EvidenceLinks (EvidenceItem -> Assertion) with polarity, strength, rationale.
- Very specific: line 109
Add TextSpans grounding key Assertions/EvidenceItems/EvidenceLinks.
- Very specific: line 112
Add Study and Experiment objects.
- Very specific: line 116
Add Condition objects (dose/time/genotype/treatment regime).
- Very specific: line 117
Add InferenceSteps for explicit/implicit reasoning chains.
- Very specific: line 146
If a category is not present in the paper, state that in notes for the paper/assertion rather than silently omitting it.
- Distinctive: line 164
every non-background assertion has decisive evidence and assertion/evidence text-span grounding
- Very specific: line 175
Use pmid:<id> for PaperExtraction.id when PMID is known.
- Very specific: line 177
If only PMCID is available, use pmc:<id> and mark PMID resolution as pending in notes.
- Distinctive: line 183
Before finalizing the extraction, run:
- Very specific: line 193
Use --profile promoted_claim for curated claims and --profile benchmark_key for scoring keys.
- Very specific: line 195
Use JSON for PaperExtraction instances and validation reports.
- Very specific: line 213
Before finalizing a PaperExtraction, answer these (internally or as qa_items):
- Very specific: line 243
Use assets/csag_qa_templates.yaml to instantiate QAItem + Answer objects.
- Very specific: line 260
Validator reports missing contexts: Add at least one Context to every Assertion.
- Distinctive: line 263
Offset mismatch: Use exact source text for TextSpans and rerun validation against the same markdown/article JSON used for extraction.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CSAG extraction skill
Goal
Convert a manuscript into a CSAG PaperExtraction instance that is:
- Schema-valid (LinkML:
assets/csag.yaml) - Evidence-grounded (TextSpans for key objects)
- Canonical (support/refute only via
EvidenceLink, chains viaInferenceStep) - Conditional (every Assertion has ≥1 Context)
Files in this skill
assets/csag.yaml— authoritative schemaassets/csag_qa_templates.yaml— QA template catalogreferences/CSAG_PLAYBOOK.md— detailed extraction guide + edge cases
Quick Reference
| Task | Action |
| Extract paper | Build one PaperExtraction per manuscript, not per search hit. |
| Ground claims | Attach important assertions, evidence, and links to TextSpans. |
| Validate schema | Run scripts/validate_paper_extraction.py before finalizing. |
| Review quality | Run scripts/csag_quality_report.py --strict and resolve issues. |
Non‑negotiable invariants
- Every Assertion MUST have ≥1 Context (schema-enforced).
- Support/refute polarity ONLY in
EvidenceLink. - Contradictions/qualification ONLY in
AssertionRelation. - Reasoning chains ONLY as
InferenceStep. - Ground important objects to TextSpans.
- Every Assertion MUST have
normalization_status:raw/partially_normalized/fully_normalized
Extraction scope
The extraction scope is the full manuscript: title, abstract, introduction, methods, results, discussion, conclusion, and supplementary material when available. If retrieval was driven by topic terms (organisms, genes, methods), do not restrict extracted assertions or evidence to sentences that mention those terms — the retrieval scope is not the extraction scope.
Instructions
Reliability pattern for model-assisted extraction
When a model is used to assist extraction, prefer a two-step workflow:
- Draft the scientific content first: claims, evidence snippets, evidence polarity, inferences, critiques, gaps, artifacts, datasets, and exact source quotes.
- Let tooling assemble the final
PaperExtraction: deterministic IDs, reference fields, enum normalization, offset lookup fromexact_text, and validator repair for mechanical schema-shape issues.
Do not rely on a model to perform all final bookkeeping in one pass. The most
common failures are missing IDs, dangling references, scalar values where lists
are required, field aliases such as evidence_id instead of evidence_item,
wrong enum labels, and missing artifact/dataset metadata.
Use the validator as a feedback loop:
uv run --script skills/csag-extraction/scripts/validate_paper_extraction.py \
work/STEM/paper_extraction.json \
--source-markdown work/STEM/STEM.md \
--article-json work/STEM/STEM.article.json \
--report-out work/STEM/paper_extraction.validation.jsonFor mechanical cleanup before curation, write a repaired candidate and inspect
the repair_actions in the validation report:
uv run --script skills/csag-extraction/scripts/validate_paper_extraction.py \
work/STEM/paper_extraction.raw.json \
--source-markdown work/STEM/STEM.md \
--article-json work/STEM/STEM.article.json \
--repair-out work/STEM/paper_extraction.repaired.json \
--report-out work/STEM/paper_extraction.validation.jsonRepairs are intentionally narrow. They can normalize deterministic schema shape, but they do not certify scientific correctness.
Phase 1 — Core graph (always)
- Build
PaperExtractionmetadata (id/title/doi/pmid if available).- Resolve
doiandpmidfrom the staged source, OCR/article outputs, TEI/XML, or local metadata whenever recoverable. - If one or both cannot be resolved, record explicit
doi_status/pmid_statusentries inextraction_activities.parameterswithresolvedorunresolved.
- Resolve
- Extract Artifacts when the paper exposes figure/table/supplement captions.
- Extract Datasets when the paper exposes data-availability text, repository links, accessions, or project identifiers.
- Extract Entities with ontology annotations when possible.
- Extract Assertions (hypotheses, result-claims, conclusions):
- must include
contexts(≥1) - must include
normalization_status - include
criticality(core,major,supporting,background) when the importance of the claim can be judged - include
falsification_criteriafor any core or major assertion (what observation would weaken or refute the claim)
- must include
- Extract EvidenceItems (results/analyses/citations).
- Create EvidenceLinks (EvidenceItem -> Assertion) with
polarity,strength,rationale. - Add TextSpans grounding key Assertions/EvidenceItems/EvidenceLinks.
Phase 2 — Study & experiment structure (if feasible)
- Add
StudyandExperimentobjects. - Enrich Contexts (organism/cell_type/tissue/disease) using Entity references.
Phase 3 — Conditions + reasoning + critique/gaps + QA (when available)
- Add
Conditionobjects (dose/time/genotype/treatment regime). - Add
InferenceSteps for explicit/implicit reasoning chains. - Add
StudyCritiqueandKnowledgeGapobjects. - Generate QA items from templates.
Input Requirements
- A full manuscript, preprint, article markdown, XML/JSON extraction, or equivalent source text.
- Any available identifiers: DOI, PMID, PMCID, title, journal, authors, year, and source URL.
- Source text or article JSON when offset-aware TextSpan validation is required.
- A target path for
paper_extraction.jsonand validation reports.
Output
paper_extraction.jsonconforming toassets/csag.yaml.- Validation report from
scripts/validate_paper_extraction.py. - Quality report from
scripts/csag_quality_report.py. - Optional QA items generated from
assets/csag_qa_templates.yaml.
Minimum coverage expectations (full research articles)
Unless the source is a short note/editorial with genuinely limited content, target:
=1 assertion for hypothesis/research-question/objective when present
=2 result/conclusion assertions from different parts of the paper when present
=2 evidence items and >=2 evidence links when present
=1 inference step when reasoning combines multiple premises/evidence
=1 critique/gap when explicitly discussed by authors
=1 artifact when figure/table captions are present in the source
=1 dataset when data-availability text, accessions, or repository links are present in the source
If a category is not present in the paper, state that in notes for the paper/assertion rather than silently omitting it.
Quality Gates
Confirm all checks:
- Assertions are not just keyword-hit snippets; they reflect core study claims.
- Evidence links cover key claims, not only the first matched sentence.
- At least one TextSpan anchors each non-trivial extracted object.
- Output includes explicit statement of absent components (e.g., no clear hypothesis section).
doi/pmidare resolved when recoverable, or explicitdoi_status/pmid_statusparameters are present inextraction_activities.artifactsare present when figure/table captions are present in the source.datasetsare present when data-availability text, accessions, or repository links are present in the source.- The repo-local validation pass succeeds (
scripts/validate_paper_extraction.py). - The quality report is reviewed (
scripts/csag_quality_report.py). Treat it as the default CSAG knowledge-artifact evaluation afterpaper_extraction.jsonis generated: inspectcompleteness,missing_or_weak, andfield_qualityas well asissues. - Any non-empty
issueslist is resolved before stopping; warnings inmissing_or_weakare fixed or justified innotes.
For higher-stakes use, run validation with --profile promoted_claim or --profile benchmark_key. These profiles additionally require:
- every non-background assertion has decisive evidence and assertion/evidence text-span grounding
- core and major benchmark assertions have at least moderate decisive evidence unless explicitly marked as
limitationorspeculation
Anti-patterns (forbidden)
- Emitting a paper with only one assertion/evidence pair when richer claims are present.
- Restricting extraction to sentences that mention the topic terms used during retrieval.
- Skipping mechanistic or statistical claims because they sit outside the topic terms.
Identifier and provenance requirements
- Use
pmid:<id>forPaperExtraction.idwhen PMID is known; fall back todoi:<doi>orcsag:doc/<slug>otherwise. - Anchor
TextSpan.document_idto the same identifier used forPaperExtraction.id. - If only PMCID is available, use
pmc:<id>and mark PMID resolution as pending innotes. - Produce one
PaperExtractionper source manuscript; do not mix spans across manuscripts. - Record
extraction_activitieswithtool_name,tool_version,model_name(when applicable), and explicitdoi_status/pmid_statusparameters when those identifiers cannot be resolved from the source.
Validation hook (blocking)
Before finalizing the extraction, run:
uv run --script skills/csag-extraction/scripts/validate_paper_extraction.py \
ABS_PATH/paper_extraction.json \
--source-markdown ABS_PATH/STEM.md \
--article-json ABS_PATH/STEM.article.json \
--report-out ABS_PATH/paper_extraction.validation.jsonUse --profile promoted_claim for curated claims and --profile benchmark_key for scoring keys. Do not stop until the validator returns OK.
Use JSON for PaperExtraction instances and validation reports. YAML is
reserved for the authoritative LinkML schema and QA templates. Add --strict
when every assertion, evidence item, and evidence link must carry a TextSpan;
missing grounding then exits nonzero.
Then run the quality report and review how complete the artifact is, what is missing or weak, and the field-level information quality:
uv run python skills/csag-extraction/scripts/csag_quality_report.py \
ABS_PATH/paper_extraction.json \
--source-markdown ABS_PATH/STEM.md \
--article-json ABS_PATH/STEM.article.json \
--report-out ABS_PATH/paper_extraction.quality.json \
--strictManuscript interrogation questions
Before finalizing a PaperExtraction, answer these (internally or as qa_items):
- What are the manuscript's hypotheses, research questions, or objectives?
- What are the primary result claims and conclusions or discoveries?
- What evidence supports each key claim, and what evidence (if any) refutes it?
- Which assertions are core, major, supporting, or background?
- What observation or analysis would falsify or seriously weaken each core or major assertion?
- What inference or mechanistic chains connect evidence to conclusions?
- What limitations or flaws are stated or strongly implied?
- What open knowledge gaps or future-work items are stated?
Map answers to CSAG objects:
- hypotheses / results / conclusions →
assertions - claim importance → assertion
criticality - falsifiability checks → assertion
falsification_criteria - support / refute →
evidence_links - reasoning chains →
inferences - limitations →
critiques - open questions →
knowledge_gaps - question-driven outputs →
qa_items(fromassets/csag_qa_templates.yaml)
Normalization rubric
raw: free-text only; triple fields may be empty.partially_normalized: some of {subject,predicate,object} filled OR ambiguous mappings.fully_normalized: subject+predicate+object present; refer to Entity IDs; predicate is CURIE/URI (RO/SIO preferred).
QA templates
Use assets/csag_qa_templates.yaml to instantiate QAItem + Answer objects.
Answers must cite supporting_assertions and/or supporting_evidence_links.
For edge cases and scoring guidance, see references/CSAG_PLAYBOOK.md.
Examples
uv run --script skills/csag-extraction/scripts/validate_paper_extraction.py \
work/paper/paper_extraction.json \
--source-markdown work/paper/paper.md \
--article-json work/paper/paper.article.json \
--report-out work/paper/paper_extraction.validation.jsonTroubleshooting
- Validator reports missing contexts: Add at least one
Contextto everyAssertion; this is not optional. - Dangling references: Rebuild IDs deterministically and verify every referenced assertion, evidence item, entity, artifact, and dataset exists.
- Weak extraction: Re-read the full manuscript and add missing hypotheses, result claims, evidence links, critiques, gaps, artifacts, and datasets when present.
- Offset mismatch: Use exact source text for TextSpans and rerun validation against the same markdown/article JSON used for extraction.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

