r/GithubCopilot • u/Tatachimcooky • 2d ago
Showcase ✨ .github/copilot-instructions.md gets injected into every Copilot Chat request. Here's a way to measure it
.github/copilot-instructions.mdgoes into every Copilot Chat request in VS Code, and Copilot's agent mode can edit it. That combination makes it the highest-leverage file in the repo and the one nobody measures.The failure mode isn't that it gets wrong, it's that it gets long. Every addition is reasonable on the day it's added. Six months later the three rules that actually matter are sitting in the middle of forty that don't, and Copilot follows whichever is loudest. You can't tell from reading it whether it's 400 tokens or 4,000.
I built ctxcap to get the number. It's an offline token counter for context files, and
.github/copilot-instructions.mdis a default scan target alongsideAGENTS.md,CLAUDE.md,.cursor/rules/**, andprompts/**. No API key, no network, no telemetry, no LLM. Two dependencies, MIT.It tracks that delta against a committed git baseline, so growth shows up in review instead of in a surprise bill. Beyond counting, it emits a ranked plan of line ranges with a
preservelist, so the agent splices by line number instead of rewriting the file from scratch, and--verifycatches it if a preserved span gets cut. If the budget is unreachable it says so:On the GitHub side there's an Action that posts a sticky PR comment (updated in place, not one per run) with the token table, and uploads SARIF to code scanning. Gating is opt-in —
fail-ondefaults tonever, so you can watch the number for a month before you make it block anything.https://github.com/Naeha-S/ctxcap
If you run it: I mostly want to hear where it misreads. Unusual layouts, spans it calls safe that aren't, paths it misses
1
u/zerpa 2d ago
That's the point. You should write it so you save tokens in discovery and from misdirected work.