deniz.in

Markets

Weather

Loading weather

· via GitHub Blog

GitHub rewrites 800,000-line Copilot runtime in Rust, with AI agents doing most of the work

GitHub says AI agents wrote most of the code as it moved its Copilot agent runtime from TypeScript and Node.js to more than 800,000 lines of production Rust, landing through 128 incrementally shipped pull requests.

GitHub rewrites 800,000-line Copilot runtime in Rust, with AI agents doing most of the work

An 800,000-line rewrite, mostly written by agents

GitHub has completely rewritten the Copilot agent runtime — the component behind the Copilot CLI, the Copilot app and the GitHub Copilot SDK — into more than 800,000 lines of production Rust, and according to the GitHub Blog, AI agents wrote most of the code. The work landed through 128 pull requests merged to main and shipped incrementally rather than waiting on a single cutover date.

The runtime began life in TypeScript on Node.js and the V8 engine, built for what is now the GitHub Copilot cloud agent (CCA), and stayed on that stack as its responsibilities grew. GitHub says the few regressions that appeared during the port were caught and fixed quickly, and that runtime performance improved by orders of magnitude along the way. The company frames the effort as something that would have occupied a full team for a year or two in the pre-agent era, yet was completed primarily by a single developer in a few months while the rest of the team kept expanding the runtime.

Why the old architecture stopped scaling

The runtime is not just the CLI's engine. The post notes that it backs a widening set of products — VS Code, Visual Studio, CCA, Copilot Code Review, Copilot Cowork, Copilot Studio, and Copilot features in Excel, Outlook, PowerPoint and Word — most of which first implemented their own agent loops and have since adopted the Copilot SDK so a fix in one place reaches all of them.

The CLI was originally a terminal UI built with Ink and React wrapped around an agent loop, and the two layers were never cleanly separated. When an SDK became necessary, the pragmatic shortcut was to layer it on top of the CLI: the SDK launched the CLI as a headless child process and marshalled calls over JSON-RPC.

That carried real costs. Every CopilotClient meant booting a second process running Node and V8 — parsing JavaScript, warming up JIT tiers and carrying V8's memory footprint, roughly 100 MB of working set at a minimum. Each of the six language SDKs (C#, TypeScript, Python, Rust, Go and Java) paid for a second language runtime its host application had no other use for. Every event, message and virtualized filesystem operation crossed a process boundary, a Node crash took the session down with it, and operators were left supervising two processes.

Why Rust, specifically

GitHub's requirements for the replacement were exacting: no TUI baked in, minimal dependencies and overhead, in-process embedding instead of out-of-process execution, strong performance and reliability, clean FFI interop for the six SDK languages, and a toolchain with a smaller supply-chain attack surface and stronger compile-time correctness guarantees.

Rust fit those constraints, but the post is careful to say this is not a blanket verdict against TypeScript. The deciding factors were C-ABI embedding, low startup and steady-state overhead, and predictable resource use, and the right target language varies by application. Rust also brought complications: lifetimes and shared state had to be modeled explicitly, and the post points to lifecycle regressions during the project as evidence of what that costs in practice.

How the port was run

Beyond the language swap, the team's first structural task was separating TUI-specific code from the runtime so that interface layers sit strictly on top of the SDK's public surface instead of being interleaved with it.

The delivery model may be the most instructive part: 128 pull requests landed in main and shipped as they went, with regressions found and fixed in flight rather than deferred to a final switchover.

Why it matters

This is one of the larger publicly documented production rewrites in which AI agents authored most of the code, directed by effectively one developer. GitHub's own framing is that a rewrite at this scale only became affordable once agents existed. If that holds beyond this showcase, the economics of rewriting versus maintaining shift for a lot of legacy codebases.

The delivery pattern matters as much as the tooling. Incremental pull requests shipped to production beat a long-running parallel branch, and regressions surfaced while each change was still small.

Caveats apply: the post doubles as a showcase for Copilot itself, and it does not claim the agents worked unattended — most, not all, of the code was agent-written, with a human developer driving the effort. As an existence proof for agent-assisted rewrites at scale, and as a case study in why embedding Node and V8 underneath an SDK was the real problem being solved, it is a data point engineers will keep citing.

  • #rust
  • #github-copilot
  • #ai-agents
  • #typescript
  • #developer-tools

Related posts