Rewriting Bun In Rust

Founder-stage talk reconstruction from IMG_7475 through IMG_7490.

15:30 - 16:00 Jarred Sumner / Anthropic Founder stage IMG_7475 to IMG_7490

Index

This page reconstructs the readable content from the available photos. Original images are appended beneath each section and can be clicked to expand.

Session Frame

Source: session page

The official session description says Jarred Sumner, creator of Bun, walks through why and how the team rewrote Bun to Rust using dynamic workflows in Claude Code.

Original Code w/ Claude session page

Problem: Rust Demands Structure The Old Code Never Had

Source: IMG_7475

A strict dependency order between ~100 crates

Five years of Zig and C++ had none.

Classify every cyclical dependency

Delete it, move the code, or restructure.

Problem: Rust Has Lifetimes, Zig Does Not

Source: IMG_7476

Use a workflow to read every file and figure out lifetimes up front.

Who creates it?

Who frees it?

Can it outlive its owner?

One Loop, Four Phases

Source: IMG_7477

  1. Generate.
  2. Adversarial review.
  3. Apply fixes.
  4. Count what is left until zero.

Each phase zooms out and groups work its own way:

PhaseScope
Phase 1Files x 1,300
Phase 2Crates x ~100
Phase 3Binary x 1
Phase 4Behavior x 4,174 tests

Ground rule: the old code never leaves. Every original file stays beside its translation as the spec.

Adversarial Review

Source: IMG_7478

2+ adversarial reviewers for every change

Author and reviewer: separate context windows

A fresh reviewer cannot be talked into the author's justifications.

Instruction

Assume it is wrong. Only report what you can prove.

Spend the tokens. It is worth it.

Maximize Throughput

Source: IMG_7479

16 agents x 4 worktrees = 64 Claudes

Ban Git

One reset in a shared tree equals 16x slowdown.

Ban cargo, ban slow commands

Own checkout, build, memory budget per worktree.

cgroups is good

Translate All 1,300 Files, All At Once

Source: IMG_7480

For each file:

  1. Write the .rs file.
  2. Run two adversarial reviews against the original and the rules.
  3. Apply fixes.

None of it has to work yet.

Fix All Compiler Errors, All At Once

Source: IMG_7481

Each round:

  1. Build once per round: the only compile.
  2. Split errors by file.
  3. Run 30 fixers in parallel with no compiler access.
  4. Commit.
  5. Next build grades everyone and loops.

Make It Run

Source: IMG_7482

Many failures, few causes. Dedupe before you assign agents, or pay 4x for the same fix.

  1. Build.
  2. Run 15 smoke tests.
  3. Dedupe crashes by location.
  4. Assign one agent per crash.
  5. Loop.

Slide aside: the day console.log(1) printed 1 was a very good day.

Fix The Process That Generates The Code

Source: IMG_7483

Do not fix the code. Fix the process that generates the code.

  1. Sample some of the results.
  2. Edit prompts to handle things that went wrong.
  3. Regenerate the code.

Round 1's Postmortem Is Round 2's Prompt

Source: IMG_7484

Round 1 postmortemRound 2 prompt carry-forward
Converted only 9% - agents played it safe.Converted only 9% - agents played it safe.
A pattern that moves memory C still points at.A pattern that moves memory C still points at.
Re-discovered settled findings.Re-discovered settled findings.
Linux-only checks shipped a macOS break.Linux-only checks shipped a macOS break.

Even The Reviewers Get Reviewed

Source: IMG_7485

Hallucinated bugs

Solo findings default to "not confirmed".

Over-correction

Itself a named, rejectable finding.

Laundering

"Did the hazard go away, or just move?"

Never take one agent's word for it, including the skeptics.

It Works

Sources: IMG_7486, IMG_7487

+1,009,257 lines. And it works.

11 days

May 3 -> merged May 14

6,778

commits

0

tests skipped or deleted

PlatformExpect() callsTestsFiles
Debian 13 x641,386,82660,6244,174
macOS 14 arm641,259,95358,8504,175
Windows 2019 x641,007,54457,3374,173

The team kept going: 10 rounds of fixes from Claude Security, 24/7 coverage-guided fuzzing of all 14 parsers, every LeakSanitizer-detectable memory leak fixed, plus a Windows bug hunt and an audit of every Rust-C boundary.

What 1.39M Assertions Missed

Source: IMG_7488

JavaScript tests cannot see Rust-level mistakes

13,000+ uses of the unsafe escape hatch

Untested corners are untranslated corners

Every gap the test suite had became a bug the team shipped.

Rewrites Make Sense Now

Source: IMG_7489

1 team x 1 year

The old price.

1 engineer x 11 days

The price with Claude Code workflows.

Large Rewrites With Claude Code

Source: IMG_7490

Most of the human job during those 11 days: reading code, reading reviews, and waiting.

  1. Get an independent judge: a test suite that does not care how the code is written.
  2. Write the rules.
  3. Bound every task and regroup the work at each phase.
  4. Review adversarially, then sample.
  5. Fix the instructions, not the code; regenerate.
  6. Loop until a number is zero.