I built a way to stop massive tool outputs from blowing up AI agent context windows

Reddit r/AI_Agents Tools

Summary

LeanCTX is updated to act as a gateway managing tool outputs for AI agents, compressing large data, scrubbing secrets, and integrating external tools via MCP to prevent token blowup.

Hey everyone. I have been building LeanCTX to manage context for coding agents. Up until now, it was mostly focused on the file system, deciding what your agent reads and compressing it. With the latest update, I shifted the architecture to solve a different problem: bloated tool outputs. When you give an agent access to external tools, the raw data they return often burns through your token budget and degrades the agent's reasoning. To fix this, LeanCTX now acts as a gateway for the ecosystem. You can plug in external tools using a single command, like lean-ctx addon add repomix. If it speaks MCP, it fits seamlessly. Instead of just passing the raw output to the model, the gateway intercepts it. It treats all addon output as untrusted and scrubs it for secrets. It then compresses the response to fit a specific token budget. If a tool returns a massive data dump, the system spills the oversized results to disk and hands the model a small reference handle instead. Everything is indexed in the background so the agent can search for it later. Tools are no longer isolated side channels. They become a native part of the managed context. I put together a registry with 19 tools so far, covering things from memory to reasoning. I included projects like Headroom, Serena, Repomix, and Mem0. A fragmented ecosystem helps no one, so the goal is to integrate rather than compete. Ten of them install with one command, and for four of them, LeanCTX handles the binary installation entirely.
Original Article

Similar Articles

@akshay_pachaar: https://x.com/akshay_pachaar/status/2053166970166772052

X AI KOLs Timeline

The article discusses a shift in AI agent tool usage from the 'MCP vs CLI' debate to 'Code Mode,' where agents write code to dynamically import tools, significantly reducing context window usage. It highlights Anthropic's approach and Cloudflare's implementation, demonstrating a 98.7% reduction in token consumption for specific tasks.

@rwayne: Context Mode solves the other half of AI Agent context issues: sandboxed tool outputs + persistent sessions. A 56 KB Playwright snapshot compressed to 299 bytes, 98% of data never entering the context. Every file edit, Git operation, task decision is stored into…

X AI KOLs Timeline

Context Mode is a tool that solves AI agent context problems by sandboxing tool outputs and persisting sessions, achieving up to 98% compression of Playwright snapshots and using BM25 retrieval to reduce context window usage. It supports 15 platforms including Claude Code, Gemini CLI, VS Code Copilot, and is used by major tech companies.