Purpose
RAG Citation Coverage Auditor is used to measure whether a generated answer completely cites approved retrieval sources. It audits locally exported claim answers, citation IDs, and approved retrieval sources, and checks citation coverage. The tool makes it clear that a cited ID only proves that some ID was written, and does not prove that the source supports the claim. Therefore it requires an explicit source-to-claim support relationship, and reports unknown permissions or freshness rather than silently treating them as approved.
Main capabilities
- Reads local JSON export files containing claims, citation IDs, and approved sources.
- Checks whether each cited source explicitly lists the corresponding claim ID in order to cover that claim.
- Reports three independent numerator/denominator pairs (the specific metrics are not expanded in the materials).
- Distinguishes known mismatches, unknown evaluations, and incomplete runs.
- Supports specifying the audit date via --as-of YYYY-MM-DD; the tool never reads the calendar.
- Supports --max-age-days to check source freshness.
- Outputs a one-line JSON report to standard output; without --json, outputs a brief summary to standard error.
- Exit codes: exit 0 for passing exports, exit 1 for fabricated citations.
- Read-only: does not write files, does not fetch sources, does not resolve hosts, and does not contact providers or accounts.
- Zero runtime and development dependencies, requires Node.js 22+.
Usage
The tool runs via the command line and accepts one named JSON input file. The export contract requires: IDs are unique ASCII strings that start with a letter and are followed by up to 63 letters, digits, underscores, or hyphens. Each supportsClaims ID names the claim of a claim. Lists are exported evidence, not judgments made by the tool.
- approved: false, an explicit permissions list missing the requested scope, or a source older than --max-age-days are all known mismatches and cause failure.
- If approved, permissions, observedAt, or supportsClaims are missing, the corresponding evaluation is unknown and the run is incomplete.
- An invalid or future observedAt is treated as unknown freshness, not fresh.
- The operator must provide --as-of YYYY-MM-DD.
- inventoryComplete: true allowsMissing referenced IDs are called forgery relative to this export and fail. An empty but declared complete source list is valid missing evidence; an empty declared list is not an audit.
- If completeness is false or omitted, missing IDs remain unresolved evidence and the run is incomplete.
- An explicit empty supportsClaims list in the source manifest indicates the claim is known not to be supported.
- At least one referenced, approved, licensed, fresh source must explicitly list the claim ID to cover it. An empty reference list does not cover it.
- Duplicate reference occurrences count as separate references and do not create claim support through duplication.
The report has three independent numerator/denominator pairs. For invalid/unreadable exports all denominators are null rather than pretending claims are zero. Claim/source text is never echoed; the report uses verified IDs only indirectly through locations and controlled messages. Findings are sorted by (location.file, location.pointer, ruleId) in UTF-16 code unit order. Severity and incompleteness come from a frozen rule table; unknown rule IDs cannot be emitted. Incomplete findings take precedence over any known failures in the aggregate status.
Applicable Scenarios
Suitable for teams planning AI documentation or knowledge workflows that need citation and source control. It can be used to audit whether answers generated by RAG systems cite approved sources and to check the completeness of citation coverage. The tool runs locally and does not require an Edilec account or service.
Limitations
- It does not perform Markdown citation extraction, model-judged entailment, source retrieval, license lookup, browser/database connections, automatic fixes, or account changes.
- Support relationships are claims from the export, not independently verified facts; sources and relationship provenance should be checked separately.
- Do not put real personal data or credentials in test fixtures or reports.
- Time checking is cooperative: a filesystem operation or JSON parsing may complete after the deadline before the next check. Actual elapsed time varies with load; completed report bytes are identical for the same input and options.
- Input boundaries are silent at N and return incomplete at N+1. Library callers use camelCase limit keys and can inject now for an exact deadline; the clock is never printed. Unknown limit names are invalid configuration.
- Ambiguous JSON objects with duplicate keys are incomplete, including escaped spellings of the same key; earlier declarations cannot be overridden.
- MIT licensed; see LICENSE.
Other Information
Edilec maintains this open source tool. The tool runs locally and does not require an Edilec account or service.