# token optimizer

> Run tests and builds through an MCP server to get compact, actionable summaries instead of context-flooding raw logs.

token optimizer is a free AI agent skill on Agensi by Λευτέρης Ευαγγελινός, in Testing & Debugging. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Λευτέρης Ευαγγελινός](https://www.agensi.io/creators/evanfree96)
- Category: [Testing & Debugging](https://www.agensi.io/skills/testing-debugging)
- Uses: 2
- Version: 1.0
- Last updated: 2026-10-15
- Security: scan passed (2026-10-14); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/token-optimizer-1
- Tags: llm-ops, testing, ai-agents, mcp-server, context-optimization, debugging

## About this skill

Stop bloating your context window with thousand-line build logs and test failures. This skill integrates with the Token Optimizer MCP server to run validation commands, keeping raw logs on disk while providing you with compact, actionable JSON summaries of test results, build errors, and typecheck failures.

### What it does
- **Command Digestion** runs noisy commands like installs or migrations and returns only the relevant answers to your intent.
- **Automated Triage** identifies specific failure points and suggests fixes without reading full log files.
- **Log Querying** allows you to grep or query specific parts of a stored execution log by ID instead of importing the whole file.
- **Regression Checking** compares current validation results against a stored baseline to detect new issues.
- **Codebase Scouting** provides ranked file and line pointers for specific goals in unfamiliar repositories.

### How it works
1. **Initialize Validation** by providing the absolute workspace path and the specific commands you need to run, such as `npm test`.
2. **Process Verdicts** via the MCP server which executes the code and uses a local or OpenRouter model to summarize the outcome.
3. **Investigate Failures** using log queries or triage tools if the initial verdict returns a fail or uncertain status.
4. **Update Baselines** using regression checks once a new stable state is reached to prevent future regressions.

### Frameworks & tools
This skill requires the `token_optimizer` MCP server. It supports any CLI-based tool including npm, pytest, go test, and cargo. It works with OpenRouter or OpenAI-compatible local LLM providers for log summarization.

### Why this beats prompting it yourself
Standard agents often hit context limits or lose focus when faced with massive compiler outputs. This skill offloads log processing to a specialized server, keeping your conversation clean and your token usage low while maintaining authoritative exit-code accuracy.

### Use cases
- Validating complex refactors across large monorepos without context overflow.
- Diagnosing intermittent CI failures by querying specific log segments.
- Onboarding to new codebases using ranked scouting to find entry points.
- Running heavy build suites and getting a high-level summary of warnings.

### Known limitations
Shell chaining, redirection, and Git mutations are blocked by the execution policy. Requires a pre-installed MCP server and a configured LLM provider for summaries.

## Requires

- @softawarest/token-optimizer-installer
- Node.js

## 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 optimizer 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 the Token Optimizer prevent my AI agent from hitting context limits during large builds?

This skill solves 'context bloat' by processing massive build and test logs through a dedicated MCP server, returning only actionable JSON summaries and specific failure points instead of thousands of lines of raw text.

### Can I use this with specific testing frameworks like Jest or Pytest?

Yes, the skill is framework-agnostic and supports any CLI-based tool, including npm, pytest, cargo, and go test, making it compatible with almost any modern development environment.

### What are the technical requirements for setting up this skill?

The skill requires the `token_optimizer` MCP server to be installed locally and access to an LLM provider (like OpenRouter or an OpenAI-compatible local server) to handle the log summarization logic.

### What happens if I need to see the full raw logs for a specific error?

While raw logs are stored on your local disk for reference, the skill provides a Log Querying tool that allows you to grep or request specific segments by ID without importing the entire file into your chat.

### Are there any specific commands or shell operations that the Token Optimizer cannot perform?

To ensure security and stability, the execution policy currently blocks shell chaining (e.g., using pipes), redirections, and any commands that perform Git mutations.

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

You receive the full skill configuration for your AI agent, including the specialized tools for Command Digestion, Automated Triage, and Regression Checking, along with documentation for the required MCP server setup.

---

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.
