Every EU Country's Laws, Queryable with Citations — Runs Entirely Local

Every EU Country's Laws, Queryable with Citations — Runs Entirely Local

May 8, 2026 7 min read #rag#claude-code#legal-tech#obsidian#chromadb#open-data#local-llm

Legal research across EU jurisdictions is messy in a very specific way. Each country runs its own official database — BOE for Spain, Legifrance for France, Bundesgesetzblatt for Germany — each with its own search logic, its own citation format, its own official language and no way to query across all of them at once. If you need to compare how three countries handle early rental contract termination, you’re opening three tabs, doing three separate searches, and manually stitching together what you find provided you understand all three languages.

The frustrating part is not finding text. That part is usually fine. The hard part is tracing an answer back to something citable: the exact statute, the exact article, a reference someone else can verify. Commercial databases handle this but they’re expensive and subscription-locked. Government portals are free but isolated. Open-data repositories for EU legislation do exist — many governments publish machine-readable law — but nothing has tied them into a unified query layer with citations built in. Until now, you were either paying for access or doing it by hand.

your-ai-lawyer is that missing layer. It takes official government legislation repositories, compiles them into a local Obsidian knowledge graph, and makes the whole thing queryable. Every answer comes with an inline citation — [BOE-A-XXXX-XXXXX, Art. N] — that traces directly back to the source article. It runs entirely on your laptop. No API key, no cloud service, no separate subscription beyond Claude Code itself.

Architecture

The system has three layers: git submodules as the law data source, Claude Code as the compilation and query engine, and ChromaDB + Obsidian as the retrieval and navigation frontend.

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 comes via git submodules pointing to official open-data repositories. Spain is wired up out of the box through the legalize-es submodule — 12,000+ laws from the BOE (Boletín Oficial del Estado), the official state gazette. Every other EU country is one git submodule add away from working the same way.

Claude Code drives the pipeline through three slash commands:

  • /compile es-ct --limit 10 — reads raw laws from the submodule, generates structured Markdown summaries with [[wikilinks]] to related statutes and legal concepts, writes them into knowledge/
  • /index — builds two ChromaDB collections: one over compiled summaries, one over raw article chunks, using ChromaDB’s built-in local embeddings
  • /qa "Can a landlord terminate a rental contract early?" — retrieves relevant chunks, generates a prose answer, inlines [BOE-A-XXXX-XXXXX, Art. N] citations pointing directly to source articles

Compilation is incremental — each law file is MD5-hashed on first run, so subsequent compiles skip unchanged files. A /lint command flags orphaned notes, broken wikilinks, and untracked files in the graph.

Getting Started

Four steps to query Spanish laws on your laptop:

git clone --recurse-submodules https://github.com/arnabdeypolimi/your-ai-lawyer
cd your-ai-lawyer && uv sync
claude .

Inside Claude Code, pick an output language first (English, Spanish, Catalan, French, Italian, German, or Portuguese):

/setup en

Then run the pipeline:

/compile es-ct --limit 10
/index
/qa "What are the requirements for a valid contract in Spain?"

es-ct (Cataluña, ~50 laws) is the recommended smoke test — small enough to run quickly, enough to validate the full pipeline. Once that works, scale up to all of Spain with /compile es (12,000+ laws, best run in batches). The --limit 10 flag caps any compile run to 10 files.

Why It’s Built This Way

The citation format is load-bearing, not cosmetic. Every /qa answer includes [BOE-A-XXXX-XXXXX, Art. N] references generated from raw article metadata — not reconstructed by the model from memory. You can trace any answer directly to the source statute and article in the official gazette.

The compiled Obsidian vault is also genuinely navigable on its own. Summaries link to related statutes and concepts via [[wikilinks]], and the graph view shows how laws connect — useful when you’re trying to understand how a specific regulation sits within a broader framework, not just retrieve a one-off answer.

No separate API key required. ChromaDB handles embeddings locally — no external embedding service. Claude Code is the interface, running through your existing subscription. No additional credentials needed beyond Claude Code itself.

28 additional jurisdictions are one submodule away. The system is jurisdiction-agnostic. The legalize-dev organisation maintains open-data law repositories for Austria, Belgium, France, Germany, Italy, Portugal, and 22 others — including EU member states, Norway, UK, Ukraine, and non-European countries (US, Argentina, Chile, South Korea, Uruguay). Adding any of them is a single git submodule add. The same compile → index → query pipeline works for any jurisdiction.

Frequently Asked Questions

Does this require a separate API key? No. /compile and /qa run inside Claude Code — no additional Anthropic API key. ChromaDB handles embeddings locally, so no third-party embedding service either. The only external dependency is Claude Code itself.

Which countries are currently supported? Spain is fully wired (12,000+ BOE laws, all 17 autonomous communities). The legalize-dev organisation maintains 28 additional repositories: EU member states (Austria, Belgium, France, Germany, Italy, Portugal, and others), plus Norway, UK, Ukraine, and non-European countries including the US, Portugal (109,000+ norms), Argentina, Chile, South Korea, and Uruguay. Adding any of them is one git submodule add.

What model does it use? Whatever Claude model you have configured in Claude Code. No separate API key — it runs inside your existing session.

How is this different from just asking Claude about a law? LLMs hallucinate citations and may be working from outdated training data. This tool retrieves text from official, versioned government repositories and grounds every answer in that specific source text — with the exact statute and article number cited. The model is doing reasoning and synthesis, not recall.

Can the knowledge graph be used without the /qa command? Yes. The compiled Obsidian vault is a standalone knowledge base — browseable, searchable, and navigable on its own.

This project extends the pattern from Building a Second Brain as a Researcher — with Claude Code and Obsidian. That post covers how it works for research papers; this one applies it to legal corpora.

Frequently Asked Questions

Does this require a separate API key? No. /compile and /qa run inside Claude Code using your existing Claude subscription — no additional Anthropic API key required. ChromaDB handles embeddings locally, so no third-party embedding service is needed either. The only external dependency is Claude Code itself.

Which countries are currently supported? Spain is fully wired (12,000+ BOE laws, including all 17 autonomous communities). The legalize-dev organisation maintains 28 additional repositories covering EU member states (Austria, Belgium, France, Germany, Italy, Portugal, and others), plus Norway, UK, Ukraine, and non-European countries including the US (60,000+ sections), Portugal (109,000+ norms), Argentina, Chile, South Korea, and Uruguay. Adding any of them requires one git submodule add.

What model does it use for answering questions? It runs through Claude Code, which uses whatever Claude model you have configured. No separate API key is needed — it runs inside your existing Claude Code session.

How is this different from asking an LLM about a law directly? LLMs hallucinate citations and may have outdated training data. this tool retrieves text from official, versioned government repositories and generates answers grounded in that specific source text — every answer cites the exact statute and article number.

Can the knowledge graph be used without querying it? Yes. The compiled Obsidian vault is a standalone knowledge base you can browse, search, and navigate in Obsidian — independently of the /qa command.


This project builds on the same Claude Code slash-command + knowledge-graph pattern described in Building a Second Brain as a Researcher — with Claude Code and Obsidian. That post covers how the pattern works for research papers; this one applies it to legal corpora.

Contributing

The project is open source under MIT. The most direct contribution is a jurisdiction submodule: add your country’s official legislation repository, and it becomes queryable for everyone using the tool.

Current coverage: Spain (12,000+ laws, all 17 regions). Available: 28 additional jurisdictions via legalize-dev — EU member states, UK, Norway, Ukraine, and others including US, Argentina, Chile, South Korea, and Uruguay.

GitHub: arnabdeypolimi/your-ai-lawyer →