Copilot Prompt Optimizer + GraphifyA 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. FeaturesToken Optimization
3D Knowledge Graph (Built-in, Zero Setup)
Session Export (
|
| 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
- Run
@optimize /export(or Prompt Optimizer: Export Session Context from the Command Palette). - Click Copy All in the export panel.
- Open a new Copilot Chat window.
- 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
- Run
@optimize /graphify <your query>— the 3D graph opens automatically. - Click any node in the graph.
- Choose Exclude from Context in the modal.
- 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,mediaautomatically 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
- Normalize whitespace — remove redundant spaces and line breaks
- Remove filler — strip "please", "I would like you to", polite wrappers
- Compress patterns — "Write a function that" →
fn: - Deduplicate — remove repeated instructions
- Abbreviate — "JavaScript" →
JS, "authentication" →auth - Inject graph context — prepend relevant codebase symbols as compressed context
- Final cleanup — ensure clean, minimal output
License
MIT