How Jarred Sumner Ships Millions of Lines of Agent-Written Code

AI Engineer 2026: Anthropic Talks
21 parts- 1Claude for Long-Horizon Tasks: Lance Martin's Four Rules for Agents That Run for Hours
- 2Inside the Claude Managed Agents Workshop: Pets, Cattle, Outcomes and Dreaming
- 3How Anthropic Builds: Mike Krieger on Being Unreasonable With Claude
- 4How Jarred Sumner Ships Millions of Lines of Agent-Written CodeCurrent
- 5A Field Guide to Fable: Thariq Shihipar on Unhobbling Claude and Finding Your Unknowns
- 6Claude Tag Lands 65% of Anthropic's Product PRs: Takeaways From Cat Wu and Thariq Shihipar
- 71,000 Claude Agents, Git and a Database: How Fable 5.2 Formalized Fermat Without a Custom Harness
- 8Your Old Prompts Are Making Claude Worse: Lance Martin's Checklist for Frontier Models
- 9Why One Agent Isn't Enough: Anthropic on Flows, UltraCode and Running 1,000 Agents
- 10Tokens Should Have Jobs: Anthropic's Case for Advisors, Graders and Dreamers
- 11Give the Agent a Budget, Not a Token: Anthropic's CI Team on Safe Agent Permissions
- 12Rethinking Claude Code Best Practices: Lydia Hallie on Getting Out of the Loop Safely
- 13How Anthropic Merges 30,000 Code Changes a Day: Addy Osmani on Verifying the Software Factory
- 14Using LLMs to Secure Source Code: Eugene Yan's Six-Step Pipeline From Anthropic
- 15From Messages API to Managed Agents: Anthropic's Applied AI Team on Harnesses That Go Stale
- 16Forward Deployed Engineering 101: When Your AI Startup Needs FDEs, From Palantir to Anthropic
- 17The Enterprise Tech Stack for AI Agents: Why Your POC Stalls and How to Design Past It
- 18The Claude Certified Architect Exam as a Field Guide to Agentic Engineering
- 19The Future of MCP: David Soria Parra on Connectivity, Progressive Discovery and Skills Over MCP
- 20Gateways Are All You Need: How Anthropic Thinks About MCP in the Enterprise
- 21How to Build Agents That Run for Hours: Anthropic's Planner, Generator and Evaluator Harness
TL;DR
Bun creator Jarred Sumner on building an ahead-of-time JavaScript compiler with Claude: five rewrites, 140 parallel agents, pre-existing tests as the only trusted oracle.
Jarred Sumner created Bun, the JavaScript runtime that powers Claude Code, and works at Anthropic. Over the summer of 2026 they led Bun's rewrite from Zig to Rust. In this AI Engineer talk they describe a project they call bigger than that one: an ahead-of-time (AOT) compiler for JavaScript and TypeScript, built mostly by Claude, that landed as a multi-million-line pull request.
It is a 22-minute talk and one of the most concrete accounts anywhere of what it takes to trust a very large amount of agent-written code.
Source: How to Ship Millions of Lines of Agent-Written Code, Jarred Sumner, AI Engineer. Performance figures below are as reported on stage; we have not benchmarked the canary build ourselves.
The Goal: Make Claude Code Lighter Without Rewriting It#
The opening prompt was simple: Claude Code needs to use much less memory and start faster, and we are allowed to modify either WebKit or Bun.
Sumner explains why the JIT is the target. In a typical JavaScript application, roughly half the CPU time goes to compiling code on demand. That, combined with single-threading, is why so many teams rewrite JavaScript tools in Rust or Go. An AOT compiler pays the compile cost once, ahead of time, instead of in every session. That matters a lot for something like Claude Code running many sessions at once.
Why not just rewrite Claude Code in Rust?#
The Bun team had just rewritten Bun in Rust, so the option was on the table. They said no, and the reason is the most important idea in the talk: Bun was an easy rewrite because its tests are written in a different language from the one it runs in.
Bun's tests are TypeScript, so the same suite could run against both the Zig and Rust builds. Claude Code's tests are also TypeScript, so a Rust port would mean porting the test suite too. And once you rewrite the tests, you can no longer trust them. So they made JavaScript faster instead. Our earlier case study of the Bun Rust rewrite covers the first project.
Verification Decides the Architecture#
Sumner's framing: on a project like this, how you will verify the code constrains everything, more than any choice about how to build it.
AOT compilation is close to an ideal agent problem because the oracle is so rich:
- Bun's existing test suite.
- WebKit's tests.
- Test262, the official ECMAScript conformance suite.
- Claude Code's own tests.
- Bun's test runner itself, run in AOT mode.
- Differential testing: run an application three ways (JIT, AOT, and AOT without types). If all three behave identically, it works for that application.
- Fuzzing: Claude writes code generators to fuzz different patterns, and the team extended Fuzzilli, the JavaScript engine fuzzer V8 uses, to cover TypeScript types.
The key property is that almost none of these tests were written for the project. They predate it, so the agent could not have bent them to pass. And they add a warning that applies to every agent-driven test effort: check that your tests actually catch bugs, because it is easy to fool yourself that they are finding problems when they are not.
%% title: Trusted oracles for agent-written compiler code
flowchart TD
C[AOT-compiled app]:::emphasis --> D{Same behavior?}
J[JIT run] --> D
U[AOT run without types] --> D
D --> T[Pre-existing suites: Bun, WebKit, Test262, Claude Code]
D --> F[Fuzzing with Fuzzilli and generated programs]One design detail: the compiler treats TypeScript types as predictions, not facts. Types can be wrong, so when it can prove a value is monomorphic it emits a direct field access, and otherwise it checks at runtime.
Five Rewrites in About a Month#
The compiler went through five versions in a bit over a month. The history is the best part of the talk because it shows where agent output goes wrong:
- Version 1 reused as much of JavaScriptCore as possible and was capped by it. Claude Code used about a gigabyte of memory.
- Version 2 added a TypeScript type checker into Bun (
bun check) and told Claude to use it. Startup got about 2x faster and memory about 3x lower, but the code was slop. Their example: any object accessing a property namedarchivewas assumed to possibly be theBun.archiveAPI. Not shippable. - Version 3 used about 140 agents in parallel to write all the code at once, then got Claude Code to run on it.
- Version 4 had good code and the same performance, but compiling Claude Code took about 50 seconds. JavaScript developers do not expect compile times at all.
- Version 5 had good code and builds under 20 seconds. It is the one shipping.
Two observations along the way:
- Claude loves writing markdown design docs. At one point it had around 1,500 of them. Nobody reads 1,500 design docs.
- When Claude sizes up whether an idea is worth pursuing, it can easily convince itself its measurements are good when they are not, and talk itself out of a promising idea. Sumner thinks several rejected ideas deserve another try.
Their conclusion: for a large project that has not shipped, rewriting is often easier than refactoring.
How the Work Is Organized#
The logistics differ by phase:
- Bulk-writing phase: many agents write lots of code at once, and you run one build at the end rather than letting every agent compile and chase build errors.
- Hardening phase: long-lived sub-agents that keep the relevant code in their context window and keep going. For the Rust rewrite they leaned on Claude Code workflows; with the latest models they mostly rely on long-lived sub-agents, which they find less wasteful.
- Visibility: an hourly scorecard posted to Slack comparing the current and previous values of the metrics they cared about, so regressions are obvious at a glance. If you are not actively re-measuring, they say, things get worse without anyone noticing.
What Does the Human Actually Do All Day?#
They showed their most-sent messages. The top one was "continue." Beyond that, their job was mostly asking leading questions:
- "Why are we doing this?" and "Can we do this?"
- "Can you do this faster?" and "What's taking so long?" because the model tends to talk itself into made-up rules.
- Pushing it to try harder, because left alone the model underestimates what it can do and settles for 0.1% improvements instead of 10%.
That matches what Mike Krieger said about being unreasonable with Claude. Ambition has to come from the human.
The Reported Results#
As presented in the talk:
- About 4x less memory and about 2x faster startup for Claude Code, being dogfooded internally.
- On JetStream 3, Bun's AOT output beat both JavaScriptCore's JIT and Node.js (V8) on most tests.
- A single-threaded program compiled with
bun compileran faster than the single-threaded build of TypeScript's Go port (TypeScript 7). - It is not always faster: code that leans on the interpreter (heavy
evalornew Function, as in the uglify-js benchmark) does not benefit. - Two breaking changes, both mostly security-driven: for example, the compiler bans assigning to
Object.prototype, which blocks a whole class of prototype pollution attacks and also helps performance.
They invited people to try it with bun upgrade --canary followed by bun compile. Check the Bun docs for current flags before relying on it.
Our Take#
The lesson that generalizes is not about compilers. It is this: the scale of agent-written code you can trust is bounded by the quality of an oracle the agent did not write. Projects with independent, pre-existing tests, a reference implementation to diff against, or a spec suite are where agent fleets shine. Projects where the agent must write its own tests are where they produce confident slop.
Before you point a fleet at a big change, ask two questions. What will tell us it works that the agents cannot edit? And how will we know if that check is quietly not catching anything?
FAQ#
What is Bun's ahead-of-time compiler?#
A compiler that turns JavaScript and TypeScript into native code before the program runs, instead of compiling on demand with a JIT. It uses TypeScript types as hints and falls back to runtime checks when they cannot be proven.
Why did Anthropic not rewrite Claude Code in Rust?#
Claude Code's tests are written in TypeScript, the same language as the code. A Rust port would have required rewriting the tests too, and rewritten tests cannot be trusted to verify the rewrite.
How many agents worked on the compiler?#
Sumner described one version where about 140 agents wrote code in parallel during the bulk-writing phase, followed by long-lived sub-agents for hardening.
Sources#
- How to Ship Millions of Lines of Agent-Written Code - video
- Bun documentation
- Test262 - the ECMAScript conformance suite
- Fuzzilli - JavaScript engine fuzzer
The Full Series#
This post is part of our coverage of Anthropic's talks at AI Engineer 2026:
- Claude for Long-Horizon Tasks: Lance Martin's Four Rules for Agents That Run for Hours
- Inside the Claude Managed Agents Workshop: Pets, Cattle, Outcomes and Dreaming
- How Anthropic Builds: Mike Krieger on Being Unreasonable With Claude
- A Field Guide to Fable: Thariq Shihipar on Unhobbling Claude and Finding Your Unknowns
- Claude Tag Lands 65% of Anthropic's Product PRs: Takeaways From Cat Wu and Thariq Shihipar
- 1,000 Claude Agents, Git and a Database: How Fable 5.2 Formalized Fermat Without a Custom Harness
- Your Old Prompts Are Making Claude Worse: Lance Martin's Checklist for Frontier Models
- Why One Agent Isn't Enough: Anthropic on Flows, UltraCode and Running 1,000 Agents
- Tokens Should Have Jobs: Anthropic's Case for Advisors, Graders and Dreamers
- Give the Agent a Budget, Not a Token: Anthropic's CI Team on Safe Agent Permissions
- Rethinking Claude Code Best Practices: Lydia Hallie on Getting Out of the Loop Safely
- How Anthropic Merges 30,000 Code Changes a Day: Addy Osmani on Verifying the Software Factory
- Using LLMs to Secure Source Code: Eugene Yan's Six-Step Pipeline From Anthropic
- From Messages API to Managed Agents: Anthropic's Applied AI Team on Harnesses That Go Stale
- Forward Deployed Engineering 101: When Your AI Startup Needs FDEs, From Palantir to Anthropic
- The Enterprise Tech Stack for AI Agents: Why Your POC Stalls and How to Design Past It
- The Claude Certified Architect Exam as a Field Guide to Agentic Engineering
- The Future of MCP: David Soria Parra on Connectivity, Progressive Discovery and Skills Over MCP
- Gateways Are All You Need: How Anthropic Thinks About MCP in the Enterprise
- How to Build Agents That Run for Hours: Anthropic's Planner, Generator and Evaluator Harness
Continue Reading#
Get the next deep dive like this in your inbox
One email a week on Anthropic and the rest of the AI dev stack. Free.
Read next on Claude Code
How Bun Coordinated 64 Concurrent Claude Agents to Port 535K Lines of Zig to Rust
How Bun ported 535K lines of Zig to Rust with up to 64 concurrent Claude agents: the workflow architecture, adversarial review gates and what the one human did.
11 min readBun Rewrites 535K Lines of Zig to Rust in 11 Days Using Claude
Bun rewrote 535K lines of Zig to Rust in 11 days with Claude. What the port fixed, what it cost, and what HN thinks it means for LLM-assisted code migration.
6 min readHow Anthropic Builds: Mike Krieger on Being Unreasonable With Claude
Instagram co-founder Mike Krieger on leaving the CPO job to build at Anthropic Labs, porting a Python codebase to TypeScript in a weekend, Claude Tag and avoiding burnout.
8 min readTechnical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.







