GraphCanon updated today · GitHub synced today · 27 views this month
Decision brief
Optimizes AI coding agent context windows via sandboxing and persisting session memory across 17 platforms using MCP plus hooks.
Good fit when
- You require seamless support for multiple coding environments including antigravity, claude-code, codex, copilot, and more.
- Your use case involves frequent switching between coding tasks needing a persistent context window without losing memory state.
Avoid when
- Your project works only on platforms not covered by the 17 supported environments listed in the repository topics section.
- You need real-time updates and direct manipulation of code snippets that bypass the sandboxed output feature, as it enforces an up to 98% reduction without manual override options.
Observed Jul 17, 2026 · Source: enrich:decision_facts
Verify the decision
Adoption
Package downloads where a registry match exists. GitHub stars (20,138) are secondary evidence.
- npm downloads (30d)
- 80,999·npm downloads API·today
Maintenance and security
Full trust report- Maintenance
- Very active (0d since push)
- As of today
- Provenance
- Not a fork · Personal account
- As of today
- Security (OSV)
- No lockfile
- As of 1mo
Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.
Install
npm install context-mode npmHow it fits your stack(1)
Typed graph edges - alternatives, integrations, successors, and dependencies. Ranked by relationship type, not raw GitHub stars.
Relationship graph
Optional deeper exploration of typed edges and category neighbours.
Similar tools
Same-category neighbours not already linked as typed edges.
Evidence and technical details
Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.
Overview
A tool that optimizes context windows for AI coding agents by sandboxing outputs and persisting session memory with support across multiple platforms using MCP plus hooks.
Capability facts
- CLI
- CLI entrypoint
Source: package.json:bin|scripts · Aug 26, 2026
- MCP server
- Ships MCP server
Source: package.json:@modelcontextprotocol/* · Aug 26, 2026
- Languages
- typescript, javascript
Source: github.language+package.json · Aug 26, 2026
Categories
Compatibility
Sourced claims from the README excerpt - not unsourced marketing copy.
Source: README excerpt (regex_v1, Aug 26, 2026)
**Prerequisites:** Node.js >= 22.5 (or Bun), Gemini CLI installed.Source link
Tags
README
Install
Platforms are grouped by install complexity. Hook-capable platforms get automatic routing enforcement. Non-hook platforms need a one-time routing file copy.
Claude Code — plugin marketplace, fully automatic
Prerequisites: Claude Code v1.0.33+ (claude --version). If /plugin is not recognized, update first: brew upgrade claude-code or npm update -g @anthropic-ai/claude-code.
Install:
/plugin marketplace add mksglu/context-mode
/plugin install context-mode@context-mode
Restart Claude Code (or run /reload-plugins).
Verify:
/context-mode:ctx-doctor
All checks should show [x]. The doctor validates runtimes, hooks, FTS5, and plugin registration.
Routing: Automatic. The SessionStart hook injects routing instructions at runtime — no file is written to your project. The plugin registers all hooks (PreToolUse, PostToolUse, UserPromptSubmit, PreCompact, SessionStart, Stop) and 11 MCP tools — six sandbox tools (ctx_batch_execute, ctx_execute, ctx_execute_file, ctx_index, ctx_search, ctx_fetch_and_index) plus five meta-tools (ctx_stats, ctx_doctor, ctx_upgrade, ctx_purge, ctx_insight).
| Slash Command | What it does |
|---|---|
/context-mode:ctx-stats | Context savings — per-tool breakdown, tokens consumed, savings ratio. |
/context-mode:ctx-doctor | Diagnostics — runtimes, hooks, FTS5, plugin registration, versions. |
/context-mode:ctx-index | Index a local file or directory into the persistent FTS5 knowledge base. |
/context-mode:ctx-search | Search previously indexed content. |
/context-mode:ctx-upgrade | Pull latest, rebuild, migrate cache, fix hooks. |
/context-mode:ctx-purge | Permanently delete all indexed content from the knowledge base. |
/context-mode:ctx-insight | Opens the hosted Insight dashboard (context-mode.com/insight) in your browser — org analytics for AI-assisted engineering teams. |
Note: Slash commands are a Claude Code plugin feature. On other platforms, type
ctx stats,ctx doctor,ctx index,ctx search,ctx upgrade, orctx insightin the chat — the model calls the MCP tool automatically. See Utility Commands.
Status line (optional): Claude Code's plugin manifest cannot declare a status line, so this is a one-time manual edit to ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "context-mode statusline"
}
}
After saving, restart Claude Code. The bar shows $ saved this session · $ saved across sessions · % efficient so you can see savings accumulate in real time. The wiring is path-free — context-mode statusline resolves through the bundled CLI regardless of where the plugin cache lives.
Alternative — MCP-only install (no hooks or slash commands)
claude mcp add context-mode -- npx -y context-mode
This gives you all 11 MCP tools without automatic routing. The model can still use them — it just won't be nudged to prefer them over raw Bash/Read/WebFetch. Good for trying it out before committing to the full plugin.
Gemini CLI — one config file, hooks included
Prerequisites: Node.js >= 22.5 (or Bun), Gemini CLI installed.
Install:
-
Install context-mode globally:
npm install -g context-mode -
Add the following to
~/.gemini/settings.json. This single file registers the MCP server and all four hooks:{ "mcpServers": { "context-mode": { "command": "context-mode" } }, "hooks": { "BeforeTool": [ { "matcher": "run_shell_command|read_file|read_many_files|grep_search|search_file_content|web_fetch|activate_skill|mcp__plugin_context-mode|mcp__context-mode|mcp__(?!.*context-mode)", "hooks": [{
For agents
This page has a .md twin and JSON over the API.