Skip to main content

citefact

Do your sources actually say what you claim?

License: MIT Python 3.11+ Zero install

Quickstart · How It Works · Usage · Limitations

citefact report: the Claims section showing AI verdicts with verbatim source evidence, including a fabricated quote caught as misrepresented

A fabricated quote caught with the source's own words. Full report.


LLMs made it trivial to produce manuscripts with fabricated citations, altered quotes, and claims the cited sources never made. Existing tools check that citations exist; citefact reads the full text of every cited source and checks that it supports what you wrote — then hands you a report with the evidence, before a reviewer finds it first.

🚀 Quickstart

# From a Zotero collection (Zotero 7+ running; no export needed):
uvx citefact check manuscript.md --zotero-collection "PhD/Chapter 3"

# Or from a BibTeX file and a folder of PDFs:
uvx citefact check manuscript.md --bib refs.bib --pdfs ./papers/

That's the whole setup: uvx fetches citefact, the report lands in ./citefact-report/report.html. The citation and quote checks are free and need no API key. The claims check uses an LLM with your own key — run uvx citefact setup once and it configures everything interactively, or pass --skip-claims to stay entirely keyless and offline.

🧭 Three Checks, Cheapest First

Check Question it answers Method Cost
1 · Citations Does every in-text citation exist in the bibliography, with a source document? Deterministic Free
2 · Quotes Is every direct quote really verbatim in its cited source? Deterministic (normalized + fuzzy) Free
3 · Claims Does the source actually support the claim attached to it? LLM, with verbatim evidence per verdict ~cents per source
Citation-existence checkers citefact
Citation exists in bibliography ✅ ✅
Direct quotes verbatim in source ❌ ✅
Source actually supports the claim ❌ ✅
Works offline / keyless varies ✅ (checks 1+2)
Metadata / DOI linting ✅ ❌ (other tools do this well)

Every claim verdict (supported / partial / misrepresented / not_in_paper) carries a verbatim evidence quote, reasoning, and a confidence score. It is presented as an AI suggestion, never as ground truth: citefact reports, you decide.

✨ Why researchers keep it in the loop

  • 📚 Zotero-native - point it at a collection and it reads metadata and attached PDFs through Zotero's local API; no exports, no Better BibTeX
  • 🔒 Keyless mode - --skip-claims catches fabricated citations and altered quotes with zero network calls
  • 🤖 Your LLM, your key - Anthropic, OpenAI, or fully local via Ollama, all through LiteLLM
  • 📊 One-file report - self-contained HTML (no CDN, no requests), with every citation's status, word-level diffs for altered quotes, and one-click links to the manuscript and each source PDF
  • ⚡ Cached everything - PDF conversions, claim extraction, and verdicts are content-addressed; editing one paragraph re-verifies only what changed, and an unchanged re-run costs $0 in seconds. Conversions go through pagebound, so a paper any other pagebound tool already converted is reused, never reconverted
  • 🕵️ Private by construction - no telemetry; the only writes are the cache and the report, and the only network traffic is your LLM provider

⚙️ How It Works

flowchart LR
    A[manuscript.md] --> D[Citation parser]
    B[Zotero / refs.bib] --> E[Bibliography catalog]
    C[source PDFs] --> F[pagebound<br/>Docling, content-hash cache]
    D --> G[Citations check]
    E --> G
    F --> G
    G --> H[Quotes check]
    H --> I[Claims check<br/>LLM + caches]
    I --> J[report.html + report.json]
  1. Parse - a deterministic parser extracts every in-text citation (narrative, parenthetical, multi-author lists, multi-citation groups) and resolves it against the bibliography by first-author surname + year.
  2. Convert - source PDFs become text via pagebound, which runs Docling once per PDF and caches the result by content hash and converter version. Scanned PDFs are OCR'd, and the report says so.
  3. Check - citations and quotes are verified deterministically; claims are extracted verbatim and judged per (claim, source) pair by the LLM, evidence included.
  4. Report - a filterable single-file report.html plus a versioned report.json for CI.

🤖 For agents and LLM tools

An agent can drive citefact from --help alone: every command states what it writes, its exit codes and the shape of report.json, and citefact help COMMAND is the same text. The loop is three commands:

citefact doctor                                           # what is installed, exit 0 always
citefact check manuscript.md --bib refs.bib --pdfs papers/ --skip-claims --json --quiet > report.json
jq '.findings[] | select(.severity == "error") | {type, location, citation, quote}' report.json

Exit codes are the contract: 0 clean, 1 findings at or above --fail-on, 2 usage or execution error with the reason on stderr. Progress never touches stdout, so --json output is safe to pipe. Finding types are stable per level (orphan_citation, missing_source, quote_modified, claim_verdict, ...) and report.json carries schema_version; changes are listed in CHANGELOG.md. Converted source text is shared with pagebound, so an agent that wants to read a source itself can use pagebound path on the same cache.

📖 Usage

Command What it does
citefact check MANUSCRIPT Run the audit and write the report
citefact setup Interactive first-run: pre-download Docling, configure and validate your LLM key
citefact doctor Show what is installed and missing, per feature
citefact convert --pdfs DIR Pre-convert PDFs to warm the cache

CI gating

citefact check manuscript.md --bib refs.bib --pdfs ./papers/ --skip-claims --fail-on error

Exit codes: 0 clean, 1 findings at or above --fail-on (default error), 2 execution error. Errors are the serious findings (fabricated citations, altered or unfound quotes, misrepresented/not_in_paper verdicts); --fail-on warning is stricter, --fail-on none just collects the report. Failed LLM calls surface as unverified findings and mark the run partial — never silently dropped.

