Git for the US Code

(lexifina.com)

153 points | by alansaber 3 hours ago

32 comments

  • kfogel 1 hour ago
    NYT, 2007:

    "... Think of what version control software could mean for the Congress [...]. If bills were created under a system where strike-throughs and additions were carefully tracked, the public would know which legislator made which change to a proposed piece of legislation as it made its way through the Capitol.

    At last, there would be transparency in the legislative process. Best-case scenario, it would shame legislators from inserting language against the public interest and only meant to reward political contributors; at worst, it would make such insertions public and allow the voters to punish the politicians who made them. ..."

    (from https://www.nytimes.com/2007/07/23/business/media/23link.htm... )

    • JumpCrisscross 3 minutes ago
      > it would shame legislators from inserting language against the public interest and only meant to reward political contributors

      You’d just got a system of favors for who inserts what language. You’d hand tough edits to your safe-seat colleagues and insert messaging amendments designed to get voted down for own comms.

      When a measure becomes a target yada yada.

      (Note: this proposal is for the U.S. code. Not bills. Git for the USC works.)

    • jonahhorowitz 28 minutes ago
      I've always wanted this. It's such an obvious idea when you're a software engineer.
      • sixdimensional 5 minutes ago
        Same. What I would like to see is Git for non-technical users, built as a public platform that is open source, hosting this.

        I do think there are some Markdown-based open source projects that might fit the bill.

      • lily121 5 minutes ago
        [dead]
    • kelseyfrog 1 minute ago
      Such a requirement would not do what you think it would. There would not be names legislator or even aids as commit authors. The commit authors would be members of the House Office of the Legislative Counsel[1].

      The House Office of the Legislative Counsel is a non-partisan, impartial, and confidential. Whether transparency has merit or not, tracking provenance would make the office partisan. Is more partisanship in government not a concern?

      The second issue with transparency is that communication between legislators and legislative counsel member is subject to the attorney-client relationship.

      A more convincing argument for transparency would address impartiality and confidentiality. This is pretty clearly a Chesterton's fence type situation where advocating to change a system should anticipate criticisms. Addressing opposition preemptively is an implicit demonstration of knowing why the system exists which is table stakes for changing it.

      1. https://legcounsel.house.gov/

  • Ericson2314 2 hours ago
    The Hacker News Community (hah) needs to lobby hard to pass a law (what boostrapping!) to require the https://en.wikipedia.org/wiki/Office_of_the_Law_Revision_Cou... to maintain the repo as part of their duties, and do it retroactively for the entire history of the US Code.

    It's a simple idea; it's cheap; there are no outstanding technical questions; it benefits almost everyone. Let's get this done.

    • danielmarkbruce 2 hours ago
      why not just do it?
      • Ericson2314 1 hour ago
        Because I have want my government to use the right tool for the job.

        I don't want to privatize this core civic function to some NGO.

    • JumpCrisscross 2 hours ago
      > it benefits almost everyone

      I want to see a practical benefit to maintaining this with public funds versus the usual redlines.

      • AdieuToLogic 44 minutes ago
        >> The Hacker News Community (hah) needs to lobby hard to pass a law (what boostrapping!) to require the https://en.wikipedia.org/wiki/Office_of_the_Law_Revision_Cou... to maintain the repo as part of their duties, and do it retroactively for the entire history of the US Code.

        > I want to see a practical benefit to maintaining this with public funds versus the usual redlines.

        The US government works for the people and, as such, changes made to the US Code over time must be traceable, discoverable, and therefore justifiable by or condemnable to those who are responsible for said changes without fear or favor.

        That is as practical as it gets.

        • JumpCrisscross 2 minutes ago
          > changes made to the US Code over time must be traceable, discoverable

          They are. The history of the USC is public. This is one way of visualizing it. It’s good. But I want to see the advantage of this presentation.

  • pcblues 2 hours ago
    I hadn't thought of using git to track the changes in legislation. This is a cool idea.

    In Australia, I spent a bit of time trying to work out how to find which politician voted for what (both at state and federal level), so that when elections come, you can single out the individuals who voted for what legislation. I think AI may make this easier, but the challenge is in not spamming the "free and open" access to the online record of our legislation.

    So far, it's probably a one-person $50K per year job to do this task manually, and the language of the public legislation record didn't lend itself easily to determining the laws or rights that actually changed when bills were passed into legislation. They are explicitly stated, but hard to distill with regexes, filters or other analysis tools (e.g. "Who voted to stop electric scooters going over 25km/h?") If you try reading the legislation, you will know what I mean.

    "A complete and open record of the proceedings of our parliament" still needs people spend a good chunk of time interpreting and summarising it (e.g. the media, commentators, etc) which means it's a time-consuming hobby or a paid gig.

    • kneyed 53 minutes ago
      https://theyvoteforyou.org.au/

      > How does your MP vote on the issues that matter to you?

      previously covered on hn:

      https://news.ycombinator.com/item?id=8485809

    • chrysoprace 51 minutes ago
      https://theyvoteforyou.org.au/ is a good resource at a federal level, but I don't know of a state or local equivalent.
    • awesome_dude 1 hour ago
      > In Australia, I spent a bit of time trying to work out how to find which politician voted for what (both at state and federal level), so that when elections come, you can single out the individuals who voted for what legislation.

      That's an interesting project - I am guessing it's only targeting federal level, but could also include state level

      The first problem I have in my mind is proxy votes, and votes that are made mandatory by the party they belong to - eg. a backbencher would struggle to go against the wishes of their party unless they felt it was worth risking their career over

      > "A complete and open record of the proceedings of our parliament" still needs people spend a good chunk of time interpreting and summarising it (e.g. the media, commentators, etc) which means it's a time-consuming hobby or a paid gig.

      https://www.aph.gov.au/parliamentary_business/hansard and (linked from that page) https://www.aph.gov.au/Parliamentary_Business/Chamber_docume... would likely be good places to start

  • demibabs 40 minutes ago
    When I read AI-generated text, my eyes just start glazing over… it really is hard to read.

    The idea is cool though.

    • silisili 37 minutes ago
      Same. I don't know if it's the word choices or just me recognizing it as AI and subconsciously feeling cheated.

      As an aside, my city FB group(small town, basically the local forum and news) has been absolutely flooded with AI 'flyers', and I have the same reaction. I can't put my finger on the exact reason, maybe the busy-ness, but they're repelling to my eyes.

      Luckily after about 6 months of this now they're starting to get heavy pushback.

    • mrinf1nity 29 minutes ago
      My brain instantly turns off from reading it too, you're not the only one.
  • TomAbel 2 hours ago
    Reminds me of a similar project for french law

    French bills evolution versioned in git and visualized The Law Factory: french bills as git, opendata and dataviz https://www.lafabriquedelaloi.fr/

    "Law is Code" on The Law Factory: french bills as git, opendata and dataviz - https://news.ycombinator.com/item?id=7817357 May 2014 (0 comments)

  • aizk 1 hour ago
    If you're like me and also eager for cool uses for git, I'll share a cool one I use -- try out git for your resume! Commits change as you progress in life, and make branches for individually tailored resumes.

    Blew my mind when I realized I could do that.

  • burnJS 2 hours ago
    I had this idea over 10 years ago but never finished it. I hope this takes off. I do fear it's not very practical for many big pieces of legislation which are often written in secret.
    • Ericson2314 2 hours ago
      Don't worry about that. Even if we only saw voted-upon revisions in the Git history, it will still be a huge improvement.

      Version control for the public parts will make both public and secretive law-drafting better.

    • SoftTalker 2 hours ago
      Why should any bit of the lawmaking process be secret?
      • dizzant 56 minutes ago
        Transparency has a cost. There are several good reasons, but my favorite is intellectual freedom. Policy makers would be much less likely to explore bold reforms or risky bipartisan compromises if their draft quality notes and correspondences were publicly tied to their political reputation. It takes significant work to produce successful legislation, and much of that work can be productively and safely done without direct public oversight. This is the same reason an individual might value a private journal.

        If you have a problem with your representative’s behavior, call their office and ask about it. They will certainly have a reason. Tell them if you disagree, and vote when you can.

        • autoexec 25 minutes ago
          > Policy makers would be much less likely to explore bold reforms or risky bipartisan compromises if their draft quality notes and correspondences were publicly tied to their political reputation.

          Only if those bold reforms weren't in the interests of the people they serve. Risky bipartisan compromises should still be transparent along with what was gained in exchange for them. If the people feel that the compromise wasn't worth it they should be empowered to vote accordingly come election time. It's the job of representatives to assure the people who elected them that they are doing a good job and if they can't do that they deserve to lose their position. Refusing to support bold reforms that the people they represent want, or refusing to compromise when it would be beneficial to voters would become just as costly to their career.

          > It takes significant work to produce successful legislation, and much of that work can be productively and safely done without direct public oversight.

          Often most of that work is done entirely for them by corporations and lobbying groups and "law makers" just vote how they are paid to vote without even reading the bill put before them. Just because something can be done in secrecy doesn't make that the ideal way to do it. We've have extremely poor results with the system as it stands right now, so a change to introduce more transparency and accountability seems like a very good idea.

          > This is the same reason an individual might value a private journal.

          A public servant representing the people by making edits to laws and performing the duties they were elected to carry out is nothing at all like someone keeping a private journal. Their work is not their personal affairs, it is the public's affairs. How that work is being done matters to the public. Legislators would still remain free to go home at the end of the day and write in their private diary all they like.

          > If you have a problem with your representative’s behavior, call their office and ask about it.

          When their behavior is conducted in secrecy behind closed doors the public doesn't have the ability to hold them accountable for it, which is exactly why it takes place in secrecy. Increasing the public's ability to hold elected officials accountable by increasing transparency can only improve outcomes for voters, and it would certainty be inconvenient for elected officials who want to put their own interests above the interests of the people who elected them.

    • EddieRingle 2 hours ago
      Likewise, a younger, more idealistic me thought it'd be great to use a GitHub-esque platform for laws. Pull Requests to suggest laws, gated behind reviews/approvals, branches so each house could work on their own versions before finally reconciling and merging into the Code, literally.
  • barrrrald 2 hours ago
    Cool idea but I can't find anywhere on the linked page to try it? It reads like a neat concept but it's not clear if this is a thing they've actually made or not (or am I just missing something super obvious?)
  • nico 1 hour ago
    I love this, and I feel every legal document (of which there are many, for example, a random one: insurance companies' policies) should have something like this (and no, Word is not good for it)

    Does it already exist?

  • LPisGood 2 hours ago
    Wow! This is very cool. I had an idea for something very similar to this when I found out the US federal government offered API keys, maybe three or four years ago. I found that while Congress did list bill revisions as they were made the format and retrieval of these was not an easy task. The idea was that I wanted to look at any line of any bill and see who proposed it that particular line’s inclusion.

    For the record, and feel free to steal it if you like it, I called it “G(overnm)it-blame”

    • BrokenCogs 2 hours ago
      Maybe at this point we should just git revert
  • alanwreath 33 minutes ago
    I wonder if there are any public sources for any of this data at a federal level? And do any of them still hold the older now versions?
  • mushufasa 3 hours ago
    I'm not an expert in this domain but I'm aware there has been prior work to attempt this. I'd appreciate if someone knowledgeable could post some of that context.
    • tpmoney 1 hour ago
      Something akin to this is a big part of the products that companies like LexisNexis or Thompson Reuters charge your lawyers a whole lot of money for. Because for a lot of legal questions, you don't just need to know what the law says now, but what it said at the time of the incident in question. And every legislative body around the country (at least at the time I was working in this space a decade ago) publishes legislative changes in completely different and often times not easily parsable forms. Web scraping and PDF scraping was far more common than you'd think. Some state legislatures published changes in more reasonable forms, and some states contract their official legislative compilation to companies like LexisNexis or Thompson Reuters and work to publish an actual change stream with proper standardized references. There's a lot of manual work that goes into making stuff like this work, a lot of lawyers and other legal professionals manually reviewing that the right pieces were removed or added in the right places, matching up references to parts of the law that might have changed between the time the legislation was passed and the time the change was published and figuring out what order everything actually goes in. And the actual text of the law is only part of the equation. Legal decisions from courts can dramatically impact the reading of the law, or effect effectively strike laws from the books (even if the laws are technically still on the books, just not enforceable). So often the right way to represent a diff of two points in time depends on the question you're trying to answer.
      • lazyasciiart 47 minutes ago
        I wanted to do something like this for a single section in Washington law, to show why a particular funding restriction had been added, but was no longer achieving the intended goal. Git alone wasn't enough of a UI, because the 'why' was only in the introductory text of the bill that changed the law, and not in the law itself - and then there was the move of that article to a different section, and a re-numbering of sections, and a change in definition in a different section that affected the scope of this one... fascinating stuff!

        I thought legal document versioning software would cover some of these problems but it doesn't seem like a similar enough process.

        • tpmoney 30 minutes ago
          Following renumbers has to be one of the worst parts of this. As an example, the text of the US code that was modified by the BCRA in 2002 has been renumbered / moved since Citizens United v FEC was decided. But the text itself is the same as it was since the BCRA passed, because courts don't remove the actual law text with their decisions. So if you want to know what parts of the current US code were ruled unconstitutional by the courts in that decision and are therefore unenforceable, you need to first find the text of the BCRA, because the ruling refers to the sections of that piece of legislation. Then you need to find the version of the US code that was on the books when the BCRA was passed to find the section references that the law talks about. Then you need to find the law that renumbered that part of the US Code and find the new parts. Then you need to see if any changes have been applied since (there hasn't really) and then you need to match the changes to the referenced sections in the old version of the code to the equivalent text in the current version of the code, modulo any changes to references that changed as part of the renumbering but are otherwise the same.

          I'm not saying lawyers aren't really really expensive, but you don't have to spend a long time digging into just a simple question like "what parts of the law are no longer enforceable after a supreme court decision" before you start to understand why they charge the prices they do.

    • tdhz77 2 hours ago
      You are correct the library of congress and the gpo do this.
  • 7kago_yomi 3 hours ago
    Unlike code, natural language laws have many exceptions and context dependencies, so trying to manage them cleanly with Git seems like it would be tough as data structuring costs and exception handling (hardcode-style responses) increase.
    • deathanatos 1 hour ago
      > Unlike code, natural language laws have many exceptions and context dependencies,

      In the interpretation of the law, yes, but that doesn't matter for version controlling the text of the law, and in that sense, you can absolutely manage the text pretty cleanly in git. Most laws are just text. Many bills are literal git-diffs, except in prose, which can make it hard to understand a bill.

      > exception handling (hardcode-style responses)

      This is basically non-sequitur (there no such thing as a "hardcode-style response" in git…), and again, I think you're misunderstanding the idea here.

    • beau_g 34 minutes ago
      This brings us to my even more unlikely idea - when whoever wrote that line in the legislation dies or retires, the line enters a short review period where it's either renewed with a new author on the line to speak to it or is deprecated. This way someone would always be there to just answer for the intent. Also would help garbage collect legislation that is no longer useful.
      • autoexec 6 minutes ago
        That seems like a great way to turn functional legislation into swiss cheese as one line at a time things are either kept or removed on the whims of the current people in power. Laws are collectively voted on as a complete package, and a law that worked and was acceptable can become useless, dangerous, and undesirable with a small number of lines removed from them. It also sounds like a great way for you to lose longstanding freedoms and protections that should never be at risk of deprecating just because some one gets voted out or dies or retires.

        The intent of a law should be clear from the text. To have a laws, or worse specific lines within a law, subject to change any time would make interrupting that law and establishing precedent a nightmare for the courts.

        We should have a system in place to help clear out the old and now pointless laws on the books, but this would be a terrible way to accomplish that.

    • JumpCrisscross 2 hours ago
      > natural language laws have many exceptions and context dependencies

      The complexity is in common law, not natural-language laws.

      The U.S. Code and Code of Federal Regulations can be completely presented through a Git-like system. The complexity comes in when attaching court cases.

      • jcranmer 2 hours ago
        Nah, it's pretty damn common in any legal system.

        If you've got a statute like "no vehicles in the park," the fundamental issue is that you have to interpret "what is meant by 'vehicle'?" and no legal drafting is going to be good enough to actually cover all the possible cases well enough. The main difference between a common law and a civil law system here is that in a common law system, you have to cite the previous similar cases (because precedent is binding) whereas in a civil law system, you're merely using those previous similar cases as persuasive evidence. At the end of the day, it boils down to arguing for your interpretation.

        And in my experience working on language standardization (which is closer to a civil law system than a common law system), it's fairly often that I have to resort to looking up not just when a change in the text occurred, but dive deep into the discussions of the paper proposing the change to understand what the committee thought it was doing with the change. The complexity of law is fairly similar--the changes to the law themselves often require understanding the legislative and interpretative history of the law to understand what the intent of the drafter was to be able to rule on how the law is extended to an unanticipated scenario.

        • thenewnewguy 1 hour ago
          Yeah but none of this matters for the "git for legislation" idea right? The point here is to record the history of the text of the laws, not their meaning.
          • tpmoney 38 minutes ago
            It depends on the question you're trying to answer. The text of the US law which Citizen's United struck down remains on the books today (though has changed since it was moved to a different part of the code, so references have been updated), but the actual effective law has most certainly changed from when it was written to now. Since courts can't write or modify the law, the literal text remains, even if some of that text is effectively stricken as if the text had been removed.

            If you want to know the literal text (that may or may not be enforceable), then sure a plain text diff is sufficient to know that nothing at all has changed about federal communication laws since this section was last amended in 2002. But if you want to know what the actual law is, you definitely need more than just a text diff.

            • beau_g 27 minutes ago
              See my response to the parent, but git blame solves the issue of "what did they mean" because the person (if alive) can just be asked. The same way git blame is used all the time to ask why a programmer did something some certain way, there's more to code too than just how exactly does it compile/execute. The higher level idea should be to stop legislation seemingly written by nobody, that nobody wants to answer for, but is used to make important decision about lives and livelihoods. Having courts needed to interpret verbiage that was written by living people is completely preposterous. If it's written by dead people, sure, that's a harder problem.
      • 7kago_yomi 2 hours ago
        I see. The laws are completely different from my country, so this is very educational. My country uses civil law, but I see that is how it is under common law. Thank you very much.
  • AustinDev 40 minutes ago
    AI explainer videos are actually pretty good. Good usage.
  • xlayn 2 hours ago
    YES PLEASE, but I suspect it will degenerate into another paid service with 1000 tiers... I think you cannot access the US law without paying for it? odd... I will wait for claude law to appear and hope they share the torrent...
    • Matticus_Rex 2 hours ago
      Legislation you can generally access for free. Case law you often cannot.
      • iAMkenough 2 hours ago
        Should that change? In my opinion, in the age of AI, both should be generally accessible for free.
        • deathanatos 1 hour ago
          Yes, it should absolutely change (both should be freely available), since ignorance of the law is not a defense, and case law is law (here, in the US, since we're a common law country). But the flip side of that is that the law has to be knowable, if ignorance is not a defense, or you're just going "lol too bad for you for not knowing the secret law".

          Also, because how the judicial branch decides case law needs to be reviewable by the People, so that we can inform the various legislatures to adjust the law if the judicial system is not ruling to the will of the People.

      • macintux 2 hours ago
        Electrical & building codes are also paywalled, IIRC.
        • kooi 2 hours ago
          Its outrageous.

          Thing which are public law should be publicly accessible.

          There's an online portal for NEC code book, but they made it awful, no search, no hyper links, the bare minimum.

          I used codex in computer mode to collect the relevant pages to my project. (Electricity to shed).

  • omoikane 1 hour ago
    See also:

    https://news.ycombinator.com/item?id=47625366 - United States Code (federal laws) in Git (2026-04-03, 15 comments)

    https://news.ycombinator.com/item?id=47621591 - Every Law a Commit – US Law in GitHub (2026-04-02, 32 comments)

    I think it's parsing this data:

    https://uscode.house.gov/download.html

    Which was discussed here:

    https://news.ycombinator.com/item?id=6135504 - The entire US Code is now online in XML (2013-07-31, 237 comments)

  • jcranmer 2 hours ago
    I think it's useful to link to a lawyer's take on the utility of a similar tool that was built by somebody else here: https://bsky.app/profile/questauthority.bsky.social/post/3mj...

    The tl;dr is that doing git-style change-tracking of the legislation isn't as helpful in practice as you'd think (especially because a lot of the very basic change-tracking is already available in the existing tools that lawyers use!).

  • layla5alive 1 hour ago
    Being able to git blame politicians and such would be very useful indeed (at first..) :-)
    • zaik 1 hour ago
      Why only at first?
  • adamdennis 1 hour ago
    Wasn’t this one of the original pitches for blockchain?
    • bowmessage 1 hour ago
      Not that I've ever heard.

      Why would one need a trustless distributed system to store document deltas published by an inherently trusted entity (federal government)?

  • noja 1 hour ago
    It’s a nice idea, but isn’t it a bit pointless if the law is not being applied?
  • yieldcrv 1 hour ago
    I put a lot of thought into this last decade, I find that some bills are big blocks of new text, and other bills are convoluted instructions to modify other blocks of existing law, sometimes saying "strike this word and that word" other times referencing just a subsection of another law. hyperlinks to that other law or a model of what the legal code would look like is necessary

    Agentically this could be done now, but it would still just be the tip of the iceberg

    You're looking at quantum states of law and regulations, and that's just for one jurisdiction

  • bottled_poe 37 minutes ago
    > Deepseek, refactor this repo to simplify the code. Make no mistakes.
  • NoMoreNicksLeft 1 hour ago
    Without 64-bit time though, can't use it historically. Since current legislation is always changes built upon legislation from long before unix epoch, it kind of falls flat.
  • counters 2 hours ago
    Major party foul for not calling this "legitslate"
  • ericfrederich 44 minutes ago
    ... And the tax code written in Python
  • iAMkenough 2 hours ago
    Sounds neat, but not something a private company should be responsible for.

    If transparency is the goal, the entire codebase for this should be public domain and not profitable. Otherwise there's a profit motive to rewrite history.

  • lily121 8 minutes ago
    [dead]
  • sundayexport 2 hours ago
    [flagged]
  • orliesaurus 1 hour ago
    [flagged]
  • reserve 2 hours ago
    [dead]
  • infogulch 3 hours ago
    [dead]
  • octoberfranklin 3 hours ago
    Fraudulent title, you can't git-clone this.
    • edflsafoiewq 2 hours ago
      There's actually two kinds of changes here: changes to the law, and changes to your description of the-law-and-its-changes (metachanges). For example, if you make a mistake in recording a change to the law, you need to fix that (unlike eg a source repo where mistakes in a commit message are forever).

      So to make this a git repo, I guess you'd make the snapshots be the law plus markup for all the changes, and the diffs are the metachanges. For each snapshot S, you could generate a git repo whose snapshots are the law and the whose diffs are the changes in the law (as described by S). However, this probably isn't the best way to query S.

    • doezi 3 hours ago
      Not really. It is arguing for version controlled legislation. So who’s responsible for what portions of literal laws and policy. I hope your "not clone-able" is in jest
      • JumpCrisscross 2 hours ago
        > who’s responsible for what portions of literal laws and policy

        This makes sense for bills. It doesn't for laws. Once a bill is a law, it's the will of the Congress.

        • dathanb82 2 hours ago
          That’s like saying that the code in a repo belongs to the whole team once a PR is merged, so it doesn’t make sense to track its provenance back to its original authors.
          • JumpCrisscross 2 hours ago
            > so it doesn’t make sense to track its provenance back to its original authors

            The legislative process is inherently collaborative in a way that's ordinarily undocumented. Who introduced an amendment and who supported it are entirely separate. Someone who introduced language can wind up not supporting it because of where the mix of trade-offs winds up.

            At the level of a bill, knowing who wrote language matters. At the level of law, you should only care who voted for it. (I'm not even tackling the inherent subjectivity in tracing e.g. language in the CFR to specific language in a bill.)

        • rileymat2 2 hours ago
          You could tag yes/no/abstains to it.