In September 2026, GitHub did something that would have sounded like science fiction a few years ago: it rewrote over 800,000 lines of its own Copilot AI assistant's runtime code — from TypeScript and Node.js into Rust — using Copilot itself to write most of the replacement code.
The results were staggering. Startup time dropped from 5.25 seconds to 292 milliseconds. Memory usage fell from 1,383MB to 126MB — a more than ten-fold reduction. And by GitHub's own benchmarks, processing performance improved by roughly 15.9 times.
How It Actually Worked
The migration took approximately 14.5 weeks and was completed through 128 pull requests — all while GitHub continued shipping new Copilot features. The final production codebase ended up at 832,378 lines of Rust, plus another 468,689 lines of Rust unit tests.
The process wasn't a one-shot AI dump. Engineers used Copilot agents to generate Rust code from TypeScript, then had separate AI reviewer subagents compare each PR's new Rust against the original TypeScript, running on three different models. Human engineers reviewed the output and caught regressions. The team maintained a compatibility shim of over 2,019 N-API exports throughout the transition so nothing broke for users while the switch-over happened incrementally.
The Cost: About $120,000 in Tokens
Secondary analyses put the AI token cost at roughly $120,000 for the entire project. Against the engineering hours a manual rewrite at that scale would have demanded, that figure is remarkably low — though the human review and coordination work was still substantial.
The initial scope was estimated at around 130,000 lines of TypeScript. In practice, the real codebase turned out to be closer to 430,000 lines of production TypeScript flowing through the migration — more than three times the original estimate, which is itself a useful reminder that large-scale migration estimates almost always undercount.
Why Rust? Why Now?
The choice of Rust over alternatives like Go or C++ reflects where performance-sensitive systems programming is heading. Rust offers memory safety without garbage collection — meaning no GC pauses, which directly benefits a low-latency tool like Copilot that must respond to keystrokes in real time. The memory drop from 1.3GB to 126MB is particularly significant: it means Copilot now has a far lighter footprint in IDE processes and on servers handling simultaneous sessions.
The broader implication is as significant as the technical achievement: AI tools are now being used to complete the kind of large-scale, tedious refactoring work that was previously bottlenecked by engineering capacity. The fact that Copilot rewrote Copilot has a recursive quality to it, but also a practical one — it validates AI-assisted migration as a real engineering strategy, not just a demo.
What It Means for Teams Considering Big Rewrites
For engineering teams sitting on legacy TypeScript or Node.js codebases that they've wanted to migrate but couldn't justify the cost, this case study changes the math considerably. A 14.5-week timeline with AI-generated code and a $120,000 token budget, delivering a 15.9x performance improvement, is a compelling argument for re-evaluating projects that previously seemed too expensive to touch.
Whether the AI-agent-assisted approach generalizes well to codebases with more domain complexity or weaker test coverage remains an open question — GitHub's codebase has unusually strong tooling and test infrastructure. But as a proof-of-concept for what's now possible, the GitHub Copilot Rust migration sets a high watermark for AI-assisted software engineering in 2026.