Context Mode logo

Context Mode

Visit

An MCP server and plugin that stops context-window bloat in AI coding agents, sandboxing MCP tool output into a searchable SQLite index and recovering it on demand.

Share:
View alternatives

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_execute call 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

  1. Compaction amnesia: the agent forgets which files it was editing and what you last asked.
  2. Raw data flooding: long snapshots and logs eat the context budget before real work starts.
  3. 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

  1. 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.
  2. Retrieval instead of replay: indexed events are searched, not dumped back, so compaction does not flood the window a second time.
  3. Works with the agent you have: an MCP server integrates across many clients instead of locking you to one editor.

Getting Started

  1. Install in Claude Code: run /plugin marketplace add mksglu/context-mode, then /plugin install context-mode@context-mode, and reload plugins.
  2. Verify with /context-mode:ctx-doctor until every check passes.
  3. 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

  1. Run /context-mode:ctx-stats regularly to see savings per tool and find your worst offenders.
  2. Use ctx_index and ctx_search for project knowledge that should survive across sessions.
  3. 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!