Grit:使用 Rust 重写 Git 并引入智能体

by

作者:

16 min read

16 分钟阅读

We used agents to port all of Git to library-first, memory-safe Rust and it passes the entire C Git test suite.

我们使用代理将整个 Git 移植为库优先、内存安全的 Rust 实现,并且它通过了整个 C Git 测试套件。

Grit: rewriting Git in Rust with agents

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.

几个月前,我读到了 Anthropic 的一项实验,他们释放了一群智能体来编写一个可用的 C 编译器,这让我思考使用同样的方法来实现我15 年来一直梦想的事情是否可行,那是在我们创立 GitHub 后不久——从零开始重写 Git,使其基于库。

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.

Git 当然是一个非常复杂的软件。它有很多“plumbing”命令,很多更高级的命令——在过去的 20 年里,它是由成千上万的人为大大小小的项目逐步拼凑而成的。它从来不是基于一个可链接和可重入的库,而是基于将更简单的命令链接在一起的“Unix”哲学,这意味着如果不为所有操作承担 fork/exec 开销,就很难在长时间运行的进程中使用它。

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.

然而,有趣的是,Git 项目中有一个非常全面的测试套件,包含 1400 多个脚本里的 42000 多个测试,非常明确地定义了所有功能应该如何以及不应该如何运作。

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?

如果我们使用 Anthropic 在他们从零开始的 C 编译器上使用的相同基本思路会怎样?开始一个全新的实现,将其设计为 Rust 库,然后让一群 agent 来解决这个问题,并不断攻克它,直到所有测试都通过?

Well, I did that for the last few months, on and off, and the result is Grit, a from-scratch, library-base...

开通本站会员,查看完整译文。

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-06-26 22:07
浙ICP备14020137号-1 $방문자$