amal66 makes chat quotes earn their citations

This fork stops a polished AI answer from passing off invented document language as a real quote.

securitychat-ui

Before a chat response presents a quotation from an uploaded document, amal66's version checks it against the document itself. It does this with direct text matching, not another AI judgment, so it adds neither another model's guess nor another model call.

  • Verified: the quoted words appear exactly in the source.
  • Repaired: minor differences in case, spacing, or punctuation are corrected to the source's actual wording.
  • Unverified: a quote that cannot be found stays visible, but is clearly not trusted.

The check also handles quotations spanning pages and avoids treating an unreadable document as evidence. A narrow punctuation edge case is documented for follow-up, rather than hidden.

So what Legal teams using AI to interrogate matter documents should care because this makes source-backed answers more auditable before anyone relies on them.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

3 commits from amal66/mike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
a05e2956 feat: server-side citation verification against source text Amalanand Muthukumaran 2026-07-25 ↗ GitHub
commit body
Port of the fork's document-quote verification (apps/api/src/lib/tools/
verifyCitations.ts and its wiring) to upstream layout. After the model's
<CITATIONS> block is parsed, each document quote is located in the
document's extracted source text (exact, then whitespace/case-tolerant,
then punctuation-tolerant matching). Quotes get a per-quote verification
record and each citation an aggregate verification_status:
verified | repaired (exact source excerpt swapped in) | unverified.
Case-law citations pass through untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CEguyEgXa9JjCciXCcVemC
2fc7a6da feat: surface unverified citation quotes willchen96 2026-08-04 ↗ GitHub
94bb82cd chore: ignore local Supabase scaffold willchen96 2026-08-04 ↗ GitHub

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-1310.md from inside the repo you want the changes in.

⬇ Download capture-thread-1310.md