AI Software Factory: How Claude Code Helps Anthropic Migrate a Million Lines of Code to Rust in Weeks

AI Software Factory: How Claude Code Helps Anthropic Migrate a Million Lines of Code to Rust in Weeks

Rewriting a large codebase in a new programming language used to be an engineering nightmare, with some migrations taking up to four years because every line had to be rewritten by hand. Anthropic, the company behind Claude, just published how it uses Claude Code itself to do this kind of work in a matter of weeks, calling the process an "AI software factory." It is a notable story for anyone who codes with AI, because the approach Anthropic describes is one you can apply to your own, much smaller project too.

What actually happened

Anthropic shared details of two real cases:

  • Bun, a popular JavaScript runtime, was migrated from the Zig language to Rust. Jarred Sumner, Bun's co-founder and now a member of technical staff at Anthropic, said the team produced roughly a million lines of code in under two weeks, with 100% of Bun's existing test suite passing in CI before the code was merged.
  • An internal Anthropic system was migrated from Python to TypeScript by Mike Krieger, co-lead of Anthropic Labs, producing 165,000 lines of code over a single weekend.
  • Even the core infrastructure layer that runs Claude itself, called the "Claude Platform," is being gradually migrated from Python (chosen originally because it is familiar to AI researchers and convenient for fast iteration) to Rust (a language that runs faster and is safer with memory) using Claude Code.

The "software factory" runs on six steps

Instead of letting AI rewrite files freely and hoping for the best, Anthropic describes a disciplined six-step process:

  1. Build the foundations: write a "rulebook" for the conversion, a dependency map between parts of the code, and a list of spots that need real logic changes, not just syntax translation.
  2. Stress-test the rules on small samples: run the rules on a handful of small files first to catch serious problems before scaling up.
  3. Translate everything: multiple parallel AI "teams" do the work, using smaller, cheaper models to write the code and a larger model only to review it.
  4. Compile: run the compiler to surface errors, then let dedicated "fixer agents" resolve them one by one in a systematic way.
  5. Run smoke tests: quick checks to see whether the program runs at all and doesn't crash.
  6. Match behavior: compare the new code's behavior against the old codebase using the full test suite, to make sure the rewritten program behaves exactly like the original.

The core lesson: fix the process, not the code

The most memorable line from Anthropic's writeup is: "You don't fix the code. You fix the process (loop) that produced the code." Instead of manually patching every mistake the AI makes, the team goes back and refines the translation rules and verification steps, so the next pass across the whole codebase is automatically more accurate. That is why work that would normally take thousands of hours of manual fixing instead took a few weeks.

What this means if you vibe code

You don't need a million-line project to use this approach. If you use Claude Code or a similar AI coding tool on your own project, try:

  • Before asking AI to "rewrite everything," write a short summary of the rules it should follow first (naming conventions, which libraries are allowed, which parts must never change).
  • Try it on a small part of the project first to check whether the AI understood correctly, then expand to the rest.
  • Always end with an objective check (running existing tests, actually running the program) instead of just reading the code and trusting it looks right.

If you are new to this tool, our guide on what Claude Code is and how to install and use it from A to Z is a good place to start, and using Claude Code to understand an unfamiliar codebase in 20 minutes is a smaller first step before attempting a big migration like Anthropic's.

Limits to keep in mind

  • This is Anthropic, the company that makes Claude, describing its own product's results, so treat it as a useful account of a method rather than independently verified research.
  • Both examples were carried out by experienced engineering teams who already had full test suites to check against. If your project has no tests, it is much harder to know whether AI-migrated code is actually correct.
  • The six-step process still requires humans to write the initial rulebook and review the early steps. This is not a one-click, fully autonomous process; it still needs someone who understands both the old codebase and the new language.

If you want to understand why AI agents tend to make more mistakes the longer they work on a large codebase, our article on what context rot is and why AI agents get worse the longer they code explains it well, and what agentic coding is and how it differs from vibe coding helps you tell this disciplined approach apart from more freeform "vibe coding."

FAQ

Does Claude Code migrate code automatically without any human oversight? No. Humans still have to write the initial conversion rulebook, test it on small samples, and review the early steps. AI handles the large-scale repetitive work, while humans set the direction and check the results.

What does "AI software factory" mean? It refers to a process where multiple AI "teams" run in parallel, each handling one part of the job (translating code, compiling, fixing errors, testing), following standardized steps instead of working freely.

Why is Anthropic migrating the Claude Platform from Python to Rust? Python was originally chosen because it is familiar to AI researchers and good for fast iteration. At large scale, Rust runs faster and is safer with memory, even though writing it takes more effort upfront than Python.

Can a beginner programmer use this approach? You can learn the principle of "write the rules first, test on a small scale, always verify with an objective tool." But it is best to start small, using Claude Code on a single file or feature, before thinking about migrating an entire large project.

Are there other tools besides Claude Code that can do something similar? The general approach (a multi-step process, multiple agents, always ending with an objective check) can be applied with various AI coding tools. Anthropic describes how it specifically used Claude Code, but the lesson of fixing the process rather than individual lines of code is broadly useful.

More articles