Context Mode is the other half of the context problem. Coding agents already have a way to buy context, but they leak it: every MCP tool call dumps raw data straight into the window, and compaction pushes the details out of reach. Context Mode is an MCP server and agent plugin that keeps raw tool output out of the window entirely, indexes the important events into SQLite, and lets the model pull back only what it actually needs. It fills the gap that model providers and context-optimization prompts leave untouched.
Compare Claude Code if you want Anthropic's first-party terminal agent, OpenCode for an open-source terminal agent, or Cursor for an AI-native editor.
Key Features
- Context saving: sandbox tools keep raw data out of the window. A 315 KB response becomes about 5.4 KB, roughly a 98 percent reduction.
- Session continuity: every file edit, git operation, task, error, and user decision is tracked in SQLite. When the conversation compacts, events are indexed into FTS5 and retrieved through BM25 search, so the model resumes exactly where it stopped.
- Think in Code: instead of reading 50 files into context to count functions, the agent writes a script that does the counting and logs only the result. One
ctx_executecall replaces several read calls and can save an order of magnitude more context. - No prose enforcement: Context Mode routes where data goes but never dictates how the model talks, so it does not force brevity patterns that can degrade reasoning.
- Broad client support: 17 supported clients including Claude Code, Gemini CLI, Codex, VS Code plugins, and the OpenClaw gateway.
Use Cases
Who Should Use This Tool?
- Developers hitting the ceiling: when a long session keeps forgetting files or tasks, this preserves the state that survives compaction.
- Teams running agents on MCP-heavy stacks: Playwright snapshots, GitHub issue dumps, and logs can consume most of the window; sandboxing them buys room back.
- Heavy multi-tool workflows: anyone with many MCP servers will see the largest savings.
Problems It Solves
- Compaction amnesia: the agent forgets which files it was editing and what you last asked.
- Raw data flooding: long snapshots and logs eat the context budget before real work starts.
- Token waste on both ends: filler in tool output and verbose replies burn budget from both sides.
Pricing
Context Mode is free to self-host under the Elastic License 2.0 (ELv2), a source-available license. The CLI, MCP tools, and plugins cost nothing. The optional hosted Insight dashboard for organization analytics is sold as a paid upgrade; the exact price was not independently verified, so treat it as a paid add-on rather than an audited figure.
Advantages & Unique Selling Points
- Fixes the leak, not the symptoms: it does not make the model write shorter, it keeps raw data out of the window in the first place.
- Retrieval instead of replay: indexed events are searched, not dumped back, so compaction does not flood the window a second time.
- Works with the agent you have: an MCP server integrates across many clients instead of locking you to one editor.
Getting Started
- Install in Claude Code: run
/plugin marketplace add mksglu/context-mode, then/plugin install context-mode@context-mode, and reload plugins. - Verify with
/context-mode:ctx-doctoruntil every check passes. - Use the sandbox tools (
ctx_execute,ctx_index,ctx_search) and let the hooks route raw output out of the window automatically.
Frequently Asked Questions
Does it work with Claude Code?
Yes. The marketplace plugin registers all hooks and 11 MCP tools with automatic routing. It also works with Gemini CLI, Codex, VS Code, and the OpenClaw gateway.
Is it a subscription?
No. The core tool is free under ELv2. Only the hosted Insight analytics are a paid service.
Does it force the model to be brief?
No. It never dictates how the final answer is written; it only controls where tool data goes.
Alternatives
- Claude Code: Anthropic's first-party terminal agent.
- OpenCode: open-source terminal-based coding agent.
- Cursor: AI-native editor built on VS Code.
Tips
- Run
/context-mode:ctx-statsregularly to see savings per tool and find your worst offenders. - Use
ctx_indexandctx_searchfor project knowledge that should survive across sessions. - Add the status line bar to watch saved context accumulate in real time.
Conclusion
Context Mode treats context as a budget to be managed, not a buffer to be filled. If your coding agent keeps losing the plot on long tasks, start at github.com/mksglu/context-mode and let the sandbox do the bookkeeping.
Comments
No comments yet. Be the first to comment!
Related Tools
Specboard
specboard.io
Spec and context management for AI coding agents. A 4-stage pipeline turns ideas into specs, a mind map and Markdown editor structure them, and a native MCP server lets agents read and write specs directly.
Claude Code
code.claude.com/docs/en/overview
Anthropic's agentic coding tool for terminal, IDE, desktop, and browser. Reads the repo, edits files, runs commands, and connects MCP, skills, and hooks.
Command Code
commandcode.ai
AI coding agent from Command Code AI that learns your coding taste with taste-1, then ships, reviews, and refactors in your style from the terminal.
Related Insights
Seven AI Coding CLIs, Six Months: No Matter How Strong the Model, Work Needs Supervision
Claude Code, Codex, opencode, pi, omp and DeepSeek Harness all have personalities. After six months of deep use I run a division of labor: pi for the fastest cheapest reviews, omp for complex PRs, DeepSeek Harness on V4 Flash for high-frequency low-cost review, and Claude Code, Qoder and Cursor for writing. No matter how strong the model, work needs supervision — ideally from an independent third party.
What Locks Codex Is the Picker, Not the Models
You already pay for OpenCode Go, Grok, and Z.ai, but the Codex picker still shows mostly GPT. The community project codex-router does not teach another install ritual. It puts subscriptions you already bought back into the selector, keeps keys on the machine, and leaves native GPT alone.
Hook OpenCode Go into Codex on Windows. Do Not Open a Second Toolkit.
A ChatGPT-signed Codex desktop app still shows mostly GPT in the picker. On Windows, enable only OpenCode Go and the Grok, GLM, Kimi, DeepSeek, and MiniMax models you already pay for appear in the same selector. Keys stay local. Native GPT stays put.