Developers wrestling with bloated context windows in AI coding assistants have a new weapon. Context Mode, an open-source MCP server, claims to reduce context usage by up to 98% by keeping raw data out of the conversation window. The tool targets the silent killer of AI agents: the gradual loss of session state as verbose tool outputs eat up token limits.
The Four-Sided Context Problem
Every MCP tool call dumps raw data directly into the context window. A single Playwright snapshot can cost 56 KB, while twenty GitHub issues add another 59 KB. After thirty minutes of work, 40% of the context is often gone. Worse, when the agent compacts the conversation to free space, it forgets which files were being edited and what tasks were in progress. Context Mode addresses this by sandboxing tools, tracking session continuity in SQLite, and enforcing a 'Think in Code' paradigm.
Think in Code, Not in Data
The core philosophy is treating the LLM as a code generator rather than a data processor. Instead of reading 50 files into context to count functions, the agent writes a script that performs the analysis and logs only the result. The documentation provides a stark example: replacing 47 Read() calls that consumed 700 KB with a single ctx_execute() call using just 3.6 KB. This approach is mandatory across 17 supported clients, including Claude Code, Gemini CLI, and VS Code Copilot.
Session Continuity via SQLite and FTS5
Context Mode tracks every file edit, git operation, task, and user decision in a local SQLite database. When the conversation compacts, the tool does not dump this data back into the context window. Instead, it indexes events into FTS5 and retrieves only relevant information via BM25 search. This ensures the model picks up exactly where the developer left off, without the overhead of re-ingesting the entire history. If a new session is started without the --continue flag, previous data is deleted immediately for a clean slate.
Key Takeaways
- Context Mode reduces context usage by 98% by sandboxing raw data outputs.
- It uses SQLite and FTS5 to maintain session continuity across conversation compactions.
- The tool enforces a 'Think in Code' paradigm, replacing verbose data reads with script execution.
- Support includes major platforms like Claude Code, Gemini CLI, VS Code, and JetBrains.
- No prose-style enforcement is applied, allowing developers to control output formatting via their own config files.
The Bottom Line
This is a practical fix for the most annoying part of AI-assisted coding: losing your train of thought because the agent forgot what you were doing. If you are tired of your context window filling up with JSON logs, install this tool and reclaim your tokens.