Bun Begins AI-Assisted Port from Zig to Rust — 'Phase A' Guide and 770K-Line Branch Land on GitHub (May 4, 2026)
Bun creator Jarred Sumner committed a 576-line Zig → Rust porting guide and a batch script to oven-sh/bun on May 4, 2026. The active 'claude/phase-a-port' branch already contains 1,646 changed files and ~774,000 added lines, signalling the largest AI-assisted runtime rewrite ever attempted by an Anthropic-owned project.
Bun creator Jarred Sumner on committed a 576-line porting guide and a 46-line batch script to oven-sh/bun that formally kicks off an AI-assisted port of the JavaScript runtime from Zig to Rust. The active claude/phase-a-port branch already contains 1,646 changed files and roughly 774,000 added lines against main — making it almost certainly the largest AI-assisted runtime rewrite ever attempted in public.
What Happened
The triggering commit is 46d3bc2 — "docs: add Phase-A porting guide" — which adds docs/PORTING.md and scripts/port-batch.ts. Sumner authored the commit; the branch name, claude/phase-a-port, makes the assistant doing the file-by-file translation explicit. The HN submission of the commit hit 432 points within hours of going live, with 60+ comments split between excited, skeptical and "this is an experiment" reactions.
Phase A's stated goal in the guide is narrow: produce a .rs draft alongside every .zig file that captures the logic faithfully — it does not need to compile. Phase B will then make each crate compile, one at a time, and Phase C reportedly handles benchmarks and parity tests. Sumner's instructions to the assistant are aggressively prescriptive: no tokio, no hyper, no async-trait, no std::fs, no std::net — Bun owns its event loop and syscalls. There are no async fn at all; the runtime stays on callbacks and state machines, exactly mirroring the existing Zig structure so reviewers can diff .zig ↔ .rs side-by-side in Phase B.
Key Details
- Branch and scale:
claude/phase-a-port— 1,646 changed files, 773,950 additions, 151 deletions vs.main, per the diff stats one HN commenter pulled in real time. - Phase A is correctness-first: annotators leave
// TODO(port): <reason>for anything they can't translate confidently and// PERF(port): <Zig idiom> — profile in Phase Bwherever the Zig used a perf-specific idiom (arena bulk-free, stack-fallback alloc, comptime monomorphization). - Mimalloc is mandatory: the guide requires every binary root to set
#[global_allocator] static ALLOC: bun_alloc::Mimalloc = bun_alloc::Mimalloc;— "otherwise you silently switch from mimalloc to glibc malloc." - Crate map: Bun's existing namespaces are pre-mapped to a fleet of
bun_*Rust crates —bun_str,bun_sys,bun_jsc,bun_uws_sys,bun_http,bun_aio,bun_js_parser,bun_pathsand more. - Style rules: snake_case fn names, runs of ≥2 uppercase letters collapse to one segment (
toAPI → to_api,isCSS → is_css), andpub fn deinitbecomesimpl Drop— not an inherent method.
Why Now
Two pieces of context explain the timing. First, Bun was acquired by Anthropic on — Anthropic's first acquisition ever — to lock in the runtime that ships Claude Code as a single executable to millions of developers; Claude Code crossed $1B in run-rate revenue in November 2025, six months after launch. Second, Zig is still pre-1.0, and Bun has long maintained its own Zig fork to ship around upstream breakage. Sumner himself, in a 2022 podcast, said he had "tried Rust for a bit" but found Zig more productive at the time — the calculus has shifted now that an Anthropic-owned project can throw Claude at the file-by-file translation work that previously made a Rust rewrite impractical.
What Developers Are Saying
The Hacker News thread (story 48016880) captures the split. One top commenter, elffjs, did the diff math: "Comparing this claude/phase-a-port branch with main: 'Showing 1,646 changed files with 773,950 additions and 151 deletions.'" Several commenters (heldrida, inkysigma) framed the move as an experiment and pointed out that a JS runtime in Zig had always been a bet given Zig's compiler maturity. Skeptics noted the obvious tension with another active HN thread complaining that Bun's quality issues had risen since acquisition. Humphrey captured the ambient hope: "I'll be very interested in how this AI port turns out. I am involved in a number of active projects that are being held back by the language… where a rewrite would be too big to undertake by using only human power." The most-quoted joke, from larpa: "Claude, migrate bun to Rust, make no mistakes."
What This Means for Developers
Nothing breaks today. Bun's main branch and the v1.x release line continue to ship in Zig, and the production runtime developers run in CI and on Vercel/Cloudflare/Render is unchanged. The port is being staged on a separate branch with no published timeline. What is worth watching is the precedent: this is the first time a major language-runtime maintainer has openly described an AI-assisted, file-by-file rewrite of a 770k-line codebase, with a published guide that other projects can copy. If Phase B compiles, expect Deno, Node native modules and possibly even runtimes outside JavaScript to publish similar Claude- and Codex-driven porting playbooks within months. If it stalls, the rewrite becomes the canonical case study for the limits of AI-assisted refactors at runtime scale.
What's Next
Sumner has not announced a Phase-A completion date. The claude/phase-a-port branch is updating actively, and the porting guide explicitly anticipates a Phase B ("makes it compile crate-by-crate") that will grep PERF(port) and benchmark each crate against the Zig original before merge. Bun remains MIT-licensed under Anthropic's ownership, and the oven-sh/bun repository is the canonical place to watch progress. The next concrete signal will be the first crate (likely bun_str or bun_paths, which have the simplest external surface) compiling cleanly and passing its existing test suite.
Sources
- oven-sh/bun commit 46d3bc2 — "docs: add Phase-A porting guide" — the primary source for the porting guide and the script.
- Hacker News — Bun is being ported from Zig to Rust — 432-point thread with developer reactions.
- Anthropic — Anthropic acquires Bun as Claude Code reaches $1B milestone — original December 2025 acquisition announcement.
- Bun Blog — Bun is joining Anthropic — Jarred Sumner's blog post on the acquisition.
- oven-sh/bun Discussion #994 — Why Zig? — historical context on the original language choice.
- P99 CONF — Bun, Tokio, Turso creators on Rust vs. Zig — Sumner on his earlier Rust productivity experience.
Stay up to date with Doolpa
Subscribe to Newsletter →