<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/the-great-bun-rewrite-azchqrili" -->

---
title: The Great Bun Rewrite | daily.dev
description: Bun's creator Jarred rewrote the JavaScript runtime from Zig to Rust in just 11 days using Claude AI agents, spending approximately $165,000 in API costs and...
canonical: https://daily.dev/posts/the-great-bun-rewrite-azchqrili
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: The Great Bun Rewrite | daily.dev
og:description: Bun's creator Jarred rewrote the JavaScript runtime from Zig to Rust in just 11 days using Claude AI agents, spending approximately $165,000 in API costs and...
og:url: https://daily.dev/posts/the-great-bun-rewrite-azchqrili
og:image: https://api.daily.dev/og/posts/AZcHQrILI.png
og:image:alt: The Great Bun Rewrite
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# The Great Bun Rewrite

**[ThePrimeTime](https://daily.dev/sources/primeagen)** · 14 min read · 2 upvotes · 0 comments

## Summary

Bun's creator Jarred rewrote the JavaScript runtime from Zig to Rust in just 11 days using Claude AI agents, spending approximately $165,000 in API costs and generating 1.8 million lines of code across 6,502 commits. The motivation was Zig's lack of compiler-enforced memory safety, which led to recurring use-after-free bugs, memory leaks, and race conditions. The AI-assisted workflow involved translating Zig files to Rust one at a time, spawning separate review agents to catch issues, then iteratively fixing 16,000 errors and making all unit tests pass. The author argues the $165,000 cost is actually a bargain compared to a traditional multi-engineer rewrite that could take a year and cost over a million dollars. The technique of using separate context-free agents for code review is highlighted as a broadly useful AI development pattern.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=NgUNjjV_AkY>

## Questions this post answers

### Why is Bun being rewritten from Zig to Rust instead of staying in Zig?

Bun's creator cited persistent memory-safety bugs in the Zig codebase, including use-after-free crashes, double-frees, memory leaks, and race conditions, stemming from mixing garbage-collected and manually managed memory. He argued that avoiding these bugs required strict style-guide discipline in Zig or C++, which relies on code review enforcement, whereas Rust enforces memory safety at the compiler level, removing the need for a style guide entirely.

_Developers weighing a language migration for memory safety can track how Bun's Rust rewrite plays out on daily.dev._

### How much did it cost and how long did it take to rewrite Bun from Zig to Rust using Claude?

The rewrite took 11 days and produced 6,502 commits totaling roughly 1.8 million lines written or rewritten. It consumed 690 million output tokens, 5.9 billion uncached input token reads, and 72 billion cached input token reads, costing approximately $165,000 in Claude API usage, using a pre-release version of Claude internally called Fable.

_Anyone estimating the real cost of AI-driven rewrites can compare notes on projects like Bun's via daily.dev._

### What review process did Bun's team use to fix errors during the Zig to Rust migration?

Each Zig file was translated to Rust by an agent, then two separate reviewer agents with no prior context were spawned to check the change set against the intended task, flag bugs, and give feedback, which was then applied. This task-review-fix loop ran repeatedly across parallel work trees to resolve roughly 16,000 compilation errors and get all unit tests passing before the rewrite was considered functional.

_Teams designing multi-agent review workflows for large refactors can pick up techniques like this through daily.dev._

## Similar posts on daily.dev

- [Zig creator calls Bun's Claude Rust rewrite 'unreviewed slop'](https://daily.dev/posts/zig-creator-calls-bun-s-claude-rust-rewrite-unreviewed-slop--zlkefwvdc) · DEVCLASS · 11 upvotes · 6 comments

---

Tags: [#rust](https://daily.dev/tags/rust), [#ai-coding](https://daily.dev/tags/ai-coding), [#claude](https://daily.dev/tags/claude), [#zig](https://daily.dev/tags/zig), [#bun](https://daily.dev/tags/bun)

[View this post on daily.dev](https://daily.dev/posts/the-great-bun-rewrite-azchqrili)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"The Great Bun Rewrite","url":"https://daily.dev/posts/the-great-bun-rewrite-azchqrili","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/the-great-bun-rewrite-azchqrili"},"datePublished":"2026-07-15T12:45:40.960Z","dateModified":"2026-09-14T08:15:03.962Z","description":"Bun's creator Jarred rewrote the JavaScript runtime from Zig to Rust in just 11 days using Claude AI agents, spending approximately $165,000 in API costs and...","image":"https://i.ytimg.com/vi/NgUNjjV_AkY/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/NgUNjjV_AkY/sddefault.jpg","isAccessibleForFree":true,"articleSection":"ThePrimeTime","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"ThePrimeTime","logo":"https://media.daily.dev/image/upload/s--J5-GjDeo--/f_auto/v1704628081/logos/primeagen.jpg","url":"https://daily.dev/sources/primeagen"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/the-great-bun-rewrite-azchqrili","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"rust,ai-coding,claude,zig,bun","timeRequired":"PT14M","video":{"@type":"VideoObject","name":"The Great Bun Rewrite","description":"Bun's creator Jarred rewrote the JavaScript runtime from Zig to Rust in just 11 days using Claude AI agents, spending approximately $165,000 in API costs and...","thumbnailUrl":"https://i.ytimg.com/vi/NgUNjjV_AkY/sddefault.jpg","uploadDate":"2026-07-15T12:45:40.960Z","duration":"PT14M","url":"https://api.daily.dev/r/AZcHQrILI","embedUrl":"https://www.youtube.com/embed/NgUNjjV_AkY"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"ThePrimeTime","item":"https://daily.dev/sources/primeagen"},{"@type":"ListItem","position":3,"name":"The Great Bun Rewrite"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/the-great-bun-rewrite-azchqrili#faq","mainEntity":[{"@type":"Question","name":"Why is Bun being rewritten from Zig to Rust instead of staying in Zig?","acceptedAnswer":{"@type":"Answer","text":"Bun's creator cited persistent memory-safety bugs in the Zig codebase, including use-after-free crashes, double-frees, memory leaks, and race conditions, stemming from mixing garbage-collected and manually managed memory. He argued that avoiding these bugs required strict style-guide discipline in Zig or C++, which relies on code review enforcement, whereas Rust enforces memory safety at the compiler level, removing the need for a style guide entirely. Developers weighing a language migration for memory safety can track how Bun's Rust rewrite plays out on daily.dev."}},{"@type":"Question","name":"How much did it cost and how long did it take to rewrite Bun from Zig to Rust using Claude?","acceptedAnswer":{"@type":"Answer","text":"The rewrite took 11 days and produced 6,502 commits totaling roughly 1.8 million lines written or rewritten. It consumed 690 million output tokens, 5.9 billion uncached input token reads, and 72 billion cached input token reads, costing approximately $165,000 in Claude API usage, using a pre-release version of Claude internally called Fable. Anyone estimating the real cost of AI-driven rewrites can compare notes on projects like Bun's via daily.dev."}},{"@type":"Question","name":"What review process did Bun's team use to fix errors during the Zig to Rust migration?","acceptedAnswer":{"@type":"Answer","text":"Each Zig file was translated to Rust by an agent, then two separate reviewer agents with no prior context were spawned to check the change set against the intended task, flag bugs, and give feedback, which was then applied. This task-review-fix loop ran repeatedly across parallel work trees to resolve roughly 16,000 compilation errors and get all unit tests passing before the rewrite was considered functional. Teams designing multi-agent review workflows for large refactors can pick up techniques like this through daily.dev."}}]}
```

