Keep coding agent context windows clear with a local plugin
This plugin prevents massive results from file reads or command executions from filling up the context. It stores tool outputs in a local sandbox and lets the agent retrieve only the parts it needs. All data stays on your computer, and no telemetry is collected.
How it pushes output out of the context
Coding agents read files, run commands, and fetch web pages, and all these results accumulate in the context window. Context Mode processes this in a local sandbox and stores the full output in a SQLite index. The agent does not read the entire data; instead, it writes short scripts to receive only the necessary information. This significantly reduces the number of bytes reaching the context. In 36 benchmark rows with original outputs larger than 10KB, the plugin's median response was 99.4% smaller than the original output.
Savings observed in real tools
Savings were measured using actual tool outputs from public projects.
- Sandbox execution When running files or commands in the sandbox, it keeps 99.5% of the output out of the context on a median basis.
- Local index search When searching the local index, it shows a 77.2% savings rate because it includes matching text.
- Host tool output When fully indexing host tool output that exceeds limits, it saves 98.3%.
Handling long sessions and compaction
When the context fills up in an old session, the host compresses it, and the agent sees only a short summary. During compaction, it preserves the session state with a snapshot of up to 2,048 bytes. The agent can then call ctx_resume to read the snapshot and use ctx_search to find previous outputs by keyword. In a script session with 40 tool outputs, the ctx_resume block that returned the agent was 2,019 bytes.
Installation and requirements
This plugin requires Node 24.15.0 or higher. On Windows, Git for Windows is required, and shell tools run in Git Bash. It is installed as the npm package context-mode, and the current 2.0 release tag uses @next. Claude Code, Codex, Gemini CLI, and Qwen Code are installed from GitHub, while other agents are installed via npm commands. After installation, restart the agent and run /ctx-doctor to check the status.
Things to check before use
This plugin is compatible with 10 coding agents and provides hooks, an MCP server, and plugin skills for all of them. Data is stored in ~/.context-mode, and a context.db is created for each project. Sandbox execution, file indexing, and search work offline. The license is a source-available license, and both personal and business use are free. Context Mode Gateway is a separate hosting service and is independent of this plugin.