Fireship
July 15, 2026
TL;DR
Bun completed a controversial rewrite of its entire 535,000-line codebase from Zig to Rust using 64 parallel Claude agents in 11 days, fixing 128 bugs and reducing binary size by 20%, but sparking a public dispute with Zig creator Andrew Kelly over misleading benchmarks.
“Half of Bun's objects were owned by the garbage collector, while the other half lived in manually managed Zig memory, and the two had to constantly manage pointers to each other, which led to a codebase that looked like it had an explosive diarrhea parasite.”
— Host
“Once Anthropic acquired Bun, the majority of its future code was going to be written by Claude. And Zig is famously anti-AI.”
— Host
“The Zig team spent years watching Bun embarrassed their language with a codebase they privately used as the example of how not to write Zig.”
— Andrew Kelly (paraphrased from his response)
1. The Problem: Memory Management and AI Alignment
Bun was originally written in Zig, which requires manual memory management. Mixed with JavaScript Core's garbage collection, this created hybrid memory handling that led to chronic bugs like use-after-free errors and memory leaks. After Anthropic acquired Bun, the majority of future code would be written by Claude, but Zig's anti-AI stance and poor LLM training data made it unsuitable for AI-assisted development.
2. The Solution: AI-Driven Rewrite to Rust
Bun decided to port 535,000 lines of Zig to Rust, whose borrow checker moves memory management into the type system, preventing most memory errors at compile time. The decision was driven by both technical issues (memory bugs) and strategic concerns (Anthropic's AI-first future and Zig's AI resistance).
3. How the Rewrite Actually Worked
Claude first produced a detailed porting guide after studying the codebase. Engineers traced field lifetimes into giant spreadsheets to document memory ownership patterns. Then 64 parallel Claude agents worked across 1,448 files on four separate git branches, producing up to 1,300 lines of Rust per minute. Each agent was paired with two adversarial reviewer Claudes in separate context windows to catch errors. The entire process took 11 days and resulted in 6,520 commits.
4. Results and Success Metrics
The rewrite fixed 128 long-standing bugs, resolved dev server memory leak issues, reduced binary size by 20%, and achieved faster performance. All tests passed on every platform. The port has already powered Claude Code since June without issues, proving the rewrite's success in practice.
5. Andrew Kelly's Response and Technical Criticisms
Zig creator Andrew Kelly disputed the results, claiming Bun embarrassed Zig's reputation for years and the Zig team used it as a negative example. He argued performance gains came from link-time optimization (available in Zig), binary reduction wasn't Rust-specific, and compile times were conveniently omitted. He also made personal criticisms about Jared's startup-focused background.
6. Who Wins the PR Battle?
The rewrite succeeded technically but both sides lost in public opinion. Zig lost its most famous user, Andrew Kelly lost credibility by attacking Jared personally, and Jared faced accusations of 'beginner energy' from a compiler engineer. The dispute reflects deeper tensions between Zig's anti-AI philosophy and the AI-driven future of software development.