TokenSafe
Your agent stops guessing. Your main branch stops breaking.
TokenSafe cuts what your agent reads and keeps your keys on your machine. Sextant makes it check the running app before it says done. Review Gatekeeper sends a human only the diffs that can break production.
One local install. Works with Cursor, Claude Code, Codex, Windsurf, Google Antigravity, Kimi Code, and ChatGPT.
Install •
Quickstart •
What's New in 5.x •
Why TokenSafe •
Benchmarks •
Pricing •
FAQ •
Reference •
Website & Docs
What's New in 5.x
TokenSafe 4.0 is a major architecture release designed for Zero Mid-Day Lockouts, 3-Second Turn Latency, Exact Code Context (Zero Loss), and Developer Flow:
- ⚡ SQLite FTS5 BM25 Code Indexer & Search (
scoped_search, tokensafe search): Native SQLite full-text search with trigram tokenization and BM25 relevance ranking (<1ms) across the repository. Replaces raw terminal grep entirely with zero-token-waste search.
- 🔗 SQLite Graph Cache & Cross-Boundary Route Linking: Persistent SQLite caching (
.tokensafe/cache/graph.db) with bidirectional semantic linking between frontend client endpoints (fetch, axios, apiClient) and backend HTTP routes (FastAPI, Express, Flask, Next.js).
- 🖼️ Vision Image Downscaler (
optimize_image, tokensafe optimize-image): Automatically scales down oversized screenshots, architecture diagrams, and mockups (>1024px) via Pillow or macOS sips, saving 50–75% vision tokens while keeping original files intact.
- 🧠 Anti-Stuck Dead-Ends Ledger (
get_mistakes, tokensafe mistakes): Persistent project memory tracking failed hypotheses, loop guard trips, and git reverts to prevent agents from cycling through already-failed solutions.
- 🧹 Transcript Superseded Output Pruning (
prune_superseded, tokensafe prune-superseded): Prunes obsolete intermediate tool reads that were superseded by subsequent edits or re-reads in long agent transcripts (-30-40% context).
- 🧼 ANSI Escape Sequence Stripper: Cleans all ANSI/VT100 escape codes from tool outputs, test runners, and proxy streams before they enter model context.
- 👻 Ghost Tokens Auditor (
tokensafe doctor): Detects and cleans redundant multi-IDE configuration files (.cursorrules, CLAUDE.md, .windsurfrules, .clinerules) and oversized rule files, saving 2,000–5,000 wasted ghost tokens on every turn.
- 🖥️ Local Control Panel (
tokensafe panel): Loopback-only browser panel over the same local store — measured savings and versions, one card per discovered project with OUMV adapter readiness, live runtimes, observe/mutate permissions, reversible wiring, and a curated command runner. No extra dependencies.
- 🛡️ Exact Code Context & Reversible Stash (
expand_ref): 100% byte-exact target symbol preservation with reversible 8-char hash anchors (#a1b2c3d4) to instantly recover any folded block.
- 🌲 C# Tree-sitter Support: Native AST slicing and God Nodes detection for C# (
tree-sitter-c-sharp) alongside TypeScript, JavaScript, Python, Go, Rust, Java, Kotlin, and PHP.
Install & Agents