TokenShield — AI Token & Cost Optimizer (Copilot & Claude)
Universal AI Token & Cost Optimization Platform for Developers, Teams, and Enterprises. Installation • Optimization Features • Savings Dashboard • Commands • Configuration • MCP Integration 🌟 Why TokenShield?AI coding assistants (Copilot, Claude, Gemini, GPT-4o) frequently consume tens of thousands of redundant tokens by re-reading build bundles, lockfiles, verbose test logs, repetitive system instructions, and conversational filler. TokenShield acts as a zero-latency, 100% on-device efficiency layer that enforces intelligent caching, AST structural pruning, context noise exclusion, and unified diff editing across all your favorite IDEs. 🏆 Key Benchmarked Gains:
⚡ The 19 Optimization FeaturesTokenShield comes equipped with 19 modular optimizations, active right out of the box:
🚀 Step-by-Step Installation GuideTokenShield works seamlessly across all major AI coding environments: 1. Google Antigravity IDETokenShield has first-class native support for Antigravity IDE: Method A: Direct VSIX Installation (Recommended)
Method B: Extension Runtime Directory Sync
2. Visual Studio Code & VS Code InsidersWorks with GitHub Copilot, Copilot Chat, and Codex:
Or via the GUI:
3. Cursor & Windsurf IDE
Or use the Command Palette ( 4. Claude Code CLI & Standalone AgentsTokenShield includes an on-disk MCP server ( Configure Claude Code (
|
| Command Title | Command ID | Description |
|---|---|---|
| TokenShield: Open Savings Dashboard | tokenshield.dashboard |
Open visual savings dashboard with live activity log |
| TokenShield: Show Session Breakdown | tokenshield.sessionBreakdown |
QuickPick breakdown of per-query savings events |
| TokenShield: Start New Session | tokenshield.newSession |
Reset active counters and archive current session to history |
| TokenShield: Switch Profile | tokenshield.switchProfile |
Switch between full, debug, planning, review, and custom |
| TokenShield: Toggle On/Off | tokenshield.toggle |
Globally enable or disable all TokenShield optimizations |
| TokenShield: Prune & Copy to Clipboard | tokenshield.pruneAndCopy |
Compresses active file or selection (30–50% savings) to clipboard |
| TokenShield: Compress Git Diff | tokenshield.compressDiff |
Compresses current git diff for token-efficient PR reviews |
| TokenShield: Edit Context Exclusions | tokenshield.exclusions |
Interactive picker for build folder, lockfile, and bundle filters |
| TokenShield: Run Health Check | tokenshield.healthCheck |
Live diagnostic validation across all 19 optimization features |
| TokenShield: Flush Semantic Cache | tokenshield.flushCache |
Clears local disk cache in .aicache/semantic-cache.json |
| TokenShield: Reindex Code Graph | tokenshield.reindex |
Triggers a fresh AST symbol graph index in .codegraph/ |
| TokenShield: Export Savings Report | tokenshield.exportReport |
Exports clean savings reports in Markdown, JSON, or CSV format |
| TokenShield: Regenerate Directives | tokenshield.regenerate |
Updates AI instruction files (AGENTS.md, .github/, CLAUDE.md) |
| TokenShield: Initialize Project | tokenshield.init |
Analyzes workspace stack and generates customized instruction files |
| TokenShield: Setup CLI Tools | tokenshield.setupTools |
Verifies and configures optional CLI acceleration tools (RTK, CodeGraph) |
⚙️ Configuration Reference (settings.json)
Configure TokenShield via .vscode/settings.json or your user settings under the tokenshield namespace:
{
"tokenshield.enabled": true,
"tokenshield.profile": "full",
"tokenshield.autoApply": true,
"tokenshield.useVscodeStorage": true,
"tokenshield.telemetry.enabled": true,
"tokenshield.verbosityLevel": "full",
"tokenshield.activeStrategies": {
"codeGraph": true,
"outputCompression": true,
"verbosityControl": true,
"sessionManagement": true,
"semanticCache": true,
"astSkeleton": true,
"contextExclusion": true,
"diffOnlyOutput": true,
"agentGuardrails": true,
"smartModelRouting": true,
"gitDiffContext": true,
"kvCacheAlignment": true,
"commentStripper": true,
"testFailureIsolator": true,
"rangeSlicing": true,
"inlineChatScopePinning": true,
"copilotIgnoreGeneration": true,
"copilotEditsAwareness": true,
"threadResetTrigger": true
},
"tokenshield.guardrails": {
"maxRetries": 3,
"maxFilesPerTask": 10,
"maxFileReads": 2
},
"tokenshield.pricing": {
"flagship": { "inputPerMillion": 15.0, "outputPerMillion": 75.0 },
"standard": { "inputPerMillion": 3.0, "outputPerMillion": 15.0 },
"lightweight": { "inputPerMillion": 0.15, "outputPerMillion": 0.60 }
}
}
🔒 100% Security & Privacy Guarantee
- Zero Cloud Leakage: 100% on-device local execution. No source code or telemetry ever leaves your machine.
- Offline & Air-Gapped Friendly: Fully functional without internet connectivity.
- Zero Repo Clutter: Local configuration stored in
.vscode/by default — never touches git tracking unless explicitly exported.
📄 License
MIT License. Built for developers and modern software engineering teams.