AI agents rewrote Bun's codebase in 11 days
Anthropic-owned Bun used Claude agent swarms to port its runtime from Zig to Rust in 11 days for $165K, and Zig's creator says it vindicates his criticism.
Bun, the JavaScript runtime Anthropic acquired earlier this year, rewrote its roughly 535,000-line Zig codebase, transpiler, bundler, package manager, test runner, and Node.js API implementations included, into Rust in 11 days, from May 3 to May 14, 2026. The work generated over 1 million lines of code across 6,502 commits, run through roughly 50 concurrent Claude agent workflows, peaking at 64 instances across four worktrees and 1,300 lines of code per minute, using a pipeline where one agent implemented, two adversarial agents reviewed, and a fixer applied the feedback. Total API cost: $165,000 across 5.9 billion input and 690 million output tokens. Bun reports the Rust version is 2-5% faster, 20% smaller as a binary, fixed 128 memory-leak bugs present in the old version, and passes its full test suite (about 1.26 million assertions) across six platform targets, with roughly 4% of the new codebase marked unsafe.
Zig creator Andrew Kelley responded publicly and bluntly. He called the old Zig codebase “hacks on top of hacks,” said Bun had become “a net liability” to the Zig project, and described his reaction to the rewrite as relief: “It Tastes Like It’s Not My Problem Anymore.” His criticism is not aimed at Rust or at AI coding tools generally, but at Bun’s management: he argues the memory-safety bugs the rewrite fixed were a consequence of how the Zig codebase was run, not a limitation of Zig itself, and points out that link-time optimization, which Bun’s post credits partly for the Rust version’s size gains, was available in Zig the whole time and went unused. He also disputes an implication in Bun’s post that its team wasn’t fuzzing the old codebase.
Strip out the personal dispute and there is a real, separately interesting data point underneath: a production codebase used by millions of developers got fully rewritten to a different systems language, by AI agents, in under two weeks, and the resulting binary reportedly passes its test suite with measurable performance and reliability gains. That is a genuinely new proof point for what agent swarms can do on a bounded, well-specified porting task. It is also, per Kelley, entangled with a public relations narrative: whether the fixed bugs prove Rust safer or prove the original Zig implementation was simply poorly maintained is exactly what’s being argued, and Bun’s own blog post is not a neutral source on that question.
For teams considering a similar AI-driven rewrite of legacy infrastructure, the honest takeaway is narrower than “AI agents can rewrite your codebase in 11 days.” It is that a well-specified, well-tested, mechanically portable codebase with a strong reference implementation to check against is a much better candidate for this kind of automation than a poorly specified one, and that the 4% unsafe-code figure and 19 in-flight regressions Bun reports are the numbers worth tracking over the next few months, not the 11-day headline. See getting results from multi-hour agents for what makes a task tractable for long-running agent swarms in the first place.