Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Copilot Token Optimizer - Context & Prompt AdvisorNew to Visual Studio Code? Get it now.
Copilot Token Optimizer - Context & Prompt Advisor

Copilot Token Optimizer - Context & Prompt Advisor

Vishwas Nayak

|
10 installs
| (0) | Free
Analyses your prompt and open files before sending to Copilot. Suggests which tabs to close or open to save tokens.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copilot Context Advisor

Analyse your GitHub Copilot prompts and open editor tabs before sending — get actionable suggestions to reduce token usage and improve prompt quality.

Core analysis is 100% local. Optionally enhance suggested prompts with a local Qwen AI model via Ollama.

How to Use

  1. Click the 🧠 Copilot Advisor icon in the Activity Bar
  2. Paste your prompt → click 🔍 Analyse (or Cmd+Shift+J / Ctrl+Shift+J)
  3. Context tab — see which tabs to close/open to save tokens
  4. Prompt Tips tab — expand any tip for details and one-click fixes
  5. Click ▶ Open in Copilot Chat to send the optimized prompt directly

What It Checks

Context Analysis — Are your open tabs costing you?

Every file tab you have open gets sent to Copilot as context — even files you're not working on. This eats into your token budget silently.

  • Large files eating tokens — Flags files over 500 lines that inflate your context window
  • Irrelevant open tabs — Detects tabs unrelated to your current task (e.g. a CSS file open while you're fixing a backend bug)
  • Expensive file types — XML, YAML, lock files, and logs are verbose and waste tokens fast
  • Test files you don't need — If you're not writing tests, open test files just add noise
  • MCP tools running in background — Extensions like Atlassian, GitKraken, and Pylance register tools that silently consume ~250 tokens each per request
  • Wrong Copilot mode — Recommends Ask, Agent, or Edit mode based on what you're actually trying to do

Prompt Quality — Is your prompt wasting tokens?

A poorly written prompt can cost 2-5x more tokens and give worse results. The extension checks 12+ common mistakes:

  • Filler phrases — "Can you please help me..." wastes tokens. Just say what you need
  • Multiple tasks in one prompt — "Fix the login AND refactor the database AND add tests" should be 3 separate prompts
  • No file reference — Without #file:YourFile.php, Copilot guesses which file you mean and loads extra context
  • No output format — Without "return only the code, no explanation", Copilot writes paragraphs of explanation you don't need
  • Vague language — Words like "something", "stuff", "things" force Copilot to guess what you want
  • Ambiguous pronouns — "Fix it" or "change this" — Copilot doesn't know what "it" refers to
  • No stopping condition — Without "only modify this file", agents may keep going — editing extra files, adding commits you didn't ask for
  • Missing success criteria — Tell Copilot what "done" looks like: "Done when the timeout is 30s and tests pass"
  • Mixing research + implementation — "Find the bug AND fix it AND write tests" should be separate conversations
  • Agent tasks without safety rails — Autonomous agent prompts need confidence gates and budget caps to prevent runaway token usage

Local AI Setup (Optional)

Enhance suggested prompts with Qwen 2.5 Coder running locally via Ollama:

# Install Ollama
brew install ollama

# Pull the model
ollama pull qwen2.5-coder:7b

# Start Ollama (runs on http://127.0.0.1:11434)
ollama serve

The extension auto-detects Ollama. When available, suggested prompts show 🤖 Qwen + rules. Without Ollama, you get 📋 Rule-based suggestions — still fully functional.

Settings

Setting Default Description
enableLocalAiSuggestedPrompt true Enable/disable Qwen enhancement
localAiModel qwen2.5-coder:7b Ollama model name
localAiTimeoutMs 30000 Timeout for AI response (ms)
fileExtensions [php, js, ts, ...] File types to scan
maxFilesToScan 50 Max workspace files to analyse

Keyboard Shortcuts

Shortcut Action
Cmd+Shift+J (Mac) / Ctrl+Shift+J (Win/Linux) Run analysis
Cmd+Enter in sidebar input Run analysis
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft