Skip to content
| Marketplace
Sign in
Visual Studio Code>AI>Copilot Prompt Optimizer + GraphifyNew to Visual Studio Code? Get it now.
Copilot Prompt Optimizer + Graphify

Copilot Prompt Optimizer + Graphify

Sai Praneeth Dontaraju

|
8 installs
| (0) | Free
Reduces token usage in GitHub Copilot Chat while maintaining accuracy. Features a 3D interactive knowledge graph, node exclusion, context-strength recommendations, session export, and multi-language workspace scanning.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copilot Prompt Optimizer + Graphify

A VS Code extension that dramatically reduces token usage in GitHub Copilot Chat while maintaining 100% prompt accuracy. Includes a built-in 3D interactive knowledge graph of your codebase, smart context injection, node-level exclusion controls, context-strength recommendations, and full session export for zero-loss context handoff.

Features

Token Optimization

  • Smart prompt compression — removes filler words, deduplicates instructions, and compresses verbose patterns
  • Zero accuracy loss — preserves semantic meaning while reducing token count by 20–60%
  • Three optimization levels — Light, Moderate, and Aggressive
  • Real-time token counting — see exact token savings per prompt
  • Selection optimizer — right-click any selected text in the editor to optimize it in-place

3D Knowledge Graph (Built-in, Zero Setup)

  • Auto-builds on activation — scans your workspace in the background; no CLI, no config files
  • Interactive 3D visualization — drag to rotate, scroll to zoom, click to focus any node
  • Relevant nodes highlighted — green nodes show which parts of your codebase match your query
  • Node exclusion — click any node → modal with Exclude from Context / Re-include / Cancel; excluded nodes are greyed out and persisted across sessions
  • Context-strength indicator — after every /graphify query you get a 🟢/🟡/🔴 strength score plus suggested nodes to add or remove
  • Word-boundary + bigram scoring — accurate context selection with less false-positive noise
  • Auto-updates — graph rebuilds when you save, create, or delete files

Session Export (/export)

  • Full context export panel — tabbed view with a 3D session graph and a structured text document
  • Context Graph tab — 3D force-graph showing sessions (purple), keywords (green), and code references (amber) with hover tooltips
  • Text Export tab — complete markdown with knowledge graph, optimization history, and graph context; ready to paste into any new chat
  • Copy Last 3 / Copy All — paste at the top of a new Copilot Chat to continue with zero context loss

Activity Bar Panel

  • Visual history — all original vs optimized prompts side-by-side with sparklines
  • Session statistics — total tokens saved, average reduction, best reduction
  • Context quality score — shows how well the graph context matched each session

Status Bar Integration

  • Live token savings — shows percentage and absolute token reduction
  • Session stats tooltip — hover for detailed statistics
  • Quick toggle — enable/disable optimization

Chat Commands

Command Description
@optimize <prompt> Optimize any prompt and inject relevant codebase context
@optimize /stats Show token optimization statistics
@optimize /compare Compare last original vs optimized prompt
@optimize /graphify <query> Query codebase graph, show context + strength recommendations
@optimize /export Open session export panel (graph + full context document)

VS Code Commands (Command Palette)

Command Description
Prompt Optimizer: Show Optimization Panel Open the sidebar activity panel
Prompt Optimizer: Toggle Auto-Optimization Enable / disable
Prompt Optimizer: Show Knowledge Graph Open the 3D codebase graph
Prompt Optimizer: Rebuild Knowledge Graph Force a full workspace rescan
Prompt Optimizer: Refresh Knowledge Graph Incremental update
Prompt Optimizer: Query Knowledge Graph Run an interactive query
Prompt Optimizer: Export Session Context Open the export panel directly
Prompt Optimizer: Clear Optimization History Reset history
Optimize Selection (editor right-click) Optimize highlighted text in-place

Keyboard shortcut: Cmd+Shift+Alt+O (Mac) / Ctrl+Shift+Alt+O (Windows/Linux) — optimize selected text.


How to Use /export in a New Chat

  1. Run @optimize /export (or Prompt Optimizer: Export Session Context from the Command Palette).
  2. Click Copy All in the export panel.
  3. Open a new Copilot Chat window.
  4. Paste as your very first message — the AI will have full workspace context and optimization history with zero re-explanation.

How to Exclude a Node from Context

  1. Run @optimize /graphify <your query> — the 3D graph opens automatically.
  2. Click any node in the graph.
  3. Choose Exclude from Context in the modal.
  4. The node turns grey and is skipped in future queries. Click it again → Re-include to restore it.

Knowledge Graph

Supported Languages

TypeScript, JavaScript, Python, Java, Kotlin, Go, Rust, C/C++, C#, Ruby, Swift, Vue, Svelte, Markdown / MDX

What Gets Indexed

  • Classes, interfaces, functions, methods, and arrow-function exports
  • Import/export relationships between files
  • Python classes and functions
  • Java / Kotlin / Go / Rust / C# classes and methods
  • Markdown headings, frontmatter titles, and keyword tags

Performance

  • Max 500 files scanned per build
  • Minified files, node_modules, dist, out, build, media automatically excluded
  • Debounced rebuild (3 s) on file changes to avoid thrashing

Configuration

Setting Default Description
promptOptimizer.enabled true Enable auto-optimization
promptOptimizer.aggressiveness "moderate" Optimization level (light / moderate / aggressive)
promptOptimizer.graphifyAutoContext true Auto-inject graph context into every prompt
promptOptimizer.showTokenCount true Show token count in status bar
promptOptimizer.maxHistoryItems 50 Max history entries to keep

Optimization Pipeline

  1. Normalize whitespace — remove redundant spaces and line breaks
  2. Remove filler — strip "please", "I would like you to", polite wrappers
  3. Compress patterns — "Write a function that" → fn:
  4. Deduplicate — remove repeated instructions
  5. Abbreviate — "JavaScript" → JS, "authentication" → auth
  6. Inject graph context — prepend relevant codebase symbols as compressed context
  7. Final cleanup — ensure clean, minimal output

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft