$165,000 in tokens is what the Zig => Rust rewrite of Bun cost.
The official "Bun ported to Rust" blog post is out and I read it for you. Here's my summary (hand-written by the way, just saying...):
1. This was NOT vibe coding
Jarred Sumner didn't just ask Claude to "rewrite Bun in Rust" and hope for the best => He built a fairly elaborate workflow around Claude Code (and with Claude Code):
- a porting guide
- lifetime analysis
- multiple implementation agents
- separate adversarial reviewer agents + fixer agents
- CI loops
He also had to tweak infrastructure (EC2 instance) to support running the complex test suite in a loop with Claude porting and fixing code.
2. Amazing scale
Bun had 535,496 lines of Zig code, excluding comments.
The rewrite happened over 11 days.
At peak, Claude (Fable) wrote about 1,300 lines of code per minute. There were 64 Claudes running through dynamic workflows. The final result included 6,502 non-merge commits and a landed diff of +1,009,272 lines.
The token usage was also … not tiny:
- 5.9 billion uncached input tokens
- 690 million output tokens
- 72 billion cached input token reads
=> around $165,000 at API pricing
Jarred estimates that doing this manually would've taken 3 engineers with full codebase context about a year.
3. Rust was chosen for stability, not because Zig is bad
The post is not about "Zig bad, Rust good".
Bun only exists because Zig made the original project possible. Jarred is very clear about that.
The problem was Bun's specific situation: JavaScriptCore, C/C++ libraries, garbage-collected JavaScript values, manually managed memory, Node.js compatibility, async behavior, and a huge runtime surface.
That combination led to bugs like use-after-free, double-free, memory leaks and more.
Rust gives Bun stronger guardrails through things like ownership, Drop, the borrow checker, and more explicit unsafe boundaries.
4. The AI reviewers were as important as the AI implementers
One of the most important parts: the code written by Claude was reviewed by other Claude instances (with fresh contexts).
The reviewers were adversarial => Their job was to assume the code was wrong and find the bug.
That caught real issues, including code that compiled cleanly but was still broken.
5. The rewrite still introduced regressions
Despite the complex setup and workflow, the rewrite introduced 19 known regressions.
All of them were fixed by now.
Most regressions came from semantic differences between Zig and Rust:
- Zig assert vs Rust debug_assert!
- release bounds checks
- Zig comptime formatting vs Rust runtime formatting
6. Bun got better after the rewrite
According to the post, Bun v1.4 fixes 128 bugs that reproduce in v1.3.14.
It also brings:
- lower memory usage
- smaller binaries
- roughly 2–5% better performance in benchmarks