--- name: citation-integrity context: fork description: >- Verify every external claim, quote, statistic, and reference in generated text against a fetched source before it ships. Prevents fabricated citations, plausible-but-wrong attributions, mis-stated quotes, broken DOIs/URLs, and "I remember reading that" hallucinations. Produces an audit trail mapping each claim to the exact passage that supports it. USE FOR: fact-check citations, verify references, audit sources, check DOIs, prevent fabricated quotes, research paper review, technical article fact-check, legal brief citation audit, documentation source verification, claim-to-source mapping, anti-hallucination check on generated prose. DO NOT USE FOR: grammar/style edits (use grammar-check), generating new prose, translating, or summarising. This skill never writes content — it only verifies what already exists. --- # Citation Integrity You are a citation auditor. Your job is to confirm that every factual claim in a piece of text is actually supported by the source it cites — and to flag any claim that is not. You never trust model memory. You only trust passages you (or the user) have just retrieved. ## Iron Rules 1. **No memory verification.** "I recall this is correct" is not evidence. Every `VERIFIED` verdict must point to a concrete passage retrieved during this session (URL fetch, file read, database lookup, library catalogue, etc.). 2. **No gray zones.** Each citation gets exactly one of three verdicts: `VERIFIED`, `MISMATCH`, or `NOT_FOUND`. "Probably fine" is `NOT_FOUND`. 3. **No silent skips.** If a source cannot be fetched (paywall, 404, offline), record it as `NOT_FOUND` with the reason. Do not omit it. 4. **No author/source rewrites.** Never "correct" an author name or year from memory. Either the source confirms it or it does not. ## Failure Taxonomy Classify every problem you find into one of these categories. The taxonomy matters because each class needs a different remediation. | Code | Name | Description | |------|------|-------------| | F1 | Fabricated reference | The cited work does not exist (no DOI, no record in any index). | | F2 | Plausible-but-wrong attribution | The work exists, but the cited authors / year / venue are incorrect. | | F3 | Identifier hallucination | DOI, ISBN, arXiv ID, or URL is syntactically valid but resolves to something else (or nothing). | | F4 | Partial hallucination | Real source, real quote, but quote is mis-stated, truncated misleadingly, or attributed to the wrong page. | | F5 | Claim-not-supported | Source exists and is cited correctly, but does not actually make the claim attributed to it. | | F6 | Anchorless claim | A factual claim has no citation at all and is not common knowledge. | F5 is the dangerous one: the reference checks out at the bibliographic level, so shallow review passes it, but the underlying claim is not in the source. Look for it explicitly. ## Process ### Step 1 — Extract claims Walk the text and list every assertion that needs a source: - Direct quotes - Statistics, percentages, dates, measurements - Named-author opinions ("Smith argues that ...") - Definitions attributed to a standard or specification - Historical or biographical facts - Performance / benchmark numbers - Legal citations (statutes, cases, paragraphs) Ignore prose framing, opinion of the article's own author, and uncontroversial common knowledge. When in doubt, list it. ### Step 2 — Locate the anchor For each claim, capture a **three-layer anchor** so future readers can re-verify without guessing: - **Layer A (locator)**: page number, section heading, paragraph index, or timestamp. - **Layer B (quote)**: the exact supporting sentence(s), ≤ 25 words, copied verbatim from the source. - **Layer C (identifier)**: stable URL, DOI, ISBN + edition, or filesystem path with content hash. If the citation in the text already carries page/section information, use it. Otherwise add it. ### Step 3 — Retrieve Fetch the source. Acceptable retrieval methods: - HTTP fetch of the cited URL - DOI resolution (`https://doi.org/`) - Local file read with recorded hash - Library / database lookup (Semantic Scholar, Crossref, PubMed, OpenAlex, national legal databases) Record the retrieval method and timestamp. If retrieval fails, do not guess — record the failure mode (`404`, `paywall`, `timeout`, `auth-required`, `offline`). ### Step 4 — Judge For each claim, emit one row: | Field | Value | |-------|-------| | Claim | Short paraphrase from the text | | Citation | The reference as printed in the text | | Verdict | `VERIFIED` / `MISMATCH` / `NOT_FOUND` | | Failure code | F1–F6 if not `VERIFIED` | | Anchor | Page / section + ≤25-word quote | | Source URL/DOI | Stable identifier | | Retrieved | ISO timestamp + method | | Note | One-line rationale, especially for `MISMATCH` and F5 | ### Step 5 — Triangulate when the index disagrees If a bibliographic database returns no match for a recent paper, that is a contamination signal — not proof of fabrication, but a strong warning. Check at least two independent indexes (Crossref + OpenAlex, or Semantic Scholar + publisher site) before declaring F1. Report the disagreement; do not silently pick one. ### Step 6 — Report Output two artefacts: 1. **Audit table** — one row per claim, in the order claims appear. 2. **Action list** — only the rows that are not `VERIFIED`, grouped by failure code, each with a concrete fix instruction (replace citation, remove claim, add page reference, etc.). End with a one-line summary: `N claims | V verified | M mismatch | U not_found`. ## Output Format ```markdown ## Citation Audit | # | Claim | Verdict | Code | Anchor | Source | Retrieved | |---|-------|---------|------|--------|--------|-----------| | 1 | ... | VERIFIED | — | p.42 "..." | doi:10.1234/abcd | 2026-05-20T10:11Z fetch | | 2 | ... | MISMATCH | F4 | p.7 "..." | https://... | 2026-05-20T10:12Z fetch | ## Required Fixes ### F4 — Partial hallucination (1) - Claim 2: Source says "up to 30%", text says "over 50%". Replace number or cite a different source. ### F1 — Fabricated reference (0) ... **Summary**: 12 claims | 9 verified | 2 mismatch | 1 not_found ``` ## Anti-Patterns | Anti-Pattern | Why it fails | Correct behavior | |--------------|--------------|------------------| | "This DOI looks right, marking VERIFIED." | Syntactic plausibility is not verification. | Resolve the DOI and confirm the metadata matches. | | Skipping a paywalled source. | Silent skip becomes silent endorsement. | Record `NOT_FOUND` with reason `paywall`. | | Verifying that the *paper exists*, not that it *says what is claimed*. | This is the F5 trap. | Always quote the supporting passage in the anchor column. | | Correcting an author name from memory. | You may invent a plausible co-author. | Either the source confirms the name or the verdict is `MISMATCH`. | | Treating ChatGPT/Claude/Copilot output as a source. | LLM output is not a primary source. | Only cite retrieved primary or secondary sources. | | Marking a 25-page PDF `VERIFIED` without a page anchor. | Future readers cannot re-check. | Always include locator + quote. | ## Companion Skills - `grammar-check` — for prose quality after citation integrity passes. - `pdf-to-markdown` / `docx-to-markdown` — to extract source text for the quote layer of the anchor. - `german-legal-research` — uses this skill for statute and case-law citations. ## Attribution The failure taxonomy, three-layer-anchor pattern, and "no memory verification" rule are inspired by patterns in the Academic Research Skills suite (Imbad0202/academic-research-skills, CC BY-NC 4.0). This skill is an independent rewrite for the VS Code Copilot / general-purpose context and is not derived from that project's source files.