Inspiration
Legal research is notoriously tedious, excessively costly, and of great importance. Although Large Language Models (LLMs) have appeared as useful writing assistants, their typical use in the field of law is suffering from a fatal flaw: hallucinations and the invention of citations. In the legal profession, citing a case that does not exist or misstating a ruling can lead to court penalties, professional censure, or having a case dismissed.
Justice is still very unevenly accessible to the general public. Students, civic campaigners, individuals representing themselves in court, and small public-interest legal clinics frequently cannot afford enterprise databases such as Westlaw or LexisNexis which cost $10,000 per year.
I have developed CaseFile AI with the aim of overcoming this gap: it is an independent legal intelligence studio that uses citation-verified information drawn from live, authoritative federal and state court records provided by CourtListener (Free Law Project) and combines this with fast LLM reasoning through Nebius Token Factory and TypeSafe AI. It doesn't merely chat; instead, it carries out a structured ReAct research loop, identifies and maps out the opposing side's arguments, confirms the actual cluster IDs, and produces IRAC memos suitable for use in court, ensuring that there are no hallucinated citations.
What it does
CaseFile AI is an autonomous legal intelligence console featuring a dynamic split-screen research desk:
- Autonomous ReAct Agent Loop: When presented with a natural language legal question or a factual dispute, CaseFile AI analyzes the query by identifying the key legal issues, applying the relevant jurisdictional filters, and considering the opposing claims.
- Search of Federal and State Courts in Real Time: The system directly uses the CourtListener v4 REST APIs to query published opinions, court dockets, and judge decisions.
- Intent Classification and Candidate Triage under 100 milliseconds: This is achieved by using TypeSafe AI routing to identify the legal domains and rank the candidate cases prior to carrying out deep synthesis. – Adversarial Matrix Analysis: In order to carry out legal advocacy it is necessary to know what the other party will contend. CaseFile AI is able to automatically divide prior cases into those that are supportive and those that are opposing or distinguishable, then draws up counter-arguments based on this.
- Zero-Hallucination Citation Verification: Before any precedent is included, it is strictly checked against official CourtListener cluster IDs and docket numbers.
- Court-Ready IRAC Synthesis: Produces legal memos that follow the standard legal method (Issue, Rule, Analysis/Application, Conclusion) with the option to export them in one click (in Markdown, PDF, or JSON format).
- Inspectable ReAct Thought Stream: Users are able to watch the agent think in real time through the use of Server-Sent Events (SSE), gaining complete transparency over each search query, opinion extraction, and triage step.
How we built it
- Frontend: Built using React 19, TypeScript, and Vite 7. The design features a concentrated dark research-console style (
#0E1116), with micro-interactions implemented using Motion and GSAP, and icons taken from Phosphor Icons. - Backend: The system was built using Node.js and Express 5, handling the multi-step ReAct agent loop, the SSE streaming pipelines, and the legal opinion extractors.
- AI & Inference:
- The Nebius Token Factory uses open-weight models to enable deep generative synthesis and IRAC legal drafting.
- TypeSafe AI (
jev-latest): It offers intent routing that takes less than 100 milliseconds and quick triage of adversarial candidates.
- Reliable data sourcing: the CourtListener REST API v4 (Free Law Project) for current legal opinions and official court metadata.
- Security & Reliability: The system includes SSRF protections featuring IP pinning and binary sniffing when retrieving remote opinion files, together with token-bucket rate limiting.
Challenges we ran into
- Eliminating Legal Hallucinations: Ordinary prompts used with LLMs tend to make up docket numbers and volume reporters. We have introduced a deterministic verification step which verifies the citations against CourtListener cluster IDs and rejects any unwarranted assertions.
- Cleaning Up Dirty Legal Text: Since real-world court opinions include broken HTML tags, obsolete OCR artifacts, and inconsistent formatting, we have developed a multi-stage text sanitizer and binary sniffer which is able to extract clean legal holdings without exceeding the context limits.
- Achieving smooth SSE streaming in React 19: It was necessary to use robust state management when coordinating the various steps of an agent's actions (Search → Extract → Triage → Synthesize) if live reasoning tokens were to be streamed smoothly to the UI without causing any UI stutters.
- SSRF Guardrails: There is a risk of SSRF if an automated backend system is allowed to retrieve remote legal documents; therefore, we implemented strict checks on the host and imposed restrictions on IP ranges.
Accomplishments that we're proud of
- 100% Grounded Citations: Each and every case card shown in the workspace has been verified and provides a direct link to the actual court opinion on CourtListener.
- Adversarial Matrix: Going beyond basic search by actively bringing forward opposing precedents and counter-arguments—something that is a vital resource for lawyers and debaters.
- High-Performance Console UI: Designed a dark, high-density interface in the style of Bloomberg so that it comes across as a professional analytical tool rather than a simple chatbot.
- Instant Response Times: By combining the use of TypeSafe AI with the Nebius Token Factory, intent routing capable of taking place in less than a second and the quick generation of legal memos can be achieved.
What we learned
The syntax and structure of Bluebook legal citations as they vary among the different federal circuits and state jurisdictions.
- Building ReAct agents using deterministic validation pipelines rather than depending entirely on prompt engineering.
- The best practices for streaming complex structured artifacts together with real-time reasoning tokens using Server-Sent Events (SSE).
What's next for CaseFile AI
- Shepardizing and Treatment Badges: This feature automatically indicates whether a precedent has been overruled, questioned, or distinguished by later appellate decisions.
- Circuit Split Visualizer: A tool for showing the way various U.S. Circuit Courts of Appeals differ on important constitutional and statutory issues.
- Brief Analyzer: This feature enables users to upload an opposing party's PDF brief so that weak citations are automatically highlighted and counter-cases are extracted.
- Team Workspaces and integration with Clio: The inclusion of collaborative case folders, annotations, and the ability to export directly to legal practice management systems.
Built With
- ai-agents
- courtlistener-api
- deepseek
- express.js
- gsap
- irac
- legaltech
- motion
- nebius-token-factory
- node.js
- react
- server-sent-events
- typesafe-ai
- typescript
- vite

Log in or sign up for Devpost to join the conversation.