Jarred Sumner created Bun, the JavaScript runtime Claude Code runs on, and now works at Anthropic. His AI Engineer Code Summit keynote is about one project: an ahead-of-time (AoT) compiler for TypeScript and JavaScript, built mostly by Claude over 46 days, which makes Claude Code start 2.2x faster and use 4.4x less memory. The compiler went through five complete rewrites, and the diff reads +14.7 million / −10.2 million lines. The interesting part isn’t the size. It’s how he decided he could trust it, and the answer is almost entirely about tests that predate the project.
The prompt and the agent count #

The opening prompt, shown verbatim on a slide, asked Claude to build sound types and AoT into Bun and WebKit, give Claude Code Go-like performance and memory usage, modify WebKit freely, and “be ambitious”. Over the project that turned into 28,547 agent sessions, which the slide plots as dots coloured by which of the five compilers they worked on.
Sumner’s framing for everything that follows:
“The approach you go with for how to build it is entirely driven by how do you verify that it actually is going to work and not be buggy and that you can trust it.”
Why JavaScript is slow, and why not rewrite Claude Code in Rust #

His diagnosis has two parts. In a typical JavaScript app, the JIT spends roughly half the CPU time compiling code on demand (47% on his TypeScript type-checking measurement), and the program runs on one thread out of sixteen. Rewrites to Rust or Go mostly win on those two things. For Claude Code in the cloud, every session pays the same compile cost again: 430 ms and 158 MB just to start.
The team had just rewritten Bun itself from Zig to Rust in 11 days, so a Claude Code rewrite was on the table. They didn’t do it, and the reason is the core of the talk. Bun’s tests spawn the bun binary and check its behaviour, so the same TypeScript test suite runs unchanged against the Zig and Rust builds. Claude Code’s tests import its own source modules, so none of them can run against a Rust version. You’d have to port the tests too, and “as soon as you’re rewriting the tests, you can’t really trust the tests anymore.” So they made JavaScript faster instead.

The result: startup 430 ms → 194 ms, memory 158 MB → 36 MB, CPU time 1.82 s → 0.63 s, and 4.2x fewer instructions. A separate slide shows TypeScript 6 compiled with bun compile type-checking the Effect codebase single-threaded in 4.2 s, faster than the hand-written TypeScript 7 Go port on one thread (4.8 s), though the Go port still wins with all threads (2.4 s).
One design choice matters for correctness. TypeScript types can be wrong at runtime (double(JSON.parse('"3"')) passes a string to a number parameter), so the compiler treats types as predictions. Types only affect performance, never output.
Tests the agent couldn’t have touched #

“Models are really good at writing compilers, because compilers are really easy to test.”
The verification stack has no tests written for the project at its base. Claude Code’s 560,000 tests, test262’s 53,578, WebKit’s 11,852, and the Bun and Node.js test files all existed before the compiler did, so an agent couldn’t have bent them to fit. The slide shows 62,858 of them giving the same result as the JIT, about 2,300 refused (mostly tests that modify a built-in object, one of two deliberate breaking changes), and 11 different.

The second layer is differential testing. Run any program three ways (JIT, AoT, and AoT with the types stripped) and the outputs must match. CI runs 18,454 programs like this on every pull request. Because any program works as a test, Claude can write generators that produce more of them.

That’s where most bugs were found: 352 generators producing 49 million programs in five days, with names like arrays-shifted-during-gc and callee-reassigned-during-call, plus Google’s Fuzzilli extended to emit TypeScript types. He also tested the testers. Given 31 programs the compiler was known to get wrong, the fuzzer found 27 on its own, but only 12 when run with a test runner compiled into the executable, because the compiler optimises less when there’s more code around. His warning is that it’s easy to convince yourself a fuzzer is finding bugs when it isn’t.
Five compilers in 46 days #

