Verify citations

From jmagly/aiwg · View interactive version

Verify citations is an AI agent skill from the GitHub repository jmagly/aiwg. Verify all citations in a document against the research corpus

How to use this skill

Skill file

Verify Citations Command

Validate that all citations, references, and factual claims are backed by actual sources in the research corpus.

Instructions

When invoked, perform systematic citation verification:

  1. Parse Target File
  1. Verify Each Citation
  1. Detect Hallucinations
  1. Check GRADE Compliance
  1. Generate Report
  1. Auto-Fix Mode (--fix)

RLM Citation Verification

When the target file contains RLM-format citations (#1205, #1223), verify-citations validates them against the current state of the cited artifacts.

Citation patterns

The skill recognizes two inline forms (matching the schema at agentic/code/addons/rlm/schemas/citation-tuple.json):

The lines field is optional in both forms.

Verdict logic

For versioned RLM citations:

  1. Resolve <artifact_id> to a project-relative file path
  2. If file does not exist → verdict: MISSING (error)
  3. If file exists, compute its current content hash using the same routine as the artifact index: sha256, truncated to first 16 hex chars (matches src/artifacts/index-builder.ts:243)
  4. Compare to the citation's content_hash:

For path-only fallback RLM citations:

  1. Resolve <artifact_id> to a project-relative file path
  2. If file does not exist → verdict: MISSING (error)
  3. If file exists → verdict: UN-VERSIONED (warning by default; error in --strict)

Stale verdict means the file content has changed since the citation was emitted — the claim may no longer be supported by the cited region. The simple hash-mismatch heuristic doesn't distinguish whitespace edits from semantic changes; richer semantic-drift detection is the responsibility of aiwg index doctor --rlm-audit (#1208).

Hash computation

The hash routine MUST match the index implementation exactly so citations emitted by rlm-batch round-trip cleanly:

sha256(file_contents).hexdigest()[0:16]

See src/artifacts/index-builder.ts:243 for the canonical implementation. Any verification logic that diverges from this convention will produce false stale verdicts.

Report format

When RLM citations are present, the report adds a new section:

RLM Citations: 12 total
  ✓ Fresh: 9
  ⚠ Stale: 2
  ⚠ Un-versioned: 1
  ✗ Missing: 0

STALE citations:
  - [src/auth/login.ts@a8f9c2d4e5f60718, L42-58]
    Current hash: f3b2c1d4e5a60718
    File modified since citation emitted

UN-VERSIONED citations:
  - [src/legacy/auth.py, L88]
    File exists but no content hash; consider running through aiwg index

Mode flags

Arguments

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.