The $165,000 AI Experiment That Rewrote the Rules of Coding
Imagine racking up a hypothetical $165,000 bill just by feeding prompts to an AI. For Jarred Sumner, that massive token usage—5.9 billion uncached inputs, 690...

Imagine racking up a hypothetical $165,000 bill just by feeding prompts to an AI. For Jarred Sumner, that massive token usage—5.9 billion uncached inputs, 690 million outputs, and 72 billion cached reads—wasn't a mistake. It was the price of doing the impossible: rewriting a massive software project from scratch in a matter of days.
In the software world, a complete ground-up rewrite is widely considered a fatal trap. Back in 2000, tech essayist Joel Spolsky famously warned developers that throwing away working code to start over is the single worst strategic mistake a project can make. But the rise of autonomous AI coding agents is forcing the industry to rewrite its own rules.
Sumner is the creator of Bun, a popular developer runtime originally written in a programming language called Zig. While Zig got the project off the ground, the software was plagued by complex memory management bugs—specifically, errors where the system would "forget to free" memory or try to use memory that had already been cleared. These crashes were keeping the creator awake at night. The solution was to switch to Rust, a language famous for its strict, built-in memory safety that turns these runtime crashes into simple compiler errors.
Historically, porting a million-line codebase to an entirely new language would take a dedicated team years. Using early versions of Anthropic’s Claude models, Sumner built a sophisticated "agentic" workflow to automate the translation. This wasn't a simple copy-paste job into a chatbot. It was a coordinated factory of AI agents conducting trial runs and adversarial code reviews.
The secret weapon that made this possible was a massive, pre-existing test suite. This acted as an automated quality assurance department. As the AI churned out new Rust code, the test suite instantly graded it. The most fascinating shift in this process was how debugging worked: when things went wrong, Sumner didn't manually fix the broken code. Instead, he tweaked the instructions given to the AI, fixing the process rather than the output.
After just 11 days of intense AI orchestration, the impossible was merged. The new Rust-based Bun added over a million lines of code and has been quietly running in production for nearly a month. The transition was so smooth that users barely noticed, save for a 10% faster startup time on Linux. In infrastructure software, being "boring" and unnoticed is the highest possible praise.
This experiment proves something profound. Choosing a foundational programming language used to be a permanent marriage; a one-way street. Today, frontier AI models have turned it into a reversible decision, unlocking a new era where rewriting the foundation of our digital infrastructure is no longer a developer's worst nightmare.
Key Points
- A complete codebase rewrite is traditionally considered a fatal mistake in software engineering.
- The Bun project used Claude AI agents to port over a million lines of code from Zig to Rust.
- The process relied on an automated test suite, shifting the human role from fixing code to fixing AI instructions.
- Frontier AI models are making foundational technology choices reversible for the first time.
Why It Matters
This case study demonstrates that AI is no longer just an autocomplete tool; it is a scalable workforce capable of executing massive architectural overhauls that were previously economically unfeasible.
Sources:
- Rewriting Bun in Rust — Simon Willison's Weblog
更多专栏

The Rise of the ChatGPT Flyer: AI's Awkward Physical Era
There is a specific visual signature taking over our physical world: a hyper-glo...

The Accidental Legacy of Apple's Cancelled Car
Long before generative AI became a daily buzzword, engineers at Apple were tryin...

Inside the AI Mind: Unlocking the Secrets of 'J-Space'
Every time you prompt an artificial intelligence, billions of calculations happe...