All posts

Bun rewrites 1M lines from Zig to Rust using Claude in 11 days

Huma ShaziaJuly 10, 2026 at 5:17 PM5 min read
Bun rewrites 1M lines from Zig to Rust using Claude in 11 days

Key Takeaways

Claude Just Migrated 750K Lines In 11 Days (Bun Got Rewritten Zig → Rust)

Bun rewrites 1M lines from Zig to Rust using Claude in 11 days
Source: The Decoder
  • Bun v1.4.0 was rewritten from Zig to Rust using 64 parallel Claude Fable 5 instances over 11 days
  • The AI-assisted rewrite cost approximately $165,000 in API fees, replacing roughly a year of human engineering work
  • Rust's compile-time memory safety checks drove the migration decision after persistent Zig memory errors

Jarred Sumner just shipped Bun v1.4.0, a complete rewrite of the JavaScript runtime from Zig to Rust. The kicker: 64 parallel instances of Anthropic's Claude Fable 5 wrote over a million lines of code in 11 days. The API bill hit $165,000.

Sumner says the switch was about reliability, not performance. Zig's memory errors and crashes were too hard to debug. Rust catches those bugs at compile time, which is exactly what you want when you're building infrastructure that millions of developers depend on.

Advertisement

Why Zig was not working

Bun launched in 2023 as a faster alternative to Node.js. Written in Zig with some C++, it combined a runtime, bundler, transpiler, and package manager into one tool. Zig gave Sumner the low-level control he needed for raw speed.

The tradeoff was painful. Zig does not have a borrow checker. Memory bugs slip through compilation and show up at runtime as crashes or silent corruption. Tracking them down takes hours, sometimes days. Sumner found himself fighting the same category of bugs repeatedly.

Rust eliminates most of these problems by refusing to compile code with memory safety issues. The compiler is strict, sometimes annoyingly so, but the result is code that does not crash from use-after-free or data races. For a runtime that needs to be rock solid, that guarantee matters more than raw flexibility.

How 64 Claude instances pulled off a million-line rewrite

Sumner used a pre-release version of Claude Fable 5, Anthropic's latest model. He spun up 64 instances running in parallel, each tackling different parts of the codebase. Over 11 days, they produced more than a million lines of Rust.

$165,000
API cost for the 11-day rewrite, replacing approximately one year of human engineering work

The economics are striking. Sumner estimates a human team would have needed about a year to complete the same work. At typical Silicon Valley engineering salaries, that would run well into the millions. The $165,000 API bill looks like a bargain.

Sumner did not have to worry about the cost anyway. Anthropic acquired Bun and his team in December 2025. The project was essentially an internal test of Fable 5's code generation capabilities at scale.

What Bun v1.4.0 delivers

The new version is available as a canary release. It fixes 128 bugs and runs 2 to 5 percent faster than the Zig version. The performance gain is modest, but that was never the point. Stability was.

For teams running Bun in production, fewer memory crashes means fewer 3 AM pages. The Rust codebase should also be easier to maintain going forward, since the compiler catches errors that would otherwise become runtime surprises.

Advertisement

What this means for AI-assisted development

This is the largest publicly documented AI-assisted code migration to date. A million lines in 11 days, with a human team in the loop for review and integration, not writing the bulk of the code.

The implications are obvious. Large-scale rewrites and migrations, traditionally multi-year projects with high failure rates, might become routine engineering tasks. Technical debt that nobody wanted to touch could become tractable.

But there are caveats. Sumner had access to a pre-release model most teams cannot get. He had deep context on the codebase and could guide the AI effectively. And the target language, Rust, has a compiler that rejects bad code. A rewrite to a more permissive language might produce code that compiles but fails in production.

ℹ️

Logicity's Take

This project sets a new benchmark for AI-assisted code generation at scale, but the conditions were unusually favorable: a well-funded team with direct Anthropic access, a codebase the lead developer knew intimately, and a target language with strong compile-time guarantees. For most teams, the lesson is not 'migrate everything with AI tomorrow' but 'start scoping which legacy systems could benefit from AI-assisted rewrites once the tooling matures.' If you are evaluating AI code tools now, compare Claude (via Anthropic's API), GitHub Copilot (starting at $10/month for individuals), and Cursor ($20/month) to see which fits your workflow.

The Zig vs Rust debate continues

Sumner's decision will fuel the ongoing argument between Zig and Rust advocates. Zig fans value its simplicity and C interoperability. Rust proponents point to exactly the kind of memory safety issues Sumner encountered.

Neither language is wrong. They optimize for different tradeoffs. But when reliability is non-negotiable, Rust's borrow checker stops being an annoyance and starts being the feature you cannot live without.

Frequently Asked Questions

What is Claude Fable 5?

Claude Fable 5 is a pre-release version of Anthropic's AI model, used by Jarred Sumner to automate the Bun rewrite. It is not yet publicly available.

Why did Bun switch from Zig to Rust?

Zig's lack of compile-time memory safety checks led to persistent crashes and bugs that were difficult to fix. Rust catches these errors at compile time.

How long would the rewrite have taken without AI?

Sumner estimates a human team would have needed approximately one year to complete the same work.

Is Bun v1.4.0 production-ready?

It is currently available as a canary release, meaning it is intended for testing rather than production use. A stable release will follow.

Can other teams replicate this process?

Not yet at this scale. Sumner had access to a pre-release model and direct Anthropic support. Public access to similar capabilities will depend on Fable 5's release timeline.

ℹ️

Need Help Implementing This?

If you are considering AI-assisted code migration or want to evaluate the latest AI development tools for your engineering team, reach out to Logicity for implementation guidance and tool comparisons tailored to your stack.

Source: The Decoder / Maximilian Schreiner

Advertisement
H

Huma Shazia

Senior AI & Tech Writer

Produced with AI assistance and reviewed by the Logicity editorial team. Learn more in our Editorial Policy.