Manages AI agent context by sandboxing tool outputs and persistently tracking session state across multiple LLM development environments to prevent context window bloat.
Context Mode is an MCP server that addresses the problem of context window bloat and loss of session continuity when using AI agents and LLM tools. Developed by mksglu, it prevents raw data from overwhelming the LLM's context by using a sandbox and persistent storage. It ensures agents can maintain awareness of ongoing tasks and files across sessions.
Context Mode functions as an MCP server, intercepting LLM tool calls. It uses isolated subprocesses (sandboxes) to execute code in 11 languages, returning only concise stdout to the LLM's context. Session events and indexed content are stored in a local SQLite database, leveraging FTS5 and BM25 ranking for efficient retrieval. Functionality is delivered via platform-specific plugins and hooks for various AI development environments, and the tool is open-source.
Ideal for developers and AI engineers building or using agents on platforms like Claude Code, VS Code Copilot, or Gemini CLI who struggle with LLM context window limits and session state loss during complex, multi-step tasks.
Full session continuity and automatic routing enforcement rely heavily on platform-specific hook support; some platforms (e.g., Antigravity, Zed in current releases) offer only partial or no hook integration, requiring manual file copying for reduced effectiveness.