Bun Rewrote 535K Lines from Zig to Rust Using Claude Bun creator Jarred Sumner used 64 parallel Claude Code agents to rewrite 535,000 lines of Zig into Rust in 11 days at an API cost of approximately $165,000, shipping the result in Claude Code v2.1.181. The rewrite eliminated 19 documented memory bugs, shrank the Linux binary from 88 MB to 70 MB, and fixed a 3 MB-per-invocation memory leak in Bun.build(). Zig creator Andrew Kelley called the result "unreviewed slop. Bun just shipped a complete Zig-to-Rust rewrite — 535,000 lines of code translated in 11 days using Claude Code agents running in parallel. The result is already live in Claude Code v2.1.181. Bun v1.4.0 is coming. The rewrite eliminated a documented class of memory safety bugs, shrank the Linux binary from 88 MB to 70 MB, and ignited the loudest debate about AI-generated code quality in production the developer community has seen yet. Why Rust: The Problem Was Real This was not a language fashion statement. Bun v1.3.14 shipped with 19 documented memory bugs — use-after-free crashes, double-frees, and leaks in zlib, HTTP/2, UDP sockets, and TLS. The root cause was architectural: Bun mixed Zig’s manual memory management with JavaScriptCore’s garbage collector, and correctly handling value lifetimes across that boundary was a recurring failure point. A call to Bun.build leaked 3 MB per invocation — across 2,000 builds, that’s 6,745 MB of unreclaimed memory. Rust’s borrow checker enforces correct lifetimes at compile time. Zig’s defer mechanism does not — it leaves correctness to the programmer and code review. Jarred Sumner, Bun’s creator, put it plainly: “For Bun, correctly handling the lifetimes of garbage-collected values and manually-managed values has been a major source of stability issues.” The rewrite was the answer to a specific, measurable problem. How the Rewrite Worked: Not Just Prompting The methodology is worth understanding, because it’s more engineered than a “prompt and ship” story. Sumner spent three hours on preparation before touching a single file: generating PORTING.md a mapping of Zig patterns to Rust equivalents and LIFETIMES.tsv a struct-by-struct field lifetime analysis . He then ran a trial on three files with full adversarial review before scaling to all 1,448 source files. Each task followed a four-role structure: one Claude instance implemented, two reviewed in separate context windows — never seeing the original Zig, only the diff — and one fixed what the reviewers flagged. The separate context windows are the key design decision: they prevent the implementer’s reasoning from contaminating the review. This adversarial setup caught more than 50 real bugs before merge, including an async close race condition where a Box