Skip to content

Token Optimization Guide

Practical guide to reducing GitHub Copilot token spend while keeping answers and code useful.

Start with Part 1 Jump to Practical Setup Concise practitioner briefing Full 8-hour workshop

What This Covers

  • Why token usage actually costs money under Usage-Based Billing
  • Why output control usually beats prompt compression on raw ROI
  • How to shrink always-on context, history, and tool overhead
  • How model-specific prompt guides improve first-pass quality and reduce rework
  • When Ask Mode, Edit Mode, and Agent Mode make financial sense
  • How to set enterprise guardrails without relying on unsupported controls
  • How to turn this repo into repeatable team habits

Fastest Wins

  1. Constrain output by default: Code only, no explanation. and No explanations unless asked.
  2. Keep .github/copilot-instructions.md small and specific.
  3. Protect cache in long sessions: keep {model, reasoning effort, loaded skills, active MCP/tool set, agent/profile} stable; if you must change one, start a fresh chat with a short handoff summary.
  4. Use Ask Mode for questions that do not need tools.
  5. Retune prompts and instructions against the official guide for your target model.
  6. Disable MCP servers you are not using.
  7. Convert DOCX/PDF/Office/media inputs to Markdown before AI work; start with MarkItDown.
  8. Audit long-running agent sessions and repeated back-and-forth.
  9. Install one shell-output filter: RTK or snip. These CLI proxies filter git, test runners, grep, build tools, and other command output before it reaches the agent. Use one filter layer per command path; do not stack them by default.
  10. Build a persistent codebase graph with Graphify — map code once via tree-sitter AST, write graphify-out/graph.json, then let agents query the graph instead of re-reading project files each session. Install: uv tool install graphifyy.

Read by Topic

Foundations

Techniques

Comparisons

Implementation

Quick Terms

  • UBB: usage-based billing. Copilot Business and Enterprise spend is tracked through AI-credit usage rather than request counters.
  • AI credits: the pooled billing unit used after the cutover.
  • Auto mode: Copilot's default model selector. Good default lane when you do not need to pin a model.
  • Ask Mode: single-shot interaction. Lowest-overhead choice for simple questions.
  • Agent Mode: multi-step interaction. Higher leverage, higher cost.
  • Content Exclusion: admin control for keeping selected repo content out of Copilot context.
  • Format tax: extra tokens from rich file metadata and layout noise in DOCX, PDF, HTML, slides, spreadsheets, images, and audio/video extraction. Convert to Markdown first.

Notes

  • /chronicle is Copilot CLI only (also available inside JetBrains via interactive Copilot CLI sessions). It is not available in VS Code — use AI Engineering Coach there. Subcommands include cost tips, improve, tips, standup, search, and reindex.
  • Usage-Based Billing is labeled UBB in this repo.