Token Savior
Lets your AI agent navigate code by symbol and keep persistent memory to use fewer tokens.
1.2k stars on GitHubby MibayyLicense MITUpdated last month
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add token-savior -e WORKSPACE_ROOTS="<your value>" -- uvx token-savior-recall
What to fill in
| Name | What it is | Required |
|---|---|---|
WORKSPACE_ROOTS | Comma-separated list of absolute paths to project roots to index. | Yes |
TOKEN_SAVIOR_CLIENT | Optional client identifier (e.g. 'claude-code', 'cursor', 'hermes') for usage attribution. | No |
TOKEN_SAVIOR_PROFILE | Manifest size. 'optimized' (recommended) advertises the Pareto-optimal 15-tool set; 'auto' sizes it from your own usage; 'full' advertises every tool; 'compact-only' if you already run symbol navigation elsewhere. | No |
Ready! Now test it
Restart the app and paste one of these requests in the chat:
Find where the payment total is calculated and show only that function.
What did we decide about the cache last week?
What it is
Token Savior indexes your codebase by function, class and call graph so the agent can jump to code instead of reading whole files. It also stores decisions and bugfixes in a local memory that is brought back in later sessions. Optional Bash compaction and command rewriting reduce noisy command output.
What it can do
search_codebase: search code and name the function holding each hitfind_symbol: find a symbolget_edit_context: context before editingmemory_searchandmemory_index: search and list stored memoryts_discover: find missed token-saving opportunities in transcripts
When to use
- βΊWhen your agent reads whole files to answer a question about a few lines.
- βΊWhen you want decisions and fixes remembered across sessions.
- βΊWhen noisy command output fills up the agent's context.
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
geminiignore-finopsOptimizes the agent's token usage to reduce costs. Helps control what the agent considers to be more efficient.cli-cost-usageShows cost breakdowns, token usage and call logs from the command line, filtered by provider, model or date, and exports reports.AgentDB Memory PatternsLets your agent remember conversations and context across sessions, using AgentDB as its persistent memory store.Frequently asked questions
Is it free and open source?
It is on PyPI with a project site. The readme does not mention a price.
Are the benchmark numbers verified?
The headline 97.9% result is reported but the benchmark harness is not public. A later re-run with 8 tasks showed about 45% lower cost but longer wall time.
Which profile should I use?
The optimized profile is recommended in the readme, set with TOKEN_SAVIOR_PROFILE=optimized.
Which agents can use the hooks?
ts init supports claude, cursor, gemini, codex and openclaw.
Do the Bash compactors shrink the current turn?
No. They run after the tool returns. The rewriter, enabled with TS_BASH_REWRITE=1, changes the command before it runs.
Where is memory stored?
In SQLite with full-text search and vector embeddings.
If it does not work
- βΊOn Claude Code, set alwaysLoad to true, or the model may never use the tools.
- βΊRun ts init --agent claude --dry-run to preview hook changes before applying them.
- βΊSet WORKSPACE_ROOTS to your project folders.
5 new skills a week. 1 minute to read.