context-mode: 98% context savings and session continuity across 17 AI coding agents

context-modemcpcontext-engineeringcontext-windowai-coding-agentstoken-savings+3
context-mode README at github.com/mksglu/context-mode on 2026-07-29, showing the 'Used across teams at' logo grid and the 'How Context Mode Solves It' four-bullet block: Context Saving, Session Continuity, Think in Code, No prose-style enforcement.
Source: https://github.com/mksglu/context-mode · Captured 2026-07-29 via Playwright Chromium · Project license: ELv2.

mksglu/context-mode is a 19,414★ MCP server that combines a 98% tool-output reduction sandbox, SQLite + FTS5 session-continuity across conversation compactions, a “think in code” paradigm, and 17 supported AI coding agent platforms — all under an ELv2 (source-available) license. Per the project’s own BENCHMARK.md: 21 scenarios, 376 KB raw data processed into 16.5 KB of context, for a 96% overall savings with 100% code-example preservation.

What happened

Every MCP tool call dumps raw data into the context window. A Playwright snapshot costs 56 KB. Twenty GitHub issues cost 59 KB. One nginx access log — 45 KB. After 30 minutes, 40% of the context is gone (README, 2026-07-29). mksglu/context-mode attacks this with four integrated subsystems packed into a single npm package registered across 17 AI coding agent platforms.

The repo stands at 19,414★ / 1,400+ forks / 2,108 commits as of 2026-07-29 (live-verified at github.com/mksglu/context-mode). It recently hit the front page of Hacker News. The project lists “Used across teams at” logos for Microsoft, Google, Meta, Amazon, NVIDIA, and Stripe in its README — self-disclosed in the project’s own README, not a customer reference.

The four sub-problems

Per the README, context-mode addresses four concrete pain points of the AI agent context window:

The four-part solution

LayerWhat it does
Context SavingSandbox tools (ctx_execute_file, ctx_index, ctx_search) keep raw data out of the context window. README hero: 315 KB raw → 5.4 KB (98% reduction).
Session ContinuityEvery file edit, git operation, task, error, and user decision is tracked in SQLite. On compaction, events are indexed into FTS5 and retrieved via BM25 search — the model picks up exactly where it left off.
Think in CodeInstead of 47 Read() calls worth 700 KB, the agent writes one ctx_execute("javascript", ...) script that console.logs the result — 3.6 KB. Mandatory across all 17 clients.
No prose enforcementThe project keeps raw data out of context but never dictates how the model writes its final answer. Brevity, completeness, formatting — the model’s call.

The benchmark numbers

Per the project’s BENCHMARK.md (21 scenarios, 376 KB raw → 16.5 KB context):

Benchmark sliceScenariosRaw → ContextSavings
Part 1: ctx_execute_file (structured data)14315 KB → 5.5 KB98%
Part 2: ctx_index + ctx_search (knowledge retrieval)660.3 KB → 11.0 KB82%
Part 3: Large-output externalization1Data >100 KB auto-indexed to FTS5Pointer only
Full debugging session177.1 KB → 10.2 KB (~45,300 → ~2,600 tokens)94% more context free

Representative ctx_execute_file rows: Playwright page snapshot 56.2 KB → 299 B (99%), nginx access log 45.1 KB → 155 B (100%), analytics CSV 85.5 KB → 222 B (100%). All 125 tests pass. The benchmark is the project’s own fixture set, not an independent replication.

The 17-platform scope

Full plugin (MCP + hooks + skills + slash commands): Claude Code (marketplace), OpenCode, KiloCode, OMP (Oh My Pi), Antigravity CLI / agy, GitHub Copilot CLI, Codex CLI.

MCP + hooks (manual config): Gemini CLI, VS Code Copilot, JetBrains Copilot, Cursor (work in progress — marketplace awaiting Cursor team review), Kiro, Kimi Code, Qwen Code, OpenClaw / Pi Agent.

MCP-only (no hook support): Zed, Antigravity IDE.

The project counts “17 supported clients, plus the OpenClaw gateway integration.” On Claude Code, the install is two commands: /plugin marketplace add mksglu/context-mode, then /plugin install context-mode@context-mode. All 11 ctx_* tools become available.

The license, in plain language

context-mode is licensed under the Elastic License 2.0 (ELv2) — the source is fully readable, anyone can install it locally, and the project accepts upstream contributions. The hosted-service restriction prevents others from selling context-mode as a managed SaaS. For a developer running npm install -g context-mode and using it as a Claude Code or Cursor plugin on their own machine, ELv2 has no practical impact.

Practical implications for builders

Risks and caveats

What to watch

Sources