Mibayy/token-savior
MCP server that gets Claude to 97.9% (188/192) on a real coding benchmark at -80% active tokens and -83% wall time, vs 78.3% plain. Structural code navigation + persistent memory engine. Works with every MCP client.
What it solves
Token Savior is designed to reduce the massive token consumption and cost associated with AI coding agents (like Claude Code) that typically read entire files to answer simple questions or lose context across sessions. It addresses three main issues: inefficient codebase navigation, lack of persistent memory across sessions, and bloated Bash output that consumes turn budgets.
How it works
The project implements a Model Context Protocol (MCP) server that provides several layers of optimization:
- Structural Code Navigation: Instead of reading whole files, it indexes the codebase by symbols (functions, classes, imports, and call graphs), allowing the agent to navigate via pointers to specific code segments.
- Persistent Memory Engine: It uses SQLite (WAL + FTS5) and vector embeddings to store decisions, bugfixes, and conventions, re-injecting them as compact deltas at the start of new sessions.
- Bash Optimization:
- PreToolUse Rewriter: Modifies Bash commands before they run to produce smaller, more token-efficient output.
- PostToolUse Compactors: Renders Bash output into a token-efficient format after the tool returns, preserving the full output in a capture sandbox for later querying.
Who it’s for
Developers using AI coding agents (such as Claude Code, Cursor, Gemini, or Codex) who want to lower their API costs, reduce latency, and improve the agent's ability to maintain context across different sessions.
Highlights
- Significant Token Reduction: Reported 80% reduction in active tokens per task on the
tsbenchbenchmark. - Curation Profiles: Offers multiple profiles (e.g.,
optimized,tiny,full) to balance the number of exposed tools and manifest token costs. - Broad Bash Support: Includes 34 different compactors for common tools like git, gh, kubectl, docker, and various test/lint frameworks.
- Agent Agnostic: While optimized for Claude Code, it provides a CLI for non-MCP agents like Cursor and Aider.
Related
- Project
- Dispatch
- Project
- Project
- Project