Context Mode MCP Cuts Coding Agent Tokens 70%
Indie Hacker Newsgo watch the original →
the gist
Context Mode MCP server sandboxes tool calls across 14 agents, compresses outputs 98%, and uses SQLite retrieval for session continuity, dropping tokens ~70% without accuracy loss.
Context Leakage in Coding Agents
Coding agents like Claude Code, Cursor, and Codex dump raw tool outputs into context windows. A Playwright snapshot costs 56 KB; 20 GitHub issues cost 59 KB. After 30 minutes, 40% of context is consumed. Agent compaction then forgets key details like the edited file.
Sandboxed Tool Calls and Compression
Context Mode MCP server intercepts tool calls, runs them in a sandbox supporting 11 languages (JavaScript, TypeScript, Python, Shell, Ruby, Go, Rust, PHP, Perl, R, Elixir), and inserts only results into context. 315 KB of raw Playwright snapshots, GitHub issues, access logs, and repo research shrinks to 5.4 KB. Output compression via system prompt instructs models to "talk like cavemen": drop articles, hedging, pleasantries for technical substance only. This cuts output tokens ~70% without losing accuracy.
Session Continuity and Think in Code
SQLite FTS5 with BM25 ranking, porter stemming, trigram matching, Levenshtein fuzzy correction (e.g., Kubernus → Kubernetes), and reciprocal rank fusion (RRF) indexes session history. Compaction retrieves only relevant data via search; multi-term queries get proximity re-ranking. "Think in code" replaces reading 50 files (47 read calls, 700 KB) with agent-generated scripts logging answers (1 call, 3.6 KB).
Installation and Trade-offs
Install via two commands on Cloud Code: add marketplace, install plugin. Session start hook injects routing; supports 14 agents. Version 1.0.11 refactors pre-tool platform detection. Trade-offs include Elastic License 2.0 (source-available, not fully open), manual config on some platforms, and fast release cadence (111 in 70 days) risking regressions. Dashboard shows real-time savings: dollars saved, efficiency %.