Skip to main content

litschema

Turn a folder of PDFs into a dataset you can defend.

Extraction gets you structured data. litschema gets you structured data where every value carries the lines it came from, a record of which model produced it, and a human's verdict on whether it's right — because in a systematic review or meta-analysis, "the model said so" is not a citation.

Everything runs on your machine. The only network calls are optional DOI lookups and the verifier's ORCID name resolution.

What you get

For each document, three artifacts that stay in step:

data/papers/<article-id>/
  article-metadata.json                  identity + bibliographic block
  <article-id>.pdf
  article.md                             prepared full text
  active-run.json                        which extraction is current
  extraction-runs/<run-id>/
    agent-extraction.json                what the document SAYS (schema-valid)
    agent-reasoning.json                 why — per-field evidence, line-cited
    run.json                             inputs hashed, model recorded
    review.json                          your verdicts on this run

Plain JSON on disk, one directory per document, diffable in git. A run is immutable once published: its extraction, reasoning, and run.json never change, so a review written against it stays meaningful forever. Re-extracting creates a new run rather than overwriting the old one.

Alpha Software

litschema is early software. Extracted data may need regenerating when updating litschema versions.

One limit qualifies the line-level citations promised above: PDF conversion collapses some tables onto a single line, so a citation into a table can name the table but not the row. This matters most for measurement-heavy schemas.

Each release documents its breaking changes and known limits in the CHANGELOG.md.

Specs

The specs describe what is currently implemented; anything deferred says so and names where it is tracked.

The flow

litschema init my-project       # scaffold a project
                                # drop PDFs into papers-inbox/
/litschema-onboard              # agent: drafts your schema, extracts, pilots
litschema verify                # you: check what was extracted
litschema export                # the reviewed data, ready for analysis

/litschema-onboard is a bundled agent skill, installed into .claude/skills/ by init. It interviews you to draft a LinkML schema from your own papers, runs intake, extracts one article as a pilot so you can course-correct, then batches the rest.

Install

uv tool install litschema      # or: pip install litschema
litschema --version

init pins each project to the version that created it (litschema_version in litschema.yaml), and commands refuse to run under any other. To move a project to a new release, install it and edit the pin.

To try an unreleased tag or work on litschema itself:

uv tool install "litschema @ git+https://github.com/clevinson/litschema@v0.1.1" --force
uv tool install --editable path/to/litschema --force   # edits take effect immediately

Commands

litschema init <dir>               scaffold a project; installs agent skills locally
litschema doctor                   diagnose config, schema, and skill installation
litschema status                   counts: inbox, articles, runs, reviews
litschema assemble                 papers-inbox PDFs -> per-article folders (offline)
litschema prepare-text <id>|--all  PDF -> article.md (offline)
litschema meta show|set|sync <id>  bibliographic metadata, provenance-tagged
litschema validate [target]        validate extractions against the schema
litschema runs list|activate       inspect published runs; choose the active one
litschema verify [--port 8000]     local review webapp (loopback only)
litschema export [-f jsonl|csv]    reviewed data as flat files (pandas/R/jq-ready)
litschema mcp                      DuckDB store served over MCP (experimental)
litschema skills install           install the agent skills globally
litschema agent ...                deterministic steps the extraction skill calls

There is no litschema extract: extraction is judgment work, so it runs as an agent skill (/extract-article <id>) with the framework checking the output. The verb exists only to say so.

How it works

Intake is offline and content-addressed. assemble derives a stable article id from each PDF's filename, moves the PDF into the store, and writes a minimal manifest. No DOI, bibliography file, or network access is needed to reach extraction, and re-dropping the same PDF is a no-op.

Extraction is agent-executed, framework-checked. The agent reads only the prepared text, writes an extraction plus a line-cited reasoning file, and loops until both validate. Validation is closed-world — nothing the schema doesn't define gets in — and citations must resolve to real lines in the prepared text, so a reference to a line that doesn't exist fails rather than shipping.

Runs are immutable and provenance-bearing. Publishing records the SHA-256 of every input — prepared text, domain context, and the skill that conducted the extraction — alongside the schema hash and what produced it. Reproduction data is computed by the publisher; attribution is recorded as asserted, since an agent cannot verify its own model. Nothing is overwritten.

Bibliographic metadata is provenance-locked. Values fetched from a DOI registry are marked and locked; machine-written values may be upgraded but human edits are never overwritten without explicit consent. Documents with no DOI flow through unchanged.

Review is field-by-field and git-native. litschema verify shows every extracted value beside its cited source lines, with the model and effort that produced it. You verify a value, correct it, or remove it — one entry per field, stored inside the run it reviews. Diffs of review.json are the audit log. Because a run's payload can never change, a review never goes stale.

Use the reviewed truth. export writes the review-applied extractions as JSONL or CSV for pandas, R, or jq. mcp (experimental) derives a DuckDB database from your schema and serves it read-only. Both apply overrides and skip error markers, so they agree.

Project layout

  • src/litschema/ — package code and CLI
  • specs/ — capability specs and decision logs; start at specs/README.md
  • skills/ — the agent-facing extraction and onboarding instructions
  • tests/ — framework tests and small project fixtures

Metadata

Release files for litschema 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for litschema 0.1.1
File Size Uploaded Provenance
litschema-0.1.1.tar.gz 152.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for litschema 0.1.1
File Interpreter ABI Platform
litschema-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 322.0 kB

Release files / litschema-0.1.1.tar.gz

Download URL litschema-0.1.1.tar.gz
Size 152.4 kB
Tags Source
SHA-256 checksum
How to use checksums
96adcf8234066c47c42f737c9be3c3ba0293501bc7ffc9f82a1fd623205c3e31
BLAKE2b-256 checksum
How to use checksums
6c65f45ea49dd801925c44fb96bdd3ba5aa75a7127d0c309a31c0eaa4f0044f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / litschema-0.1.1-py3-none-any.whl

Download URL litschema-0.1.1-py3-none-any.whl
Size 169.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec9ba3b862ee37763613a60f23dc006bdd7189472555527258bd014ae1457054
BLAKE2b-256 checksum
How to use checksums
eb1d8ae438cd76f1cf51625364513eb8f76935d23616df438317c07f6f2555f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Security for litschema 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for litschema-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page