Anthropic details large-scale code migrations with Claude Code, including a 1M-line Zig-to-Rust port of Bun
Anthropic published a case-study blog post on July 16, 2026 walking through how large codebase migrations can be run end-to-end with Claude Code and agentic loops, headlined by a roughly 1-million-line migration of the Bun JavaScript runtime from Zig to Rust completed in under two weeks.
What's new
The post lays out concrete results from two migrations run with Claude Code:
- Bun (Zig to Rust): approximately 1 million lines of code migrated in under two weeks. The full existing test suite passed before the migration was merged, with 19 post-merge regressions surfaced and fixed afterward. Anthropic reports the resulting Rust binary was 19% smaller, 2-5% faster, and had a 6x faster startup time than the Zig original.
- Python-to-TypeScript port: roughly 165,000 lines of code migrated over a single weekend.
- Cost: Anthropic states the Bun migration consumed about $165,000 in API tokens, broken out as 5.9 billion input tokens and 690 million output tokens.
The central argument of the post is about process rather than one-off prompting. As Anthropic put it: "The core insight is that you don't fix the code. You fix the process (loop) that produced the code." The approach treats a migration as a repeatable, self-correcting loop — write code, run the test suite, diagnose failures, fix, repeat — rather than a single large generation task, which is what let the agent sustain accuracy across a million-line codebase.
Context
Code migrations (language ports, framework upgrades, dependency modernization) are traditionally slow, manual, and risky precisely because they touch enormous surface area with low tolerance for regressions. Anthropic has spent much of 2026 pushing Claude Code from a single-session coding assistant toward a platform for long-running, largely autonomous engineering work — including prior investments in extended agent sessions, orchestration of parallel subagents, and enterprise-grade agent tooling. This post is best read as evidence for that trajectory: rather than a new product feature, it's a demonstration that current-generation Claude Code, run as a disciplined test-and-repair loop, can now handle migration workloads that were previously considered too large or too risky to hand to an AI agent.
Why it matters
If the reported numbers hold up under scrutiny, they reset expectations for what AI-assisted migrations can realistically take on. A million-line rewrite finishing in under two weeks, with the existing test suite as the acceptance bar, is a meaningfully different claim than typical "AI helped refactor a module" case studies — both in scale and in the explicit cost accounting ($165,000 in tokens is a real, comparable number against engineering-hours cost of a manual migration of similar scope). For engineering leaders evaluating whether to greenlight AI-driven modernization projects, the framing Anthropic offers — invest in the loop and verification harness rather than the individual edits — is arguably the more durable takeaway than the specific benchmark numbers, since it describes a repeatable method rather than a one-time result.