your-ai-lawyer
Every EU country's laws, queryable with citations — compiles 12,000+ official statutes into a local Obsidian knowledge graph with inline source references. Runs entirely on your laptop.
your-ai-lawyer
A local-first RAG system that turns official government legislation repositories into a queryable Obsidian knowledge graph. Every answer comes with inline citations in the form [BOE-A-XXXX-XXXXX, Art. N] — traceable directly to the source statute. No API key, no cloud dependency, no subscription.
The Problem
Each EU country operates its own official legal database — BOE for Spain, Legifrance for France, Bundesgesetzblatt for Germany — with no unified query layer. Cross-jurisdictional research means juggling multiple portals and manually reconciling results. Commercial databases are expensive and subscription-locked. Government portals are free but isolated.
Architecture
git submodule (official law repos)
↓
/compile <jurisdiction>
↓
knowledge/ (Obsidian vault — wikilinked summaries)
↓
/index → ChromaDB (summaries + raw article chunks)
↓
/qa → prose answer + [BOE-A-XXXX-XXXXX, Art. N] citation
Law data arrives via git submodules pointing to official open-data repositories. Spain is wired up out of the box via the legalize-es submodule — 12,000+ laws from the BOE. Every other EU country is one git submodule add away.
Claude Code drives the pipeline through three slash commands:
/compile es-ct --limit 10— reads raw laws, generates structured Markdown summaries with[[wikilinks]]to related statutes, writes intoknowledge//index— builds two ChromaDB collections over compiled summaries and raw article chunks using ChromaDB’s built-in local embeddings/qa "..."— retrieves relevant chunks, generates a prose answer with[BOE-A-XXXX-XXXXX, Art. N]inline citations
Key Features
- Structural citations — every answer cites the exact statute and article, not post-hoc attribution
- Navigable knowledge graph — compiled summaries are valid Obsidian notes with functional
[[wikilinks]]between related statutes - Fully local — ChromaDB handles embeddings locally, no external embedding API needed
- Incremental compilation — MD5 hashing skips unchanged files on subsequent runs
- Multi-language output — English, Spanish, Catalan, French, Italian, German, Portuguese
- 28 additional jurisdictions — EU member states, UK, Norway, US, and others, one
git submodule addeach
Quick Start
git clone --recurse-submodules https://github.com/arnabdeypolimi/your-ai-lawyer
cd your-ai-lawyer && uv sync
claude .
Inside Claude Code:
/setup en
/compile es-ct --limit 10
/index
/qa "What are the requirements for a valid contract in Spain?"
Technical Stack
- Python with
uvfor dependency management - ChromaDB for local vector storage, retrieval, and embeddings
- Claude Code slash commands as the compilation and query interface
- Obsidian for knowledge graph navigation
Links
- GitHub: arnabdeypolimi/your-ai-lawyer
- Blog post: Every EU Country’s Laws, Queryable with Citations