Rewriting Bun in Rust
AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.
Why it matters
Bun's rewrite proves frontier coding agents can safely execute massive ground-up rewrites, breaking the old 'never rewrite' rule for large software projects.
Bun, a fast JavaScript tool, has been rewritten from the Zig programming language into Rust, a language that automatically prevents certain memory bugs. The rewrite was done mostly by AI agents over 11 days, checked against Bun's existing tests. Since June, it ships inside Claude Code, and almost nobody noticed the change.
Bun's creator ported a million-line JavaScript runtime from Zig to Rust using parallel AI agents costing roughly $165,000 in tokens at API prices. Bun's test suite acted as the safety net, and the Rust build has run in Claude Code since version 2.1.181 (June 17) with 10% faster startup on Linux. The lesson: large AI-assisted rewrites are now viable when strong test suites exist.
Jarred Sumner rewrote Bun in Rust to eliminate use-after-free, double-free and leak bugs that came from mixing garbage collection with manual memory management in Zig. An agent harness drove the port, using Bun's TypeScript test suite as a language-independent conformance check with a million assertions, plus adversarial code review; failing cases prompted fixes to the generation process rather than the code. Cost: 5.9B uncached input, 72B cached input, 690M output tokens (~$165,000).
Read the original
This summary exists to save you time, not to replace the source.
Key terms
Bun Rust Zig Claude Code Anthropic Jarred Sumner Joel Spolsky
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
A hierarchical note-taking app for building large personal knowledge bases
Trilium lets users build and navigate massive personal knowledge bases without duplicating content, saving time on organization and retrieval.
Desktop apps in Go with native UI or web frontend
Go developers can now ship cross-platform desktop and mobile apps in a single small binary without cgo or heavy runtimes, cutting build complexity and deployment size.
OpenBitFun: an agent workspace with four harness modes and phone remote control
OpenBitFun lets agents run on any machine and be controlled from a phone, eliminating the need to choose between local power and remote access, saving developers time switching contexts.
Intel One Mono: a monospaced font designed with low-vision developers
Developers with low vision or eye fatigue can read code more clearly, reducing errors and improving productivity.