GithubNapalys KliciusProblem & solution
Better tools made Copilot code review worse. Here’s how we actually improved it.
Summary
When migrating GitHub Copilot code review from custom navigation tools to shared Unix-style CLI utilities—grep, glob, and view—benchmarks revealed higher review costs and fewer caught issues. Rather than an issue with the underlying tools, trace analysis showed the agent used general-purpose coding assistant instructions that triggered expansive repository browsing loops. In response, the team rewrote the tool guidance to enforce a review-specific workflow anchored to pull request diffs. The updated instructions direct the agent to narrow candidate call sites and files using batched discovery before reading minimal line ranges with view. This workflow tuning reduced average review costs by approximately 20% in production while maintaining review quality.
Context
Migrating Copilot code review to shared Copilot CLI code exploration tools caused higher token costs and fewer caught issues because general-purpose assistant prompts led the agent to browse repositories broadly instead of investigating diff evidence.
Approach / What changed
Rewriting the tool instructions to follow a review-specific workflow that anchors to the pull request diff, batches cheap discovery via grep and glob, reads minimal line ranges with view, and prevents guessing paths on search failures.
Takeaways
Retaining broad tool output inside an LLM's working context inflates token usage and degrades focus across subsequent reasoning steps.
Restructuring tool guidance to prioritize diff-anchored discovery before focused reads lowered average review costs by roughly 20% while maintaining review quality.
Tool prompt optimizations tailored to pull request reviews failed to produce identical wins in the Copilot CLI, where broad interactive exploration remains necessary.
Source and freshness
- Source
- github.blog
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.