token-savior  by Mibayy

AI coding assistant for extreme token savings and persistent code memory

Created 4 weeks ago

New!

697 stars

Top 48.6% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

Token Savior Recall is an MCP server designed to drastically reduce token consumption and enhance context persistence for AI coding assistants. It addresses the inefficiency of traditional code navigation methods (like cat or grep) used by AI, which inflate context windows and incur high costs. By providing a structural index and a persistent memory engine, it enables AI agents to navigate codebases with 97% token savings and retain knowledge across sessions, making AI coding more efficient and cost-effective.

How It Works

The system employs a two-pronged approach: a structural index and a persistent memory engine. The structural index parses codebases into symbols (functions, classes, etc.), enabling sub-millisecond queries for specific code elements, dependencies, or impact analyses, rather than reading entire files. This significantly reduces the tokens an AI agent needs to process. The memory engine, built on SQLite WAL + FTS5, captures and retrieves observations like bug fixes, decisions, and conventions across sessions, injecting relevant context at startup. This combination ensures AI agents have precise, context-aware information without excessive token usage.

Quick Start & Requirements

  • Primary install: uvx token-savior-recall (runs directly from PyPI).
  • Prerequisites: Python 3.11+.
  • Compatibility: Works with any MCP-compatible AI coding tool (e.g., Claude Code, Cursor).

Highlighted Details

  • Achieves a 97% token reduction on code navigation, saving an estimated 203M tokens (~$609) across 170 sessions and 17 projects.
  • Delivers sub-millisecond query response times, even for complex analyses like get_change_impact on large codebases (e.g., 1.1M lines).
  • Features a robust memory engine storing 12 types of observations, with LRU-based ranking, auto-promotion, and contradiction checking.
  • Provides 69 MCP tools for core navigation, impact analysis, memory management, testing, and code quality analysis across multiple languages.

Maintenance & Community

  • Continuous Integration is maintained via GitHub Actions. No specific community links (Discord/Slack) or contributor details are provided in the README.

Licensing & Compatibility

  • License: MIT. This license is permissive and generally compatible with commercial use and closed-source linking.
  • Compatibility: Designed to integrate with any MCP-compatible AI coding tool.

Limitations & Caveats

  • The index updates on query, not on save, meaning a brief pre-edit state might be visible immediately after an edit.
  • Cross-language tracing for impact analysis is limited to within a single language boundary.
  • The JSON annotator indexes structural key relationships, not semantic value meaning.
  • Windows path compatibility has not been tested. Default limits exist for maximum files (10,000) and file size (1 MB) per project.
Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
16
Issues (30d)
8
Star History
708 stars in the last 28 days

Explore Similar Projects

Feedback? Help us improve.