A few months ago I read about Anthropic's experiment of releasing a swarm of agents to write a functioning C compiler and it made me wonder about the feasibility of using that same approach to accomplish something I've been dreaming about for 15 years now, not long after we started GitHub - rewrite Git from scratch to be library based.
Git is of course a very complex piece of software. There are lots of "plumbing" commands, lots of higher level commands - it was put together incrementally by thousands of people over the last 20 years for projects large and small. It was never based on a linkable and reentrant library, but instead on a "Unix" philosophy of chaining together simpler commands, which means that it's difficult to use it in long running processes without fork/exec overhead for everything.
However, interestingly, there is a very comprehensive test suite of over 42,000 tests in more than 1,400 scripts in the Git project that define pretty solidly how everything should and should not work.
What if we used the same basic idea that Anthropic used on their from-scratch C compiler? Start a brand new implementation, design it as a Rust library, then throw a swarm of agents at the problem and just keep pounding away at it until all the tests pass?
Well, I did that for the last few months, on and off, and the result is Grit, a from-scratch, library-based, memory-safe, idiomatic Rust reimplentation of Git that passes over 99% of the entire Git test suite.
The new Grit project website
Achtung! While Grit passes the tests, it's not tested. Nobody has used this for anything real yet. If you play with it, be warned that there is a high probability currently that it will do the wrong thing and may even corrupt stuff. Use at your own risk. But if you find something, let us know so we can fix it.
Why would anyone do this?
Unlike the Anthropic experiment, this wasn't just to see if it could be done. When we started, I figured that if it worked, we might have something actually pretty useful in ways that C Git is problematic. But we'll get to that in a minute.
What was I trying to get out of this?
... continue reading