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.
Spain is not a country with a Common Law legal system entirely like the US or the UK. They have a civil law system where prior court judgement does not form a strictly binding precedent. Prior judgements can be important, but case law is not really a thing.
Is it not the same in Spain at all?
So while this project does track laws, is there any facility to determine which laws from which bodies are relevant to a specific activity in a specific location?
No, cities don't have their own laws, but the autonomous communities do have some influence in some laws and regulations (not all), like the amount of income tax you have to pay and so on. But cities within the autonomous communities don't have their own laws.
I think local government in Spain has at least as much authority as it does in the UK, maybe more, but almost certainly less than it does in the US.
Regardless, cities do not have their own "local laws" in the way your comment made it seem. We have national laws, and minor differences in various autonomous communities, since they have some legislative power to control their own industry, commerce, education and some more stuff.
I suspect that this should be qualified by "in the US"
I think the corollary that comes to mind is that reforms, with their git commits, are incrementally valuable if they refer to other parts of the legislation, previous commits, etc. to give more context as to the intent at the time of the law. So maybe there's a way to distill the legislative process into more PR and commit-oriented work—likely ex post as you did here, but perhaps in the future as part of an actual workflow.
And then maybe I'd pitch the idea to some technologically-inclined local government.
Also, in my experience (having built in this space before), regulations aren’t really the issue. Court rulings are, because there’s no open data for them in Spain. And the potential users for a paid product (legal professionals) already know the law; the key players (big law firms) have their own databases of annotated and verified court rulings and other documents.
Ed: Nevermind, I missed the "BOE (Spain's official gazette) consolidated legislation API" part. Sending jealous greetings from Germany. We just have a bunch of PDFs in Germany. And the private entity that has been publishing them for decades even claims copyright on them!
As to what can be done with the data, maybe one interesting step could be a graph-database regarding laws which reference other laws or the definitions that they depend on?
Just thinking how this could maybe used for (automated) research / visualization on the evolution of (spanish - in this case) law
Looking at the commit dates (which seem to be derived from the original publication dates) the history seems quite sparse/incomplete(?) I mean, there have only been 26 commits since 2000.
Is the parsing/uploading code shared somewhere else?
Definitely the kind of idea that would have been below my activation energy pre-Claude.
I think this approach should be standard, I have always wondered why the source of truth for these documents is not moved to a repo like git.
There really, really are.
The legal industry is well aware of that fact - and how many billable hours they stand to lose by making their work more efficient and understandable.
You know how tax prep companies spent over $90m 'lobbying' Congress to ensure that filing your taxes remains difficult and complicated [0]?
Well, lawyers know just as well or better how to butter their bread; and they will pull out every dirty trick they have to scupper attempts to make practising law more transparent or efficient in any way.
0 - https://www.opensecrets.org/news/2023/09/tax-prep-companies-...
For a while I thought about trying to write software that would turn the obscure natural-language diffs in written bills into a readable diff, showing the laws before and after with highlighted changes. But she said they just got the bills as paper printouts which weren't always even up-to-date, so it might not have helped much. Maybe now they're online. And LLMs might make the project easier.
Maryland just launched their regs on our platform:
https://regs.maryland.gov (https://github.com/maryland-dsd/law-xml-codified)
Feel free to reach out (email in bio) if you would like your community to publish their official laws on GitHub!
Out of curiosity, like what specifically?
Didn’t DOGE’s failure highlight that it actually wasn’t trivial? I’m skeptical at first glance but open to being proven wrong.
No shade on the author, they made a fun thing. I'm directing my cannons more towards the parent post idea that the world needs software developers for their rare genius to use their beautiful brains to solve problems in ways no actual participant in the system could have ever thought of.
The additude that because you can prompt a LLM to write some python you are also uniquely situated to solve the world's problems is how we built an entire generation of automated solutions worse than what we had before.
But getting the entire country's law into git is already an impressive feat.
Git isn't structured for collaborative commits, but community-wide conventions kind of "patches" support for it on top of the git message body, via "Co-Authored-By: name <name@example.com>" which IIRC most platforms support, and the convention itself initially comes from Linux kernel development.
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".
In Brazil we have lexml, a standard to describe the law and their changes over time. It's surprisingly complex.
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.
It left out the tables (e.g. under 2.1 Materiales.) and the images (e.g see the very bottom).
With this repo, git log --oneline -- spain/BOE-A-1978-31229.md gives you every reform to the Spanish Constitution in one command. git diff between any two reforms shows you exactly what changed in context. git blame tells you which reform touched which article. These are operations that would take a lawyer hours of cross-referencing, and they're free once the data is structured this way.
The other great thing: you can build tooling on top of it and use it with the CLI.
I'm sure I won't be the only one curious, please enlighten me.
[1]: <https://github.com/EnriqueLop/legalize-es/commit/424cbc96507...>
When someone specifically mentions "built in ~4h with Claude Code" they probably didn't care that much about the outcome quality
But I'm sure someone at some point might figure it out, you never know :)
It's interesting to wonder what kind of coverage Cycorp managed to achieve internally, and on what domains. Seemingly no job openings at the moment though!
I'll take a look at data to enrich it :).
State of Utopia[1] has this manifesto[2]. In our estimation (and we use AI a lot), it is not powerful enough to govern a country yet. We thought it was worth trying anyway.[3] We would like it to be able to handle contexts that are millions of times greater (think more like 1 billion tokens than 1 million tokens), and even so AI governance is a very difficult matter. In addition, once AI governance is achieved, how can you truly trust the governance model not to be corrupted? Transparent government run by AI is an additional point of difficulty. These days, the most difficult unsolved problem is how to introduce voting and users' comments without inviting comment spam and vote rigging. You can watch my latest update here[4] (I'm sorry, it's very quiet), and we welcome your input on all subjects. We have a fully autonomous agent currently running the country, which consists of a Mac Mini and a Claude subscription (plus our own dedicated server in a country that recognizes us, and we have a couple of other embassies by agreement and legal contract). But in practice this government just does whatever I tell it. It's not advanced enough to run a code of laws, which is one of the basic requirements citizens expect of their country. The size of problem space for running a country is larger than models can handle, but many things help.
One of the best hopes we have is with deterministic offline models where we share the pipeline with people ahead of time, so they know exactly how it will work. This could be a trustworthy matter of dispute resolution, if we get the architecture right.
For example, our country could help you sign a contract and in case of dispute, both parties could submit supporting documents and make statements and the offline model they agreed to at the time of signing their contract could adjudicate. This pipeline could be transparent from the start. This won't satisfy everyone, but might provide the minimum standard of having a code of laws that assists with contract enforcement. For now, all you can really do is keep checking our site for updates and leave comments about what direction you'd like the country to take. (For example, you can leave a comment on my latest update on Youtube.)
[2] https://claude.ai/public/artifacts/d6b35b81-0eeb-4e41-9628-5...
[3] https://medium.com/@rviragh/ai-is-not-ready-to-create-utopia...
https://www.legislation.gov.uk/ukpga/1990/18/section/9
Laws being passed are these ludicrous sets of patches:
The main difference is that in Britain the judge decisions become almost-laws, so it's like a repo with too many people with commit right. I think in Spain the judge decisions have less weight and only the legislature has commit permissions .
Edit: Consider the following words included in law.
“reasonable” “reckless” “due care”
Certain laws, like parts of tax law may be possible to turn into code, like percentages and deadlines, but even those often carry natural language conditions that can't be evaluated so easily. Seriously, try it.
Looks like it's been abandoned, though. :(
If you go on particular laws, you can see the previous versions and how it changed. Example: https://www.legifrance.gouv.fr/codes/section_lc/LEGITEXT0000...
Click on "version" then "comparer" buttons and you will see a diff.
P.S: Sadly my PR amendment was repealled
$ git commit --amend --author="Author Name <author@spanish.gov>" --no-edit
.. with the details for the author of each commit.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:
I’ve long wanted to see gource applied in other sociologically-relevant contexts and this’d be a real good one ..
But yes, it seems it is included indeed: https://github.com/EnriqueLop/legalize-es/blob/master/spain/... (which seems to have been well written enough to not needing any changes [so far])
Very glad my country is so compassionate with people that we can facilitate things like things when needed.
> Euthanasia (from Greek: εὐθανασία, lit. 'good death': εὖ, eu, 'well, good' + θάνατος, thanatos, 'death') is the practice of intentionally ending life to eliminate pain and suffering.
Like many, you are confusing "making it legal" for "making it ok." But that is of course the root concern of Christianism as an ideological project. Thankfully the correct legal interpretation won out here, as it did in the US Schiavo case(s).
This case got heaps of media popularity because the christian right wing latched on it, and the father tried as hard as he could to impede the euthanasia. Ultimately got told that the lady unequivocally wants it and qualifies, and he can't override that.
Not just once, but five times by different courts, finalized by the European Court of Human Rights!
> Her request had been approved on July 18, 2024, by the Catalonia Guarantee and Evaluation Commission. The commission found that she met all legal requirements, as she had a “nonrecoverable clinical situation,” causing “severe dependence, pain, and chronic, disabling suffering.”
> But in August of that same year, her father – advised by the ultraconservative religious group Christian Lawyers – began a legal fight to stop the process
> From then on, her father initiated a long legal process that delayed Noelia’s euthanasia for 20 months, going through five judicial levels: a Barcelona court, the High Court of Justice of Catalonia, the Supreme Court, the Constitutional Court, and the European Court of Human Rights.
https://catala-lang.org/
*Edit*: Woah ! The French crew is here. We are at least 5 quoting a variation of <https://www.legifrance.gouv.fr/> for versioning.