
Bun's creator completed a full rewrite of the JavaScript runtime from Zig to Rust in 11 days using Claude, Anthropic's AI agent tool. The migration eliminated memory leaks, shrank the binary by roughly 20%, and improved performance by 2–5%, demonstrating a new workflow for large-scale code migration driven by AI agents and automated testing rather than manual review.
Summaries like this, in your inbox every morning.
Sign up free →What happened
Jarred Sumner, creator of the Bun JavaScript runtime, used Claude (Anthropic's AI agent tool) to port approximately 535,000 lines of code from Zig to Rust over 11 days. The rewritten Bun 1.4 (Canary) now runs on Rust instead of Zig and passed the full test suite.
Why it matters
The migration eliminates memory leaks, reduces binary size by approximately 20%, and improves performance by 2–5%. Sumner chose Rust for its memory safety guarantees—preventing crashes from memory errors that were harder to catch in Zig—making Bun more stable for users relying on it (including Anthropic, which acquired Bun in December 2025).
What to watch
The work cost approximately $165,000 in Claude API usage and involved dynamic workflows running continuously for 11 days, generating 6,778 commits and peaking at approximately 1,300 lines of Rust code per minute. Sumner used multi-agent adversarial code review and test-driven iteration rather than manual verification, establishing a pattern for large-scale AI-assisted refactoring.
Bun, a Node.js-compatible JavaScript runtime, was acquired by Anthropic in December 2025 and serves as the runtime for Claude Code. In May 2026, Sumner began experimenting with migrating the codebase from Zig to Rust; by July 2026, he had completed the full rewrite using Claude as an AI agent orchestrator.
The approach was methodical: Sumner first established porting rules and lifetime annotations by discussing patterns with Claude and creating reference documents. He then deployed dynamic, multi-agent workflows that ran for 11 continuous days, generating code, running tests, and receiving corrections in tight feedback loops. Critically, Sumner used adversarial review agents (at least two per implementation agent) to catch bugs and enforce correctness, treating the test suite and automated review as the source of truth rather than manual code inspection. At peak, the system generated approximately 1,300 lines of Rust per minute across parallel agents, producing 6,778 commits.
The results—elimination of memory leaks, 20% smaller binary, and 2–5% performance gain—suggest that large-scale refactoring can be completed via AI-assisted workflow iteration without traditional line-by-line human review, provided test coverage and adversarial automation are sufficiently robust. For businesses considering large code migrations, this demonstrates a potential cost-benefit: $165,000 in API usage versus the equivalent of three engineers for one year.
No comments yet. Be the first to share your thoughts!
Log in to join the discussion




Get curated AI news from 200+ sources delivered daily to your inbox. Free to use.
Get Started FreeFree · takes 30 seconds · unsubscribe anytime
1 minute a day. The AI essentials.
200+ sources · Email / LINE / Slack