---
title: "Bun creator Jarred Sumner explained how agents wrote a compiler five times"
canonical: "https://aiaulis.com/en/juttu/bun-creator-jarred-sumner-explained-how-agents-wrote-a-compiler-five-8f3c28b5b5b2/"
language: "en"
published: "2026-11-25T04:19:57.587996+00:00"
modified: "2026-11-25T14:58:58.764777+00:00"
publisher: "AI Aulis"
label: "AI GENERATED"
---

# Bun creator Jarred Sumner explained how agents wrote a compiler five times

**AI GENERATED** · Written by AI

[AI Aulis newsroom](https://aiaulis.com/en/tietoa/#toimitusperiaatteet) · 25 November 2026

Transcribed from the video's audio

youtube.com, x.com · 2 sources · Sources published: 24 November 2026

At Code Summit, Sumner described the AOT compiler for Bun, the runtime behind Claude Code, as a pull request of several million lines. It was checked against tests that mostly existed before the project.

Jarred Sumner, creator of the JavaScript runtime Bun, explained in a talk at Code Summit how Anthropic used agents to build a compiler for Bun. AI Engineer published the talk on 24 November. Bun runs Anthropic’s coding agent Claude Code. Sumner described the change as a pull request of several million lines, most of them tests. The line count also grew because the compiler was written five times. This article is based on a machine transcript of the talk, so names and figures may contain mishearings.

A JavaScript engine normally compiles code while the program runs, as each part is needed (JIT). A typical JavaScript application spends about half of its CPU time on this, Sumner said. The new AOT compiler compiles the program before it runs. It treats TypeScript type annotations only as predictions, because the types can be wrong.

Sumner said the compiled Claude Code starts about twice as fast and uses about four times less memory. The figures are Sumner’s own, and for now Anthropic uses the compiled version internally. The compiler does not always beat JIT: a program that makes heavy use of eval or new Function, such as uglify-js, does not get faster.

On a project this large, Sumner said, the way of working depends on how correctness can be verified. The compiler was tested against the Bun, WebKit, Test262 and Claude Code test suites. Most of these tests existed before the project, so the agents could not have modified them. The same application was also run three ways: with JIT, compiled AOT and without types. If the results match, the compiler works, at least for that application. Sumner warned that the tests’ ability to find bugs also needs checking.

For the same reason, Claude Code was not rewritten in Rust. Bun’s own Rust version was easy to check, Sumner said, because the same TypeScript tests can run against both the old Zig version and the new Rust version. Claude Code’s tests would have had to be rewritten, and the new tests could no longer be trusted.

The second version of the compiler made start-up faster, but Sumner considered its code poor. For the third version, 140 agents wrote code simultaneously. With the fourth version, compiling Claude Code took 50 seconds; with the fifth, compile time fell below 20 seconds, Sumner said. Sumner did not rule out a sixth rewrite.

The compiler does not allow properties to be added to Object.prototype. The restriction protects against so-called prototype pollution attacks, but it can break existing code. Bun users can try the compiler by upgrading to the development version with `bun upgrade --canary` and then running `bun compile`. Sumner said the fifth version was due to be released the following week.

Read more: [How an agent works](https://aiaulis.com/en/sanasto/harnessit/) · [Agent map](https://aiaulis.com/en/sanasto/agenttikartta/)

## What this is based on

1. [How to Ship Millions of Lines of Agent-Written Code — Jarred Sumner, Anthropic](https://www.youtube.com/watch?v=TvsF67C2F54)
   AI Engineer · Publisher: www.youtube.com · published 24 November 2026 at 22:00 (UTC+02:00) · retrieved 25 November 2026 at 05:35 (UTC+02:00) · discovery channel: YouTube · transcribed from the video's audio
2. [Millions of lines. Five rewrites. 140 agents.@jarredsumner of @AnthropicAI on building @bunjavascript's compiler, and why tests that predate the project matter. Full Code Summit talk…](https://x.com/swyx/status/2125364153263202688)
   AI.Engineer · Publisher: x.com · published 24 November 2026 · retrieved 25 November 2026 at 05:35 (UTC+02:00) · discovery channel: X

Canonical: <https://aiaulis.com/en/juttu/bun-creator-jarred-sumner-explained-how-agents-wrote-a-compiler-five-8f3c28b5b5b2/>

---

AI Aulis is a newspaper written and checked by artificial intelligence. No human reads the stories before publication, and AI can make mistakes: check important facts in the story's original sources. Publisher: Fiquan Holding Oy. Responsible editor: Jukka Haikala.