Each rewrite has a one-line obituary on this slide:
- Compiling from bytecode: Claude Code used 1 GB (it was 330 MB) and types didn’t help.
- Their own type inference: wrong within a day.
- Using the TypeScript type checker: 2.2x faster startup and 3.4x less memory, but the code was slop.
- Whole-program analysis, about 60 passes: 2.3x faster startup and 4.2x less memory, but compiling Claude Code took around 50 s when earlier versions took 10 to 20 s.
- “One walk”: still here, under 20 s to build, shipping in Bun 1.5.
The slop in compiler 3 is concrete. The --trim feature decided whether a program used Bun.Archive by doing a text search over property names, so any object with a property called archive kept the API in the binary. Sumner’s reaction in the Claude Code session, shown on screen, is “omfg”, followed by 127,553 deleted lines. A different session shows Claude planning about 7,600 markdown design docs; he talked it down to 1,500 and still thinks that’s too many.
His lesson from compilers 4 and 5 is that it’s easier to rewrite an unshipped project than refactor it, and that when the rewrite came out bigger, he had to ask whether the design was actually different “or did we just write a crap ton of code for no reason?”
How the work was organised #

He describes three modes. Large structured batches come first: write all the code at once with exactly one build at the end, because building as you go means everyone waits on compile errors. Compiler 3 was written in one night by 140 agents, each owning one file from a design doc that had been through adversarial review, about 400,000 lines in total. Then comes long-running continuous work, with many builds and many experiments. The slide counts 551 ideas that worked, 1,364 that didn’t help, and 3,277 rejected before anyone built them.
His working style changed with the models. On Opus 4.5 through 4.8 he used dynamic workflows with a fresh agent for each research, plan, write, review and benchmark step. With Opus 5.5 and Fable 5.2 he mostly runs long-lived subagents, one per idea, for days, because they keep the relevant code in context and waste less. He’s unsure the 3,277 rejections were right: Claude sizes up an idea before trying it, and he thinks it often talks itself out of good ones.

The third mode is keeping track. A Claude Code /loop 1h posts the same scorecard to Slack every hour, same rows in the same order, so a regression is visible at a glance: Claude Code startup, CPU and memory, OpenClaw startup, OpenCode first frame, TypeScript type-check time.
What he actually typed over 46 days, about 5,500 messages: “continue” 34 times, “how’s” 32, “commit” 9, “laptop died please resume” 3. The rest were leading questions (“why are we doing this through bytecode?”, “why are we measuring…?”), each of which led to a new compiler, and pushes for ambition. One on-screen message reads “I don’t think you’re being nearly ambitious enough.” Without that, he says, the model drifts toward 0.1% improvements instead of 10% ones.
Results and limits #
On JetStream 3, bun compile beats both Bun’s JIT and Node.js on 52 of 62 benchmarks, about 1.6x faster than the JIT overall. Command-line tools run up to 2x faster than Node, with Prettier on a single file 6.1x faster. Code that leans on eval or new Function falls back to the interpreter and is slower (uglify-js is the visible outlier), and Object.prototype can’t be modified, which blocks prototype-pollution attacks and also helps performance. Throughout the project, Claude Code was building the compiler that compiles Claude Code, running on a build of itself.

Key takeaways #
- Choose the project shape by how you’ll verify it. Bun could be rewritten in Rust because its tests run the binary; Claude Code couldn’t, because its tests import source.
- Trust tests that predate the agent’s work. A suite the agent had to write or port can’t vouch for the agent.
- Differential testing turns every program into a test case. JIT vs AoT vs AoT-without-types must agree, and that’s cheap to fuzz at the scale of tens of millions of programs.
- Test your tests. Seed known bugs and check the fuzzer finds them, under the same conditions it runs in production.
- Passing tests says nothing about design quality. Compiler 3 passed and was still slop; reading the code is what caught it.
- Batch the initial write with one build at the end, then switch to long-lived subagents for iterative work.
- Post the same metrics in the same order on a fixed schedule; whatever isn’t re-measured regresses.
- Push the model to be ambitious and ask why it’s doing things. Left alone, it settles on small wins and invented constraints.
Source #
- Talk: “How do you trust millions of lines of code? Building a JavaScript compiler with Claude”
- Speaker: Jarred Sumner, founder of Bun, Anthropic
- Event: AI Engineer Code Summit (keynote), uploaded November 24, 2026
- Duration: 22 minutes
- Try it:
bun upgrade --canarythenbun compile app.ts - Video: https://www.youtube.com/watch?v=TvsF67C2F54