GitHub Let an AI Agent Rewrite 832,000 Lines of Its Own Product
GitHub just published a case study that's less "AI helped us code" and more "AI did the coding." Engineer Stephen Toub walked through how the team used a Copilot coding agent to migrate the entire Copilot agent runtime — the backend that powers Copilot itself — from TypeScript/Node.js to Rust. The result: 832,378 lines of production Rust, most of it written by the agent, shipped across 128 pull requests over roughly 14.5 weeks, with the product staying live and shipping the whole time.
That's not a demo. That's a real system, with real users, rewritten underneath itself while running.
Why Rewrite a Working System At All
Rewrites are usually the thing engineering teams avoid — they're expensive, risky, and famous for quietly turning into multi-year sinkholes. GitHub's motivation was performance and reliability at scale: Rust gives you stronger memory safety guarantees and tighter runtime performance than a Node.js service, which matters a lot when that service is answering coding-agent requests for millions of developers.
Normally a rewrite of this size is a multi-quarter, multi-team slog with a dedicated migration squad. GitHub's bet was that an agent could compress that timeline dramatically — not by cutting corners, but by handling the mechanical translation work at a scale and pace no human team could sustain.
How They Actually Did It
The key detail isn't "AI wrote code." It's how the migration was structured so an agent could do it safely:
- 128 incremental pull requests, not one giant cutover. Each PR was small enough to review, test, and merge into
mainindependently. - Continuous deployment throughout. The service kept shipping updates during the entire migration — there was no long-lived branch that had to be reconciled at the end.
- The agent did the bulk of the translation work — reading TypeScript logic, reproducing it faithfully in Rust, and adapting to the language's stricter type and memory model — while engineers reviewed, corrected, and steered.
That incremental structure is the actual innovation here. It's the difference between "we asked an AI to rewrite our app" (which usually ends badly) and "we broke a huge rewrite into hundreds of agent-sized, reviewable steps" (which is a workflow, not a gamble).
The Numbers That Matter
832,378 lines of Rust is a lot of code by any measure — more than most companies' entire codebases. Doing that in 14.5 weeks, while keeping a production service running and shipping, is the part worth sitting with. A team-driven rewrite at this scale would typically be measured in years, not months, and would usually require freezing feature work during the transition. GitHub didn't do either.
It's also a useful data point on what these agents are actually good at right now: large-scale, well-specified, mechanically verifiable translation work, done incrementally with human review gating every step. Not "replace the engineering team" — more like "remove the tedious 80% of a migration so the team can focus on the 20% that needs judgment."
The Catch — and Why It Still Counts
This wasn't a hands-off process. Every one of those 128 PRs went through human review. Engineers were steering architecture decisions, catching subtle translation errors, and deciding what "done" looked like. The agent did an enormous amount of the actual writing, but the team stayed in the loop the entire time.
That's not a knock on the result — it's the actual template. The interesting claim isn't "AI can rewrite your codebase unsupervised." It's "AI can carry the bulk of a huge, tedious migration if you structure the work into small, reviewable increments and keep a human in the approval seat." That's a much more useful and much more replicable lesson than a headline number.
What This Means If You Use OpenClaw
This is exactly the kind of task that agentic coding tools like OpenClaw are built for: large, well-defined, incremental work that benefits from an agent doing the heavy lifting while a human reviews and directs. The GitHub case study is a scaled-up version of the same pattern — break a big task into small agent-sized steps, keep humans reviewing at each checkpoint, and let the agent handle the volume.
You don't need an 832,000-line codebase to see the benefit. Whether it's migrating a smaller service, cleaning up technical debt, or working through a backlog of mechanical-but-tedious code changes, the same incremental, human-in-the-loop approach scales down just as well as it scaled up here.