Skip to main content

xrad

ci pypi python licence

Your agent cannot assert here without quoting the source.

Extraction pipelines produce knowledge graphs that assert. Acme ACQUIRED Beta, as a fact. That holds until the source only implies it, attributes it to someone, or hedges it — and then the graph has quietly turned a rumour into a fact, and nothing downstream can tell.

xrad stores claims: who said it, with what commitment, and the verbatim span that proves it. The contract lives in the tooling, not in the prompt.

uv tool install xrad          # the CLI, isolated, on your PATH
uv pip install xrad           # or as a library, in your project

In sixty seconds

git clone https://github.com/narimannemo/xrad && cd xrad
python examples/demo.py
-- 1. an agent paraphrases ---------------------------------
   REFUSED | quote_not_found
   The contract says 'hereby acquires'. The paraphrase is plausible,
   would pass any human review, and is not in the document.

-- 2. it quotes verbatim -----------------------------------
   STORED | contract:c00001 at characters [31, 64]

-- 3. it invents a relation --------------------------------
   REFUSED | unknown relation 'SORT_OF_RELATED_TO' — use one of: ACQUIRED, OWNS

-- 4. it credits a source the quote does not name -----------
   STORED, with a warning:
   the quote does not name 'Reuters'...

Three refusals

A paraphrase is refused. A model quotes; xrad finds the quote in the source. Exact, case-insensitive, whitespace-insensitive — and deliberately nothing fuzzy, because a near-miss means the model paraphrased, and a paraphrase pointing at real offsets is the corruption this exists to prevent.

A relation outside the vocabulary is refused, with the valid options in the error so an agent can retry. Vocabularies are YAML; the prompt text is generated from the same file the code enforces, so the two cannot drift.

A claim with no evidence cannot be constructed. A claim you cannot check is indistinguishable from one that was invented.

Two questions an edge store cannot answer

$ xrad path Acme Gamma
  1. Acme --ACQUIRED--> Beta            the filing
  2. Beta --OWNS--> Gamma   (reported)  Reuters
  2 hops · 1 asserted · 1 reported or hedged

$ xrad path Acme Gamma --modality assertion
  no chain  the connection may exist when reported claims are allowed

The argument does not survive on the filing's own authority. It is a shortest-path query by any other name, but what comes back is a chain of claims: every hop carries who committed to it, how strongly, and whether its evidence held.

$ xrad disagreements
  Acme  ACQUIRED  Beta   the filing (assertion)  vs  the auditor (rejected)

Two sources contradicting each other is the most interesting object in a corpus. An edge store would have kept one and lost the other.

Documentation

Concepts why claims and not edges, and what follows from it
MCP wiring it to Claude Code, Cursor or your own agent
Vocabularies designing the closed set of types and relations
Auditing having a second model try to refute every claim
Reference every command and the Python API
Packaging uv, Homebrew, and which to use

Why it exists

Extracted from a pipeline that put 5,646 claims from a 1652 folio into a graph where every one resolves to a rectangle on a scanned page.

The audit is the reason to trust any of it: a second model, shown only the cited span, tries to refute each claim. 23% did not survive. The largest single failure was an attribution the quote itself did not contain — the source names Strabo once and writes for three paragraphs, and the extractor quotes paragraph three while still crediting him. One prompt rule fixed it, refutation fell to 11.5%, and it replicated on a second volume (z = 5.05).

That finding ships as the warning record_claim emits when a reported claim credits a source its own quote does not name.

What it is not

Not a vector index. No embeddings, no similarity search — a claim store you traverse.

Not an extraction model. Bring your own agent; xrad decides what it is allowed to record.

Not a fact database. Sources are wrong. A source being wrong is recorded, with the modality showing how it held the statement.

Apache-2.0. Contributions welcome — CONTRIBUTING.md says what will and will not be accepted before you spend an evening.

Release files for xrad 0.4.0

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

Source distribution (sdist)

Source distribution for xrad 0.4.0
File Size Uploaded
xrad-0.4.0.tar.gz 67.7 kB Details

Built distribution (wheel)

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

Total release size: 118.7 kB

Release files / xrad-0.4.0.tar.gz

Download URL xrad-0.4.0.tar.gz
Size 67.7 kB
Tags Source
SHA-256 checksum
How to use checksums
abc73b0b4c93538d5916a29d6fbda92ccc065f22434cf911f588897eb9fab6e4
BLAKE2b-256 checksum
How to use checksums
d3cfe150b6256e683565fef0627714248b779bbc179eb11fd0a5473e4d86e50e
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 Aug 5, 2026.

Transparency log

Release files / xrad-0.4.0-py3-none-any.whl

Download URL xrad-0.4.0-py3-none-any.whl
Size 50.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1966701b0b3f27043df7748964bfc944b0627c0690de034c4b263d7c094a9df
BLAKE2b-256 checksum
How to use checksums
07c86a862207680248bee784e5d17a47657887f4c7e64ebef9ec78a43e38939b
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 Aug 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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