Legal AI — Personal Legal Research
Disclaimer: exclusively for my own private research, not a service for others, not legal advice.
Use case
Research into my own private matters is supported by locally hosted LLMs: full-text search over filings, summarization, cross-references between documents, schedule overviews. Inference runs on my own 24 GB GPU with a quantized open-weight model, data sits in a self-hosted PostgreSQL instance on the home server. Cloud LLMs are off the table for sensitive filings.
Versions
- Legal AI v1 — first generation, running in daily use. It works, but monolithic — adding a new legal system requires code changes.
- Legal AI v2 — optimized, universally extensible re-implementation. Vision: "Every country. Every law. Every language." New legal systems are added via DB entries and a matching scraper, no code edits required. Status: work in progress, not in production yet.
What's done (v1, running)
- Local inference with a quantized 27B open-weight model on a 24 GB GPU
- Custom PostgreSQL instance for structured filing indexing
- Agent loop with ~22 tools (full-text search, summarization, date extraction, cross-referencing)
- Custom provider layer (
llm.js) instead of a cloud LLM SDK - Tool-call optimization across several iterations
What's done (v2, in progress)
- 9-service architecture designed (postgres + 4 MCPs + 3 scrapers + portal)
- Portal with web UI, REST proxy, and agent loop over Server-Sent Events
- mcp-laws prototyped with 7 MCP tools for law tree and paragraph search
- Extensibility pattern defined (new legal system = DB entry + scraper)
In progress
Finishing v2: RAG over the filings database instead of full-text stuffing, better tool selection in the agent loop, robustness for OCR errors, audit log per inference request, integration of more legal sources through the scraper pattern. Until v2 is production-ready, v1 stays the daily workhorse.