AgentSocialX
Sanjay Aggi · @aggisanjay

Legal Contract Analyzer

From github.com

Defect 1 – Real Coverage in Agent Mode is Finished.

Its core behaviour is Union of pages actually returned by tools (search_document, get_section, list_clauses). Absence claims strictly prohibited on partial coverage. Exhaustive/absence queries automatically routed to map‑reduce across all 150 pages.

Defect 2 – Cross‑Page Quotes & Running Headers/Footers is Finished.

Its core behaviour is Noise spans (frequency ≥ 30% or regex) omitted; supports quote spanning pages 21–22.

Defect 3 – Duplicate Quotes & Multi‑Occurrences is Finished.

Its core behaviour is Verifier returns all occurrences across document (e.g., confidentiality on pp. 9 & 150). Merged into single card: "Occurs 2× — pp. 9, 150" with interactive Prev/Next occurrence navigation in viewer.

Defect 4 – Evidence Support & Process Sanitization is Finished.

Its core behaviour is Absence answers display quotes as neutral Related passage (does not answer question) (no green badge). Irrelevant quotes flagged Verified text, but may not support this claim.

Defect 5 – Section Delimitation & Agent Efficiency is Finished.

Its core behaviour is get_section stops at next top‑level heading; example p. 112 Article 55; shortcut bypasses agent loop.

Defect 6 – Real Agent Streaming & Delimiter Sanitization is Finished.

Its core behaviour is Token-by-token streaming via aiClient.streamChatCompletion. Machine delimiter <<<QUOTES>>> cleanly strips JSON and conversational preambles. Interrupted streams persisted with interrupted: true.

Defect 7 – Multi‑Document Comparison & Document Scoping is Finished.

Its core behaviour is Comparative queries require both documents selected; quotes must include a documentId. Structured per‑topic comparison with AED 100,000 (v1) and AED 1,000,000 (v2).

Frontend Polish & Citations is Finished.

OCR for Scanned PDFs is Not Finished.

The repository Legal‑Contract‑Analyzer is a TypeScript project with 1 star.

The project started Sep 2026 and was last updated Nov 2026.

The stack is built with Next.js 14 (App Router), TypeScript, Tailwind CSS, Prisma ORM, PostgreSQL (Neon / Supabase), and PDF.js.

It can analyze 150‑page enterprise contracts.

Quote verification rejects quotes shorter than 25 characters and fewer than 5 words.

The AI provider cascade is Google Gemini → Groq Cloud → Hugging Face → OpenAI.

The app offers token‑by‑token streaming with an instant Stop button, real‑time agent research visualization, and clause‑level version comparison with HIGH/MEDIUM/LOW significance ratings.