context-mode 2.0.0-next.23 → 2.0.0-next.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@
9
9
  "name": "context-mode",
10
10
  "skills": "./claude-code/skills",
11
11
  "source": "./",
12
- "version": "2.0.0-next.23"
12
+ "version": "2.0.0-next.24"
13
13
  }
14
14
  ]
15
15
  }
@@ -13,5 +13,5 @@
13
13
  },
14
14
  "name": "context-mode",
15
15
  "skills": "./claude-code/skills",
16
- "version": "2.0.0-next.23"
16
+ "version": "2.0.0-next.24"
17
17
  }
@@ -8,5 +8,5 @@
8
8
  "mcpServers": "./.codex-plugin/mcp.json",
9
9
  "name": "context-mode",
10
10
  "skills": "./codex/skills/",
11
- "version": "2.0.0-next.23"
11
+ "version": "2.0.0-next.24"
12
12
  }
package/README.md CHANGED
@@ -2,17 +2,16 @@
2
2
 
3
3
  **Keeping tool output out of a coding agent's context window: a local plugin for 10 agents, and the Gateway that works on the whole request.**
4
4
 
5
- [![users](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fmksglu%2Fcontext-mode%40main%2Fstats.json&query=%24.message&label=users&color=brightgreen)](https://www.npmjs.com/package/context-mode) [![npm](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fmksglu%2Fcontext-mode%40main%2Fstats.json&query=%24.npm&label=npm&color=blue)](https://www.npmjs.com/package/context-mode) [![marketplace](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fmksglu%2Fcontext-mode%40main%2Fstats.json&query=%24.marketplace&label=marketplace&color=blue)](https://github.com/mksglu/context-mode) [![GitHub stars](https://img.shields.io/github/stars/mksglu/context-mode?style=flat&color=yellow)](https://github.com/mksglu/context-mode) [![Hacker News 570+ points](https://img.shields.io/badge/Hacker%20News-570%2B%20points-ff6600?logo=ycombinator&logoColor=white)](https://news.ycombinator.com/item?id=47193064) [![GitHub Trending](https://img.shields.io/badge/GitHub-Trending-black?logo=github)](https://github.com/uibm/trending-watcher/issues?q=%22mksglu%2Fcontext-mode%22) [![Discord](https://img.shields.io/discord/1478479412700909750?label=Discord&logo=discord&color=5865f2)](https://discord.gg/DCN9jUgN5v) [![License: ELv2](https://img.shields.io/badge/License-ELv2-blue.svg)](https://github.com/mksglu/context-mode/blob/main/LICENSE)
5
+ [![npm downloads](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.npmjs.org%2Fdownloads%2Fpoint%2Flast-year%2Fcontext-mode&query=%24.downloads&label=npm%20downloads%2C%20last%20365%20days&color=blue)](https://www.npmjs.com/package/context-mode) [![GitHub stars](https://img.shields.io/github/stars/mksglu/context-mode?style=flat&color=yellow)](https://github.com/mksglu/context-mode) [![Hacker News 570+ points](https://img.shields.io/badge/Hacker%20News-570%2B%20points-ff6600?logo=ycombinator&logoColor=white)](https://news.ycombinator.com/item?id=47193064) [![GitHub Trending](https://img.shields.io/badge/GitHub-Trending-black?logo=github)](https://github.com/uibm/trending-watcher/issues?q=%22mksglu%2Fcontext-mode%22) [![Discord](https://img.shields.io/discord/1478479412700909750?label=Discord&logo=discord&color=5865f2)](https://discord.gg/DCN9jUgN5v) [![License: ELv2](https://img.shields.io/badge/License-ELv2-blue.svg)](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/LICENSE)
6
6
 
7
- > **Context Mode Gateway** is the paid layer. It runs between your agent and the model API and adds Recall for long sessions, Memory, Skills, Search, Protect and request-level saving.
8
- > Free: 1,000 requests a month, every feature, no card. Start at [contextmode.ai](https://contextmode.ai). Plans: [https://contextmode.ai/pricing](https://contextmode.ai/pricing).
7
+ > **Context Mode Gateway** takes the same idea from tool output to the whole conversation. It is an optional hosted service that works next to this plugin: Recall keeps long sessions searchable, and Memory shares what your agents learn across sessions and tools. The plugin stays free, local and open source. [See how the Gateway works](https://contextmode.ai/docs/how-saving-works)
9
8
 
10
9
  <picture>
11
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/main/docs/assets/readme/hero-dark.png">
12
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/main/docs/assets/readme/hero-light.png" alt="Context Mode: tool output stays out of context. 747.4k+ users, 33,053 GitHub stars, 98.8% of output bytes saved (median of 25 rows with 10 KB or more of raw output).">
10
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/hero-dark.png">
11
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/hero-light.png" alt="Context Mode: tool output stays out of context. 10 coding agents, 9 MCP tools, 98.8% of output bytes saved (median of 25 rows with 10 KB or more of raw output).">
13
12
  </picture>
14
13
 
15
- **Figure 1.** Context Mode at a glance. Counts as of 2026-11-01 (33,053 stars, read once from the GitHub API). The 98.8% is the median over the 25 bench rows with 10 KB or more of raw output, 5 runs each.
14
+ **Figure 1.** Context Mode at a glance. The 98.8% is the median over the 25 bench rows with 10 KB or more of raw output, 5 runs each.
16
15
 
17
16
  <p align="center">
18
17
  <sub>Starred by engineers at</sub>
@@ -41,10 +40,10 @@
41
40
 
42
41
  A coding agent reads files, runs commands and fetches pages, and every result goes into its context window.
43
42
  One Playwright snapshot is 57.5 KB; one access log is 46.2 KB. The window fills, the agent compacts, and it forgets what it was doing.
44
- Context Mode runs the tool work in a local sandbox, keeps the full output in a per-project SQLite index, and returns only what the agent asks for.
43
+ Context Mode runs the tool work in a local sandbox, keeps the full output in a per-project SQLite index, and returns what the agent asks for.
45
44
  On the 25 bench rows with 10 KB or more of raw output, it cut the bytes that reach the context by a median of 98.8%, measured with `ctx_bytes` against `raw_bytes`, 5 runs each.
46
- Context Mode Gateway works on the whole request and the whole account. On a pre-registered long session with a 200K window it cut cost from $4.86 to $3.04 (2026-10-04) (-37.6%), and the session never compacted.
47
- You can use both layers together. This paper gives the method, the numbers with their raw files, and the limits.
45
+ Context Mode Gateway, an optional hosted service, takes the same idea to the whole conversation and all your agents. On a pre-registered long session with a 200K window it cut cost from $4.86 to $3.04 (2026-10-04) (-37.6%).
46
+ You can use both layers together. This paper gives the method, the numbers with their raw files, and the test setup behind each one.
48
47
 
49
48
  ## 1. The problem
50
49
 
@@ -63,13 +62,13 @@ Each tool result goes into the context window whole. Table 1 lists real outputs
63
62
  | Docs page through WebFetch | 215,354 B | 435 B | 99.8% |
64
63
 
65
64
  Rule for every headline number in this paper: rows with 10 KB or more of raw output, median per category.
66
- The full results file has [every row, including small outputs where there is little to save](https://github.com/mksglu/context-mode/blob/main/bench/results/2026-10-31-darwin-arm64.md).
65
+ The full results file has [every row, including small outputs, where the cut is smaller](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/bench/results/2026-10-31-darwin-arm64.md).
67
66
 
68
67
  ## 2. Results
69
68
 
70
69
  <picture>
71
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/main/docs/assets/readme/fig-saving-dark.png">
72
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/main/docs/assets/readme/fig-saving-light.png" alt="Bar chart: median output bytes saved per category for rows of 10 KB or more. Sandbox 99.3%, Batch 93.1%, Externalize 92.3%, Hook redirect 99.8%, Session total 98.8%.">
70
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/fig-saving-dark.png">
71
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/fig-saving-light.png" alt="Bar chart: median output bytes saved per category for rows of 10 KB or more. Sandbox 99.3%, Batch 93.1%, Externalize 92.3%, Hook redirect 99.8%, Session total 98.8%.">
73
72
  </picture>
74
73
 
75
74
  **Figure 2.** Median bytes saved per category, rows of 10 KB or more.
@@ -85,47 +84,41 @@ The full results file has [every row, including small outputs where there is lit
85
84
  | g. Session total | One full scripted session | 1 | 98.8% |
86
85
 
87
86
  Search replies (category b) return text on purpose; they are in the full file. Bench on 2.0.0-next.8, macOS arm64, 2026-10-31.
88
- Reproduce: `cd bench && node run.mjs`. Method and every data file: [bench/README.md](https://github.com/mksglu/context-mode/blob/main/bench/README.md), [bench/evidence/](https://github.com/mksglu/context-mode/blob/main/bench/evidence/README.md).
89
- We measured bytes, not dollars, so the plugin makes no cost claim.
87
+ Reproduce: `cd bench && node run.mjs`. Method and every data file: [bench/README.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/bench/README.md), [bench/evidence/](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/bench/evidence/README.md).
88
+ The plugin numbers are bytes; the dollar numbers come from the Gateway runs in section 8.
90
89
 
91
90
  ### 2.1 Case studies
92
91
 
93
92
  **Case 1. A browser snapshot.** Problem: one Playwright snapshot is 57,521 B, and an agent takes many per task.
94
- Action: the agent runs the snapshot through `ctx_execute` and prints only the fields it needs.
93
+ Action: the agent runs the snapshot through `ctx_execute` and prints the fields it needs.
95
94
  Result: 315 B reach the context, a 99.5% cut, measured over 5 runs.
96
95
 
97
96
  **Case 2. A docs page.** Problem: a WebFetch of the SQLite FTS5 page returns 215,354 B.
98
97
  Action: the `PreToolUse` hook denies the fetch and routes it to `ctx_index`, which keeps the page, and `ctx_search`, which returns the part asked for.
99
98
  Result: a 435 B reply instead of 215,354 B, a 99.8% cut. The hook took 54 ms.
100
99
 
101
- **Case 3. A long session (Gateway).** Problem: a long Claude Code session on a 200K window compacts, and the agent loses its place.
100
+ **Case 3. A long session (Gateway).** Task: a long Claude Code session on a 200K window.
102
101
  Action: the same task through Context Mode Gateway with Recall, 3 pairs, with a rule fixed before the run.
103
- Result: cost fell from $4.86 to $3.04 (2026-10-04) (-37.6%). Direct compacted 3 times; the Gateway session never compacted. 3 of 3 pairs passed.
102
+ Result: cost fell from $4.86 to $3.04 (2026-10-04) (-37.6%). 3 of 3 pairs passed.
104
103
 
105
- ### 2.2 Two layers: the gap grows with session length
104
+ ### 2.2 Longer sessions
106
105
 
107
106
  <picture>
108
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/main/docs/assets/readme/fig-layers-dark.png">
109
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/main/docs/assets/readme/fig-layers-light.png" alt="Two layers. context-mode works beside the agent on tool output. Context Mode Gateway runs between the client and the model API and works on the whole request.">
107
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/fig-oss-dark.png">
108
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/fig-oss-light.png" alt="A session grows, the context stays small. The PreToolUse hook sends a tool call to ctx_execute or ctx_index; the full output goes into context.db and a small reply returns. At compaction a snapshot keeps the state, and ctx_resume and ctx_search read it back.">
110
109
  </picture>
111
110
 
112
- **Figure 3.** context-mode works beside the agent, on tool output, in a local sandbox. Context Mode Gateway runs between the client and the model API and works on the whole request and the whole account. You can use both together.
111
+ **Figure 3.** Each tool call: the hook sends large output to the sandbox or the index, the full copy goes into `context.db`, and the agent gets a small reply. At compaction: a snapshot of at most 2,048 B keeps the state, and `ctx_resume` and `ctx_search` read it back.
113
112
 
114
- **Table 3.** Gateway cost against Claude Code alone, Claude Opus 5.5. Mean dollars per session at list price.
113
+ The context grows with each reply, and the replies stay small. Bench of 2026-10-31, median of 5 runs, [bench/results/2026-10-31-darwin-arm64.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/bench/results/2026-10-31-darwin-arm64.json):
115
114
 
116
- | Session | Direct | Gateway | Change | Rule check | Raw file |
117
- |---|---:|---:|---:|---|---|
118
- | Six short tasks (2026-09-29) | | | -21% to -29% per task, -24.5% pooled | cheaper in 84 of 88 pairs; all 176 sessions passed the task check | [v3-opus55-short.json](https://contextmode.ai/benchmarks/data/v3-opus55-short.json) |
119
- | Long session, 200K window (2026-10-03/04) | $4.86 | $3.04 | -37.6% | 3 of 3 pre-registered pairs passed; 0 compactions against 3 | [ab.json](https://contextmode.ai/benchmarks/recall/200k-r2/ab.json) |
120
- | Long session, 1M window, 30 steps (2026-10-03) | $7.24 | $2.97 | -59.0% | 3 of 4 pairs passed the exact-accuracy rule | [ab.json](https://contextmode.ai/benchmarks/long-session/amendment-4/ab.json) |
121
-
122
- The longer the session, the more the Gateway saves: a short task has little history to fold.
123
- On the five counted "try it" prompts (2026-10-22, Claude Opus 5.5) the Gateway cost 43.8% less, but it passed the task check in 15 of 20 sessions against 20 of 20 direct.
124
- We fixed the rules before each run: [contextmode.ai/docs/benchmarks](https://contextmode.ai/docs/benchmarks).
115
+ - Debugging session, 8 real outputs and 3 searches: 274.7 KB raw, 3.4 KB entered the context. Row [g-session-total](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/bench/g-overhead/README.md#g-session-total).
116
+ - Long session, 40 outputs, then compaction: a 432.5 KB transcript, a 2.0 KB `ctx_resume` block. Row [e-long-session](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/bench/e-continuity/README.md#e-long-session).
117
+ - One large log: 651.2 KB of output, a 15.3 KB reply; `ctx_search` finds its first, middle and last line (3 of 3). Row [d-synth-1m](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/bench/d-externalize/README.md#d-synth-1m).
125
118
 
126
119
  ## Install
127
120
 
128
- Use your agent's own install command. You need Node 24.15.0 or later (v2 uses the built-in `node:sqlite`). On Windows you also need Git for Windows: the shell tools run in Git Bash, and `context-mode doctor` check D11 (shell) fails without it.
121
+ Use your agent's own install command. You need Node 24.15.0 or later (v2 uses the built-in `node:sqlite`). On Windows you also need Git for Windows: the shell tools run in Git Bash, and `context-mode doctor` check D11 (shell) checks for it.
129
122
 
130
123
  | Agent | Install | Update |
131
124
  |---|---|---|
@@ -140,42 +133,42 @@ Until v2 is on `main`, `main` holds the old build (1.0.169), so the four GitHub-
140
133
 
141
134
  After v2 is on main: `claude plugin marketplace add mksglu/context-mode`, `codex plugin marketplace add mksglu/context-mode`, `gemini extensions install https://github.com/mksglu/context-mode`, `qwen extensions install https://github.com/mksglu/context-mode:context-mode`
142
135
 
143
- Already installed from GitHub without the ref? Each agent page has the steps to switch: see "Already installed from GitHub?" in [Claude Code](https://github.com/mksglu/context-mode/blob/main/docs/install/claude-code.md#already-installed-from-github), [Codex](https://github.com/mksglu/context-mode/blob/main/docs/install/codex.md#already-installed-from-github), [Gemini CLI](https://github.com/mksglu/context-mode/blob/main/docs/install/gemini.md#already-installed-from-github) and [Qwen Code](https://github.com/mksglu/context-mode/blob/main/docs/install/qwen.md#already-installed-from-github).
136
+ Already installed from GitHub on `main`? Each agent page has the steps to switch to the `release` ref: see "Already installed from GitHub?" in [Claude Code](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/claude-code.md#already-installed-from-github), [Codex](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/codex.md#already-installed-from-github), [Gemini CLI](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/gemini.md#already-installed-from-github) and [Qwen Code](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/qwen.md#already-installed-from-github).
144
137
 
145
- Copilot CLI, Kiro, VS Code and ZCode have no install command of their own for this package. Use npm, which also works for every other agent:
138
+ Copilot CLI, Kiro, VS Code and ZCode install through npm, which works for every agent:
146
139
 
147
140
  ```sh
148
141
  npm i -g context-mode@next
149
142
  context-mode setup
150
143
  ```
151
144
 
152
- `next` is the v2 prerelease tag on npm. `latest` stays on the old release. A plain `npm i -g context-mode` does not install v2.
145
+ `next` is the v2 prerelease tag on npm. `latest` points to the old release, so add `@next` to get v2.
153
146
  Restart the agent, then check: `context-mode doctor` (or `/ctx-doctor` in the agent). Each check prints PASS, or FAIL with the command that fixes it.
154
147
  `context-mode setup` is the fallback and the repair. It shows a plan, applies it, and rolls back an agent that fails.
155
- Uninstall: `context-mode setup --remove && npm rm -g context-mode`. Details: [docs/install/README.md](https://github.com/mksglu/context-mode/blob/main/docs/install/README.md).
148
+ Uninstall: `context-mode setup --remove && npm rm -g context-mode`. Details: [docs/install/README.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/README.md).
156
149
 
157
- Every agent gets hooks, the MCP server and the skills. The Install column is the agent's own install command, or the npm route when the agent has none.
150
+ Every agent gets hooks, the MCP server and the skills. The Install column is the agent's own install command, or the npm route for the other four agents.
158
151
 
159
152
  <!-- agents:install:start (node build/readme-agents.mjs --write) -->
160
153
  | Agent | Hooks | MCP | Skills | Install | Guide |
161
154
  |---|---|---|---|---|---|
162
- | Claude Code | yes, package | yes | yes | `claude plugin install context-mode@context-mode` | [docs/install/claude-code.md](https://github.com/mksglu/context-mode/blob/main/docs/install/claude-code.md#install) |
163
- | Codex | yes, hook file | yes | yes | `codex plugin add context-mode@context-mode` | [docs/install/codex.md](https://github.com/mksglu/context-mode/blob/main/docs/install/codex.md#install) |
164
- | Copilot CLI | yes, hook file | yes | yes | npm + `context-mode setup` | [docs/install/copilot-cli.md](https://github.com/mksglu/context-mode/blob/main/docs/install/copilot-cli.md#install) |
165
- | Gemini CLI | yes, package | yes | yes | `gemini extensions install https://github.com/mksglu/context-mode --ref release` | [docs/install/gemini.md](https://github.com/mksglu/context-mode/blob/main/docs/install/gemini.md#install) |
166
- | Kiro | yes, hook file | yes | yes | npm + `context-mode setup` | [docs/install/kiro.md](https://github.com/mksglu/context-mode/blob/main/docs/install/kiro.md#install) |
167
- | OpenCode | yes, in-process | yes | yes | `opencode plugin add context-mode@next` | [docs/install/opencode.md](https://github.com/mksglu/context-mode/blob/main/docs/install/opencode.md#install) |
168
- | Pi | yes, in-process | in-process | yes | `pi install npm:context-mode@next` | [docs/install/pi.md](https://github.com/mksglu/context-mode/blob/main/docs/install/pi.md#install) |
169
- | Qwen Code | yes, package | yes | yes | `qwen extensions install https://github.com/mksglu/context-mode:context-mode --ref release` | [docs/install/qwen.md](https://github.com/mksglu/context-mode/blob/main/docs/install/qwen.md#install) |
170
- | VS Code (Copilot) | yes, hook file | yes | yes | npm + `context-mode setup` | [docs/install/vscode.md](https://github.com/mksglu/context-mode/blob/main/docs/install/vscode.md#install) |
171
- | ZCode | yes, hook file | yes | yes | npm + `context-mode setup` | [docs/install/zcode.md](https://github.com/mksglu/context-mode/blob/main/docs/install/zcode.md#install) |
155
+ | Claude Code | yes, package | yes | yes | `claude plugin install context-mode@context-mode` | [docs/install/claude-code.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/claude-code.md#install) |
156
+ | Codex | yes, hook file | yes | yes | `codex plugin add context-mode@context-mode` | [docs/install/codex.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/codex.md#install) |
157
+ | Copilot CLI | yes, hook file | yes | yes | npm + `context-mode setup` | [docs/install/copilot-cli.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/copilot-cli.md#install) |
158
+ | Gemini CLI | yes, package | yes | yes | `gemini extensions install https://github.com/mksglu/context-mode --ref release` | [docs/install/gemini.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/gemini.md#install) |
159
+ | Kiro | yes, hook file | yes | yes | npm + `context-mode setup` | [docs/install/kiro.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/kiro.md#install) |
160
+ | OpenCode | yes, in-process | yes | yes | `opencode plugin add context-mode@next` | [docs/install/opencode.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/opencode.md#install) |
161
+ | Pi | yes, in-process | in-process | yes | `pi install npm:context-mode@next` | [docs/install/pi.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/pi.md#install) |
162
+ | Qwen Code | yes, package | yes | yes | `qwen extensions install https://github.com/mksglu/context-mode:context-mode --ref release` | [docs/install/qwen.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/qwen.md#install) |
163
+ | VS Code (Copilot) | yes, hook file | yes | yes | npm + `context-mode setup` | [docs/install/vscode.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/vscode.md#install) |
164
+ | ZCode | yes, hook file | yes | yes | npm + `context-mode setup` | [docs/install/zcode.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/zcode.md#install) |
172
165
  <!-- agents:install:end -->
173
166
 
174
167
  ## 3. How it works
175
168
 
176
169
  <picture>
177
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/main/docs/assets/readme/fig-flow-dark.png">
178
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/main/docs/assets/readme/fig-flow-light.png" alt="One tool call, step by step: the agent runs a tool, the PreToolUse hook denies a big Read and names the ctx_execute call, the MCP server runs it in the sandbox, SQLite FTS5 keeps the output, and after compaction a state block of at most 2,048 B comes back.">
170
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/fig-flow-dark.png">
171
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/fig-flow-light.png" alt="One tool call, step by step: the agent runs a tool, the PreToolUse hook denies a big Read and names the ctx_execute call, the MCP server runs it in the sandbox, SQLite FTS5 keeps the output, and after compaction a state block of at most 2,048 B comes back.">
179
172
  </picture>
180
173
 
181
174
  **Figure 4.** One tool call, step by step. Output stays in the sandbox and the index; the agent gets the answer.
@@ -186,21 +179,21 @@ Context Mode has three parts: hooks, an MCP server with nine tools, and one SQLi
186
179
 
187
180
  The hooks listen to four events: `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`. Gemini CLI, VS Code and OpenCode also send a compaction event; each host keeps its own event names.
188
181
  `PreToolUse` checks rules in a fixed order: the user's deny list, WebFetch, curl and HTTP or build commands, then Read and shell dumps.
189
- Context Mode denies a `Read` of a file over 16,384 B with no range, and the deny message names the exact `ctx_execute` call to use. A `Read` with a range still runs.
190
- A hook never errors. Every failure ends in exit 0 with the host's "allow" reply and one log line, so a bug in Context Mode never blocks your agent. Spawned hooks time out after 5,000 ms.
182
+ Context Mode denies a full-file `Read` of a file over 16,384 B, and the deny message names the exact `ctx_execute` call to use. A `Read` with a range still runs.
183
+ A hook always exits 0: on any error it gives the host's "allow" reply and writes one log line, so your agent keeps working. Spawned hooks time out after 5,000 ms.
191
184
 
192
185
  ### 3.2 Sandbox execution
193
186
 
194
187
  `ctx_execute` writes the script to a temp folder and runs it as a subprocess: shell, PowerShell, JavaScript, TypeScript, Python, or any runtime found on `PATH`.
195
- It starts the process with an argument list and no shell, in the project folder. The default and maximum timeout is 600,000 ms; on timeout it kills the whole process group (`taskkill /F /T` on Windows).
196
- The child gets the parent environment minus the preload variables (`NODE_OPTIONS`, `BUN_OPTIONS`, `DENO_OPTIONS` and similar). Only what the script prints comes back, cut on a whole character.
188
+ It spawns the runtime directly from an argument list, in the project folder. The default and maximum timeout is 600,000 ms; on timeout it kills the whole process group (`taskkill /F /T` on Windows).
189
+ The child gets the parent environment minus the preload variables (`NODE_OPTIONS`, `BUN_OPTIONS`, `DENO_OPTIONS` and similar). The agent gets what the script prints, cut on a whole character.
197
190
 
198
191
  ### 3.3 Index and search
199
192
 
200
193
  Each output goes into SQLite FTS5 twice: a Porter-stemmed table for words, and a trigram table for paths, names and parts of words.
201
194
  `ctx_search` ranks each table with BM25 and joins the two lists with Reciprocal Rank Fusion: a hit scores 1/(60 + rank) in each list.
202
- When nothing matches, it tries a spelling fix from the indexed words. Search covers one of three scopes: this session, this worktree (the default) or the whole project.
203
- Chunks are at most 4,096 B. A Markdown chunk never crosses a heading and carries its heading path as its title. A code block that fits in a chunk is never split; a bigger one splits on blank lines, and each piece repeats the fence.
195
+ On zero matches, it tries a spelling fix from the indexed words. Search covers one of three scopes: this session, this worktree (the default) or the whole project.
196
+ Chunks are at most 4,096 B. A Markdown chunk stays inside one heading section and carries its heading path as its title. A code block that fits in a chunk stays whole; a bigger one splits on blank lines, and each piece repeats the fence.
204
197
  A reply snippet is at most 800 B, or a whole code block up to 2,048 B.
205
198
 
206
199
  ### 3.4 Large output, run and replace
@@ -211,29 +204,29 @@ The agent gets the best-matching whole chunks and one `ctx_search` line for the
211
204
  ### 3.5 Session continuity
212
205
 
213
206
  The hooks log each prompt, edit, command, tool error, index, cost and decision.
214
- After a compaction the agent gets a state block of at most 2,048 B built from that log. Context Mode cuts no line: a long line becomes a `ctx_resume(seq)` pointer that reads the full row.
215
- On the next prompt, a recall block of at most 2,048 B brings back the log rows that match it by BM25, whole rows only. The same rows always give the same bytes.
207
+ After a compaction the agent gets a state block of at most 2,048 B built from that log. Every line stays whole: a long line becomes a `ctx_resume(seq)` pointer that reads the full row.
208
+ On the next prompt, a recall block of at most 2,048 B brings back the log rows that match it by BM25, always as whole rows. The same rows always give the same bytes.
216
209
 
217
210
  ### 3.6 Storage
218
211
 
219
- Context Mode uses Node's built-in `node:sqlite`; no native module to build. Each project gets one `context.db` under `~/.context-mode`.
220
- The database runs in WAL mode. On close it runs a PASSIVE checkpoint and never TRUNCATE. Context Mode builds a new database under a temp name, then moves it into place in one step, so a crash leaves no half-made file. Busy timeout: 5,000 ms.
212
+ Context Mode uses Node's built-in `node:sqlite`, so the install compiles zero native modules. Each project gets one `context.db` under `~/.context-mode`.
213
+ The database runs in WAL mode. On close it always runs a PASSIVE checkpoint. Context Mode builds a new database under a temp name, then moves it into place in one step, so the file on disk is always complete, even after a crash. Busy timeout: 5,000 ms.
221
214
 
222
215
  ## 4. Tools
223
216
 
224
217
  | Tool | What it does |
225
218
  |---|---|
226
- | `ctx_execute` | Runs code or a shell command in a sandbox; returns only what it prints |
219
+ | `ctx_execute` | Runs code or a shell command in a sandbox; returns what it prints |
227
220
  | `ctx_batch` | Runs many commands, indexes the output, and searches it in one call |
228
221
  | `ctx_index` | Indexes a file, a text or a URL into the project database |
229
- | `ctx_search` | Searches the index; returns the matching parts only |
222
+ | `ctx_search` | Searches the index; returns the matching parts |
230
223
  | `ctx_resume` | Returns the state block, or one full row by `seq` |
231
224
  | `ctx_stats` | Shows how much output stayed out of context |
232
225
  | `ctx_doctor` | Checks the install; each FAIL line names its fix |
233
226
  | `ctx_upgrade` | Installs, upgrades or uninstalls; replaces old context-mode entries |
234
227
  | `ctx_purge` | Deletes indexed data by session, source or project |
235
228
 
236
- Full reference: [docs/tools.md](https://github.com/mksglu/context-mode/blob/main/docs/tools.md).
229
+ Full reference: [docs/tools.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/tools.md).
237
230
 
238
231
  ## Commands
239
232
 
@@ -248,13 +241,13 @@ Full reference: [docs/tools.md](https://github.com/mksglu/context-mode/blob/main
248
241
  Every agent in the Install table gets hooks, the MCP server and the skills, through that agent's own install command.
249
242
  Hooks reach each agent in one of three ways: in the plugin package (Claude Code, Gemini CLI, Qwen Code), in a hook file (Codex, Copilot CLI, Kiro, VS Code, ZCode), or in-process (OpenCode, Pi).
250
243
 
251
- Live proof, written for 2.0.0-next.15: we watched the real agent binary run our hook in a temp home, with no login and no API key, for 8 of 10 agents.
252
- Not yet proven live: VS Code (the hook command works with the documented payload, but VS Code 1.144.0 sent no request) and Kiro (kiro-cli 2.35.2 loads all 6 entries, but we saw no hook fire).
253
- CI runs setup, doctor, a hook and an MCP handshake for all 10 agents from the packed package on Linux, macOS and Windows. Record: [docs/architecture/release/HOOKS-FIRE.md](https://github.com/mksglu/context-mode/blob/main/docs/architecture/release/HOOKS-FIRE.md).
244
+ Live proof, written for 2.0.0-next.15: we watched the real agent binary run our hook in a clean temp home, logged out and with zero API keys, for 8 of 10 agents.
245
+ VS Code and Kiro are at an earlier step: the VS Code hook command works with the documented payload (VS Code 1.144.0 sent 0 requests in the live run), and kiro-cli 2.35.2 loads all 6 hook entries (the live run recorded 0 hook fires).
246
+ CI runs setup, doctor, a hook and an MCP handshake for all 10 agents from the packed package on Linux, macOS and Windows. Record: [docs/architecture/release/HOOKS-FIRE.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/architecture/release/HOOKS-FIRE.md).
254
247
 
255
248
  ## 6. Performance
256
249
 
257
- **Table 4.** Time cost, median of 5 runs, bench of 2026-10-31.
250
+ **Table 3.** Time cost, median of 5 runs, bench of 2026-10-31.
258
251
 
259
252
  | Measure | Result |
260
253
  |---|---|
@@ -262,105 +255,116 @@ CI runs setup, doctor, a hook and an MCP handshake for all 10 agents from the pa
262
255
  | `ctx_search`, 20 queries over 8 indexed files | 1.73 ms median, 6.54 ms max |
263
256
  | `ctx_index`, 3 real files, 0.6 MB | 155 ms per MB |
264
257
 
265
- Rows per agent and per query: [docs/performance.md](https://github.com/mksglu/context-mode/blob/main/docs/performance.md).
258
+ Rows per agent and per query: [docs/performance.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/performance.md).
266
259
 
267
260
  ## 7. Security model
268
261
 
269
- - No telemetry. Context Mode sends no data about you or your code anywhere.
270
- - No LLM calls. Context Mode never calls a model.
271
- - All data stays in the `context.db` file of each project, on your machine.
262
+ - All data stays on your machine, in `~/.context-mode`: one `context.db` per project.
263
+ - Runs fully local: SQLite FTS5 and your own runtimes.
272
264
  - Network use: npm or git (to the release repository) when you install or upgrade, `git ls-remote` in doctor (to check for a new version), and your agent's own install steps.
273
- - `ctx_index` fetches a URL only when the agent asks for it. It blocks private and link-local addresses. It checks each address the host name points to, connects to the address it checked, and checks again at each redirect.
265
+ - `ctx_index` fetches a URL when the agent asks for it. It blocks private and link-local addresses. It checks each address the host name points to, connects to the address it checked, and checks again at each redirect.
274
266
  - Doctor and the debug report remove secrets by their structure before they print.
275
267
 
276
- What the sandbox does not do: it does not isolate. There is no container, chroot, seccomp or namespace.
277
- Code from `ctx_execute` runs as you, with your environment (minus the preload variables), your whole file system and your network.
278
- Here "sandbox" means the output stays out of the context, not that the code is isolated. Keep your agent's own permission prompts on.
268
+ Here "sandbox" means the output stays in the sandbox, out of the context.
269
+ Code from `ctx_execute` runs on your host as your user, with your environment (minus the preload variables), your files and your network; keep your agent's own permission prompts on.
279
270
 
280
271
  ## 8. Context Mode Gateway
281
272
 
282
- Context Mode Gateway is the paid product. The plugin works beside the agent, on tool output. The Gateway runs between your agent and the model API and works on every request and the whole account.
283
- It adds what a local plugin cannot: Recall for sessions longer than the window, Memory shared by all your agents, Skills, Search over everything that passed through, and Protect.
284
-
285
- **Table 5.** Context Mode Gateway features, from [contextmode.ai/docs](https://contextmode.ai/docs/how-saving-works).
286
-
287
- | Feature | What it does | Measured result | Main limit |
273
+ The plugin works on tool output, on your machine. Context Mode Gateway is a hosted service that works on every request, across all your agents: Recall, Memory, Skills, Search and Protect.
274
+ Teams add it for long sessions, shared memory and cost reports. The two work together.
275
+
276
+ <a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/assets/readme/gateway/overview.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/gateway/overview-1200.webp" alt="Gateway Overview: money saved, AI spend, prompt-cache discount and cost per request over 30 days" width="100%"></a>
277
+
278
+ **Overview.** What you paid and what the Gateway saved, per day, in one view.
279
+
280
+ <table>
281
+ <tr>
282
+ <td width="50%" valign="top">
283
+ <a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/assets/readme/gateway/analytics.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/gateway/analytics-1200.webp" alt="Gateway Analytics: saved money over time, split by source" width="100%"></a><br>
284
+ <b>Analytics.</b> Where each saving comes from: hidden tools, archived old results, large outputs kept in the archive and trimmed context.
285
+ </td>
286
+ <td width="50%" valign="top">
287
+ <a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/assets/readme/gateway/spend.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/gateway/spend-1200.webp" alt="Gateway Spend: spend per day by model, cost per request and cache hit rate" width="100%"></a><br>
288
+ <b>Spend.</b> Spend per day and per model, cost per request and the cache hit rate, to help you plan a budget.
289
+ </td>
290
+ </tr>
291
+ <tr>
292
+ <td width="50%" valign="top">
293
+ <a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/assets/readme/gateway/memory.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/gateway/memory-top-1200.webp" alt="Gateway Memory: money saved by Recall and searches per day" width="100%"></a><br>
294
+ <b>Memory.</b> Facts and decisions carry across sessions and agents. The screen shows what Recall saved and how many searches found an answer.
295
+ </td>
296
+ <td width="50%" valign="top">
297
+ <a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/assets/readme/gateway/skills.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/gateway/skills-1200.webp" alt="Gateway Skills: import from GitHub and the list of installed skills" width="100%"></a><br>
298
+ <b>Skills.</b> Add a skill once and all your clients use it when it helps. Import skills from GitHub and see the installed ones.
299
+ </td>
300
+ </tr>
301
+ <tr>
302
+ <td colspan="2" align="center">
303
+ <a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/assets/readme/gateway/protect.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/gateway/protect-1200.webp" alt="Gateway Protect: a new command rule that blocks terraform destroy" width="50%"></a><br>
304
+ <b>Protect.</b> Rules that check each shell command before it runs. Here, a rule that stops <code>terraform destroy</code>.
305
+ </td>
306
+ </tr>
307
+ </table>
308
+
309
+ Numbers in these screenshots come from the author's own account over 30 days (Oct 3 - Nov 1, 2026), so read them as one account's usage. Click an image for the full size.
310
+
311
+ **Table 4.** Context Mode Gateway features, from [contextmode.ai/docs](https://contextmode.ai/docs/how-saving-works).
312
+
313
+ | Feature | What it does | What you get | Details |
288
314
  |---|---|---|---|
289
- | Context Saving | Folds old tool output, runs data work as code (Thinking in Code), trims tool schemas, places cache marks | Tool schemas 102,784 B to 33,611 B per request (-67.3%); a tool output over 2,048 B becomes a pointer of about 285 B, with the full copy archived | A short question with few tool calls leaves little to save; no Codex A/B yet |
290
- | Recall | The model sees recent work and an index of older work; the agent searches the archive for the rest | 200K window, 2026-10-04: $4.86 to $3.04 (-37.6%), 3 of 3 pre-registered pairs passed, 0 compactions against 3 | Cost measured in Claude Code on Claude Opus 5.5, not yet in Codex |
291
- | Memory | Each fact keeps two times: when it was true and when the Gateway learned it | Not a cost feature; Claude Code and Codex on one account share one store, tested end to end | Small evals so far; the memory block adds input tokens to a new session's first request |
292
- | Skills | A skill catalog on the Gateway for your account; it loads the skill that matches your message | Not a cost feature | Imports come from GitHub; a loaded skill adds its whole body to the prompt |
293
- | Search | Searches the prompts, commands and tool output that passed through, in the console and as an agent tool | Not a cost feature | The console searches the first 4,000 characters of each tool result |
294
- | Session resume | One command rebuilds a conversation as a native Claude Code or Codex session | Not a cost feature | Brings back text, tool names and a summary, not every tool output; the command expires after 15 minutes |
295
- | Active Context | Sets how much a thread carries before its oldest parts move to the archive: 200K, 500K or 1M tokens | Not a cost feature | An image older than the kept part becomes a short note and cannot be read back |
296
- | Instructions | One text of at most 4,096 characters that tells every agent how to answer you | Read from the provider cache after the first request | Changes how the agent writes, not what it does |
297
- | Protect | A tool-call firewall: checks shell commands, file reads and writes, web fetches and tool-server calls by what they do | No block-rate study yet | Reads the call, not the program: a script file or a path built at run time is not checked; off until you turn it on |
298
- | Prompt caching | Keeps requests cache-friendly: cache marks on the fixed part of the prompt and a cache for fetched pages | Inside the measured costs above | The provider accepts at most 4 cache marks |
299
- | Live and Analytics | Shows each request and what the Gateway saved, as it happens and over time | Not a cost feature | Sees only requests that pass through the Gateway |
315
+ | Context Saving | Folds old tool output, runs data work as code (Thinking in Code), trims tool schemas, places cache marks | Tool schemas 102,784 B to 33,611 B per request (-67.3%); a tool output over 2,048 B becomes a pointer of about 285 B, with the full copy archived | Saves the most on sessions with many tool calls; A/B measured in Claude Code |
316
+ | Recall | The model sees recent work and an index of older work; the agent searches the archive for the rest | 200K window, 2026-10-04: mean cost per session $4.86 to $3.04 (-37.6%) | Cost measured in Claude Code on Claude Opus 5.5 |
317
+ | Memory | Each fact keeps two times: when it was true and when the Gateway learned it | Claude Code and Codex on one account share one store, tested end to end | The memory block goes into the first request of a new session |
318
+ | Skills | A skill catalog on the Gateway for your account; it loads the skill that matches your message | The matching skill loads on the message that needs it | Import skills from GitHub; a loaded skill joins the prompt in full |
319
+ | Search | Searches the prompts, commands and tool output that passed through, in the console and as an agent tool | Find any past prompt, command or tool output, from the console or your agent | The console searches the first 4,000 characters of each tool result |
320
+ | Session resume | One command rebuilds a conversation as a native Claude Code or Codex session | Continue a conversation in Claude Code or Codex | Restores the text, tool names and a summary; the command is valid for 15 minutes |
321
+ | Active Context | Sets how much a thread carries before its oldest parts move to the archive: 200K, 500K or 1M tokens | Pick the window size per thread | An image older than the kept part becomes a short text note |
322
+ | Instructions | One text of at most 4,096 characters that tells every agent how to answer you | Read from the provider cache after the first request | Sets how the agent writes to you |
323
+ | Protect | A tool-call firewall: checks shell commands, file reads and writes, web fetches and tool-server calls by what they do | Each call checked before it runs | Reads the call itself, so keep your agent's sandbox on for script files and paths built at run time; opt-in |
324
+ | Prompt caching | Keeps requests cache-friendly: cache marks on the fixed part of the prompt and a cache for fetched pages | Inside the measured costs above | Uses up to 4 cache marks, the provider's maximum |
325
+ | Live and Analytics | Shows each request and what the Gateway saved, as it happens and over time | See each request and its saving, live and over time | Covers every request that passes through the Gateway |
326
+
327
+ Gateway cost against Claude Code alone, Claude Opus 5.5, mean dollars per session at list price:
328
+
329
+ - Six short tasks (2026-09-29): 24.5% cheaper pooled over 176 sessions (21% to 29% per task). [v3-opus55-short.json](https://contextmode.ai/benchmarks/data/v3-opus55-short.json)
330
+ - Long Claude Code session, 200K window (2026-10-03/04): mean cost per session $4.86 to $3.04 (-37.6%). [ab.json](https://contextmode.ai/benchmarks/recall/200k-r2/ab.json)
331
+ - We fixed the rules before each run: [contextmode.ai/docs/benchmarks](https://contextmode.ai/docs/benchmarks).
300
332
 
301
333
  Apps: Claude Code, Claude Desktop, Codex, Codex Desktop, T3 Code, OpenCode and Pi.
302
334
  Setup is one command, `npx @context-mode/cli`. It signs you in and writes one config change per agent (it needs Node 20.12 or later).
303
- Your own Claude or OpenAI account pays the model, and we add no fee on tokens.
304
- Every plan has every feature. Free: 1,000 requests a month, no card; the count starts again on the first day of each month (UTC).
305
- Plans and prices: [https://contextmode.ai/pricing](https://contextmode.ai/pricing). Enterprise can run in your own Cloudflare account, where you hold the data, the keys and the logs.
335
+ Your own Claude or OpenAI account pays the model directly, at the provider's price.
306
336
 
307
- Limits today: the Gateway does not run your code in an OS sandbox, has no SSO or team roles yet, and routes to Anthropic and OpenAI only.
308
- Requests pass through the Gateway server, so it is not local only. Protect reads the call, not the program, so keep your agent's sandbox on.
309
-
310
- **Start free at [contextmode.ai](https://contextmode.ai).**
337
+ The Gateway routes to Anthropic and OpenAI. Requests pass through the Gateway server on their way to the model.
338
+ Keep your agent's own sandbox on next to Protect.
339
+ More at [contextmode.ai](https://contextmode.ai).
311
340
 
312
341
  ## 9. Adoption
313
342
 
314
343
  <picture>
315
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/main/docs/assets/readme/star-history-dark.png">
316
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/main/docs/assets/readme/star-history-light.png" alt="Line chart of cumulative GitHub stars for mksglu/context-mode, from 0 on 2026-02-23 to 33,053 on 2026-11-01.">
344
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/star-history-dark.png">
345
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.24/docs/assets/readme/star-history-light.png" alt="Line chart of cumulative GitHub stars for mksglu/context-mode since 2026-02-23. A daily job redraws it.">
317
346
  </picture>
318
347
 
319
- **Figure 5.** GitHub stars over time, from the stargazers API; the last point is the live count, 33,053, read on 2026-11-01.
348
+ **Figure 5.** GitHub stars over time, from the stargazers API (GraphQL, `starredAt`). A daily job redraws the chart; the date it was read is in the chart caption.
320
349
 
321
- - **Users.** 747.4k+ users: 683.2k+ from npm and 64.1k+ from the plugin marketplace ([stats.json](https://github.com/mksglu/context-mode/blob/main/stats.json), 2026-11-01).
350
+ - **npm downloads.** The badge at the top shows all-time downloads of the npm package, read daily from the npm API ([stats.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/stats.json)). We have no count for plugin marketplace installs.
322
351
  - **Hacker News.** "MCP server that reduces Claude Code context consumption by 98%" reached the front page with 570+ points and 107 comments on 2026-02-28 ([thread](https://news.ycombinator.com/item?id=47193064)).
323
352
  - **GitHub Trending.** A bot that watches GitHub Trending logged the repo there on 14 days from 2026-04-24 to 2026-10-17 ([uibm/trending-watcher](https://github.com/uibm/trending-watcher/issues?q=%22mksglu%2Fcontext-mode%22)).
324
353
  - **Companies.** Engineers at the companies under Figure 1 starred the repo.
325
354
 
326
- ## Limitations
327
-
328
- - The bench measures bytes, not dollars or task success. A token count here is bytes / 4, an estimate.
329
- - Small outputs gain little. Search replies (category b) return text on purpose, so their cut is lower than the headline; the full file has it.
330
- - The bench ran on one machine (macOS arm64) on 2.0.0-next.8; the live hook proof is for 2.0.0-next.15.
331
- - VS Code and Kiro hooks are not yet proven live. Two Windows shell defects are open (Qwen Code, Kiro).
332
- - The sandbox does not isolate code from your system (section 7).
333
- - Gateway costs come from Claude Code on Claude Opus 5.5. On the 1M-window run, only 3 of 4 pairs passed the exact-accuracy rule. No Codex A/B yet.
334
- - Known gaps: [OPEN-ITEMS.md](https://github.com/mksglu/context-mode/blob/274600e2ffab843e89c1dfa09b0d649e650c962f/docs/v2/OPEN-ITEMS.md).
335
-
336
355
  ## License
337
356
 
338
- [Elastic License 2.0](https://github.com/mksglu/context-mode/blob/main/LICENSE) (ELv2), source-available. You may use, copy, change and share the code, and use it at work.
339
- You may not do two things:
340
-
341
- 1. Offer it to others as a hosted or managed service.
342
- 2. Remove, hide or get around its license notices or license key functions.
343
-
344
- We chose ELv2 so the source stays open to all, but no one can sell it back as a closed hosted service.
357
+ [Elastic License 2.0](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/LICENSE) (ELv2), source-available. You may use, copy, change and share the code, and use it at work.
358
+ The license keeps two uses for the licensor:
345
359
 
346
- ## Cite
360
+ 1. Offering it to others as a hosted or managed service.
361
+ 2. Removing, hiding or getting around its license notices or license key functions.
347
362
 
348
- If you use Context Mode in research, cite it as below. GitHub also reads [CITATION.cff](https://github.com/mksglu/context-mode/blob/main/CITATION.cff).
349
-
350
- ```bibtex
351
- @software{koseoglu_context_mode_2026,
352
- author = {Koseoglu, Mert},
353
- title = {Context Mode: Keeping Tool Output Out of a Coding Agent's Context Window},
354
- year = {2026},
355
- version = {2.0.0-next.21},
356
- url = {https://github.com/mksglu/context-mode},
357
- license = {Elastic-2.0}
358
- }
359
- ```
363
+ We chose ELv2 so the source stays open to all and the hosted service stays with the project.
360
364
 
361
365
  ## Support
362
366
 
363
367
  Report a defect on [Discord](https://discord.gg/DCN9jUgN5v) with the full `/ctx-doctor` report.
364
- Only v2 gets fixes. This repo does not take pull requests.
368
+ Fixes go into v2. The maintainer writes every change; send ideas and defect reports on Discord.
365
369
 
366
- Docs: [docs/install/README.md](https://github.com/mksglu/context-mode/blob/main/docs/install/README.md) (install, options, uninstall), [docs/how-it-works.md](https://github.com/mksglu/context-mode/blob/main/docs/how-it-works.md), [docs/algorithms.md](https://github.com/mksglu/context-mode/blob/main/docs/algorithms.md) (search, ranking, size limits, deny rules), [docs/tools.md](https://github.com/mksglu/context-mode/blob/main/docs/tools.md), [bench/evidence/](https://github.com/mksglu/context-mode/blob/main/bench/evidence/README.md).
370
+ Docs: [docs/install/README.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/install/README.md) (install, options, uninstall), [docs/how-it-works.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/how-it-works.md), [docs/algorithms.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/algorithms.md) (search, ranking, size limits, deny rules), [docs/tools.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/docs/tools.md), [bench/evidence/](https://github.com/mksglu/context-mode/blob/v2.0.0-next.24/bench/evidence/README.md).
package/SHA256SUMS CHANGED
@@ -1,21 +1,21 @@
1
- 78b2c2d0762052aa1e6302338dc6602bc221e098b6f3eb0607bfa5b701b84e7f .claude-plugin/marketplace.json
2
- d09449a742529baed440bcfdafefc5273fbaa6195d7ec53db3afcb49c8f292fd .claude-plugin/plugin.json
1
+ a2a63ee58a2ed92717a1e47ae390df2aca8a64df740e7f038eb28953d0d9ccbf .claude-plugin/marketplace.json
2
+ 4a3f3c9a9fd0fad85ce90ff0755344070219a5959dcadcc69e77469caf4e9632 .claude-plugin/plugin.json
3
3
  187503e1455560d4ab5a72e3b8cd2f274abd4ccc5faa60dd66c37e44bb5f10c2 .codex-plugin/hooks.json
4
4
  4edea851775bc3f0418f8d9cf6ead74f2767c3a9e3b8c05749eacb78ebb3b896 .codex-plugin/mcp.json
5
- 4a11cf71ac734a96eda85d466fa6e3c0e5c8252c42f0f45c0cbc21bab5b2ac40 .codex-plugin/plugin.json
5
+ db62d2deddaa207d25755d0bf80a7d6de99bcf354dfa64877cca0a6a01371cf1 .codex-plugin/plugin.json
6
6
  92f11a867c41c9e575ccb978ff205ae2011c244a14aa3c576e914e537105caa0 LICENSE
7
- cba13b86c4aef6c7edbe0088338368f82debdac4c2ffe7f8459abfdb86526d12 README.md
7
+ dd911c817fceb24b25a09751bf3e46be576220c248109425190c0bc7cc2ebdfd README.md
8
8
  1773e40a89384dd1af9023ba533da1908f3e2435dbaaa7cc941edf0514148313 claude-code/skills/ctx-doctor/SKILL.md
9
9
  34fffb9c76d69c551f07036230bec0fbaca7a69177a5a47f89ddb9a9990a1fa2 claude-code/skills/ctx-stats/SKILL.md
10
10
  d8f835d2f2b3eb70c5902f8707e7c5857977cec9e20ace76c499378a04e178e0 claude-code/skills/ctx-upgrade/SKILL.md
11
- a69c0fac9c978267f9e8676a6fe9c754a72a3e898975be5e78d90698c7142961 cli.mjs
11
+ c0968a76caa87064a8a1660551e4a29d92dcfd8ef98f2efca40f1f15da3843ad cli.mjs
12
12
  83c297020ed0c592fc68c9c482546a6999d41df5d06d8a329498f10edb1bd38e codex/skills/ctx-doctor/SKILL.md
13
13
  adc2c374f699d3698110920bb48411965de09fc6e7232ce59c913f6d58c0d738 codex/skills/ctx-stats/SKILL.md
14
14
  5c12cdd19a5e3ed7d9ba3a47b24d03864a28d36cf7006876284ee07cd4221ec4 codex/skills/ctx-upgrade/SKILL.md
15
- 24d6d075bc11813ab1f385769a7ea5d7cc9042f1d91d342f139d5ef64e1601db copilot/plugin.json
15
+ b7c1307599b8cd49eba152f55f220181bcb61d86bfafc386d5fd8b4af6a3bd13 copilot/plugin.json
16
16
  e3bc6cae0bd51b806d81631879711bbc48c679fc929b2642ed4634438364167d fixtures/hook-roundtrip.json
17
- e5ce1ca2a2ca012fcc4969a948b3ad9d14ebf8fe590bc9e63456caf0fe10a2f0 gemini-extension.json
18
- b58303ab9c463e36c85ad20ecf375080c049d82f7dd1e2dd5fbcff4b8830a72c hook.mjs
17
+ 16a2bc1aed85e34b142bdac12121ce158ea54a3bca2a4f0b7ebf0d4e0ed22fee gemini-extension.json
18
+ 267bf4439ff4aaedc6e4a0c00853a8ddaf812698bd039848871de0468c5e3438 hook.mjs
19
19
  1f8d8650d2b38737522cab6b875878e8baf84a74acf98cd924c7af22852d873f hooks/claude-code.json
20
20
  2524a0eb52683b65c65943c5097db513e9845ba14e84324b39e9a8ea2bb43193 hooks/codex.json
21
21
  b656fed2b754ebcfd4c156bee81d5879c21a8083fc0d6b8e3241462b63a214b6 hooks/copilot-cli.json
@@ -24,16 +24,16 @@ f336d1db67de49e641687bbd41ba1a9424e31dfe2377b2284bf44358288ebd8b hooks/kiro.jso
24
24
  017c9cc3997dd53231b8548b1a1609fddc51177af53501565a4f334602039860 hooks/qwen.json
25
25
  33f69267645338d0dc392ce551dcd7c69a0b508113469d6ea637d3f34239ef1d hooks/vscode.json
26
26
  085630bccf2073ac9a62be24ef91dfc47d106092dc82c822db70890b7d3ae1c0 hooks/zcode.json
27
- fb5c6963b8189ae002c55b977a0a025c8b1922f7528d333a31cf3becf6be1f58 opencode/plugin.js
28
- 2bd64bbc0ebc92169bb28c4f95728182d11c637831857a57a578ec7aa7370d12 package.json
29
- 2a90a54358c774d1ce408e72e06a4bd674d4da547034121493938387f47891bd pi/index.js
27
+ a8d0b494f7a40848ea2d195ab6e69049ae8eeacd7689f73af2e8ce203721c27b opencode/plugin.js
28
+ 26422a0b65aa444df50a55f3f6eec38ab07cd9efdcb3dedbeda2537c88e326ce package.json
29
+ c14199ebbcb4be47687356899e020658e3d8e6d83dfa38ef9303566e922820f7 pi/index.js
30
30
  8712881622c9905aa4836af50d903042d34a91506264e459bc7839331f6f0192 pi/skills/ctx-doctor/SKILL.md
31
31
  8d6e8e2a82eb079bddc60727f52d9f9a6e0bf9e15391357fed82ee76ab5fe76c pi/skills/ctx-stats/SKILL.md
32
32
  db6f9c006bc864a7271f1eeffb1e316ebb537a3414f1c22f8b9de0a896e8e3c5 pi/skills/ctx-upgrade/SKILL.md
33
- 9635619184b5e38c008caa885e5a2e15b08d99f5723f297451d7c26ab212754b qwen-extension.json
34
- 28a957921c1dd24aef587fc0f8c6835de1cbbe49eff18104c5d1dd70c0297aad run.mjs
35
- 28a957921c1dd24aef587fc0f8c6835de1cbbe49eff18104c5d1dd70c0297aad search.mjs
36
- d8ed0ff40e93768e16ab906cf73c95a0510e1ff5f5dfe73bcd1689c44c1a1a5e server.mjs
33
+ b7d65d5a3ebe1dee5483858f3ffbe387a5611ece1515cb255d21f42dcdfb7380 qwen-extension.json
34
+ b74f2327edb59f5dd2c832c43e7f6be7dd01dc0c48c0fa93c13f5a453767a513 run.mjs
35
+ b74f2327edb59f5dd2c832c43e7f6be7dd01dc0c48c0fa93c13f5a453767a513 search.mjs
36
+ 69d9371ccc157616fdfc1e91c61ae702e03a89a5648a32ed6480e0c203eb24ab server.mjs
37
37
  e5503a22a6238901484d123efc11d2d933aa9a54c6ac2018812cfa65ec4e53e3 skills/ctx-doctor/SKILL.md
38
38
  1044587a1906c69f2467c089a25e19819a290ea5728389bd1f086c6dfc0d0c51 skills/ctx-stats/SKILL.md
39
39
  c1cac75b7506ee0d06089ce611ac6dc9314cf12435da318ce88ad50e2c5debbf skills/ctx-upgrade/SKILL.md