I built a pipeline that converts all Spanish state legislation into version-controlled Markdown. Each law is a file, each reform is a real git commit with the historical date. 8,642 laws, 27,866 commits.
The idea: legislation is just patches on patches on patches. Git already solves this. Instead of reading "strike paragraph 3 and replace with...", you get an actual diff.
The repo is the product. Browse any law, git log to see its full reform history, git diff to see exactly what changed.
Built the pipeline in ~4 hours with Claude Code. Source is BOE (Spain's official gazette) consolidated legislation API.
Exploring whether there's a business here — structured legislation API for legaltech/compliance, or just a useful open dataset. Curious what HN would build with this data.
This is brilliant. I wish this were available for all legislations. There's so many inefficiencies that are trivially solved with existing tech frameworks.
For others wondering, while most of the Franco-era laws were nuked in 1978, this does include lots of old laws (ie pre-20th C).
However, the source material starts with a sqashed commit in 1960 :) So no changelog before that. The BOE source though is pretty phenomonal, they've scanned files going back to the 1600s so far.
This is great. Compare it to British legislation which is frankly a mess of patches. Example picked fairly much at random, this law was originally passed in 1990 and has been "patched" regularly:
This is amazing. I have a couple of suggestions:
- Maybe breaking the "Spain" folder into subfolders? Not sure what categories could be used, but browsing would be easier.
- There's a missed opportunity in having different authors for the commits (maybe the "legislatura" number), and possibly, tags/labels including the political parties that voted in favor of each.
Nobody seems to have (yet) mentioned the most recent (rn) commit [1] dated 2099.
I can't really figure out where the date came from, at the source noted in the commit I find no '2099', I can't see it being a joke, if it's a bug it's not obvious to me..
I'm sure I won't be the only one curious, please enlighten me.
I'm surprised the world is not running a system where laws are formally encoded using some DSL that would allow making decision (guilty/not guilty) using formal logic. Perhaps there is not much interest from law making/enforcing parties for this either.
I've seen something like this before, here's the Argentina constitution as a git repo, with reforms as commits. Much shorter in scope, but this was pre LLM coding
I think this is great. Only limit of git is I can't imagine "git blame" works. It would be nice to know who voted for and against each patch. Git isn't structured for collaborative commits.
Neat. I wonder if there are commercial products that are formal specifications of laws, decisions, etc. Such that you can reason on them via solvers etc.
Not only would be cool for laws to have appropiate time stamps so we can "go back in time to how it was at a certain moment", but also if we could have proper git commit diffs of how laws change over time. See this: https://www.boe.es/buscar/act.php?id=BOE-A-2015-11430
You can see how certain articles have the option to check "how that particular article was at each moment in time". That would be way harder to track, but it would be awesome if not only could you "go back in time and see what the law was" but also "how its been evolving".
This is a key project, and I’m sure many countries have enough developers who might try and get it done, but a project that can do it for most legal systems (assuming the sources are on-line) would help a lot more people access legal resources.
65 comments
[ 5.3 ms ] story [ 69.7 ms ] threadThe idea: legislation is just patches on patches on patches. Git already solves this. Instead of reading "strike paragraph 3 and replace with...", you get an actual diff.
The repo is the product. Browse any law, git log to see its full reform history, git diff to see exactly what changed.
Built the pipeline in ~4 hours with Claude Code. Source is BOE (Spain's official gazette) consolidated legislation API.
Exploring whether there's a business here — structured legislation API for legaltech/compliance, or just a useful open dataset. Curious what HN would build with this data.
For others wondering, while most of the Franco-era laws were nuked in 1978, this does include lots of old laws (ie pre-20th C).
However, the source material starts with a sqashed commit in 1960 :) So no changelog before that. The BOE source though is pretty phenomonal, they've scanned files going back to the 1600s so far.
https://www.legislation.gov.uk/ukpga/1990/18/section/9
Laws being passed are these ludicrous sets of patches:
https://www.legislation.gov.uk/ukpga/2015/9/part/1
Then, it would be simply amazing to run gource, sit back, and watch where all the noise is coming from.
Gource:
https://github.com/acaudwell/gource
What gource looks like:
https://gource.io/
I’ve long wanted to see gource applied in other sociologically-relevant contexts and this’d be a real good one ..
I'll take a look at data to enrich it :).
I'm sure I won't be the only one curious, please enlighten me.
[1]: <https://github.com/EnriqueLop/legalize-es/commit/424cbc96507...>
P.S: Sadly my PR amendment was repealled
In Brazil we have lexml, a standard to describe the law and their changes over time. It's surprisingly complex.
You can see how certain articles have the option to check "how that particular article was at each moment in time". That would be way harder to track, but it would be awesome if not only could you "go back in time and see what the law was" but also "how its been evolving".