# token-buddy

> Adaptive token budgeting and subagent routing for Antigravity agents to optimize model spend and context usage.

token-buddy is a free AI agent skill on Agensi by Ugochukwu Ofuzor, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Ugochukwu Ofuzor](https://www.agensi.io/creators/bishop)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-11-23
- Security: scan passed (2026-11-23); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/token-buddy
- Tags: llm-ops, antigravity, token-optimization, gemini, cost-management

## About this skill

LLM agent sessions often fail when chat context becomes bloated or quotas hit zero mid-task. This skill package provides adaptive token budgeting and subagent routing to maintain high performance without exhausting your model limits.

### What it does
- **Quota monitoring** tracks live accessible models and remaining percentage pools via the `swarm` action.
- **Burn analysis** scans local transcripts to report 24h, 7d, and lifetime token consumption and cache hit rates.
- **Tiered routing** classifies requests into T0-T3 complexity levels to select the cheapest viable model.
- **Context management** offloads heavy file reads and log scans to `flash` subagents to keep parent chat history lean.
- **Static auditing** identifies prompt overhead from rules, skills, and plugins that drive up cache-miss costs.

### How it works
1. **Initialize** by running `locate_gemini.py --install` to sync the skill with your global configuration.
2. **Audit** usage by calling the `swarm` action to fetch live quota data and saving it to your config directory.
3. **Plan** tasks by running the script with the `--plan` flag to determine the optimal model for the current request complexity.
4. **Monitor** in real-time by launching `dashboard.py` to view quota pools and routing recommendations.

### Frameworks & tools
This skill is built for the Antigravity agent framework. It uses Python scripts for local transcript parsing and works with Gemini-family models including `flash_lite`, `flash`, and `pro`.

### Why this beats prompting it yourself
Manual prompts cannot track real-time API quota percentages or scan local log files for lifetime burn data. This skill automates the model selection logic based on actual remaining resources rather than guessing.

### Use cases
- Prevent session termination due to exhausted model quotas during long debugging sessions.
- Reduce API costs by automatically routing trivial lookups to `flash_lite`.
- Maintain fast response times by triggering `/compact` prompts when chat history exceeds 40 steps.
- Audit which plugins or MCPs are causing the most static prompt overhead.

### Known limitations
Requires local access to run Python scripts for transcript analysis. Quota tracking depends on the framework's `swarm` action returning accurate API metadata.

## Requires

- Python

## 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 token-buddy 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 does this skill help reduce my overall LLM API costs?

This skill package prevents Antigravity agent sessions from crashing due to bloated context or exhausted API quotas by implementing tiered routing and real-time token monitoring. It automatically selects the most cost-effective Gemini model for a task and offloads heavy processing to subagents to keep your main chat history lean.

### Which agent frameworks and models are supported?

This package is specifically designed for the Antigravity agent framework and is optimized for the Gemini model family, including Pro, Flash, and Flash-Lite. It requires a local Python environment to run the included transcript analysis and dashboard scripts.

### What is the installation process like for these optimization tools?

Setup is straightforward: you'll run the provided installation script to sync with your global configuration and then trigger the 'swarm' action to map your current quotas. The package includes a dashboard utility to visualize your resource pools immediately after setup.

### What exactly is included in the purchase of this skill?

You receive the full suite of Python scripts for transcript parsing and burn analysis, the adaptive routing logic, and the 'dashboard.py' monitoring utility. It also includes the 'swarm' action integration for live quota tracking within the Antigravity framework.

### How does the subagent routing differ from simply using a smaller model for everything?

The 'flash' subagent routing allows the parent agent to delegate heavy file reads or log scans to a separate, cheaper process. This keeps the parent's context window small and responsive while avoiding the high costs of re-processing large logs in every turn.

### Can I use this to identify which of my other plugins are consuming the most tokens?

Yes, the skill includes a static auditing feature that identifies which specific rules, plugins, or MCPs are contributing most to your prompt overhead. This helps you prune unnecessary 'bloat' from your agent's system instructions to further save on cache-miss costs.

---

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.
