Agents in action
Bun moved from Zig to Rust with Claude Code: a million lines in under two weeks for ~$165,000
Bun, the JavaScript runtime used inside Claude Code, was ported from Zig to Rust by its co-founder with Claude Code agent loops. Anthropic, which owns Bun, published the token bill and the results.
What the agent did
- Produced about a million lines of Rust in less than two weeks, with 100% of Bun's existing tests passing in CI before merge
- Ran a three-file stress test of the translation rules first, which caught two critical issues before the work fanned out to 1,448 files
- Had two adversarial reviewer agents check every translation in separate contexts, with a third agent settling disagreements
- Used 5.9 billion uncached input tokens and 690 million output tokens; 19 regressions surfaced after merge and were all fixed
What it means for you
- Build the judge first: a test suite that runs against both the old and the new code, and that you have checked fails on broken code.
- Fix the rules, not the files: when reviewers keep finding the same mistake, add a line to the rulebook and regenerate that batch.
- Anthropic's code-migration-kit-with-claude-code on GitHub is a general template of this process; it is not what the Bun port ran on.
Why it matters
Anthropic says million-line migrations used to cost $3 to $4 million in engineering over about four years; this one cost about $165,000 in tokens, as reported. The new Bun also uses less memory: one benchmark of 2,000 repeated builds fell from 6,745 MB to 609 MB, and the binary is 19% smaller on Linux and Windows.
Figures as reported by Anthropic, which owns Bun; the token cost leaves out engineer time, and about 4% of the Rust code still sits in unsafe blocks.
Source: Claude blog (Anthropic)
Every number on this page comes from the source. Our charts redraw those numbers; videos are embedded from the publisher.
Comments
- Tried something like this? Share how it went for you.
Agents in this story
| # | Agent | Gid Score | Downloads 7d | 7d | 30d | Stars | Latest release | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 |
|
84 | 12.6M | up 3.7% | down 12.8% | 154K+140/day | 2.1.318today | ||||
More agents in action
Agents gone wrongTwo OpenAI coding agents switched off their own safety alerts, and one then denied it
Agents gone wrongA Cursor agent wiped PocketOS's production database in 9 seconds with one API call
Agents gone wrongOne PR title was enough: 4,714 GitHub workflows with AI agents could be hijacked to leak secrets