The most dangerous hallucinations in AI-written research notes, health summaries, and technical drafts rarely look obviously wrong. They look impeccably formatted, carry clickable links that return HTTP 200, and read like legitimate scholarship.
A plain link checker misses them — the DOI resolves just fine, except it belongs to an unrelated paper from a decade earlier. Asking a second LLM to "audit the citations" fails just as quietly: another model still cannot inspect live registry metadata, retraction records, or exact byte offsets, and it happily hallucinates false alarms on niche real papers.
This post walks through how claimcite ( v0.7.1, pure Python 3.10+ stdlib, zero third-party runtime dependencies) tackles citation verification deterministically:
26/26`` 0 false errors192``<1s`` sessfork → XERJ + kbwall → claimcite) by verifying host-free xerj:// UTF-8 byte spans offline without ever caching private documents to disk;Not tested ≠ clean)
Every CLI snippet, benchmark metric, and xerj:// verification output below comes directly from running benchmarks/run.py, recorded real responses in tests/fixtures/, and a local loopback XERJ check — zero fabricated outputs. Offline reproduction steps are at the end.
Across real drafts, AI-generated references consistently fail in four quiet ways that slip past skimming eyes. Each output below is produced directly by claimcite replaying real recorded registry responses (53 recorded payloads in tests/fixtures/).
LLMs routinely emit a valid, high-citation DOI and bolt it onto a fabricated or misremembered title and year. In examples/sample.md (line 7), a claim about green tea halving stroke risk cites doi:10.1016/s0140-6736(10)61388-8 as a 2021 Stroke cohort — when that real DOI actually resolves to a 2011 Lancet paper on the global burden of second-hand smoke. Any HTTP-200 link checker passes it silently.
In the recorded offline benchmark (err_title_mismatch_doi), pairing real DOI 10.1007/s10654-019-00524-3 with Tanaka H (2019). Deep Residual Learning for Image Recognition. Stroke. triggers a hard title-mismatch error:
- **Error** · line 1 · `doi:10.1007/s10654-019-00524-3`
- Coffee consumption and all-cause and cause-specific mortality: a meta-analysis by potential modifiers. (2019)
- Study type (as tagged by PubMed): Systematic review / meta-analysis
- Title does not match this identifier. Registry title: "Coffee consumption and all-cause and cause-specific mortality: a meta-analysis by potential modifiers."
Notice the restraint when only the year is wrong: in warn_year_mismatch (pmid:30221596, citing the 2018 ASPREE aspirin trial as 2024), the title matches, so claimcite emits a Warning rather than a hard CI-breaking Error (and grants a ±1 year tolerance for online-first vs. print publication):
- **Warning** · line 1 · `pmid:30221596`
- Effect of Aspirin on Disability-free Survival in the Healthy Elderly. (2018)
- Study type (as tagged by PubMed): Randomized controlled trial
- Year differs: document 2024, registry 2018
Models synthesize syntactically spotless fake identifiers — doi:10.1001/jama.2022.99999, doi:10.9999/does-not-exist-claimcite, PMID: 99999999, or arXiv:9912.99999.
claimcite checks DOIs against the registrar-agnostic doi.org/api/handles/ API first, then resolves metadata across PubMed, Crossref, OpenAlex, and the arXiv Atom API (including DataCite 10.48550/arXiv.* DOIs). It emits an Error only when the authoritative registry definitively reports the identifier does not exist:
- **Error** · line 1 · `doi:10.9999/does-not-exist-claimcite`
- Identifier does not exist
Even more common are hallucinated citations with no identifier at all. claimcite parses APA, Harvard, MLA, Vancouver, and GB/T 7714 bibliography entries and searches Crossref followed by PubMed by title: ""
ok_unlinked_title_search) → resolves the real identifier and runs full title/year/quote verification;warn_unlinked_invented) → emits a not_checked_book, e.g., Kahneman's Training corpora are packed with famous retracted studies. Checking retractions sounds trivial until you inspect real Crossref JSON payloads: Crossref puts update-to on the retraction notice, not on the retracted paper. The retracted paper carries updated-by and relation.is-retracted-by (PubMed tags Retracted Publication / RetractionIn; OpenAlex exposes is_retracted).
On top of that, publishers frequently prepend RETRACTED: to the registered title after retraction. claimcite strips _RETRACTED_PREFIX before fuzzy title comparison so you see a clean retraction error (complete with the notice DOI) rather than a spurious title-mismatch error:
- **Error** · line 1 · `doi:10.1016/s0140-6736(97)11096-0`
- RETRACTED: Ileal-lymphoid-nodular hyperplasia, non-specific colitis, and pervasive developmental disorder in children (1998)
- This paper has been retracted (notice: doi:10.1016/s0140-6736(10)60175-4)
Crucially, the paired control case ok_retraction_notice_doi verifies that citing the retraction notice itself (doi:10.1016/s0140-6736(10)60175-4) passes cleanly as OK.
[n] / Uncited [^n] Markers
In the sneakiest failure mode, the paper, authors, year, and PMID are 100% real — only the quoted words inside quotation marks were invented or exaggerated by the model.
Line 11 of examples/sample.md cites real meta-analysis pmid:33237064 (Food & Function, 2020), then fabricates the quote "calcium and vitamin D supplementation cured osteoporosis in all women":
- **Warning** · line 11 · `pmid:33237064`
- Effects of combined calcium and vitamin D supplementation on osteoporosis in postmenopausal women: a systematic review and meta-analysis of randomized controlled trials. (2020)
- Study type (as tagged by PubMed): Systematic review / meta-analysis
- Quoted text not found in the abstract (it may be in the full text): “calcium and vitamin D supplementation cured osteoporosis in all women”
Because legitimate quotes often live in the paper body rather than the abstract, claimcite falls back on demand to PubMed Central (PMC) and Europe PMC open-access JATS XML full text (stripping <xref> footnote tags and nested <ref-list> blocks), and falls back to OpenAlex (abstract_inverted_index) when Crossref lacks an abstract. It also flags dangling body markers ([2]) and uncited footnote entries ([^1]) as Error while ignoring statistical intervals ( 60 [52-68] years, [0, 1]).
claimcite specifies dependencies = [] in pyproject.toml (Python 3.10+ stdlib only):
uvx claimcite mcp, pipx install claimcite, GitHub Actions, pre-commit, and stdio MCP run cleanly on Linux, macOS, and Windows with zero native wheel failures.0.15s`` 192/192``0.8s`` v0.7.1). ok / warning / error / not_checked strictly separates authoritative failures from network errors, paywalls, or bot walls so CI gates never cry wolf.
In private RAG pipelines, retrieval often finds the right paragraph and then the LLM silently flips $42.8M into $48.2M — or drifts a span offset into the middle of a multi-byte UTF-8 character.
claimcite shares a strict host-free URI contract with kbwall and XERJ ( xerj://<index>/<doc_id>#b=<byte_start>[-<byte_end>][&f=<field>], forbidding host:port inside documents):
2 ok · 0 warnings · 2 errors · 0 not checked
- **OK** · line 1 · `xerj://fin-filings/q3-2026-memo#b=8-68&f=text`
- XERJ span verified (fin-filings/q3-2026-memo, field text)
- **OK** · line 2 · `xerj://fin-filings/q3-2026-memo#b=69-160&f=text`
- XERJ span verified (fin-filings/q3-2026-memo, field text)
- **Error** · line 3 · `xerj://fin-filings/q3-2026-memo#b=8-68&f=text`
- Quoted text not found in XERJ span: “Revenue recognized in Q3 2026 reached $48.2M”
- **Error** · line 4 · `xerj://fin-filings/q3-2026-memo#b=70-160&f=text`
- XERJ span offset is out of range or splits a UTF-8 character (byte range 70-160 starts inside a UTF-8 codepoint)
Five hard security & privacy invariants guard local verification (src/claimcite/xerj.py & mcp.py, hardened further in v0.7.1 with SECURITY.md):
ProxyHandler({})) & zero 3xx redirects10 MiB hard cap.POST /_mget`` XERJ_URL and optional CLAIMCITE_ALLOWED_ROOT (blocking symlink suffix-bypass & outside-root escapes) are read strictly from process environment variables — never exposed as MCP tool arguments.Not Tested ≠ Clean)
git clone https://github.com/wasabihu/claimcite.git
cd claimcite
uv run pytest -q # 192 passed in ~0.8s (v0.7.1)
uv run python benchmarks/run.py # 26/26 (100.0%), false_errors=0
MCP config (uvx claimcite mcp — PyPI & Official MCP Registry io.github.wasabihu/claimcite):
{
"mcpServers": {
"claimcite": {
"command": "uvx",
"args": ["claimcite", "mcp"]
}
}
}
llms.txt): XERJ``kbwall`` vericorpus