global-law README

The project's README from github.com/lexifina/global-law. As one markdown file: README.md.

Git for Global Law

The world's law in one git history. Every word traced to the law that wrote it for any country and any date.

An expansion of the same for the US Code, #1 on Hacker News (28/10/26). Semantic, searchable law on a global scale.

https://github.com/user-attachments/assets/f24f3411-24d9-416a-8c45-9cebc817c64e

Free to use: CC0. Fork it, build on it, ship it in a product: no permission or credit needed. The law text sits in each country's repository, under that repository's own terms.

The law of many jurisdictions as one git history. Each jurisdiction's law is its own repository, where every commit is one law taking effect, written by that law. This repository arranges those repositories by jurisdiction and interleaves their histories in the order the changes took force, so a single commit here is the state of all of them on one day.

global-law/
├── manifest.json            every corpus: path, source repo, coverage, which trailer holds the in-force date
├── jurisdiction.json        the world, and its children: 193 UN members, other territories with their own ISO code, and the EU
├── germany/                 Germany (ISO code DE in its jurisdiction.json)
│   ├── SOURCES.md           where German law can be read, with what each source offers
│   └── bund/                federal law
│       └── acts/            submodule: the Grundgesetz since 1949 (grundgesetz/), every other federal act since 2019
├── estonia/                 Estonia
│   └── national/acts/       submodule: Estonia's law history, from its corpus.json
├── france/                  France: jurisdiction.json and SOURCES.md, no history yet
└── …                        every other country, the same way

Each country's law lives in its own repository, lexifina/<country>-law, which says where it belongs here in a corpus.json at its root. A country whose repository still holds only its sources (no law yet) has a folder with its jurisdiction.json and SOURCES.md, and no submodule: only real law is pinned. Laws adopted but not yet in force stay on each corpus's future branch; main here holds only what is in force by the build date.

Corpora differ widely in reach. Some hold a country's whole statute book (Czechia, Spain, Switzerland, Georgia, Malta); others hold a few acts, or a sample: the US corpus is nine titles of the United States Code, and the UK corpus is the special educational needs law. manifest.json gives each corpus's coverage, and history says how its past is known: in-force (dated official versions), replayed (rebuilt by applying each amending act; its verification says which dates were checked) or current-only (today's text only).

Using it from an AI model (MCP)

tools/mcp_server.py is a Model Context Protocol server for this tree. It lets Claude or any other MCP client ask the law what it said on a date, and every answer states where its record starts and ends. It uses only Python 3.10+ and git, runs on your machine over stdio, reads the repository and changes nothing. It makes no network calls.

git clone --recurse-submodules https://github.com/lexifina/global-law && cd global-law
claude mcp add global-law -- python tools/mcp_server.py      # Claude Code; or approve the project's .mcp.json

For other clients (Claude Desktop, Cursor and the like), add this to their MCP settings:

{ "mcpServers": { "global-law": { "command": "python", "args": ["/path/to/global-law/tools/mcp_server.py"] } } }

Then ask in plain words, for example:

It has 18 read-only tools, three prompts and a resource template. The tools cover finding a provision, reading it on a date, who wrote each word, comparing dates, a provision's history, the laws between two dates, searching the text and the change notes, when words entered or left the law, what else a change affects, checking precedent, resolving the citations in a brief, and which text applies to a case. Old paths with ISO country codes (us/federal/usc/..., de) are still read. MCP.md has the full tool list, the protocol versions, the security measures and how it compares with other law MCP servers. The tests are python -m unittest tests.test_mcp.

How it is built

Dates

Git cannot store dates before 1970, so changes to the Grundgesetz that took effect earlier carry 1970 commit dates, one second apart, in the right order. The In-force trailer is authoritative and the tools use it, so law.py show 1956-03-19 … works.

What it does not show

Visualisation suite

How long each country's law waits between adoption and entry into force, one distribution per jurisdiction

See all global law cohort visualisations and bridges here

Reading it

git clone https://github.com/lexifina/global-law && cd global-law
git submodule update --init

python tools/law.py world 2022-05-01                       what every corpus looked like that day
python tools/law.py show 2022-05-01 united-states/federal/usc/title-11/1182.md
python tools/law.py blame 2022-07-01 united-states/federal/usc/title-11/1182.md
python tools/law.py words 2022-07-01 united-states/federal/usc/title-11/1182.md
python tools/law.py diff 2022-05-01 2022-07-01 united-states/federal/usc/title-11/1182.md
python tools/law.py laws 1990-01-01 1990-12-31 germany

Dates must be written YYYY-MM-DD. When a date falls before a record starts or after it ends, the tools say so on stderr, because each country's record covers a different period (see record_to in manifest.json).

Plain git works too, with care:

Tests

python -m unittest discover -s tests -v

The 48 tests check the jurisdiction tree and the timeline, known readings in each country, and that the answers here agree with each corpus read with its own tools. REPRODUCE.md lists them, with the exact build and a hash-for-hash rebuild check.

How it was made

tools/build.py builds this repository from the published corpus repositories, deterministically. REPRODUCE.md records the command, the software, the commits pinned, the decisions made by hand and what an AI model did and did not do.

Videos

https://github.com/user-attachments/assets/6020acb1-53f3-4b65-94a4-fe132b867358

https://github.com/user-attachments/assets/3e3076d7-cfb4-4e0a-8552-2926a630fc8e

License

This repository is CC0. The law text is in each country's repository, under that repository's own terms.

global-law (lexifina/global-law)

Searching Database…

Free to use: CC0. Fork it, build on it, ship it in a product: no permission or credit needed. The law text sits in each country's repository, under that repository's own terms.

Creator
lexifina
Size
507.7 MB
Stars
924
Updated
CommitOct 31
Age
2d
Commits · 90 Days