Save up to 60 % of your token bill

Your context under control

Teams waste roughly 40 % of their token budget on noise: unused MCP schemas, off-topic chat history, abandoned projects. tokenguard finds those leaks and removes them in one command.

scan → mcp lazy → chats compact → budget. No account, no network calls, MIT.

31 tests passingNode ≥ 20MIT LicenseZero telemetry
tokenguard — scan
$ tokenguard scan Harnesses & chats Harness Found Chats Size ──────────────── ───── ───── ─────── DeepSeek Harness yes 12 15.9 MB ℹ total sessions: 12 (15.9 MB) MCP Client Server Tools ~Tokens Verdict ────── ────── ───── ─────── ─────── DSH safari 2 ~221 lazy ✓ $ tokenguard chats drift --all OpenRouter Explorer Free 939 ≈2.1M split Digital twins 859 ≈1.8M split ⚠ 3 chats drifted — splitting recommended $ tokenguard mcp lazy safari --apply ✓ Lazy proxy: ~/.tokenguard/lazy/safari.cjs ✓ idle timeout: 10min $
−87% schema tokens
8 integrations
9 commands
2.4B tokens analyzed
~40 % of token spend is noise
Try in 30 sec →
Fast · Secure · Local · Open

Why teams install it

Every feature closes a specific leak

Dry-run by default. Nothing changes until you pass --apply, and a backup is written first.

Lazy MCP Proxy

Cut MCP schema costs up to 90 %. The client sees 2 tools instead of 50+; upstream starts on the first call_tool and sleeps when idle.

Topic Drift Detector

Pinpoints the message where the conversation drifted and estimates the tokens you get back by starting a fresh chat. Fully offline, no LLM.

Chat Compaction

Compress 500+ messages into one structured digest — requests, files, commands, key topics — and keep the last 8 verbatim. Clean context in a new chat.

Token Profiler & Budgets

See spend by day, session, tool and model. Set a daily cap and let CI fail the build on overrun. USD estimates via pricing.json.

Project Hygiene

Find dead and unfinished repositories by git metrics, then archive them with git bundle + tar + manifest. Restore with a single clone.

Docs Checks

Catch broken links, conflicting versions and ports, duplicated paragraphs, stale "as of" dates. Stale docs stop burning context.

Compatibility

Works with the tools you already run

Chats, rename, MCP configs and lazy proxies for every major harness.

HarnessChatsRenameMCP configLazy
DeepSeek Harness FullNativeYAML profilesProxy + --apply
Claude Code Read—~/.claude.jsonProxy
OpenAI Codex CLI Best effort—config.tomlProxy
Gemini CLI ——settings.jsonProxy
Cursor ——~/.cursor/mcp.jsonProxy
VS Code / Copilot ——.vscode/mcp.jsonProxy
Claude Desktop ——claude_desktop_config.jsonProxy

Get started

Install in 30 seconds

Node.js ≥ 20 or a prebuilt binary. No account, no network calls, MIT licensed.

terminal
# global install
npm install -g tokenguard
tokenguard version

tokenguard 0.3.4

# first look at the environment
tokenguard scan
# isolated run
docker run --rm \
  -v ~/.tokenguard:/data \
  -v ~/.dsh:/dsh \
  tokenguard/tokenguard:latest scan

DeepSeek Harness  yes     12      15.9 MB
# prebuilt binary (Linux x64)
curl -fsSL https://github.com/tokenguard/tokenguard/releases/latest/download/tokenguard-linux-x64.tar.gz | tar xz
sudo mv tokenguard /usr/local/bin/

tokenguard version
tokenguard 0.3.4
# from source
git clone https://github.com/tokenguard/tokenguard.git
cd tokenguard && npm install
npm link

tokenguard scan

FAQ

Questions and answers

How much can I actually save?
It depends on your MCP setup. Teams running several MCP servers usually see the largest win from the lazy proxy, because unused tool schemas stop travelling with every request. Run tokenguard scan on your workspace — it reports schema tokens and estimated waste before you change anything.
Is it safe to run on a live workspace?
Yes. Everything is dry-run by default, changes require --apply, a backup is written before any modification, sessions touched in the last 2 minutes are skipped, and no network calls happen without an explicit flag.
Which harnesses are supported?
DeepSeek Harness (full: chats, rename, usage), Claude Code, OpenAI Codex CLI, Gemini CLI, Cursor, VS Code / Copilot and Claude Desktop for MCP configs.
Is it free?
Yes — MIT, free forever. A Pro tier with team dashboards, SSO and a managed MCP gateway is planned; the CLI stays open source.

Start saving tokens today

See your own leaks in one command

Run tokenguard scan — it reports where your tokens go before changing anything.

Free and MIT. Pro (team dashboards, SSO, MCP gateway) is on the roadmap — the CLI stays open source.