# tokenfat — AI Coding Token Waste Autopsy & Active Cure

> 100% local forensic token waste autopsy, Token Nutrition Facts scorecard & live PreToolUse auto-diet for Claude Code, Codex, Gemini CLI & Cursor.

tokenfat — AI Coding Token Waste Autopsy & Active Cure is a free AI agent skill on Agensi by yihong chen, in Testing & Debugging. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [yihong chen](https://www.agensi.io/creators/yihong-chen)
- Category: [Testing & Debugging](https://www.agensi.io/skills/testing-debugging)
- Version: 1.0
- Last updated: 2026-12-03
- Security: scan passed (2026-12-03); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/tokenfat-ai-coding-token-waste-autopsy-active-cure
- Tags: testing, llm-ops, productivity, cost-optimization, privacy, claude-code, token-usage, context-optimization

## What it does

- Scans local coding logs to find where AI tokens are being wasted
- Identifies huge sessions that re-read too much data every time you speak
- Spots tool outputs like test results that are bloating your chat history
- Flags saved secrets or passwords found in your local settings files
- Generates a shareable card or web report showing your usage facts
- Offers a reversible fix to help your agent use fewer tokens automatically

## Who it's for

- **Founders using AI for coding teams:** See exactly where your money goes when your team uses AI coding tools. Try: "Run a token audit for the last 30 days and show me why our costs are high."
- **Freelance developers on a budget:** Stop burning cash on long AI sessions that repeat the same data over and over. Try: "Check my local logs for token waste and give me a plan to fix it."
- **Privacy-conscious developers:** Audit your local AI history for hidden costs without ever sending data to the cloud. Try: "Scan my agent logs for wasted tokens and redact all prompt text from the report."

## About this skill

Diagnose AND actively cure AI coding token waste in one command — 100% local, zero network, $0 LLM cost.

What this skill does:
- Runs local forensic waste autopsies across Claude Code, Antigravity, Codex, Gemini CLI, OpenCode & Cursor (`npx -y tokenfat`).
- Exposes Elephant Sessions (>180K Context Rot), Cache Miss penalties ("Most Expensive Single Message"), Tool Output Compounding Bombs, and 0-call Zombie MCPs/Skills.
- Exports shareable high-DPI "Token Nutrition Facts" PNG cards (`--card`) and offline interactive HTML reports (`--html`).
- Previews and installs a 100% reversible Active Cure Suite (`--cure`): real-time Elephant Session & Cache-Miss Guard Hooks, live PreToolUse shell output auto-diet trimmer (preserves exact exit codes & saves raw logs to /tmp), and painless 35-line `/handoff` resets.

Open-source MIT project: tokenfat (GitHub: yihongchen772-alt/tokenfat · npm: tokenfat).

## Requires

- tokenfat
- Node.js
- Git

## Known limitations

This skill only analyzes local logs on your disk and does not check cloud-only history.

## Technical details

This skill runs the tokenfat CLI tool locally to parse logs from Claude Code, Cursor, Gemini CLI, and others. It uses deterministic local analysis (no LLM calls for the audit itself) and supports redacting prompt snippets via regex. It can generate PNG cards and interactive HTML reports. The 'cure' function modifies local agent rules or hooks to manage context windows, which can be reverted using the uncure command.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the tokenfat — AI Coding Token Waste Autopsy & Active Cure skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How exactly does this skill help me save money on my AI coding bills?

This skill scans your local coding logs to find where you are wasting money on AI tokens. It identifies long chat sessions that carry too much data, tool outputs that clutter your history, and expensive messages triggered by short replies like "ok".

### Do I need to create a special account or pay for a subscription to use this?

You do not need to sign up for any new services or cloud accounts. The skill only needs access to your local logs from tools like Claude Code, Cursor, Gemini CLI, or Codex to perform its analysis.

### What kind of report will I receive after the audit is finished?

You get a local report showing your top three waste drivers and a scorecard with your usage facts. It also provides an interactive report file and a plan to fix the waste by adjusting your chat settings.

### Is my private code or chat history sent to the cloud during the audit?

The skill is designed for privacy and runs entirely on your own computer without sending your data to any servers. It can also hide specific text from your chat logs if you want to share a screenshot of your savings scorecard publicly.

### How do I tell my AI agent to start the audit?

Simply ask your agent to run a local forensic audit of your recent coding logs to find token waste. You can also ask it to show you a nutrition facts card or a plan to fix your context settings.

### Are there any types of data this skill cannot analyze?

The audit only looks at logs and config files stored on your disk from the last 30 days. It focuses on specific coding tools like Antigravity and OpenCode rather than general web browsing or non coding chat apps.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
