Dev & Engineering context-window-optimizationmcp-serversqlitesession-continuitytool-sandboxing

Context Mode — Context Optimization for AI Coding Agents

Cut context window bloat, persist session memory, and enforce tool routing across 17 platforms via MCP and hooks.

FollowAgents review · FARS-2.1
Not recommended
54/ 100 5-point scale 2.7 / 5
1 2 3 4 5 6
1Trust11 / 29 · 1.9/5

Evidence shows: tool sandboxing (ctx_execute etc.) reduces raw data entering context, but permission model does not explicitly follow least privilege; user confirmation exists (e.g., ctx_purge requires confirmation) but not comprehensive; data flow transparency is good, README details data flow; sensitive data handling (e.g., session data) has deletion mechanism but no explicit encryption; dependency security not audited; external effects (e.g., web fetch) sandboxed but not explicitly restricted; rollback mechanism exists (ctx_upgrade can fix) but not explicit data rollback; source attribution clear (author, repo) but publisher unverified. Deductions: permission model not explicit least privilege, user confirmation not comprehensive, sensitive data not encrypted, dependencies not audited, external effects not explicitly restricted, rollback incomplete, publisher unverified.

2Reliability8 / 14 · 2.9/5

Evidence shows: self-consistency good, README consistent with code; dependency availability not verified (static review); failure messages provided (e.g., ctx-doctor diagnostics) but not comprehensive. Deductions: dependency availability not verified, failure message coverage incomplete.

3Adaptability12 / 18 · 3.3/5

Evidence shows: audience clear (AI coding agent users), scenarios diverse (17 platforms); capability boundaries clear (tool list); trigger precision good (hook matchers); environment fit good (multi-platform configs). Deductions: some platform support incomplete (e.g., Cursor pending review), environment fit has limitations.

4Convention10 / 18 · 2.8/5

Evidence shows: information architecture clear (README, docs); install notes detailed; naming stable (ctx_* tools); examples and FAQ provided; known limitations documented (e.g., Cursor limitations); license clear (ELv2); version and changelog provided (package.json version) but no standalone CHANGELOG; maintenance responsibility clear (author, repo). Deductions: no standalone CHANGELOG, maintenance responsibility not fully explicit.

5Effectiveness9 / 13 · 3.5/5

Evidence shows: output usability high (tools return structured results); marginal value high (98% context savings); cost-benefit reasonable (free open source). Deductions: no independent cost analysis, but overall reasonable.

6Verifiability4 / 8 · 2.5/5

Evidence shows: claims traceable (README references issues, docs); cross-source corroboration limited (only within repo); fact-inference separation good (README distinguishes problem and solution). Deductions: cross-source corroboration insufficient.

Evidence confidence: Low Reviewed Aug 09, 2026 Reviewed revision 04288af76f1d
The upstream repository has new commits since this review. The score still applies to the reviewed revision shown and may not cover the latest changes.
Before you use it
  • Publisher unverified, identity unknown.
  • Dependency security not audited, recommend checking dependency vulnerabilities.
  • Sensitive data (e.g., session data) not explicitly encrypted, recommend encryption at rest.
  • Some platform support incomplete (e.g., Cursor pending review), confirm before install.
  • No standalone CHANGELOG, version change history incomplete.
Review evidence [1][2][3][4][5][6][7][8]
See the full review method →

What does this agent do, and when should you use it?

Context Mode is an MCP server that solves the problem of AI coding agents' context windows being flooded by tool output. It sandboxes tool execution to keep raw data out of context (e.g., 315 KB → 5.4 KB, a 98% reduction) and persists session events (file edits, git operations, tasks, errors, user decisions) into SQLite, using FTS5 and BM25 search to restore key state after conversation compaction. The project promotes a "think in code" paradigm where the model writes scripts that compute results and output only stdout, rather than reading many files into context. Context Mode supports 17+ platforms including Claude Code, Gemini CLI, Copilot, Cursor, OpenCode, and others, with hooks or routing files for enforcement, and it works as an MCP server. It provides 11 MCP tools like `ctx_execute` and slash commands like `ctx-stats` and `ctx-doctor`. The project is licensed under ELv2 and targets developers and teams using LLM-assisted coding.

Context Mode registers itself with supported clients via MCP or plugins. When the model calls tools, hooks or routing rules guide it to prefer sandboxed tools like ctx_execute and ctx_batch_execute, which run code in separate subprocesses and only return stdout to context. ctx_index chunks markdown by headings while preserving code blocks, storing in SQLite FTS5; ctx_search uses BM25 and Reciprocal Rank Fusion to retrieve indexed content. ctx_fetch_and_index fetches URLs, converts to markdown, chunks, and indexes with TTL caching. Session events are captured by hooks like PreToolUse and PostToolUse into SQLite; before compaction, PreCompact hooks save snapshots, and on session resume, SessionStart injects relevant state. ctx_stats reports context savings.

  1. A Claude Code user installs the plugin and uses /context-mode:ctx-doctor to verify, with hooks automatically redirecting large tool calls to sandbox execution.
  2. A Gemini CLI developer registers MCP and hooks via one config file, reducing context usage and maintaining session continuity.
  3. A Cursor user manually configures .cursor/hooks.json and rules file to protect context in the IDE, as the Marketplace plugin is pending review.
  4. A Codex CLI user enables plugin and hooks feature flags to ensure state restoration after conversation compaction.
  5. A team uses ctx_index and ctx_search to build a project knowledge base for on-demand retrieval without loading large documents.
  6. An OpenCode user uses the TypeScript plugin to get native ctx_* tools and hooks, with session snapshots during compaction.

What are this agent's strengths and limitations?

Pros
  • Sandboxed tools can reduce tool output by up to 98% (e.g., 315 KB → 5.4 KB), drastically preserving context.
  • Session continuity is robust, with hooks and SQLite restoring file and task state after compaction.
  • Supports 17+ platforms including Claude Code, Gemini CLI, Cursor, Codex, with automatic or manual routing.
Limitations
  • Non-hook platforms like Antigravity IDE and Zed rely on rule files, achieving only ~60% routing compliance, offering weaker protection.
  • Requires Node.js >= 22.5 and all platforms need Node installed.
  • Some platforms like Cursor lack SessionStart hooks, requiring extra rules file; Cursor plugin is awaiting review.

How do you install or deploy this agent?

For Claude Code: run /plugin marketplace add mksglu/context-mode and /plugin install context-mode@context-mode, then restart and verify with /context-mode:ctx-doctor. For other platforms, install Node.js >= 22.5, npm install -g context-mode, then copy the platform-specific MCP config, hooks file, and routing rules. Full steps in README.

How do you use this agent?

After installation, type ctx stats in a supported client to see savings, ctx index to index a file, ctx search to query, and ctx doctor to diagnose. Sandbox tools like ctx_execute are automatically invoked by the model or can be used manually.

How does this agent compare with similar options?

Compared to other AI coding assistants without context optimization, Context Mode's unique selling point is its sandboxed execution and SQLite-based session persistence, not just prompt compression.

FAQ

Is Context Mode free?
The repo is under the ELv2 license, not fully open-source. Commercial use may require additional licensing; check the license for details.
Will using sandbox tools limit functionality?
Sandboxing isolates subprocesses, but credential passthrough enables authenticated CLIs (e.g., gh, aws), so most operations work normally.
Does Context Mode collect my data?
It stores session data and indexes locally, but the [insight] dashboard may require uploading usage data to provide org analytics.
How do I uninstall?
For Claude Code, use /plugin to uninstall; for others, remove the MCP config, hooks file, and the global npm package.

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related agents