HomeArticle

Burned $160,000, wrote 1 million lines of code at a frantic pace, the father of Bun rewrote the underlying layer with Claude

新智元2026-07-17 16:10
Creator of Bun: Making AI Rewrite Millions of Lines of Code

A project that once required 4 years of development was compressed to just two weeks by Claude Code!

Costs were slashed from $3 million to just over $100,000.

Recently, Anthropic publicly disclosed the "full workflow" of large-scale CC code migration for the first time, with a six-step framework that stunned the entire tech industry.

The protagonist of this story is Jarred Sumner, the father of Bun.

He spent a year writing Bun, a JavaScript runtime faster than Node.js.

Now, in less than two weeks, he rapidly migrated a million lines of code, switching the underlying language from Zig to Rust.

The Creator of Bun Let AI Rewrite a Million Lines of Code

Back then, Jarred Sumner's reason for betting on Zig was straightforward: to achieve performance comparable to C through extreme simplicity.

It was almost a purpose-built tool tailored for independent founders.

In his own words, "Before the advent of LLMs, one person could write Bun in a small apartment in Auckland within a year."

However, the flip side of extreme simplicity was countless hidden pitfalls planted early on.

Today, Bun's CLI monthly downloads have strongly exceeded 10 million, and it has even become a heavy underlying dependency for CC.

As the ecosystem expands rapidly, the "technical debt" accumulated over the years has reached a point where it must be repaid with interest.

So he did something he once could not have imagined: using Claude Code to migrate the entire Bun from Zig to Rust, which offers better memory safety.

In less than two weeks, a million lines of code were produced.

Before the merge, all existing test cases for Bun passed 100% in CI. After the merge, 19 regressions emerged, all of which have now been fully fixed. The Rust version was quietly launched with Claude Code in June.

This migration consumed 5.9 billion input tokens and 690 million output tokens, which is approximately $165,000 based on API pricing.

That doesn't sound cheap, but compared to the old ledger of 4 years and $3 million, this cost is extremely cost-effective.

One Python Library Transformed Into 165,000 Lines of TS

Jarred Sumner is not the only one using CC as an efficiency engine.

Mike Krieger, co-head of Anthropic Labs and co-founder of Instagram, has an even more representative story.

Over one weekend, he migrated a Python codebase to 165,000 lines of TypeScript, with the main part consuming approximately 27 million tokens.

Hundreds of agents, 8 checkpoints, and 3 rounds of adversarial reviews were deployed, followed by a consistency check that compared the output of every command one by one with the original Python version, fixing any behavioral discrepancy as a bug.

He even had Claude design an end-to-end test suite, running it nonstop for four nights to catch those unforeseen edge cases no one could have anticipated.

Why was this migration necessary?

His team's internal tools needed to be packaged into a single binary for delivery to users.

With the Python toolchain, compilation for each platform took 8 minutes, and the entire build matrix required half an hour of waiting per release.

After the migration, the same compilation takes only 2 seconds, the binary starts 6 times faster, and an entire deployment pipeline was retired in the process.

Don't Fix the Code — The Six-Step Core Framework

So what is the essence of this methodology?

Anthropic summed it up in one sentence: instead of fixing the code, you should fix the loop that produces the code.

Large-scale migrations are particularly suitable for AI processing, for a simple reason —

The work is inherently parallelizable, with thousands of files being processed simultaneously;

The legacy code itself serves as the best specification;

The test suite acts as a ready-made arbiter;

Whenever compilation or testing fails, the next pending task automatically emerges.

The model can work tirelessly against this "objective truth" for days, with no human intervention required for arbitration.

Thus, Anthropic presents a reusable six-step framework: first set up the arbiter, write the rulebook, map the dependency graph, and create a gap list.

Then conduct a small-scale "trial run" to stress-test the rules, identifying critical issues before scaling to thousands of files.

After that, proceed with full translation, running the multi-agent "implementation — review — fix" loop; finally compile, execute, and compare behaviors one by one.

Throughout the entire process, rules are never manually patched:

Every time a reviewer identifies an error, a new rule is added to the rulebook, and the affected batch of files is regenerated.

Anthropic's final suggestion is: pick a codebase you've been putting up with for far too long, and ask Claude what its migration workflow would look like.

Four years ago, that would have been a joke. Today, it's a check that can actually be cashed.

In the past, code migration was an insurmountable chasm for developers; now, it's just a progress bar waiting to be filled.

This article is from the WeChat public account "AI Era", author: ASI Revelations, published with authorization from 36Kr.