Reduce LLM Token Costs by Selecting Tools Before Context Loading
A new workflow uses a tool called 'ctx' to automatically recommend only relevant skills, agents, and MCP servers for a given task, preventing unnecessary token consumption from the start.
Practical Summary
Instead of compressing prompts or responses after they are loaded, this method analyzes your repository and task to recommend a minimal set of relevant tools (skills, agents, MCP servers, harnesses) to load into context. This proactive selection reduces the total token footprint of your AI session, potentially lowering API costs and improving response relevance.
Why It Matters
Token cost is a major operational expense in AI workflows. While tools exist to compress outputs, this upstream approach prevents irrelevant context from being loaded at all, addressing a root cause of high token usage. It represents a shift from reactive optimization to proactive cost management.
Understand the Problem: Tool Overload
Many developers accumulate a large number of skills, agents, MCP servers, and other tools. When an AI model has access to this entire library, it must process all options, leading to unnecessary token consumption and potential confusion. This is like giving a mechanic an entire warehouse of tools for a simple oil change.
The Proactive Solution: Contextual Tool Selection
The 'ctx' tool addresses this by analyzing the current repository and task *before* the AI session begins. It walks a pre-built graph of available tools and recommends only the top-scored, relevant bundle. This ensures the AI model only sees the tools it might actually need for the specific job.
How the Recommendation System Works
The recommendations are based on a curated dataset: over 91,000 skills, 467 agents, 10,700 MCP servers, and 207 harnesses. This dataset was built using AI assistance but manually curated to ensure accuracy and prevent hallucinated suggestions. The tool uses this data to make informed, repeatable selections.
Integration with Existing Token-Saving Tools
This method is complementary to downstream token-saving tools. For example, you could use 'ctx' to select the right tools for the task, then use a tool like 'rtk' to compress the terminal output those tools produce, and use a terse-output tool for shorter assistant responses. The goal is a layered optimization strategy.