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.

Stars
★ 35k
Last updated
1d ago v2.2.4
FARS reviewed
Nov 08, 2026 +9 new
License
NOASSERTION
Primary language
JavaScript

At a glance

How it runs
MCP serverAgent plugin / skillCLI
Works with
Universal · cross-platformChatGPT · Codex · Claude Code
Cost
Free, no paid service needed
Setup effort
Medium · a few setup steps
You'll need
Node.js >= 22.5Shell / CLINetwork accessLocal filesystemMCP Server
Typical use
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.
Not a fit if
  • Teams without Node.js >= 22.5 installed on every platform
  • Teams needing 100% routing enforcement on non-hook platforms like Cursor or Zed
  • Users unwilling to add rules files or edit platform config files
Website
contextmode.ai ↗ set on GitHub
Maintenance
Commits in the last 30 dayslast commit 2026-12-02latest release v2.2.4 (2026-11-25)+31.1 ★/day over 7 days
Source review
73/100 · Some gaps

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.

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Install / run
  • npm install -g context-mode
Runtime
Node.js 22.5+

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.

Safety boundaries, hardening & integrations

Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.

Declared capability surface (blast radius)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

External MCP tool bridge

Inherits capabilities of connected MCP servers; audit third-party servers before enabling.

FARS trust-control audit

Verified present in source (3/3)
  • data-flow disclosure

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 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.

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
Context Mode — Context Optimization for AI Coding Agents This agent 73 · Some gaps MCP serverFree ★ 35k 1d ago JavaScript ChatGPT · Codex · Claude Code
MCP Task Orchestrator 70 · Some gaps MCP serverFree ★ 215 1d ago Kotlin Claude Code
Mnemosyne 78 · Good CLIFree ★ 162 2d ago TypeScript Claude Code
Okto Nexus Coordination Hub 77 · Good — ★ 107 22d ago Python —

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Some gaps
73/ 100 5-point scale 3.7 / 5
This review covers the source as of Nov 08, 2026. The project has shipped 9 stable release(s) since, which have not been re-reviewed. The score and verdict describe the reviewed version only. Recent releases ↓
Trust 18/29
Reliability 9/14
Adaptability 14/18
Convention 14/18
Effectiveness 12/13
Verifiability 6/8
Why each dimension lost points
Trust18 / 29 · 3.1/5

The source shows path containment, per-hop SSRF checks for URL fetching, timeouts, and a local SQLite index. The README identifies data location and network calls, earning full marks for flow transparency. Setup and upgrade describe config backup, plan display, and restoration on early failure, supporting ordinary user control. Sensitive-data rules and dependency auditing are thin in this packet, and the license restricts hosted service use, so those scores are lower. Publisher identity is unverified, with no stronger independent identity evidence in the packet.

Reliability9 / 14 · 3.2/5

The packet includes CI configuration for multiple operating systems, type checking, unit and end-to-end checks, plus README guidance for installation checks and fixes. No checks were executed for this review, and the supplied source excerpts cannot establish all behavior, so consistency, availability, and failure messaging receive moderate scores.

Adaptability14 / 18 · 3.9/5

The README covers ten coding agents, varied practical tasks, and agent-specific installation paths. It explains the sandbox, indexing, search, and hooks, but the packet omits full tool descriptions and all agent configuration, limiting capability-boundary and trigger precision scores. Node and Windows Git Bash requirements also constrain environment fit.

Convention14 / 18 · 3.9/5

The README has a clear contents structure and detailed install, update, check, removal, example, benchmark, and limitation guidance. Manifests consistently show version 2.1.6, and the license text identifies Elastic License 2.0, which has substantial hosted-service restrictions and is not an unrestricted open-source license. No changelog is present in the packet; maintenance responsibility is evidenced mainly by author metadata and repository links.

Effectiveness12 / 13 · 4.6/5

The tools keep large output in a local index and return concise replies with search access; the skills specify usable report and table formats. Multiple benchmark rows support the stated context-saving value. The cost-benefit case has benchmark methods and runtime requirements, but the figures are project-reported and runtime costs and variation across scenarios receive limited treatment.

Verifiability6 / 8 · 3.8/5

The README links savings claims to benchmark rows, input sources, and rerun commands, while source code supports design claims such as path containment and local indexing. Manifests, source, and README provide some corroboration, but several security and performance conclusions rely on project material; statistics and execution records were not independently verified in this review. Cross-source corroboration and separation of fact from inference therefore receive moderate scores.

Risks and how to mitigate them
  • Elastic License 2.0 expressly restricts providing the software as a hosted or managed service; review its terms before enterprise use or redistribution.
  • The README claims zero telemetry and lists network calls, but this review saw only selected source files and could not independently verify all network behavior or sensitive-data handling.
  • Node 24.15.0 or later is required; Windows also requires Git for Windows.
Evidence confidence: Low Reviewed Nov 08, 2026 Reviewed revision 2000abbadc1b New commits since this review; the score may not cover them
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/context-mode.svg)](https://followagents.com/en/agents/context-mode)
<a href="https://followagents.com/en/agents/context-mode"><img src="https://followagents.com/badge/context-mode.svg" alt="FARS review"></a>

Recent releases

Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.

  1. v2.2.4
    Release notes excerpt
    Fixes - fix(ci): OMP release step adds its dir to GITHUB_PATH (D-OMP-CI-6) - fix(ci): OMP native install step stops after 6 min and hands off to the release step (D-OMP-CI-5) - fix(ci): OMP binary from its GitHub release when OMP's install script gets no build (D-OMP-CI-4) - fix: sandbox child env sets PYTHONUTF8=1 so python prints exact UTF-8 on Windows code pages (#1417) Who gets this One version on both channels: the release commit on main (GitHub) and npm. | Agent | Channel | Update with | |---|---|---| | Claude Code | GitHub | claude plugin update context-mode@context-mode | …
    View on GitHub ↗
  2. v2.2.3
    Release notes excerpt
    Fixes - fix: CTX_REPLACE_TRIGGER_BYTES is no longer read; the replace trigger is the constant 4096 and doctor names a leftover value (ADR-0027 D1) - fix: remember a lost replace bet per session, ADR-0027 D3 (ADR-0027 D3) - fix: ctx_search reads a source in order when no query word is in it, so a replaced MCP document comes back in full pages (#1372) - fix: OMP doctor, setup and uninstall read OMP's plugin store and agent dir the way OMP does (#1415) - fix: codex setup list check reads codex mcp get context-mode --json and names a timeout (#1413) …
    View on GitHub ↗
  3. v2.2.2
    Release notes excerpt
    Fixes - fix: a Fake-IP DNS name in 198.18.0.0/15 passes the SSRF guard after a once-per-process .invalid probe; literals and all other ranges stay blocked (#1403) - fix: only an absolute missing cwd walks up to its nearest existing parent; GP3 and Windows cases follow (#1409) - fix: Claude Code PostToolUseFailure takes the narrow matcher, a foreign MCP failure spawns no hook (#1408) - fix: Claude Code registers PostToolUseFailure, so a failed host tool gets its toolerr row (#1408) - fix: ctx_doctor answers when the project does not resolve (#1410) …
    View on GitHub ↗

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.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

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

Related concepts