Launching today

TokenSafe
Zero-Loss Token Optimizer for AI Coding Agents
1 follower
Zero-Loss Token Optimizer for AI Coding Agents
1 follower
Zero-Loss Token Compression and AST Distillation engine for AI coding agents including Claude, Cursor, Codex, and Antigravity.



Free Options
Launch Team / Built With

Render: Get up to $100K in startup creditsThe fastest way to launch and scale your startup in the cloud
Promoted



Hey Product Hunt! 👋
I built TokenSafe because I was burning through Cursor requests and Anthropic API credits for completely dumb reasons.
The breaking point was watching an agent read three 800-line files and pull an entire `package-lock.json` into context just to change a 5-line utility function. By turn 4, that single fix had burned 30,000 tokens. The model slowed down, started missing earlier instructions, and I was paying for thousands of lines of boilerplate the agent never even looked at.
Giving models 1M or 2M token context windows doesn't actually solve this. It just makes it easier to drown the model in noise and pay for the privilege.
So I wrote a local tool to fix context hygiene before anything leaves the machine:
- AST skeletonization: When an agent opens a file, TokenSafe parses it locally and collapses inactive functions into typed signatures. The agent still gets the full architecture map, but read tokens drop by around 85-90%.
- Lockfile & diff stripping: It intercepts terminal diffs and strips out noisy lockfiles and minified bundles so they don't pollute the prompt.
- MCP bloat audit: If you run 3 or 4 MCP servers, their schemas silently dump 5k to 10k tokens into every single turn. TokenSafe measures that tax (`tokensafe doctor`) and lets you toggle heavy tools off.
- Cache alignment: Cleans out volatile timestamps from system prompts and sets ephemeral cache headers, so Claude reliably hits prompt caches for 90% discounts.
The core client is MIT-licensed and written in pure Python standard library. Zero pip packages required, it runs locally, and source code never leaves your computer.
For the PH launch, code `PH50` gives 50% off (capped at the first 100 people in Stripe).
GitHub: https://github.com/NekoSin4eG/tokensafe
Site: https://tokensafe.dev
You can test your own context overhead right now from terminal:
`npx tokensafe doctor`
Curious to hear how you handle context limits in your own setup, or if you run into any edge cases with the AST parser!