Your agent cannot assert without quoting the source. A claim store with verbatim-evidence enforcement, for LLM extraction pipelines.
Project description
xrad
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xrad-0.3.0.tar.gz.
File metadata
- Download URL: xrad-0.3.0.tar.gz
- Upload date:
- Size: 66.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc2b31b117c680845b492b04578a5e60cf6c0ddfbb1f79c393c3005f5c17f4ef
|
|
| MD5 |
d0fc61069b43333d25741a03bb4d929f
|
|
| BLAKE2b-256 |
4e82ea2c488aaf92c8b6bac1e515b38c9abe01be83aa22a17f8e660b0783f17c
|
Provenance
The following attestation bundles were made for xrad-0.3.0.tar.gz:
Publisher:
release.yml on narimannemo/xrad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xrad-0.3.0.tar.gz -
Subject digest:
bc2b31b117c680845b492b04578a5e60cf6c0ddfbb1f79c393c3005f5c17f4ef - Sigstore transparency entry: 2337681176
- Sigstore integration time:
-
Permalink:
narimannemo/xrad@36dbe03e8cafb48c6b7390461ad2c114d78165a9 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/narimannemo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@36dbe03e8cafb48c6b7390461ad2c114d78165a9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file xrad-0.3.0-py3-none-any.whl.
File metadata
- Download URL: xrad-0.3.0-py3-none-any.whl
- Upload date:
- Size: 50.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38f5241e608a967e8f3986cef103070e030799b0cb8e4f089994d2905a023c71
|
|
| MD5 |
f82dab17cf6499119365b916da2801b6
|
|
| BLAKE2b-256 |
6f889c0137d4df6dd9df1f87e6f8baa17bb8bd828a07c81ed5026b294170623e
|
Provenance
The following attestation bundles were made for xrad-0.3.0-py3-none-any.whl:
Publisher:
release.yml on narimannemo/xrad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xrad-0.3.0-py3-none-any.whl -
Subject digest:
38f5241e608a967e8f3986cef103070e030799b0cb8e4f089994d2905a023c71 - Sigstore transparency entry: 2337681181
- Sigstore integration time:
-
Permalink:
narimannemo/xrad@36dbe03e8cafb48c6b7390461ad2c114d78165a9 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/narimannemo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@36dbe03e8cafb48c6b7390461ad2c114d78165a9 -
Trigger Event:
push
-
Statement type: