no-fake-cite

May 11, 2026 · View on GitHub

tests License: Apache 2.0 Claude Code

A Claude Code Stop hook that blocks citation-formatted references — [1], Smith et al., 2023, doi:10.1234/xyz, arXiv:2403.12345, "published in NeurIPS 2025" — when no verifiable URL appears in the same message. LLMs hallucinate citations at 14–94% rates; this hook keeps fabricated refs out of your work.

no-fake-cite is one bash file (~80 lines, depends only on jq) wired into Claude Code's Stop and SubagentStop events. It pattern-matches academic citation formats in the assistant's outgoing message and blocks the closeout when no https:// URL accompanies the citation.

Why this exists

The numbers are not subtle:

The 19.9% baseline means no LLM-generated citation should ship without verification. This hook is the textual-boundary enforcement of that rule.

What gets blocked

Citation-formatted patterns:

  • Numeric academic refs[1], [12], [1, 2, 3] followed by a citation-shaped string.
  • Author-yearSmith et al., 2023, Jones et al. 2024.
  • DOIdoi:10.1234/abcd, bare 10.1234/abcd.
  • arXivarXiv:2403.12345, arXiv 2403.12345.
  • Venue+year"published in NeurIPS 2025", "at ICLR 2026", etc.

When the message contains any of these patterns and no https:// URL anywhere in the message, the hook blocks.

What stays allowed

  • Any message with a https:// or http:// URL anywhere in it (even in unrelated context — the hook is conservative; if there's a URL, the operator can audit).
  • Any message that doesn't contain a citation-formatted pattern.
  • Messages that show command evidence of having actually fetched the citation (curl, WebFetch, "verified at ", "fetched from ").

What it does NOT do

  • It does not validate that a present URL actually resolves to the cited content. That requires a network call and runs into rate limits / authentication issues. The hook just enforces the precondition: a citation must come with a URL the operator could check.
  • It does not catch fabricated URLs that happen to look real. A hallucinated https://example.com/fake-paper.pdf passes the hook's URL check; that's a false negative the operator must catch with their own audit.
  • It does not validate DOI registration. A fabricated doi:10.5555/fake.123 paired with a separate URL passes.

The hook is a precondition enforcer, not a verifier. The verification step is the operator's.

Install

mkdir -p .claude/hooks
curl -fsSL https://raw.githubusercontent.com/waitdeadai/no-fake-cite/main/no-fake-cite.sh \
  -o .claude/hooks/no-fake-cite.sh
chmod +x .claude/hooks/no-fake-cite.sh

Merge settings.example.json into .claude/settings.json. Requires jq.

Receipts

Three reproducible local tests in RECEIPTS.md. Three for three.

Sister tools

Part of the LLM Dark Patterns Hooks suite.

License

Apache-2.0.