Bun, the JavaScript runtime Anthropic acquired in December 2025, has been rewritten from Zig to Rust largely by Claude Fable 5. The AI-assisted rewrite produced 1,009,257 lines of Rust at an estimated API cost of $165,000, with 99.8% of tests passing on Linux x64.

Bun founder Jarred Sumner announced the Rust rewrite on July 8, 2026 on the official Bun blog, and the announcement carried a second surprise: Anthropic acquired Bun in December 2025, a deal not widely reported at the time. The rewrite converted Bun’s 535,496-line Zig codebase into more than a million lines of Rust using a pre-release version of Claude Fable 5 — the most concrete public evidence yet that frontier AI models can execute enterprise-scale rewrites, not just toy projects.

  • Scale: 1,009,257 lines of Rust added, 2,188 files changed, 6,755 commits in the merged pull request
  • Cost: an estimated $165,000 at API pricing — 5.9 billion uncached input tokens and 690 million output tokens
  • Quality: 99.8% test compatibility on Linux x64 glibc
  • Status: experimental parallel work — stable Bun still ships from the Zig codebase
  • Ownership: Anthropic acquired Bun in December 2025 (price not disclosed)

What Actually Happened — The Key Numbers

According to analysis by Simon Willison of the merged pull request, the rewrite added 1,009,257 lines of Rust while deleting 4,024 lines of Zig across 6,755 commits, as detailed on simonwillison.net. The original Bun codebase measured 535,496 lines of Zig excluding comments — meaning the Rust version is nearly double the line count, a typical trade-off given Rust’s more explicit error handling and memory-safety annotations.

The token bill tells the AI story: 5.9 billion uncached input tokens and 690 million output tokens through a pre-release Claude Fable 5, roughly $165,000 at API pricing. A human engineering team doing an equivalent rewrite would plausibly cost millions of dollars and take years.

Why Bun Left Zig for Rust

The motivation was memory safety, not speed. Per the Bun team’s announcement: “A large percentage of bugs in the existing codebase were use-after-free, double-free, and ‘forgot to free’ errors in error paths, which in safe Rust are compiler errors with automatic cleanup via Drop.” Zig, chosen by Sumner for its speed and low-level control, lacks Rust’s borrow checker — so an entire class of memory bugs that shipped in Zig simply fails to compile in Rust. Deno, Bun’s closest runtime rival after Node.js, is already built in Rust.

The Quiet Anthropic Acquisition — Why It Matters

The December 2025 acquisition makes Bun an Anthropic product, giving the company a direct stake in JavaScript developer tooling — the same audience OpenAI courts with Codex and SpaceXAI courts with Grok 4.5 and Cursor. Anthropic appears to be building toward owning the AI-native developer workflow from the runtime up, consistent with the direction of Anthropic’s AI research and the rollout of Claude Fable 5 across its products this month. Importantly, Anthropic did not build Bun — Jarred Sumner and team did — and the acquisition price has not been reported.

What This Means for Developers

Nothing changes today. Stable Bun releases continue to ship from the Zig codebase, and the Rust rewrite is parallel experimental work. The Bun team says the Rust version will become the default only when it reaches feature and compatibility parity across all supported platforms. There are no published performance benchmarks comparing the Zig and Rust builds yet, so claims about speed differences remain speculation. The developer discussion is substantial — the announcement drew a 427-point thread with 221 comments on Hacker News.

💡 Our Take: Anthropic just used its own flagship AI to rewrite a million lines of production code — and it worked. This isn’t a demo; it’s Claude Fable 5 doing what would be an engineering team’s multi-year job for $165K in API costs. AI coding isn’t coming for enterprise-scale work “eventually” — at Fable 5’s level, it’s already doing it.

FAQ

Did AI really rewrite the entire Bun codebase?

Largely, yes. The Bun team used a pre-release version of Anthropic’s Claude Fable 5 to convert 535,496 lines of Zig into over a million lines of Rust, consuming 5.9 billion input tokens. The result passes 99.8% of Bun’s test suite on Linux x64.

How much did the Bun Rust rewrite cost?

An estimated $165,000 at Claude API pricing, based on 5.9 billion uncached input tokens and 690 million output tokens, per Simon Willison’s analysis. A comparable human-led rewrite would likely cost millions of dollars over multiple years.

Does Anthropic own Bun?

Yes. The July 8, 2026 announcement revealed that Anthropic acquired Bun in December 2025, which had not been widely reported. The acquisition price has not been disclosed. Bun was originally built by Jarred Sumner and his team.

Is the Rust version of Bun available now?

No. The Rust rewrite is experimental parallel work, and stable Bun releases still ship from the original Zig codebase. The Rust build will become the default only once it reaches feature and compatibility parity across all supported platforms.

Why did Bun switch from Zig to Rust?

Memory safety. The team reported that a large share of Bun’s bugs were use-after-free, double-free, and forgot-to-free errors — bugs that Rust’s borrow checker turns into compile-time errors with automatic cleanup. Zig offers speed and control but no equivalent compile-time memory guarantees.

Share.

I am a software engineer, I have a passion for working with cutting-edge technologies and staying up-to-date with the latest developments in the field. In my articles, I share my knowledge and insights on a range of topics, including business software, how to set up tools, and the latest trends in the tech industry.

Comments are closed.

Exit mobile version