context-mode — Claude Code plugin: what it does, how to install
An MCP server that keeps raw tool output out of the context window and rebuilds session state after a compact. Useful when the agent burns through context fast.
/plugin marketplace add anthropics/claude-plugins-community
/plugin install context-mode@claude-communityWhat context-mode does
Every MCP tool call drops raw output straight into the context window. A Playwright snapshot, a batch of issues, an access log — and half an hour later the window is noticeably emptier. context-mode intercepts that: sandbox tools do the work off to the side, and only the result comes back. The README walks through a case where 315 KB shrinks to 5.4 KB.
Under the hood it's an MCP server with a SQLite database. File edits, git operations, tasks, errors and user decisions land there as events, get indexed into FTS5, and are pulled back through BM25 search when the conversation compacts. The model picks up where it stopped. One catch: without the --continue flag, the previous session's data is deleted right away, so a new session starts from a clean slate.
A separate principle is that the agent writes a script to do the analysis instead of computing it itself. Rather than reading fifty files, it runs code and prints only the result. The mode doesn't dictate how the model phrases its answer — brevity or completeness stays with the model and your CLAUDE.md. Claude v1.0.33 or newer is required; check with claude --version.
What it helps with
- keep raw MCP tool output out of the context window
- recover which files were being edited after a compact
- replace ten tool calls with a single script
- find a session event by search instead of rereading history
- start a fresh session without leftovers from the previous one
Example prompts for the agent
- count lines in every .ts file under src with ctx_execute, don't read them into context
- what did I edit in the last session? pull it from the events
- take a Playwright snapshot but return only the headings
How to install context-mode
Plugin marketplace
/plugin marketplace add anthropics/claude-plugins-community/plugin install context-mode@claude-communityStep by step, with commands for each platform: Claude Code plugins: marketplaces, installing, and building your own
Questions about context-mode
How do I install context-mode in Claude?
Through the plugin marketplace: first /plugin marketplace add anthropics/claude-plugins-community, then /plugin install context-mode@claude-community.
What does context-mode do?
It's an MCP server that runs tools in a sandbox and keeps their raw output out of context. It also logs session events to SQLite so you can get back to the right spot after a compact.
What do I need for context-mode to work?
Claude v1.0.33 or newer — check with claude --version. If you start a session without --continue, the previous session's data is deleted immediately.