Why does GitHub Copilot now spend fewer tokens on the same coding tasks?
GitHub changed how its Copilot agent handles context across four separate systems. The updates cut token usage without lowering the quality of completed coding tasks.
GitHub Copilot is an AI coding agent that runs inside terminals, editors, and code-review workflows. On September 2, 2026, the team published a detailed breakdown of four internal changes that reduce the number of tokens the model sees and generates while keeping task success rates flat.
The post comes from Erik Kristensen and Napalys Klicius, engineers who work on the agentic harness that powers Copilot CLI, the Copilot app, and Copilot code review. They explain that earlier attempts to shrink individual tool responses backfired. A utility called RTK shortened shell output, but when the model needed the omitted lines it reopened the original output or reran the command. Those recovery steps added turns and carried more context forward. The individual response was shorter, yet the full task used more tokens and took longer.
The local metric trap
Token count per tool call looks like an obvious efficiency target. The team found it is the wrong one. In their benchmark configuration, compressing output aggressively made the model repeat work or read the full saved output, increasing end-to-end cost and reducing task success. For example, an early version compressed git diff output. Benchmark tasks showed agents reopening the original diff to recover missing information. That filter was removed.
The lesson: an efficiency change has to be evaluated across the complete task, from the user request through the final result. The goal became removing only what the model never needed to do.
Compress noise, preserve useful information
Analysis of benchmark runs showed that install, build, test, and lint output often contains repetitive noise. Source-like output and arbitrary command results are more likely to hold information the agent needs. That analysis informed a selective output compressor with a three-part policy.
Preserve source-like and arbitrary output. Commands such as cat and git diff are returned unchanged. The same goes for git show and arbitrary scripts. Reorganize search results without dropping content. Matches and file lists from tools such as grep can be grouped more efficiently while retaining every result. Compress repetitive noise selectively. Install and build output is compressed only when the savings are substantial. Test and progress output follows the same rule.
When output is compressed, the agent can still retrieve the complete original through a direct recovery path. The team tracked whether the agent opened the saved original, reran commands, repeated exploration, narrowed its searches, or took additional turns. Frequent recovery would indicate the compressor had removed something valuable. On offline tasks where compression triggered, no statistically significant task-success regression was detected, and agents extremely rarely opened the saved originals. In the online experiment, average cost decreased slightly with no material regression detected in the tracked quality metrics.
Remove formatting before removing information
The view tool reads file contents into context. Previously, view prefixed every line with a number before showing the contents to the model. Earlier file-editing tools used those numbers to target changes. Current tools instead match surrounding code and do not use line numbers. The prefixes remained even though the normal workflow no longer used them.
Each prefix was small. Repeated across every line and every file read, however, that unused formatting accumulated throughout a session. So they removed it. Line numbers remain useful in diffs and short snippets. They were wasteful here because they were attached to every file read without serving the current editing workflow.
Removing them caused model-inference cost to fall by roughly 5% in offline agentic coding benchmarks. Success rates stayed within the expected run-to-run variance, and edit failures did not increase. The online experiment with Copilot CLI users reduced average daily model-inference cost per user by about 3%, with no material regression detected in the quality or satisfaction metrics tracked. For developers, that means more of the context window is available for the work itself rather than formatting the agent does not use.
Compress prompts without compressing intent
Prompts carry instructions that shape how an agent works, and they are sent to the model on every turn. Shortening them only improves efficiency if the agent keeps the behaviors developers depend on. In GitHub Copilot, the task tool launches specialized agents for parallel work. Its guidance had accumulated across tool descriptions, schemas, agent definitions, system instructions, and companion tools.
A meta-prompting loop, in which Copilot iteratively wrote its own prompt, reduced that prompt by roughly half. Copilot produced and refined smaller candidates, and targeted behavioral tests checked the requirements they wanted to preserve. The first online experiment found a regression that the initial offline evaluations had missed. The meta-prompting loop had rewritten cautious parallelism guidance into a hard scheduling policy, causing independent custom agents to run sequentially. They stopped the experiment.
Before changing the prompt again, they wrote a regression evaluation for the behavior users had exposed. The eventual fix replaced an explicit allowlist and denylist with one sentence: "Independent agents can run in parallel; consider side effects." That sentence was shorter and less restrictive; it deferred the choice of whether to run sub-agents in parallel to the model instead of the previous explicit guidance. With it, the new behavior test passed without causing any existing behavioral tests to fail.
The shipped prompt removes about 1,300 task-tool prompt tokens per turn, corresponding to approximately 1.8% fewer total prompt tokens per session and 2.9% lower normalized cost per active hour, with no quality regression detected in the measured evaluations.
Deliver completed background work without an extra retrieval turn
Agents often run independent work in the background, such as a long-running shell command alongside a sub-agent investigation. Notifications let the agent continue until that work is ready without spending a tool call waiting. If the agent does not explicitly wait for either task, the harness wakes the model and notifies it when the shell command or sub-agent finishes.
Previously, that notification did not include the completed result, so the agent had to spend another turn retrieving output Copilot had already received. When several tasks finished close together, that detour could repeat. Copilot now batches eligible completion notifications and delivers completed results directly in the existing tool-result format. The agent can continue with the information it needs, without spending an extra turn asking for it again. Explicit reads for work that is still running behave as before.
Before this change, each completed task required one model call to request its result and another to process it. For the shell command and sub-agent shown in the post, that meant four model calls before work could continue. Now the harness batches both completions and supplies their results together, so a single model call can process both. Removing those retrieval detours also avoids carrying the full session context through unnecessary calls. By delivering completed results directly, without compressing, summarizing, or withholding anything, the harness reduced average token-related usage, as measured in AI Credits, by about 2.3%.
Measure changes in context
A change that saves tokens in one Copilot workflow can increase costs in another. A tighter set of file-tool instructions was inspired by positive results in Copilot code review. In a Copilot CLI online experiment, it increased cost, so they did not ship it. By contrast, removing line-number prefixes and selectively compressing output each reduced average prompt tokens per review by roughly 5% in independent evaluations across a large set of Copilot code review tasks using the production model. They detected no material change in the tracked review-quality metrics.
These findings are separate from the earlier migration of Copilot code review to the shared file tools, which, together with review-instruction tuning, reduced code review cost by about 20%. Each change needs to be measured in the workflow where it runs. The changes described in the post are shipping across GitHub Copilot experiences that use the same underlying harness.
The sources this article was written from
- "GitHub Blog
https://github.blog/ai-and-ml/github-copilot/how-we-make-ai-coding-more-cost-efficient-without-sacrificing-task-quality/"