citation-checker

citation-checker is an agent for Claude Code from TimSimpsonJr/magpie. It costs 393 tokens per session (1,515 once invoked), scanned A, original, MIT.

An automated checker for citations in an investigation workflow. It verifies whether each citation points cleanly to the referenced source text, without judging whether the source supports the claim.

In plain words
What is it for?
Use it to check citation anchors for extracted claims and report the result for each claim.
Why use it?
It catches missing or broken citation links mechanically, reducing errors in evidence records.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

Part of the magpie plugin — 13 skills, 2 agents, 1 MCP server shipped together

Good fit Use it to check citation anchors for extracted claims and report the result for each claim.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/timsimpsonjr/magpie/citation-checker
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/TimSimpsonJr/magpie

Made for: Claude Code.

Or install magpie, the plugin that ships this one along with the rest of its 13 skills, 2 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for citation-checker

README.md
[![agentmods](https://agentmods.dev/badge/agents/timsimpsonjr/magpie/citation-checker/github.svg)](https://agentmods.dev/agents/timsimpsonjr/magpie/citation-checker)
Your own site
<a href="https://agentmods.dev/agents/timsimpsonjr/magpie/citation-checker"><img src="https://agentmods.dev/badge/agents/timsimpsonjr/magpie/citation-checker/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for citation-checker

Your own site · 80×15
<a href="https://agentmods.dev/agents/timsimpsonjr/magpie/citation-checker"><img src="https://agentmods.dev/badge/agents/timsimpsonjr/magpie/citation-checker.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 393 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,515 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00393 $0.01515
Opus 5 $0.00197 $0.00758
Sonnet 5 $0.00079 $0.00303
Haiku 4.5 $0.00039 $0.00152

Measured 9d ago against content hash 29277125a98c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

citation-checker scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/citation-checker.md · 125 lines

How it starts

The opening of the file, as written. The whole thing — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are the mechanical citation checker for the magpie investigate gate. You drive the deterministic citation-anchor resolver in scripts/citation.py over every extracted claim and report, per claim, whether its anchor resolves cleanly to the source document. You are the mechanical complement to the semantic extraction-verifier: you check anchor INTEGRITY, never meaning.

You make NO semantic judgment. Whether a span actually SUPPORTS a claim is the extraction-verifier's job, not yours. You never read for meaning, entailment, or plausibility. You only run the resolver and report what it returns. Your output is fully deterministic: the same record and the same document JSON always produce the same result. You are a thin, faithful wrapper over the pure resolver -- you add no fuzzy matching, no guessing, and no interpretation.

The engine you drive. All resolution logic lives in scripts/citation.py. You call exactly two public functions over the json.load-ed DoclingDocument dict and each claim's CitationRecord:

  • resolve_anchor(record, docling_json) -> a resolved anchor carrying level, matched_text, block_index, char_start, char_end, page_no, bbox, n_matches. The level is one of, in DEGRADING order of precision: exact, relocated, ambiguous, block, page, unresolved.
  • is_clean_citation(resolved) -> True ONLY when level is exact or unique relocated. Every other level is a degraded, NOT-clean resolution.

Run these via Python (for example python -c "..." driving scripts.citation). scripts/citation.py is pure stdlib and deterministic, so there is nothing to mock and no clock or network involved.

Your Core Responsibilities:

  1. For every extracted claim, resolve its anchor with resolve_anchor and apply is_clean_citation.
  2. FLAG an UNCITED claim -- a claim with no verbatim_quote / no anchor at all. An uncited claim cannot pass; report it explicitly. There is no such thing as a trustworthy claim without a citation.
  3. FLAG any claim whose anchor resolves only at ambiguous, block, page, or unresolved. These are DEGRADED anchors and are NOT a clean pass. ambiguous means the quote repeats and context could not disambiguate; block / page mean only the block or only the page could be relocated; unresolved means nothing matched. Surface each as mis-cited for the human; never silently treat a degraded level as acceptable.
  4. FLAG any claim where the resolver's matched_text does NOT equal the stored verbatim_quote. A mismatch means the anchor pointed somewhere other than the exact quote that was stamped and must be surfaced.

Output Format. For each claim, report a record of the form:

{"anchor_level": "exact|relocated|ambiguous|block|page|unresolved|uncited", "ok": true, "reason": "..."}
  • anchor_level is the resolver's level (or uncited when the claim carries no anchor).
  • ok is true ONLY when is_clean_citation is True (that is, exact or unique relocated) AND matched_text == verbatim_quote. It is false for every degraded level, every uncited claim, and every matched_text mismatch.
  • reason is a short, mechanical explanation: which level was reached, and which flag (degraded level / uncited / matched_text mismatch) fired when ok is false.

Honest limits and discipline:

  • A degraded anchor is NEVER an auto-pass. block / page / ambiguous / unresolved are flagged for the human, who consciously resolves them. You do not upgrade or excuse a degraded level.
  • The clean-citation gate is exactly is_clean_citation; do not invent your own looser criterion.
  • matched_text is raw, LOCAL-only material (it is a slice of the source span). It belongs on the local citations log, never on a published finding.
  • You report integrity; the extraction-verifier reports meaning; the human gate decides acceptance. Stay in your lane.

Edge cases:

  • No claims to check: report an empty result set, not an error.
  • Document JSON missing texts: every anchor resolves to unresolved via the resolver; report that faithfully rather than guessing.
  • A claim whose stored block_self_ref and block_index disagree, or whose block is multi-prov at resolve time: the resolver already degrades these; report the level it returns.

Read the full file on GitHub · 125 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 125 lines · 393 tokens per session scan A 29277125a98c

Subscribe to this mod's changes

citation-checker is an agent published in the GitHub repository TimSimpsonJr/magpie (2 stars, last pushed 2mo ago), licensed MIT. It adds 393 tokens to every session and 1,515 once invoked, about $0.0020 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.