Jarred Sumner announced the successful rewrite of the Bun JavaScript runtime from Zig to Rust, a process that took 11 days of intensive agentic engineering using Claude and cost approximately $165,000 in API tokens. This rewrite demonstrates that modern AI coding agents can make large-scale rewrites feasible, challenging the long-held 'never rewrite' wisdom. It also shows how Rust's memory safety can eliminate common bugs like use-after-free that plagued Zig's manual memory management. The Bun test suite, written in TypeScript, served as a conformance suite to validate the port. The new Rust-based Bun has been running in Claude Code since June 17, 2026, with 10% faster startup on Linux and no noticeable changes for users.
Background
Bun is a fast all-in-one JavaScript runtime, package manager, and test runner, originally written in Zig. Zig is a systems programming language that requires manual memory management, which led to use-after-free and double-free bugs in Bun. Rust provides memory safety guarantees via its ownership model and Drop trait, preventing such bugs at compile time. Agentic engineering refers to using AI agents that can plan, use tools, and autonomously complete tasks with human supervision.