Rewriting Bun in Rust: 535K Lines, 11 Days, 64 AI Agents
Bun's creator Jarred Sumner recounts how he used Anthropic's Claude Fable 5 to rewrite Bun's 535,496 lines of Zig into Rust in 11 days. The motivation: Zig's manual memory management caused numerous use-after-free, double-free, and memory leaks when mixed with JavaScriptCore's GC. Instead of an incremental port, he orchestrated 64 Claude agents in parallel using dynamic workflows and adversarial review. 100% of Bun's test suite (over 600k assertions) passed on all 6 platforms. The rewrite fixed 128 bugs, reduced memory usage by up to 90%, shrank the binary by ~20%, and improved throughput by 2-5%. The article details the workflow, common porting mistakes (e.g., debug_assert! side effects, slice overruns, comptime format differences), and how Rust's Drop systematically prevented memory leaks. A first-hand account of using cutting-edge AI to accomplish a year-long team project in less than two weeks.