⚡ Token Savior Recall

Structural code navigation + persistent memory engine for Claude Code. 97% fewer tokens. Nothing forgotten between sessions.

v2.6.0 105 tools 1318 / 1318 tests 97% savings vector search Python 3.11+ MCP MIT

What it does

Claude Code reads whole files to answer questions about three lines, and forgets everything the moment a session ends. Token Savior Recall fixes both. It indexes your codebase by symbol — functions, classes, imports, call graph — so the model navigates by pointer instead of by cat. Measured reduction: 97% fewer chars injected across 170+ real sessions.

On top of that sits a persistent memory engine. Every decision, bugfix, convention, guardrail and session rollup is stored in SQLite WAL + FTS5 + vector embeddings, ranked by Bayesian validity and ROI, and re-injected as a compact delta at the start of the next session. Contradictions are detected at save time; observations decay with explicit TTLs; a 3-layer progressive-disclosure contract keeps lookup cost bounded.

Token savings

OperationPlain ClaudeToken SaviorReduction
find_symbol("send_message")41M chars67 chars−99.9%
get_function_source("compile")grep + cat4.5K charsdirect
get_change_impact("LLMClient")impossible16K chars (154 + 492)new
get_backward_slice(var, line)130 lines12 lines−92%
memory_index (Layer 1)n/a~15 tok/resultshortlist
60-task tsbench run1,431,624 chars234,805 chars−84%
tsbench score67/120 (56%)115/120 (96%)+40 pts

Full methodology and per-task results at github.com/Mibayy/tsbench.

Memory engine

CapabilityHow it works
StorageSQLite WAL + FTS5 + sqlite-vec (optional), 12 observation types
Hybrid searchBM25 + vector (all-MiniLM-L6-v2, 384d) fused via RRF, FTS fallback graceful
Progressive disclosure3-layer contract: memory_indexmemory_searchmemory_get
Citation URIsts://obs/{id} — reusable across layers, agent-native pointers
Bayesian validityEach obs carries a validity prior + update rule; stale obs are surfaced, not silently trusted
Contradiction detectionTriggered at save time against existing index; flagged in hook output
Decay + TTLPer-type TTL (command 60d, research 90d, note 60d) + LRU scoring 0.4·recency + 0.3·access + 0.3·type
Symbol stalenessObs linked to symbols are invalidated when the symbol's content hash changes
ROI trackingAccess count × context weight — unused obs age out, high-ROI obs are promoted
MDL distillationMinimum Description Length grouping compresses redundant observations into conventions
Auto-promotionnote ×5 accesses → convention; warning ×5 → guardrail
Hooks8 Claude Code lifecycle hooks (SessionStart/Stop/End, PreCompact, PreToolUse ×2, UserPromptSubmit, PostToolUse)
Web viewer127.0.0.1:$TS_VIEWER_PORT — htmx + SSE, opt-in
LLM auto-extractionOpt-in TS_AUTO_EXTRACT=1 — PostToolUse tool uses extracted into 0-3 observations

vs claude-mem

Two projects share the goal — persistent memory for Claude Code. The axes below are measured, not marketing.

Axisclaude-memToken Savior Recall
Bayesian validitynoyes
Contradiction detection at savenoyes
Per-type decay + TTLnoyes
Symbol staleness (content-hash linked obs)noyes
ROI tracking + auto-promotionnoyes
MDL distillation into conventionsnoyes
Code graph / AST navigationnoyes (105 tools)
Progressive disclosure contractnoyes (3 layers)
Hybrid FTS + vector search (RRF)noyes

Token Savior Recall is a superset: it ships the memory engine plus the structural codebase server that gave the project its name.

Install

uvx (no venv, no clone)

uvx token-savior-recall

pip

pip install "token-savior-recall[mcp]"
# Optional hybrid vector search:
pip install "token-savior-recall[mcp,memory-vector]"

Claude Code one-liner

claude mcp add token-savior -- /path/to/venv/bin/token-savior

Configure

{
  "mcpServers": {
    "token-savior-recall": {
      "command": "/path/to/venv/bin/token-savior",
      "env": {
        "WORKSPACE_ROOTS": "/path/to/project1,/path/to/project2",
        "TOKEN_SAVIOR_CLIENT": "claude-code"
      }
    }
  }
}

Tools (105)

CategoryCount
Core navigation14
Dependencies & graph9
Git & diffs5
Safe editing8
Checkpoints6
Test & run6
Config & quality8
Docker & multi-project2
Advanced context (slicing, packing, RWR, prefetch, verify)6
Memory engine21
Reasoning (plan/decision traces)3
Stats, budget, health10
Project management7

Progressive disclosure — memory search

Three layers, increasing cost. Always start at Layer 1. Escalate only if the previous layer paid off. Full contract: progressive-disclosure.md.

LayerToolTokens/resultWhen
1memory_index~15Always first
2memory_search~60If Layer 1 matched
3memory_get~200If Layer 2 confirmed

Each Layer 1 row ends with [ts://obs/{id}] — pass it straight to Layer 3.

Links

Repository

github.com/Mibayy/token-savior

PyPI

token-savior-recall

Benchmark

60-task measured suite

Changelog

v2.6.0 — Memory Engine Phase 1+2

Progressive disclosure

3-layer contract spec

MCP

Model Context Protocol