How Bun rewrote 535K lines from Zig to Rust with 64 AI agents
Bun's creator used 64 parallel Claude agents to rewrite 535,000 lines of Zig into Rust in two days. Key lessons for engineering teams.
Bun creator Jarred Sumner used Anthropic's Fable model to migrate Bun's entire codebase from Zig to Rust. Zig's lack of memory safety had produced persistent leaks and crashes despite patches, and a traditional rewrite of 535,000 lines was expected to take a team a full year — an unacceptable pause for a project with 22 million monthly downloads.
Instead, Sumner spent three hours briefing Claude, which distilled the conversion rules into a 600-line PORTING.md guide covering event-loop ownership, banned crates, and borrow-checker patterns. After a trial run on three files and adversarial review passes, the work was split across 64 parallel Claude agents running in four git worktrees, each handling a subset of the 1,448 source files.
Early runs failed as agents collided over git state; tightening the workflow to forbid destructive git commands fixed this. The full rewrite finished in about two days, followed by roughly 12 hours to resolve 16,000 compiler errors — a scale of mechanical fixing well suited to parallel AI agents but impractical for a human team. The case illustrates how orchestrated AI agents can compress large-scale language migrations, provided engineers define strict guardrails and verify every change.