Live progress

Long phases draw progress bars with ETA and running LLM cost on interactive terminals (plain lines in CI), and every run ends with a summary:

Verifying claims ━━━━━━━━━━━━━━╸━━  38/41  0:03:12  ETA 0:00:15  $0.31  smith2023

⚠️ Summary: 0 errors, 13 warnings (quotes 13) | cost $0.33 | 158.2s
Report: citefact-report/report.html
check flags reference
Flag Default Meaning
--bib FILE BibTeX bibliography (this or --zotero-collection)
--zotero-collection NAME Zotero collection (name or "Parent/Child" path); needs Zotero 7+ running
--pdfs DIR Folder of source PDFs, fuzzy-matched to entries lacking one
--skip-claims off Citations + quotes only: free, keyless
--only LEVELS all Comma-separated subset: citations,quotes,claims
--model / --provider anthropic/claude-sonnet-5 LLM for the claims check
--fail-on error error | warning | none: what makes the exit code 1
--out DIR ./citefact-report Where report.html + report.json land
--json off Also stream report.json to stdout
--quiet off Silence progress and summary
--force off Ignore the conversion cache

Environment: CITEFACT_CACHE relocates the .citefact/ cache (written next to the manuscript by default); CITEFACT_MODEL pins a model. citefact convert resolves its cache relative to the current directory, so run it from the manuscript's folder or set CITEFACT_CACHE.

Converted PDFs live in .citefact/pagebound/, the project's own pagebound store. If you also have a shared pagebound cache (~/.cache/pagebound, or PAGEBOUND_CACHE), citefact reads it first and copies hits into the project store; it never writes to the shared cache.

All finding types (what lands in the report)
Finding Check Severity Meaning
orphan_citation citations error In-text citation with no bibliography entry (the fabricated-citation signal)
uncited_reference citations warning¹ Bibliography entry never cited in the text
missing_source citations warning Entry is cited but no PDF/text is available, so later checks skip it
quote_verified quotes info Quote found verbatim in the source
quote_modified quotes error Near match only; the report shows a word-level diff
quote_not_found quotes error Quote does not appear in the cited source
quote_unattributed quotes warning Long quote with no resolvable citation nearby
claim_verdict claims by verdict supported info · partial warning · misrepresented/not_in_paper error · unverified warning

¹ Demoted to info with --zotero-collection: a collection is a reading library, so uncited entries are normal there.

🤖 LLM Configuration

The easy path is one command:

uvx citefact setup

It asks for your provider, takes the API key with hidden input, validates it with a minimal call, and stores it in ~/.config/citefact/config.toml (owner-only permissions). Done — citefact check just works from then on.

Everything else is an override, in precedence order: --model / --provider flags > ANTHROPIC_API_KEY-style environment variables and CITEFACT_MODEL > the setup config file > the built-in default (anthropic/claude-sonnet-5). Any LiteLLM-supported provider works, including fully local:

uvx citefact check manuscript.md --bib refs.bib --model ollama/llama3.1

⚠️ Limitations

  • Author-year (APA-like) citation styles only; numeric styles (Vancouver/IEEE) are on the roadmap
  • Markdown manuscripts only in v0.1 (DOCX next; the manuscript itself cannot be a PDF)
  • You supply the source PDFs; there is no automatic retrieval by DOI
  • The first PDF conversion downloads the Docling environment (~1-2 GB, one-time) into the uv cache
  • Claim verdicts are AI suggestions with the usual LLM failure modes; that is why every verdict carries its evidence

Roadmap: DOCX manuscripts → LaTeX (\cite{}) → numeric citation styles → stable JSON schema and JOSS submission. report.json already carries schema_version and is the contract for integrations; schema changes are listed in CHANGELOG.md.

For developers
git clone https://github.com/hearthresearch/citefact
cd citefact
uv sync
uv run pytest              # unit tests, LLM mocked
uv run pytest --run-evals  # opt-in LLM eval fixtures (costs money)

📄 License

MIT

🤝 Acknowledgments

  • LiteLLM for provider-agnostic LLM access
  • pagebound and Docling for PDF-to-Markdown conversion with page provenance
  • ZotSeek - related tool: AI-powered semantic search for Zotero

citefact: Do your sources actually say what you claim? Built by José Fernandes

Metadata

Release files for citefact 0.2.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 citefact 0.2.1
File Size Uploaded
citefact-0.2.1.tar.gz 735.8 kB Details

Built distribution (wheel)

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

Total release size: 800.6 kB

Release files / citefact-0.2.1.tar.gz

Download URL citefact-0.2.1.tar.gz
Size 735.8 kB
Tags Source
SHA-256 checksum
How to use checksums
57670656e95d25b6e25feeecf0a134834ab1c7726d9e0110840bc96c84f756cb
BLAKE2b-256 checksum
How to use checksums
8701b45874ccdb5241d620e6b9a0afb53533455ad69275ed0d8cfd5efbc06a1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / citefact-0.2.1-py3-none-any.whl

Download URL citefact-0.2.1-py3-none-any.whl
Size 64.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ad7b8b7548adc0d9cc3ef04aa80d0da43ed449ceab9db42ce18e0ac1e31e44b
BLAKE2b-256 checksum
How to use checksums
bec9b527bdae176ca152052ff65284db6babb6af522b3b1688682c3805a3046a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.3.0

2 release files

This release

0.2.1 This release

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