tokensave  by aovestdipaperino

Local semantic code intelligence for AI coding agents

Created 4 months ago
357 stars

Top 78.1% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

tokensave addresses the inefficiency and high token costs associated with AI coding agents exploring codebases. It provides a 100% local, semantic code intelligence server (MCP) that pre-indexes codebases into knowledge graphs. This allows AI agents to perform instant, structured queries for symbols, relationships, and code snippets, drastically reducing token consumption and tool calls compared to traditional file-scanning methods. It is designed for AI coding agents and their users, offering a more efficient and cost-effective way to understand and interact with code.

How It Works

Instead of agents performing expensive file operations like grep, glob, or read, tokensave offers a libSQL Graph Database backend. The tokensave MCP server exposes over 80 specialized tools that AI agents can query. These queries retrieve pre-computed, structured information directly from the semantic knowledge graph, providing instant, context-rich answers. This approach bypasses the need for agents to scan files, leading to significant reductions in token usage and processing time.

Quick Start & Requirements

  • Primary Install: Available via Homebrew (brew install aovestdipaperino/tap/tokensave), Scoop (scoop install tokensave), Cargo (cargo install tokensave), or by downloading prebuilt binaries for macOS, Linux, and Windows.
  • Prerequisites: Git is required for project indexing and hooks. Rust/Cargo is needed for building from source. Optional: ast-grep CLI for advanced rewrite primitives.
  • Setup: Install agent integrations with tokensave install [--agent <name>] and index projects with tokensave init. Git hooks can be automatically installed.
  • Links: Official website: tokensave.dev.

Highlighted Details

  • Extensive Tooling: Offers 80+ MCP tools for deep code intelligence, including semantic search, impact analysis, call graph traversal, code quality metrics, and atomic edit primitives.
  • Broad Language Support: Indexes over 50 programming languages across three tiers (lite, medium, full), with Markdown support.
  • Deep Agent Integration: Supports 12+ AI coding agents (e.g., Claude Code, Gemini, Cursor, Copilot) with native configuration, hooks, and prompt rules.
  • 100% Local & Private: All indexing, querying, and server operations are performed locally, ensuring code privacy and eliminating reliance on external APIs or keys.
  • Crash-Resilient Sync: File parsing is isolated in subprocesses, preventing grammar crashes from halting the entire indexing process.
  • Multi-Branch Indexing: Optional per-branch databases allow for instant cross-branch analysis and diffing without requiring branch checkouts.
  • Performance: Demonstrates significantly faster indexing and query times compared to alternatives like CodeGraph.

Maintenance & Community

This project is a Rust port of the original CodeGraph (TypeScript) by @colbymchenry. Free code signing on Windows is provided by SignPath.io. No explicit community links (e.g., Discord, Slack) were found in the provided README.

Licensing & Compatibility

  • License: MIT License.
  • Compatibility: The MIT license is permissive and generally compatible with commercial use and closed-source projects.

Limitations & Caveats

Project-local installation (--local) is not supported for all agent integrations. For exceptionally large projects, users may need to disable tokensave per-project via an environment variable (DISABLE_TOKENSAVE=true) to manage RAM usage. Some advanced edit primitives rely on the optional ast-grep CLI being available in the system's PATH.

Health Check
Last Commit

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
24
Issues (30d)
47
Star History
195 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.