Reduce AI Token Costs by Pre-Selecting Relevant Tools: The 'ctx' Upstream Approach
How to avoid loading unnecessary skills, agents, and MCP servers into context before an AI session even starts, as a complementary layer to output-compression tools.
Practical Summary
Instead of just compressing requests or responses after they are generated, this workflow focuses on curating and recommending only the necessary tools (skills, agents, MCP servers) for a given task before the session begins. This upstream selection can prevent irrelevant context from ever consuming tokens.
Why It Matters
Accumulating unused tools and context is a hidden source of token cost. By narrowing the available toolset at the start, businesses can reduce input and processing tokens, directly impacting API costs without sacrificing task completion. It's a proactive strategy that works alongside reactive compression tools.
Understanding the Problem: Tool Accumulation and Token Waste
Teams often accumulate numerous AI tools, skills, agents, MCP servers, and custom prompts over time. When an AI model is given access to this entire, large toolbox for every task, it must process all that context, consuming tokens. Tools like rtk, caveman, and ponytail help by compressing output *after* it's generated, but they don't prevent the initial loading of irrelevant context.
The Upstream Solution: Pre-Session Context Selection
The 'ctx' workflow introduces an upstream selection step. Before a coding or task session starts, the system analyzes the repository and the task description. It then walks a pre-built graph of your available tooling and recommends a small, top-scored bundle of only the relevant skills, agents, and MCP servers for that specific context.
This curated, smaller bundle is what gets loaded into the AI's context window, rather than the entire toolbox. The goal is to avoid sending irrelevant instructions and tool definitions to the model altogether.
How It Works: Curation and Graph-Based Recommendation
The system relies on a carefully curated database. The creator reports using AI to generate and then manually revise a dataset containing over 91,000 skills, 467 agents, 10,700 MCP servers, and 207 harnesses. A graph is built from this data to map relationships and help the system make informed recommendations.
By watching the repo and task, the system uses this graph to select a focused tool bundle, aiming to make recommendations that are not hallucinated and are repeatable.