Rewriting Bun from Zig to Rust Using Claude Agents

Simon Willison · rss · 2026-07-09

The creator of Bun detailed how they leveraged cutting-edge AI coding agents to rewrite the massive Bun runtime from Zig to Rust in just 11 days. - **Rewrite Motivation**: Zig's mixed garbage collection (GC) and manual memory management led to numerous hard-to-track memory errors (like use-after-free). In safe Rust, these issues become compile-time errors or are automatically cleaned up. - **Agent Engineering Practices**: The project relied heavily on language-independent test suites as a consistency check. Through advanced agent orchestration techniques like dynamic workflows, dry runs, and adversarial reviews, the bulk of the initial porting was automated. - **Results and Costs**: The new Rust implementation has been quietly running in Claude Code for nearly a month, boosting Linux startup speeds by 10% with almost no one noticing (stability first). This rewrite consumed roughly 5.9 billion uncached input tokens, with API costs estimated at $165,000.

Original post →

More from coding & agent

coding & agent channel →