CiteGuard — Check a Legal Brief for Fake Cases and Invented Quotes
Problem
Lawyers keep getting sanctioned for filing briefs that cite cases which were never decided. An AI assistant makes up a case name, a volume and a page number, the citation looks normal, and nobody notices until a judge tries to read it. Quotes fail the same way: the case is real, but the sentence in quotation marks was never written by that court.
Business Impact
Lawyers and clerks who draft with AI tools, and anyone who reviews filings, need a fast way to catch invented authority before a court does. Checking each citation and quote by hand is simple but tedious, and it gets skipped under deadline. CiteGuard turns that into one paste-and-check step on the user's own machine, with no account or key, so a firm can try it without a procurement process.
System Approach
- A Next.js app with one API route that streams results line by line, so each citation's verdict appears as soon as it is known
- Citations are extracted with a built-in regex over US reporters; an optional FastAPI service using eyecite also picks up Id. and supra back-references
- Each citation is resolved through the CourtListener citation redirect, and the case name in the brief is compared with the case it resolves to
- Opinion text is fetched from the Caselaw Access Project static mirror, and every quotation near a citation is matched against it
- Optional later-history lookup (with a free CourtListener token) lists opinions that cite the case and use the word overruled about it, as a reading list with links
- An optional deep mode sends the opinion to a local Ollama model to check whether it supports the claim
Key Decisions & Trade-offs
- A citation is called fabricated only on a definite 404 from CourtListener; anything else is reported as not checked, to avoid falsely accusing a real case
- Only an exact match earns 'quote is accurate'. Similarity scores are not trusted, because adding a single 'not' to a long sentence reverses the holding while barely changing the score
- Later history is a reading list, not a verdict, because the same search returns nineteen opinions for both Roe (overruled) and Miranda (not overruled)
- Keyless core: the citation and quote checks need no account and no API key, and only the volume, reporter and page of each citation (plus party names of resolved cases) leave the machine
- The Python extractor and the Ollama check are optional add-ons, so npm install and npm run dev are the whole setup
- The reporter list lives at the top of one file, so supporting another reporter takes one line
Current Status
Public and open source under the MIT licence at github.com/rohitguta2432/citeguard, with unit tests (vitest) for citations, quotes and later history, and a Python test for the extractor. Install with npm install and npm run dev (port 4622).
Roadmap
- Find a keyless source for later history, which now needs a free CourtListener token since its search API stopped answering anonymous requests
- Cover opinions newer than the Caselaw Access Project mirror, which ends around 2020
- Support reporters outside the US
What I'd Improve Next
- Quote and opinion-reading checks are unavailable for recent cases, because the opinion text source ends around 2020
- Only US reporters are recognised, and the built-in extractor misses Id. and supra unless the Python service is running
Explore More
- TraceLens — Local-First Flight Recorder For AI Agents — When an AI agent misbehaves or runs up a bill, the usual answer is a cloud dashboard that needs an SDK around every LLM call, an account, and your API keys.
- agentgrade — Production-Readiness Auditor For AI Agents — Most AI agents work in a demo and then fail with real users, because nobody can say whether the agent is getting worse, what it actually did on a bad answer, or who owns it when it breaks.
- Ordermez — Menu Engineering That Shows Which Dishes to Reprice — Most restaurants know their total sales but not which dishes make the money.
- Swarm — An AI-First Community For Agent Builders — A normal developer forum is empty until hundreds of strangers show up every day, which a solo founder cannot fix.
- All 47 projects — the full catalogue, with live links and repos.