Practitioner briefing

GitHub Copilot Token Optimization

Reduce token spend, avoid rework, and verify what ships.

Need the full training? Open the 8-hour workshop.

Outcome: useful work per token

Spend less

Reduce unnecessary input, output, and tool overhead.

Move faster

Keep context focused. Avoid expensive rework loops.

Verify results

Plan, test, and use the right agent mode for the task.

Community guidance, not official GitHub or Microsoft policy.

Know what you pay for

Input

System prompt, instructions, files, history, tool schemas, and your prompt.

Output

Responses, reasoning, and tool calls. Usually the highest-cost token type.

Cached input

Stable request prefixes can be reused at a lower effective cost.

Agent loops

Every read, command, retry, and rework step compounds cost.

Where to start

  1. Constrain output. Stop paying for prose you do not need.
  2. Shrink context. Keep always-on instructions and files focused.
  3. Reduce tool overhead. Load only needed MCP tools and compress command output.
  4. Avoid rework. Choose the mode and model, agree on a plan, then verify.

1. Start with concise output

Answer concisely. Keep the evidence needed to act.

Choose formats per task. Caveman is optional, not a guaranteed cost reduction.

Compare default, concise, and Caveman on total cost and correctness. Evidence and protocol.

2. Compress always-on instructions

Keep

Project pitfalls, required commands, naming, architecture rules, output constraints.

Remove

Boilerplate, facts visible in code, duplicate rules, occasional checklists.

Loaded instructions add input on later turns. Put path-specific rules in scoped files and occasional guidance on demand.

3. Target context deliberately

  • Close unrelated editor tabs and avoid attaching broad files.
  • Use applyTo instruction files for path-specific rules.
  • Convert rich input to Markdown before AI work.
  • Send the relevant plan and files, not an entire project history.

4. Protect cached prefixes

For one long task, keep this stable:

{ model, reasoning effort, loaded skills, MCP/tool set, agent/profile }

Changing these settings can lose cache savings. Start a fresh chat with a short handoff when a change is needed.

5. Use the smallest capable mode

Ask

Questions, explanations, decisions. No tools needed.

Edit

Bounded changes with known files and intent.

Agent

Multi-file work that needs exploration, commands, and verification.

Do not use Agent mode for a question that Ask mode can answer.

6. Route models by task

  • Auto first for everyday work.
  • Lightweight for lookup, syntax, small mechanical edits.
  • Strong reasoning for planning, architecture, and hard debugging.
  • Cheaper execution model once the plan captures the hard decisions.

Choose effort before long work. If the task changes, reassess with a concise handoff.

7. Plan, then execute fresh

Plan first, then execute cheaply

Capture acceptance criteria, likely files, risks, and verification. Start execution with only that handoff.

8. Keep the MCP baseline small

  • Loaded tool definitions add context; hosts may defer unused schemas.
  • Disable servers and extensions not needed for this repo or task.
  • Use a clean profile or focused agent for repeat workflows.
  • Run /context in Copilot CLI to see what is loaded.

9. Compress shell output once

RTK

Compiled defaults for common developer command output.

snip

YAML pipelines and local savings tracking.

Choose one filter layer per command path. Do not stack both by default.

10. Reuse a codebase map

Graphify builds a reusable repo map for structural queries. Update it after refactors.

graphify query "where is auth middleware?"
graphify path "Router" "Database"

Best for large repos and repeated agent sessions. Skip it for small, one-off changes.

11. Make token use visible

In-session

Use /context to inspect Copilot CLI context pressure and loaded tools.

Cross-session

Tokentop shows local live tokens, cost, burn rate, and budget alerts.

Use these to find waste; neither tool compresses context.

12. Set a stable session harness

Model + effort + mode + agent + skills + MCP tools + output filter + repo instructions

Choose these settings before long work. If they need to change, start a fresh session with the relevant context.

13. Verify before completion

  1. Name the acceptance criteria.
  2. Run the targeted test, build, or check.
  3. Report evidence, not a generic “done.”

Check the result before review exposes missing work.

14. Adopt and sustain

Long responses

Set concise output preferences.

Large context

Trim loaded instructions, files, and tools.

Noisy commands

Try one output filter; preserve diagnostics.

Repeated rework

Clarify the task, model choice, and verification.

Choose a change for observed waste. Compare accepted work and total cost.

Read the guide · Open the full workshop