context-mode 2.0.0-next.33 → 2.0.0-next.37

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.
package/README.md CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  **A free, local plugin for 10 coding agents. It keeps tool output out of your agent's context window and keeps all usage data on your machine. The plugin is free forever.**
4
4
 
5
- [![npm downloads](https://img.shields.io/npm/dt/context-mode?label=npm%20downloads)](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) [![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.33/LICENSE)
5
+ [![npm downloads](https://img.shields.io/npm/dt/context-mode?label=npm%20downloads)](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) [![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.37/LICENSE)
6
6
 
7
- **33K GitHub stars · 683K npm downloads** (read 2026-11-01, [stats.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/stats.json)) · on the Hacker News front page and GitHub Trending: [charts and sources](#adoption-stars-and-npm-downloads)
7
+ **33K GitHub stars · 683K npm downloads** (read 2026-11-01, [stats.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/stats.json)) · on the Hacker News front page and GitHub Trending: [charts and sources](#adoption-stars-and-npm-downloads)
8
8
 
9
9
  > The Context Mode plugin is free and local, with its source open on GitHub. **Context Mode Gateway** is a separate hosted service with its own account and subscription. It takes the same idea from tool output to the whole conversation: Gateway Recall keeps long sessions searchable, and Gateway Memory shares what your agents learn across sessions and tools. [See how the Gateway works](https://contextmode.ai/docs/how-saving-works?utm_source=github&utm_medium=readme&utm_content=quote)
10
10
 
11
11
  <picture>
12
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/hero-dark.png">
13
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/hero-light.png" alt="Context Mode plugin: free and local, zero telemetry, the plugin keeps your data on your machine. Bench of 2026-11-01: 99.4% of output bytes saved (median of 36 rows with 10 KB or more of raw output). A full debugging session (row g-session-total): 281,261 B raw to 3,266 B in context, about 70K to 817 tokens (an estimate at 4 B per token). Resume after compaction (row e-long-session): a 442,893 B transcript to a 2,019 B block, about 111K to 505 tokens (an estimate). Runs in 10 coding agents with 9 MCP tools.">
12
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/hero-dark.png">
13
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/hero-light.png" alt="Context Mode plugin: free and local, zero telemetry, the plugin keeps your data on your machine. Bench of 2026-11-01: 99.4% of output bytes saved (median of 36 rows with 10 KB or more of raw output). A full debugging session (row g-session-total): 281,261 B raw to 3,266 B in context, about 70K to 817 tokens (an estimate at 4 B per token). Resume after compaction (row e-long-session): a 442,893 B transcript to a 2,019 B block, about 111K to 505 tokens (an estimate). Runs in 10 coding agents with 9 MCP tools.">
14
14
  </picture>
15
15
 
16
16
  **Contents:** [Why](#why) · [Adoption](#adoption-stars-and-npm-downloads) · [Install](#install) · [Try it](#try-it) · [Use cases](#use-cases) · [Benchmarks](#benchmarks) · [How it works](#how-it-works) · [Tools](#tools) · [Security and privacy](#security-and-privacy) · [Context Mode Gateway](#context-mode-gateway) · [License](#license) · [Community](#community)
@@ -25,13 +25,14 @@ The Context Mode plugin runs that work in a local sandbox, keeps the full output
25
25
  - **The plugin keeps your data on your machine.** Every index lives in `~/.context-mode`: one `context.db` per project.
26
26
  - **Zero telemetry.** The plugin keeps all usage data on your machine. [Security and privacy](#security-and-privacy) lists each network call it makes.
27
27
  - **Works offline after install.** Sandbox runs, file indexing and search use local SQLite and your own runtimes.
28
+ - **Thinking in Code.** The agent writes a short script instead of reading the data, and only what the script prints reaches the context: see [How it works, step 5](#thinking-in-code).
28
29
  - **Small replies.** On the 36 bench rows with 10 KB or more of raw output, the plugin's median reply is 99.4% smaller than the raw output.
29
30
 
30
31
  ## Adoption: stars and npm downloads
31
32
 
32
33
  <table><tr>
33
- <td width="50%"><a href="https://contextmode.ai/open-source/stats?utm_source=github&utm_medium=readme&utm_content=adoption#stars"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/star-history-dark.png"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/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."></picture></a></td>
34
- <td width="50%"><a href="https://contextmode.ai/open-source/stats?utm_source=github&utm_medium=readme&utm_content=adoption#daily"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/npm-downloads-dark.png"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/npm-downloads-light.png" alt="Area chart of npm downloads per day for context-mode, the last 90 days. A daily job redraws it."></picture></a></td>
34
+ <td width="50%"><a href="https://contextmode.ai/open-source/stats?utm_source=github&utm_medium=readme&utm_content=adoption#stars"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/star-history-dark.png"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/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."></picture></a></td>
35
+ <td width="50%"><a href="https://contextmode.ai/open-source/stats?utm_source=github&utm_medium=readme&utm_content=adoption#daily"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/npm-downloads-dark.png"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/npm-downloads-light.png" alt="Area chart of npm downloads per day for context-mode, the last 90 days. A daily job redraws it."></picture></a></td>
35
36
  </tr></table>
36
37
 
37
38
  Open the [interactive chart](https://contextmode.ai/open-source/stats?utm_source=github&utm_medium=readme&utm_content=adoption#daily) and point at a bar to read its value. Tabs there show days, weeks, months and years. Stars come from the GitHub GraphQL API (`starredAt`); npm downloads come from `api.npmjs.org/downloads/range`. The total up to 2026-10-29 is 683K npm downloads (`stats.json` keeps a daily copy). A daily job redraws both charts.
@@ -40,109 +41,216 @@ Open the [interactive chart](https://contextmode.ai/open-source/stats?utm_source
40
41
  - **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)).
41
42
 
42
43
  <picture>
43
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/stargazers-dark.png">
44
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/stargazers-light.png" alt="Companies that stargazers of mksglu/context-mode name in their GitHub profile, Microsoft, Tencent, Alibaba, ByteDance, Google and more.">
44
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/stargazers-dark.png">
45
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/stargazers-light.png" alt="Companies that stargazers of mksglu/context-mode name in their GitHub profile, Microsoft, Tencent, Alibaba, ByteDance, Google and more.">
45
46
  </picture>
46
47
 
47
- Starred by engineers at these companies: each name is the company field of 2 or more stargazer profiles, read with the GitHub GraphQL API on 2026-11-01 ([data](https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/docs/assets/readme/data/stargazer-companies.json)).
48
+ Starred by engineers at these companies: each name is the company field of 2 or more stargazer profiles, read with the GitHub GraphQL API on 2026-11-01 ([data](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/assets/readme/data/stargazer-companies.json)).
48
49
 
49
50
  ## Install
50
51
 
51
- The plugin needs Node 24.15.0 or later (the `engines` field in [package.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/package.json)). On Windows you also need Git for Windows: the shell tools run in Git Bash, and `context-mode doctor` checks that Git Bash is there.
52
+ Pick your agent: [Claude Code](#install-claude-code) · [Codex](#install-codex) · [Gemini CLI](#install-gemini) · [Qwen Code](#install-qwen) · [Pi](#install-pi) · [OpenCode](#install-opencode) · [Copilot CLI](#install-copilot-cli) · [Kiro](#install-kiro) · [VS Code](#install-vscode) · [ZCode](#install-zcode)
52
53
 
53
- Open your agent and copy its own install command. Each block also has the update, check and remove steps. Step-by-step guide: [Install](https://contextmode.ai/docs/engine/install?utm_source=github&utm_medium=readme&utm_content=install).
54
- The npm commands use `@next`, the current 2.0 release tag; a plain `npm i -g context-mode` installs 1.x. Claude Code, Codex, Gemini CLI and Qwen Code install from GitHub, and each of their commands names the `release` branch.
55
- The `context-mode` command (doctor, setup, remove) comes with the npm package: run `npm i -g context-mode@next` once, or use `/ctx-doctor` in the agent for the check.
54
+ Open its block and copy its own install command. Each block also holds the update, check and remove steps, and the [Install guide](https://contextmode.ai/docs/engine/install?utm_source=github&utm_medium=readme&utm_content=install) walks through them.
56
55
 
57
- <details open id="install-claude-code"><summary><b>Claude Code</b></summary>
56
+ The plugin needs Node 24.15.0 or later, from the engines field in [package.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/package.json). On Windows, add Git for Windows: the shell tools run in Git Bash, and doctor checks for it.
57
+ The npm commands use `@next`, the current 2.0 release tag; the plain package name gives the 1.x line.
58
+ Claude Code, Codex, Gemini CLI and Qwen Code install from GitHub, and each of their commands names the release branch.
59
+
60
+ <details id="install-claude-code"><summary><b>Claude Code</b></summary>
58
61
 
59
62
  ```sh
60
63
  claude plugin marketplace add mksglu/context-mode#release
61
64
  claude plugin install context-mode@context-mode
62
65
  ```
63
- Update: `claude plugin update context-mode@context-mode`. Check: `context-mode doctor --agents claude-code`. Remove: `context-mode setup --remove --agents claude-code`.
64
- Hooks: yes (package) · MCP: yes · Skills: yes
66
+
67
+ ```sh
68
+ # update
69
+ claude plugin update context-mode@context-mode
70
+ # check
71
+ claude plugin list
72
+ # remove
73
+ claude plugin marketplace remove context-mode
74
+ ```
75
+
76
+ Hooks ✓ (package) · MCP ✓ · Skills ✓
77
+
65
78
  </details>
66
- <details open id="install-codex"><summary><b>Codex</b></summary>
79
+ <details id="install-codex"><summary><b>Codex</b></summary>
67
80
 
68
81
  ```sh
69
82
  codex plugin marketplace add mksglu/context-mode@release
70
83
  codex plugin add context-mode@context-mode
84
+ # one-time step: trust the plugin hooks
85
+ npm i -g context-mode@next
86
+ context-mode setup --agents codex
87
+ ```
88
+
89
+ ```sh
90
+ # update
91
+ codex plugin marketplace upgrade context-mode
92
+ # check
93
+ codex mcp list
94
+ # remove
95
+ codex plugin remove context-mode@context-mode
96
+ codex plugin marketplace remove context-mode
71
97
  ```
72
- Then run `context-mode setup --agents codex` once: it marks the plugin hooks as trusted in the Codex `config.toml`, so Codex runs them.
73
- Update: `codex plugin marketplace upgrade context-mode`. Check: `context-mode doctor --agents codex`. Remove: `context-mode setup --remove --agents codex`.
74
- Hooks: yes (hook file) · MCP: yes · Skills: yes
98
+
99
+ Hooks ✓ (hook file) · MCP ✓ · Skills ✓
100
+
75
101
  </details>
76
- <details open id="install-gemini"><summary><b>Gemini CLI</b></summary>
102
+ <details id="install-gemini"><summary><b>Gemini CLI</b></summary>
77
103
 
78
104
  ```sh
79
105
  gemini extensions install https://github.com/mksglu/context-mode --ref release
80
106
  ```
81
- Update: `gemini extensions update context-mode`. Check: `context-mode doctor --agents gemini`. Remove: `context-mode setup --remove --agents gemini`, then `gemini extensions uninstall context-mode`.
82
- Hooks: yes (package) · MCP: yes · Skills: yes
107
+
108
+ ```sh
109
+ # update
110
+ gemini extensions update context-mode
111
+ # check
112
+ GEMINI_CLI_TRUST_WORKSPACE=true gemini mcp list
113
+ # remove
114
+ gemini extensions uninstall context-mode
115
+ ```
116
+
117
+ Hooks ✓ (package) · MCP ✓ · Skills ✓
118
+
83
119
  </details>
84
- <details open id="install-qwen"><summary><b>Qwen Code</b></summary>
120
+ <details id="install-qwen"><summary><b>Qwen Code</b></summary>
85
121
 
86
122
  ```sh
87
123
  qwen extensions install https://github.com/mksglu/context-mode:context-mode --ref release
88
124
  ```
89
- Update: `qwen extensions update context-mode`. Check: `context-mode doctor --agents qwen`. Remove: `context-mode setup --remove --agents qwen`, then `qwen extensions uninstall context-mode`.
90
- Hooks: yes (package) · MCP: yes · Skills: yes
125
+
126
+ ```sh
127
+ # update
128
+ qwen extensions update context-mode
129
+ # check
130
+ qwen extensions list
131
+ # remove
132
+ qwen extensions uninstall context-mode
133
+ ```
134
+
135
+ Hooks ✓ (package) · MCP ✓ · Skills ✓
136
+
91
137
  </details>
92
- <details open id="install-pi"><summary><b>Pi</b></summary>
138
+ <details id="install-pi"><summary><b>Pi</b></summary>
93
139
 
94
140
  ```sh
95
141
  pi install npm:context-mode@next
96
142
  ```
97
- Update: `pi update --extensions`. Check: `context-mode doctor --agents pi`. Remove: `context-mode setup --remove --agents pi`.
98
- Hooks: yes (the plugin's own event handlers) · MCP: ctx tools built into the plugin · Skills: yes
143
+
144
+ ```sh
145
+ # update
146
+ pi update --extensions
147
+ # check
148
+ pi list
149
+ # remove
150
+ pi remove npm:context-mode@next
151
+ ```
152
+
153
+ Hooks ✓ (the plugin's own event handlers) · MCP ✓ (ctx tools built into the plugin) · Skills ✓
154
+
99
155
  </details>
100
- <details open id="install-opencode"><summary><b>OpenCode</b></summary>
156
+ <details id="install-opencode"><summary><b>OpenCode</b></summary>
101
157
 
102
158
  ```sh
103
159
  opencode plugin add context-mode@next
104
160
  ```
105
- Update: `opencode plugin update`. Check: `context-mode doctor --agents opencode`. Remove: `opencode plugin remove context-mode@next`, then `context-mode setup --remove --agents opencode`.
106
- Hooks: yes (the plugin's own event handlers) · MCP: yes · Skills: yes
161
+
162
+ ```sh
163
+ # update
164
+ opencode plugin update
165
+ # check
166
+ opencode mcp list --pure # OpenCode 1.19
167
+ opencode mcp list --standalone # OpenCode 2
168
+ # remove
169
+ opencode plugin remove context-mode@next
170
+ ```
171
+
172
+ Hooks ✓ (the plugin's own event handlers) · MCP ✓ · Skills ✓
173
+
107
174
  </details>
108
- <details open id="install-copilot-cli"><summary><b>Copilot CLI</b></summary>
175
+ <details id="install-copilot-cli"><summary><b>Copilot CLI</b></summary>
109
176
 
110
177
  ```sh
111
178
  npm i -g context-mode@next
112
179
  context-mode setup --agents copilot-cli
113
180
  ```
114
- Update: `context-mode upgrade`. Check: `context-mode doctor --agents copilot-cli`. Remove: `context-mode setup --remove --agents copilot-cli`.
115
- Hooks: yes (hook file) · MCP: yes · Skills: yes
181
+
182
+ ```sh
183
+ # update
184
+ context-mode upgrade
185
+ # check
186
+ context-mode doctor --agents copilot-cli
187
+ copilot mcp list
188
+ # remove
189
+ context-mode setup --remove --agents copilot-cli
190
+ ```
191
+
192
+ Hooks ✓ (hook file) · MCP ✓ · Skills ✓
193
+
116
194
  </details>
117
- <details open id="install-kiro"><summary><b>Kiro</b></summary>
195
+ <details id="install-kiro"><summary><b>Kiro</b></summary>
118
196
 
119
197
  ```sh
120
198
  npm i -g context-mode@next
121
199
  context-mode setup --agents kiro
122
200
  ```
123
- Update: `context-mode upgrade`. Check: `context-mode doctor --agents kiro`. Remove: `context-mode setup --remove --agents kiro`.
124
- Hooks: yes (hook file) · MCP: yes · Skills: yes
201
+
202
+ ```sh
203
+ # update
204
+ context-mode upgrade
205
+ # check
206
+ context-mode doctor --agents kiro
207
+ # remove
208
+ context-mode setup --remove --agents kiro
209
+ ```
210
+
211
+ Hooks ✓ (hook file) · MCP ✓ · Skills ✓
212
+
125
213
  </details>
126
- <details open id="install-vscode"><summary><b>VS Code (Copilot)</b></summary>
214
+ <details id="install-vscode"><summary><b>VS Code (Copilot)</b></summary>
127
215
 
128
216
  ```sh
129
217
  npm i -g context-mode@next
130
218
  context-mode setup --agents vscode
131
219
  ```
132
- Update: `context-mode upgrade`. Check: `context-mode doctor --agents vscode`. Remove: `context-mode setup --remove --agents vscode`.
133
- Hooks: yes (hook file) · MCP: yes · Skills: yes
220
+
221
+ ```sh
222
+ # update
223
+ context-mode upgrade
224
+ # check
225
+ context-mode doctor --agents vscode
226
+ # remove
227
+ context-mode setup --remove --agents vscode
228
+ ```
229
+
230
+ Hooks ✓ (hook file) · MCP ✓ · Skills ✓
231
+
134
232
  </details>
135
- <details open id="install-zcode"><summary><b>ZCode</b></summary>
233
+ <details id="install-zcode"><summary><b>ZCode</b></summary>
136
234
 
137
235
  ```sh
138
236
  npm i -g context-mode@next
139
237
  context-mode setup --agents zcode
140
238
  ```
141
- Update: `context-mode upgrade`. Check: `context-mode doctor --agents zcode`. Remove: `context-mode setup --remove --agents zcode`.
142
- Hooks: yes (hook file) · MCP: yes · Skills: yes
239
+
240
+ ```sh
241
+ # update
242
+ context-mode upgrade
243
+ # check
244
+ context-mode doctor --agents zcode
245
+ # remove
246
+ context-mode setup --remove --agents zcode
247
+ ```
248
+
249
+ Hooks ✓ (hook file) · MCP ✓ · Skills ✓
250
+
143
251
  </details>
144
252
 
145
- Already installed from GitHub on `main`? Switch Claude Code, Codex, Gemini CLI or Qwen Code to the `release` ref with the steps in [Already installed from GitHub?](https://contextmode.ai/docs/engine/install?utm_source=github&utm_medium=readme&utm_content=install-switch#already-installed-from-github).
253
+ Moving Claude Code, Codex, Gemini CLI or Qwen Code from the main branch to the release ref? Follow [Already installed from GitHub?](https://contextmode.ai/docs/engine/install?utm_source=github&utm_medium=readme&utm_content=install-switch#already-installed-from-github).
146
254
 
147
255
  The npm route works for every agent:
148
256
 
@@ -151,21 +259,32 @@ npm i -g context-mode@next
151
259
  context-mode setup
152
260
  ```
153
261
 
154
- `context-mode setup` is also the repair. It shows a plan, saves your earlier config, then applies the plan; when a step ends early, it restores the saved config.
155
- Uninstall: `context-mode setup --remove && npm rm -g context-mode`.
262
+ Setup is also the repair. It shows a plan, saves your earlier config, then applies the plan; when a step ends early, it restores the saved config. To uninstall:
263
+
264
+ ```sh
265
+ context-mode setup --remove
266
+ npm rm -g context-mode
267
+ ```
268
+
269
+ Restart the agent, then run `/ctx-doctor` in it. Each check prints PASS or a fix command, and the [Doctor guide](https://contextmode.ai/docs/engine/doctor?utm_source=github&utm_medium=readme&utm_content=install-doctor) explains each check.
156
270
 
157
- Restart the agent, then run `context-mode doctor` (or `/ctx-doctor` in the agent). Each check prints PASS or a fix command.
271
+ <details><summary><b>How we tested the install</b></summary>
158
272
 
159
- Every agent gets hooks, the MCP server and the plugin skills (files in `skills/`); the last line of each block above says how.
160
- 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 a plugin inside the agent (OpenCode, Pi).
273
+ Every agent gets hooks, the MCP server and the plugin skills; the last line of each block above says how.
274
+ 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 a plugin inside the agent (OpenCode, Pi). The [Agents guide](https://contextmode.ai/docs/engine/agents?utm_source=github&utm_medium=readme&utm_content=install-agents) shows what each agent runs.
161
275
  We ran the real binary of each agent with the plugin hook: Claude Code, Codex, Gemini CLI, Qwen Code, Pi, OpenCode, Copilot CLI and ZCode. Each run used a clean temp home and a local test model, on 2.0.0-next.15.
162
276
  For VS Code and Kiro, the check covers the hook setup: VS Code runs the hook command with the documented payload, and kiro-cli 2.35.2 loads all 6 hook entries.
163
- 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`.
277
+ CI runs setup, doctor, a hook and an MCP handshake for all 10 agents from the packed package on Linux, macOS and Windows. Record: [HOOKS-FIRE.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/architecture/release/HOOKS-FIRE.md).
278
+ Each agent uses its own install command, and [ADR-0023](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/architecture/adr/ADR-0023-native-install.md) says why.
279
+
280
+ </details>
281
+
282
+ Your first task with the plugin, step by step: [First session](https://contextmode.ai/docs/engine/first-session?utm_source=github&utm_medium=readme&utm_content=install-next). Or paste a prompt from [Try it](#try-it) right now.
164
283
 
165
284
  ## Try it
166
285
 
167
- Paste one of these prompts into your agent after the install. Each one ran once, live, in Claude Code 2.1.312, and its answer matched the source data ([evidence and rerun steps](https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/bench/evidence/try-it-2026-11-02/README.md)). The headline numbers in [Benchmarks](#benchmarks) use the median of 5 runs. Other agents do the same job with the same tools: `ctx_execute`, `ctx_index` and `ctx_search`.
168
- Then run `/ctx-stats` in your agent to see how much output stayed out of the context. Every agent gets this command with the plugin skills (`skills/ctx-stats`).
286
+ Paste one of these prompts into your agent after the install. Each one ran once, live, in Claude Code 2.1.312, and its answer matched the source data ([evidence and rerun steps](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/evidence/try-it-2026-11-02/README.md)). The headline numbers in [Benchmarks](#benchmarks) use the median of 5 runs. Other agents do the same job with the same tools: `ctx_execute`, `ctx_index` and `ctx_search`.
287
+ After a prompt, run the stats skill and read the report yourself ([See the saving](#see-the-saving)).
169
288
  ```text
170
289
  On https://react.dev/reference/react/useEffect, show me the example that connects to a chat server and cleans up, and list the rules for the dependency array.
171
290
  ```
@@ -183,43 +302,80 @@ What are the top 10 stories on the Hacker News front page right now? Give title,
183
302
  ```
184
303
  The hook sends WebFetch to the sandbox, and the agent reads ten stories from the page. 35,087 B raw, 1,501 B reached the context, 95.7% saved (2026-11-02, 2.0.0-next.26, claude-haiku-5-5). The front page changes, so the raw size changes with each run.
185
304
 
305
+ ### See the saving
306
+
307
+ Run the stats skill right after a prompt. Each agent uses its own command; the skill calls `ctx_stats` and shows its report unchanged.
308
+
309
+ | Agent | Command |
310
+ |---|---|
311
+ | Claude Code | `/ctx-stats` |
312
+ | Codex | `$ctx-stats` |
313
+ | Copilot CLI | `/ctx-stats` |
314
+ | Gemini CLI | `Call ctx_stats and show me the report.` |
315
+ | Kiro | `Call ctx_stats and show me the report.` |
316
+ | OpenCode | `Call ctx_stats and show me the report.` |
317
+ | Pi | `/skill:ctx-stats` |
318
+ | Qwen Code | `Call ctx_stats and show me the report.` |
319
+ | VS Code (Copilot) | `/ctx-stats` |
320
+ | ZCode | `Call ctx_stats and show me the report.` |
321
+
322
+ The first lines of a real report, after the JSON prompt above ran as one `ctx_execute` call:
323
+
324
+ ```text
325
+ context-mode stats
326
+ ────────────────────────────────────────────────────────────────────────────────
327
+
328
+ This session · 1 call · <1m active
329
+ 1015.5 KB became 3.7 KB: 1011.8 KB kept out (99.6%)
330
+ Without context-mode |████████████████████████████████████████| 1015.5 KB
331
+ With context-mode |█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░| 3.7 KB
332
+ about 259K tokens kept out, 1.3 times a 200K window
333
+ ```
334
+ Captured 2026-11-03 with 2.0.0-next.35: `release-out/server.mjs` over MCP in a temp HOME.
335
+
336
+ Next, the same numbers for 20 real tools, in [Use cases](#use-cases).
337
+
186
338
  ## Use cases
187
339
 
188
340
  Real tool output from public projects, run through Context Mode. Bench of 2026-11-01 on 2.0.0-next.23 (commit 16a4bcc5), median of 5 runs.
189
341
 
190
342
  | What you do | Tool | Raw | Reaches the context | Saved |
191
343
  |---|---|---:|---:|---:|
192
- | Read a browser page | Chrome DevTools MCP `take_snapshot` | 136,514 B | 463 B | 99.7% |
193
- | List 40 issues | GitHub CLI `gh issue list --json` | 182,943 B | 850 B | 99.5% |
194
- | List 25 pull requests with checks | GitHub CLI `gh pr list --json` | 195,471 B | 776 B | 99.6% |
195
- | Look up library docs | Context7 `query-docs` | 6,917 B | 473 B | 93.2% |
196
- | Run 1,106 tests | Vitest `vitest run --reporter=verbose` | 62,909 B | 429 B | 99.3% |
197
- | Lint a source folder | Biome `biome lint --reporter=json` | 288,523 B | 577 B | 99.8% |
198
- | Install a workspace | pnpm `pnpm install --frozen-lockfile` | 14,988 B | 199 B | 98.7% |
199
- | Install packages | npm `npm install --loglevel http` | 37,761 B | 435 B | 98.8% |
200
- | Read container logs | Docker `docker logs` | 60,374 B | 587 B | 99.0% |
201
- | Plan 72 resources | Terraform `terraform plan` | 34,081 B | 166 B | 99.5% |
202
- | Read 300 commits with file stats | git `git log --stat` | 164,385 B | 268 B | 99.8% |
203
- | Read an 89 KB source file | Read, sent to `ctx_execute` by the hook | 91,362 B | 375 B | 99.6% |
204
- | Fetch a 265 KB docs page | WebFetch, sent to `ctx_index` and `ctx_search` | 271,731 B | 439 B | 99.8% |
205
- | Fetch a 214 KB API reply | curl in Bash, replaced after it runs | 219,175 B | 291 B | 99.9% |
206
- | Print a 187 KB git log in Bash | Bash, output replaced after it runs | 191,120 B | 204 B | 99.9% |
207
- | Print the same git log through a host tool | Host tool output over the cap, indexed whole | 191,120 B | 2,842 B | 98.5% |
208
- | Print a 214 KB GitHub API reply through a host tool | Host tool output over the cap, indexed whole | 219,175 B | 4,060 B | 98.1% |
209
- | Read a 45 KB log file | Read, sent to `ctx_execute` by the hook | 46,216 B | 371 B | 99.2% |
210
- | Read a 60 KB source file | Read, sent to `ctx_execute` by the hook | 61,576 B | 374 B | 99.4% |
211
- | Debug for a full session: 8 outputs, 3 searches | All hooks and tools | 281,261 B | 3,266 B | 98.8% |
212
-
213
- Source: [bench/results/2026-11-01-darwin-arm64.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/bench/results/2026-11-01-darwin-arm64.json), one row per line; each input is named in `bench/fixtures/data/SOURCE.md`.
344
+ | [Read a browser page](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/a-sandbox/README.md#a-devtools-mcp-snapshot) | Chrome DevTools MCP `take_snapshot`, [Thinking in Code](#thinking-in-code) | 136,514 B | 463 B | 99.7% |
345
+ | [List 40 issues](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/a-sandbox/README.md#a-gh-issue-list-vite) | GitHub CLI `gh issue list --json`, [Thinking in Code](#thinking-in-code) | 182,943 B | 850 B | 99.5% |
346
+ | [List 25 pull requests with checks](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/a-sandbox/README.md#a-gh-pr-list-vite) | GitHub CLI `gh pr list --json`, [Thinking in Code](#thinking-in-code) | 195,471 B | 776 B | 99.6% |
347
+ | [Look up library docs](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/a-sandbox/README.md#a-context7-query-docs-vite) | Context7 `query-docs`, [Thinking in Code](#thinking-in-code) | 6,917 B | 473 B | 93.2% |
348
+ | [Run 1,106 tests](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/a-sandbox/README.md#a-vitest-run-vite) | Vitest `vitest run --reporter=verbose`, [Thinking in Code](#thinking-in-code) | 62,909 B | 429 B | 99.3% |
349
+ | [Lint a source folder](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/a-sandbox/README.md#a-biome-lint-vite) | Biome `biome lint --reporter=json`, [Thinking in Code](#thinking-in-code) | 288,523 B | 577 B | 99.8% |
350
+ | [Install a workspace](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/a-sandbox/README.md#a-pnpm-install-vite) | pnpm `pnpm install --frozen-lockfile`, [Thinking in Code](#thinking-in-code) | 14,988 B | 199 B | 98.7% |
351
+ | [Install packages](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/a-sandbox/README.md#a-npm-install-log) | npm `npm install --loglevel http`, [Thinking in Code](#thinking-in-code) | 37,761 B | 435 B | 98.8% |
352
+ | [Read container logs](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/a-sandbox/README.md#a-docker-logs-mongo) | Docker `docker logs`, [Thinking in Code](#thinking-in-code) | 60,374 B | 587 B | 99.0% |
353
+ | [Plan 72 resources](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/a-sandbox/README.md#a-terraform-plan) | Terraform `terraform plan`, [Thinking in Code](#thinking-in-code) | 34,081 B | 166 B | 99.5% |
354
+ | [Read 300 commits with file stats](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/a-sandbox/README.md#a-git-log-stat-vite) | git `git log --stat`, [Thinking in Code](#thinking-in-code) | 164,385 B | 268 B | 99.8% |
355
+ | [Read an 89 KB source file](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/f-hook-redirect/README.md#f-read-vite-config) | Read, sent to `ctx_execute` by the hook | 91,362 B | 375 B | 99.6% |
356
+ | [Fetch a 265 KB docs page](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/f-hook-redirect/README.md#f-webfetch-vite-docs) | WebFetch, sent to `ctx_index` and `ctx_search` | 271,731 B | 439 B | 99.8% |
357
+ | [Fetch a 214 KB API reply](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/f-hook-redirect/README.md#f-bash-curl-post) | curl in Bash, replaced after it runs | 219,175 B | 291 B | 99.9% |
358
+ | [Print a 187 KB git log in Bash](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/f-hook-redirect/README.md#f-bash-dump-post) | Bash, output replaced after it runs | 191,120 B | 204 B | 99.9% |
359
+ | [Print the same git log through a host tool](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/d-externalize/README.md#d-real-git-log) | Host tool output over the cap, indexed whole | 191,120 B | 2,842 B | 98.5% |
360
+ | [Print a 214 KB GitHub API reply through a host tool](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/d-externalize/README.md#d-real-github-json) | Host tool output over the cap, indexed whole | 219,175 B | 4,060 B | 98.1% |
361
+ | [Read a 45 KB log file](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/f-hook-redirect/README.md#f-read-large-file) | Read, sent to `ctx_execute` by the hook | 46,216 B | 371 B | 99.2% |
362
+ | [Read a 60 KB source file](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/f-hook-redirect/README.md#f-read-big-source) | Read, sent to `ctx_execute` by the hook | 61,576 B | 374 B | 99.4% |
363
+ | [Debug for a full session: 8 outputs, 3 searches](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/g-overhead/README.md#g-session-total) | All hooks and tools | 281,261 B | 3,266 B | 98.8% |
364
+
365
+ Source: [bench/results/2026-11-01-darwin-arm64.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/results/2026-11-01-darwin-arm64.json), one row per line; [SOURCE.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/fixtures/data/SOURCE.md) names where each input comes from.
366
+ Click a task to open its case: the command, the input file with its sha256, and the run command, so you can run the same row on your machine.
214
367
 
215
368
  The agent gets the part it asks for. The full output stays in the local index, and `ctx_search` reads it back.
369
+ Rows with a command run in the [sandbox](https://contextmode.ai/docs/engine/sandbox?utm_source=github&utm_medium=readme&utm_content=usecases); the agent then finds the rest with [search](https://contextmode.ai/docs/engine/search?utm_source=github&utm_medium=readme&utm_content=usecases).
216
370
  The Context7 row has 6,917 B of raw output, under the 10 KB line of the headline rule, so the headline leaves it out.
217
371
 
372
+ Next, how the bench counts these bytes, in [Benchmarks](#benchmarks).
373
+
218
374
  ## Benchmarks
219
375
 
220
376
  <picture>
221
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/fig-saving-dark.png">
222
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/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.5%, Batch 93.1%, Externalize 98.3%, Hook redirect 99.8%, Session total 98.8%. The table below adds Retrieval, 77.2%.">
377
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/fig-saving-dark.png">
378
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/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.5%, Batch 93.1%, Externalize 98.3%, Hook redirect 99.8%, Session total 98.8%. The table below adds Retrieval, 77.2%.">
223
379
  </picture>
224
380
 
225
381
  Rule for every headline number in this README: rows with 10 KB or more of raw output, median of 5 runs per row, measured with `ctx_bytes` against `raw_bytes`; a category is the median of its rows; 1 KB = 1,024 B.
@@ -234,22 +390,24 @@ All 36 such rows, the six categories below: the plugin keeps a median of 99.4% o
234
390
  | f. Hook redirect | A big Read, curl or WebFetch sent to the sandbox | 7 | 99.8% |
235
391
  | g. Session total | One full scripted session | 1 | 98.8% |
236
392
 
237
- Search replies (category b) carry the matching text, so they save 77.2%. Category e (long sessions) is in [Longer sessions](#longer-sessions). The full file lists every row, small ones too: `bench/results/2026-11-01-darwin-arm64.md`.
238
- Reproduce: `cd bench && node run.mjs`. Method, data files and rerun steps: [Benchmarks](https://contextmode.ai/docs/engine/benchmarks?utm_source=github&utm_medium=readme&utm_content=benchmarks).
393
+ Search replies (category b) carry the matching text, so they save 77.2%. Category e (long sessions) is in [Longer sessions](#longer-sessions). The full file lists every row, small ones too: [2026-11-01-darwin-arm64.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/results/2026-11-01-darwin-arm64.md).
394
+ Reproduce with `cd bench && node run.mjs`. It needs plain Node and runs offline; [bench/README.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/README.md) lists each scenario and its options.
395
+ Method, data files and rerun steps: [Benchmarks guide](https://contextmode.ai/docs/engine/benchmarks?utm_source=github&utm_medium=readme&utm_content=benchmarks).
239
396
 
240
397
  ### Longer sessions
241
398
 
242
399
  <picture>
243
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/fig-oss-dark.png">
244
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/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.">
400
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/fig-oss-dark.png">
401
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/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.">
245
402
  </picture>
246
403
 
247
404
  Say you debug a slow test all afternoon. The agent reads files, runs the suite and fetches docs, and each result goes into the context window. When the window is full, the host compacts it, and from then on the agent sees a short summary plus your next message.
248
405
 
249
406
  Context Mode keeps the full output of each large tool call in `context.db` on your machine and gives the agent a small reply. At compaction, a snapshot of at most 2,048 B keeps the session state. After the compaction, the agent calls `ctx_resume` to read that snapshot back and `ctx_search` to find any earlier output by keyword.
250
407
 
251
- In the bench, a scripted session of 40 tool outputs and one compaction made a 442,893 B transcript, and the `ctx_resume` block that brought the agent back was 2,019 B (row `e-long-session` in the bench file).
252
- In the same bench, one large log of 666,796 B put 3,380 B into the context, and the full log stayed in the index for `ctx_search` (row `d-synth-1m`).
408
+ In the bench, a scripted session of 40 tool outputs and one compaction made a 442,893 B transcript, and the `ctx_resume` block that brought the agent back was 2,019 B (row `e-long-session` in the bench file; [open the case](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/e-continuity/README.md#e-long-session)).
409
+ In the same bench, one large log of 666,796 B put 3,380 B into the context, and the full log stayed in the index for `ctx_search` (row `d-synth-1m`; [open the case](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/d-externalize/README.md#d-synth-1m)).
410
+ How the snapshot picks what to keep: the [Long sessions guide](https://contextmode.ai/docs/engine/long-sessions?utm_source=github&utm_medium=readme&utm_content=longer-sessions) and [ADR-0009](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/architecture/adr/0009-compaction-and-memory.md).
253
411
 
254
412
  ### Speed
255
413
 
@@ -261,22 +419,103 @@ Median of 5 runs, bench of 2026-11-01.
261
419
  | `ctx_search`, 20 queries over 8 indexed files | 1.62 ms median, 6.70 ms max |
262
420
  | `ctx_index`, 3 real files, 625,649 B | 150 ms per MB |
263
421
 
264
- Source: rows `g-hook-kiro` to `g-hook-claude-code`, `g-search-latency` and `g-index-per-mb` of `bench/results/2026-11-01-darwin-arm64.md`, with every agent and query.
422
+ Source: rows `g-hook-kiro` to `g-hook-claude-code`, `g-search-latency` and `g-index-per-mb` of [the bench file](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/results/2026-11-01-darwin-arm64.md), with every agent and query. The [overhead cases](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/g-overhead/README.md) show how each one runs.
423
+
424
+ Next, what happens inside one tool call, in [How it works](#how-it-works).
265
425
 
266
426
  ## How it works
267
427
 
268
428
  <picture>
269
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/fig-flow-dark.png">
270
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/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.">
429
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/fig-flow-dark.png">
430
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/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.">
271
431
  </picture>
272
432
 
273
- 1. Your agent calls a tool: it reads a file, runs a command or fetches a page.
274
- 2. A hook sees the call first. It sends a big read or fetch to the sandbox and gives the agent the exact call to use.
275
- 3. The sandbox runs the work on your machine and keeps the full output in a local SQLite index.
276
- 4. The agent gets the part it asked for, and calls `ctx_search` when it wants more.
277
- 5. After a compaction, the agent gets a short state block; each line points to the full record.
278
-
279
- Timeouts, chunk sizes, ranking and storage: [How it works](https://contextmode.ai/docs/engine/how-it-works?utm_source=github&utm_medium=readme&utm_content=how).
433
+ One tool call, in time order, from the install to a hook error.
434
+
435
+ 1. **Install.** Each agent's own install command adds the MCP server, the hooks and the skills `ctx-doctor`, `ctx-stats` and `ctx-upgrade` to that agent's config folder, for example `~/.codex/skills/<name>/SKILL.md`. `context-mode setup` writes or repairs any part the native command leaves out ([ADR-0023](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/architecture/adr/ADR-0023-native-install.md)).
436
+ 2. **Session start.** The `SessionStart` hook opens the project database. When the session ran before, the agent gets one line that tells it to call `ctx_resume` ([dispatch.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/hooks/dispatch.ts)).
437
+ 3. **PreToolUse checks.** Before a tool runs, the `PreToolUse` hook checks the call in a fixed order: the user's deny list, WebFetch, curl and wget, inline HTTP and build commands, then a full-file Read over `OUTPUT_CAP` (16,384 B) and one-file shell dumps such as `cat` or `tail`. A Read with a line range runs as usual ([decide.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/policy/decide.ts)).
438
+ 4. **The exact call.** When a check matches, the hook stops the call and its reply names the exact `ctx_*` call to use, for example `ctx_execute` with `{"language":"shell","code":"<the command>","intent":"<what you need>"}`. For WebFetch the reply names `ctx_index`, then `ctx_search` ([read-deny.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/policy/read-deny.ts)).
439
+ 5. **The sandbox.** This is the Thinking in Code step: the agent's script runs here, and only what it prints comes back. `ctx_execute` writes the script to a temp folder and spawns the runtime from an argument list in the project folder. The timeout is `EXEC_TIMEOUT_MS` (600,000 ms, default and maximum); on timeout it stops the whole process group (`taskkill /F /T` on Windows). The child gets your environment minus preload variables such as `NODE_OPTIONS`, and the agent gets what the script prints, at most `OUTPUT_CAP` ([execute.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/tools/execute.ts)).
440
+ <a id="thinking-in-code"></a>**Thinking in Code.** The agent sends a short script as a tool parameter, the script reads the data in the sandbox, and only what it prints goes into the context. Two real calls, in the form the Claude Code terminal shows them:
441
+
442
+ `ctx_execute` on 5,000 JSON records, from the Claude Code 2.1.312 stream of the Try-it run with Context Mode 2.0.0-next.26 ([04-api-json.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/evidence/try-it-2026-11-02/04-api-json.json)). The data is 1,039,898 B; the agent gets 254 B.
443
+
444
+ ```text
445
+ ⏺ context-mode - ctx_execute (MCP)(language: "javascript", c…jsonplaceholder.typicode.com/photos\");
446
+ if (!res.ok) throw new Error(\"HTTP \" + res.status);
447
+ const photos = await res.json();
448
+ let longest = null;
449
+ for (const p of photos) {
450
+ if (!longest || p.title.length > longest.title.length) longest = p;
451
+ }
452
+ const withEst = photos.filter(p => p.title.includes(\"est\")).length;
453
+ const ties = photos.filter(p => p.title.length === longest.title.length).map(p => p.id);
454
+ console.log(JSON.stringify({ total: photos.length, longest…nd count of titles containing \"est\"")
455
+ ⎿ exit 0 · 239 B
456
+ {
457
+ "total": 5000,
458
+ "longest": {
459
+ "id": 653,
460
+ "title": "temporibus commodi et fugit doloremque re…rit exercitationem necessitatibus aut",
461
+ "length": 86
462
+ },
463
+ "longestTieIds": [
464
+ 653
465
+ ],
466
+ "titlesContainingEst": 892
467
+ }
468
+ ```
469
+
470
+ `ctx_batch` on an install log and a long git log, one live MCP call to `release-out/server.mjs` of Context Mode 2.0.0-next.36 on 2026-11-03 ([2026-11-03-ctx-batch.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/evidence/thinking-in-code/2026-11-03-ctx-batch.json)). The commands print 228,881 B; the agent gets 8,667 B, the parts that match its two queries, and the full output stays in the index.
471
+
472
+ ```text
473
+ ⏺ context-mode - ctx_batch (MCP)(commands: ["cat npm-install… queries: ["cache miss","feat commit"])
474
+ ⎿ ## cache miss
475
+ js.org/@esbuild%2fwin32-x64 282ms (cache miss)
476
+ npm http fetch GET 200 https://registry.npmjs.org/@esbuild%2flinux-s390x 79ms (cache miss)
477
+ npm http fetch GET 200 https://registry.npmjs.org/@esbuild%2fopenbsd-x64 101ms (cache miss)
478
+ npm http fetch GET 200 https://registry.npmjs.org/@esbuild%2fwin32-arm64 99ms (cache miss)
479
+ npm http fetch GET 200 https://registry.npmjs.org/@esbuild%2fdarwin-arm64 99ms (cache miss)
480
+ … +95 lines (ctrl+o to expand)
481
+ ```
482
+ 6. **Indexing.** The full output goes into the index in chunks of at most `MAX_CHUNK_BYTES` (4,096 B). A Markdown chunk stays inside one heading section, and a code block that fits stays whole. Each chunk goes into two SQLite FTS5 tables: a Porter-stemmed table for words and a trigram table for paths, names and parts of words ([fts.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/store/fts.ts)).
483
+
484
+ `ctx_index` on a copy of this repo's `docs/how-it-works.md`, one live MCP call to `release-out/server.mjs` of Context Mode 2.0.0-next.36 on 2026-11-03 ([calls.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/evidence/terminal-calls-2026-11-03/calls.json)). The file is 11,569 B; the agent gets 64 B.
485
+
486
+ ```text
487
+ ⏺ context-mode - ctx_index (MCP)(path: "how-it-works.md")
488
+ ⎿ Indexed 1 source(s), 17 chunk(s) from s1. Label: how-it-works.md
489
+ ```
490
+ 7. **Search.** `ctx_search` ranks each table with BM25 and joins the two lists with Reciprocal Rank Fusion: a hit scores 1/(`RRF_K` + rank), with `RRF_K` = 60. Before it returns an empty list, it tries a spelling fix from the indexed words. Search covers this session, this worktree (the default) or the whole project, and each snippet is at most `SNIPPET_MAX_BYTES` (800 B) ([search.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/tools/search.ts)).
491
+
492
+ `ctx_search` on that index, in the same run. The agent gets 1,757 B: the best snippets, each with its source and heading.
493
+
494
+ ```text
495
+ ⏺ context-mode - ctx_search (MCP)(queries: ["compaction state block"])
496
+ ⎿ Query "compaction state block":
497
+ how-it-works.md #14: ### Session continuity
498
+
499
+ The hooks log each prompt, edit, command, tool error, i…e same rows always give the same bytes.
500
+ … +16 lines (ctrl+o to expand)
501
+ ```
502
+ 8. **Run, then replace.** On hosts that run the tool first, the `PostToolUse` hook checks the result. Output over `REPLACE_TRIGGER_BYTES` (4,096 B) goes into the index whole, and the agent gets the best-matching chunks and one `ctx_search` line for the rest ([dispatch.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/hooks/dispatch.ts)).
503
+ 9. **Journal and compaction.** The hooks log each prompt, edit, command, tool error and decision in a journal. After a compaction the agent gets a state block of at most `STATE_BUDGET` (2,048 B), and each long line becomes a `ctx_resume(seq)` pointer to the full row; one `ctx_resume` reply is at most `RESUME_CAP` (2,048 B). On the next prompt, a prompt-match block brings back the journal rows that match it by BM25 ([ADR-0009](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/architecture/adr/0009-compaction-and-memory.md)).
504
+
505
+ `ctx_resume` with empty parameters returns the state block, in the same run: 209 B.
506
+
507
+ ```text
508
+ ⏺ context-mode - ctx_resume (MCP)()
509
+ ⎿ <context_mode_state session="mcp:85e67fa2-28ef-45eb-9d5b-a967129b74c0" upto="2">
510
+ indexed how-it-works.md
511
+ source s1: how-it-works.md (11536 B)
512
+ more: ctx_search(queries:[], scope:"session")
513
+ </context_mode_state>
514
+ ```
515
+ 10. **The database.** Each project has one `context.db` under `~/.context-mode`, in Node's built-in `node:sqlite`. The database runs in WAL mode and runs a PASSIVE checkpoint on close. A new database gets built under a temp name and moves into place in one atomic step, and the busy timeout is `DB_TIMEOUT_MS` (5,000 ms) ([db.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/store/db.ts)).
516
+ 11. **A hook error.** A hook always ends with exit 0. On any error it gives the host's allow reply and writes one log line to `~/.context-mode/hook-errors.log`, so your agent keeps working. A spawned hook has `HOOK_TIMEOUT_MS` (5,000 ms) ([fallback.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/hooks/fallback.ts)).
517
+
518
+ Every number with its reason: [How it works](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/how-it-works.md). The rules the hook follows: [ADR-0008](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/architecture/adr/0008-enforcement-rewrite-and-cap.md). Next, the [Tools](#tools) the agent calls.
280
519
 
281
520
  ## Tools
282
521
 
@@ -292,28 +531,63 @@ Timeouts, chunk sizes, ranking and storage: [How it works](https://contextmode.a
292
531
  | `ctx_upgrade` | Installs, upgrades or uninstalls; replaces old context-mode entries |
293
532
  | `ctx_purge` | Deletes indexed data by session, source or project |
294
533
 
534
+ Three more real calls, from the same live run of Context Mode 2.0.0-next.36 on 2026-11-03 ([calls.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/bench/evidence/terminal-calls-2026-11-03/calls.json)).
535
+
536
+ `ctx_stats`: the agent gets 3,097 B, the first line is the summary.
537
+
538
+ ```text
539
+ ⏺ context-mode - ctx_stats (MCP)()
540
+ ⎿ ctx_stats: 82.5% kept out all-time, 82.5% this session.
541
+ … +59 lines (ctrl+o to expand)
542
+ ```
543
+
544
+ `ctx_doctor` after `context-mode setup --agents claude-code`: 862 B, one row per check.
545
+
546
+ ```text
547
+ ⏺ context-mode - ctx_doctor (MCP)()
548
+ ⎿ Environment: context-mode 2.0.0-next.36 (8facf27), agent claude-code 0 (client r20-live)
549
+ Environment: darwin-arm64, Node v26.8.1, shell /bin/zsh
550
+ | Check | Status | Detail | Fix |
551
+ |---|---|---|---|
552
+ | D1 version | PASS | 2.0.0-next.36 (8facf27): ahead of next on npm (2.0.0-next.34) | |
553
+ | D2 node | PASS | ok | |
554
+ … +11 lines (ctrl+o to expand)
555
+ ```
556
+
557
+ `ctx_purge` deletes one source: 66 B.
558
+
559
+ ```text
560
+ ⏺ context-mode - ctx_purge (MCP)(source: "how-it-works.md")
561
+ ⎿ ctx_purge: deleted 18 rows (scope: source). This cannot be undone.
562
+ ```
563
+
295
564
  Full reference: [Tools](https://contextmode.ai/docs/engine/tools?utm_source=github&utm_medium=readme&utm_content=tools).
296
565
 
297
566
  Commands in the agent: `/ctx-stats` shows the `ctx_stats` result, `/ctx-doctor` runs `ctx_doctor` (send its report with a defect report), and `/ctx-upgrade` runs `ctx_upgrade`, then `ctx_doctor`.
298
567
 
299
568
  ## Security and privacy
300
569
 
301
- - The plugin keeps all its data on your machine, in `~/.context-mode`: one `context.db` per project. `ctx_purge` deletes it by session, source or project. Read the [Security guide](https://contextmode.ai/docs/engine/security?utm_source=github&utm_medium=readme&utm_content=security).
302
- - The plugin has zero telemetry: usage data, events and crash reports stay on your machine. It uses the network at these call sites, each one started by you or your agent:
303
- - `ctx_index` of a URL the agent asks for: `src/core/sandbox/fetch.ts`. It blocks private and link-local addresses, checks each address the host name points to, connects to the address it checked, and checks again at each redirect.
304
- - `context-mode doctor`: one read of the npm dist-tags of `context-mode`, with `git ls-remote` of the release tags as the fallback when npm is down, to check for a new version (`src/core/ops/doctor-env.ts`).
305
- - `ctx_upgrade`: `git clone --depth 1` of the release branch (`src/core/ops/release-fetch.ts`). `context-mode upgrade`: `npm i -g context-mode@next` (`src/cli/commands.ts`).
306
- - The debug report: `gh issue create`, after you press a key (`src/cli/commands.ts`).
307
- - Install and update: your agent's own install command, npm or git.
308
- - The guard test D-PRIVACY-NET-1 in `tests/0008-enforcement.test.mjs` scans `src` for HTTP clients, sockets, DNS lookups, git network calls and `gh` or `npm` spawns. It fails when a new call site appears outside this list, so this section stays true.
570
+ - The plugin keeps all its data on your machine, one database per project in `~/.context-mode`, and `ctx_purge` deletes it by session, source or project. Read the [Security guide](https://contextmode.ai/docs/engine/security?utm_source=github&utm_medium=readme&utm_content=security).
571
+ - The plugin has zero telemetry: usage data, events and crash reports stay on your machine. It uses the network for five calls, each one started by you or your agent:
572
+
573
+ | Call | When | File |
574
+ |---|---|---|
575
+ | Fetch of a URL, for `ctx_index` | Your agent asks for a page. The fetch blocks private and link-local addresses, checks each address the host name points to, connects to the address it checked, and checks again at each redirect. | [fetch.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/sandbox/fetch.ts) |
576
+ | One read of the npm dist-tags, with `git ls-remote` of the release tags as the fallback | You run `context-mode doctor`, to check for a new version | [doctor-env.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/ops/doctor-env.ts) |
577
+ | `git clone --depth 1` of the release branch | You run `ctx_upgrade` | [release-fetch.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/core/ops/release-fetch.ts) |
578
+ | `npm i -g context-mode@next`, or `gh issue create` | You run `context-mode upgrade`, or you press a key to send the debug report | [commands.ts](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/src/cli/commands.ts) |
579
+ | Your agent's own install command, npm or git | You install or update | Your agent |
580
+
581
+ - The guard test D-PRIVACY-NET-1 in [tests/0008-enforcement.test.mjs](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/tests/0008-enforcement.test.mjs) scans the source for HTTP clients, sockets, DNS lookups, git network calls and gh or npm spawns. It flags each new call site, so this table stays true.
309
582
  - Doctor and the debug report remove secrets by their structure before they print.
310
583
 
311
- Here "sandbox" means the output stays in the sandbox, out of the context. 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.
584
+ Code from `ctx_execute` runs on your host as your user, with your files, your network and your environment except the preload variables, so keep your agent's own permission prompts on. Here "sandbox" means the output stays in the sandbox and out of the context.
585
+ What the plugin stores, where, and how to delete it: [Privacy](https://contextmode.ai/docs/engine/privacy?utm_source=github&utm_medium=readme&utm_content=privacy).
312
586
 
313
587
  ## Context Mode Gateway
314
588
 
315
589
  The plugin works on tool output, on your machine, and it is complete on its own. Context Mode Gateway is a separate hosted service with its own account and subscription. It works on every request, across all your agents. Its 11 features, the full list: Context Saving, Recall, Memory, Skills, Search, Session resume, Active Context, Instructions, Protect, Prompt caching, Live and Analytics.
316
- Teams add it for long sessions, shared memory and cost reports. The two work together.
590
+ Add the Gateway when you want savings on every request, memory across sessions and agents, or cost reports for a team. For one project on one machine, the plugin covers the job. The two work together: [Gateway guide](https://contextmode.ai/docs/engine/gateway?utm_source=github&utm_medium=readme&utm_content=gateway).
317
591
  Gateway Recall, Search and Session resume run on the Gateway server, across sessions and agents. The plugin's `ctx_search` and `ctx_resume` read the local `context.db` of one project.
318
592
  With the Gateway on, your requests pass through its server; the plugin keeps its own data on your machine.
319
593
 
@@ -322,16 +596,25 @@ With the Gateway on, your requests pass through its server; the plugin keeps its
322
596
  | Context Mode plugin | On your machine | One project, local `context.db` | Free |
323
597
  | Context Mode Gateway | Hosted service | All sessions and agents | Subscription, separate from the plugin |
324
598
 
325
- <a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/docs/assets/readme/gateway/live.mp4"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/gateway/live.webp" width="100%" alt="Gateway Live screen during a session: money saved, bytes kept out per request, history kept and sent, and a feed of each request with its cost and saving"></a>
599
+ Set up the Gateway with one command:
600
+
601
+ ```sh
602
+ npx @context-mode/cli
603
+ ```
604
+
605
+ `npx @context-mode/cli` signs you in to your Gateway account, which has its own subscription, and writes one config change per agent.
606
+ Apps: Claude Code, Claude Desktop, Codex, Codex Desktop, T3 Code, OpenCode and Pi. The Gateway CLI needs Node 20.12 or later, from its npm engines field.
607
+
608
+ <a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/assets/readme/gateway/live.mp4"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/gateway/live.webp" width="100%" alt="Gateway Live screen during a session: money saved, bytes kept out per request, history kept and sent, and a feed of each request with its cost and saving"></a>
326
609
 
327
610
  **Live.** One session as it runs: money saved this session, bytes kept out per request, history kept and sent, and a feed of each request with its cost and saving. Click the image for the full video.
328
611
 
329
612
  Docs: [How saving works](https://contextmode.ai/docs/how-saving-works?utm_source=github&utm_medium=readme&utm_content=live)
330
613
 
331
614
  <table>
332
- <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/docs/assets/readme/gateway/overview.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/gateway/overview-1200.webp" alt="Gateway Overview: money saved, AI spend, prompt-cache discount and cost per request over 30 days"></a><br><b>Overview.</b> Your spend and what the Gateway saved, per day, in one view.<br>Docs: <a href="https://contextmode.ai/docs/how-saving-works?utm_source=github&utm_medium=readme&utm_content=overview">How saving works</a></td><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/docs/assets/readme/gateway/analytics.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/gateway/analytics-1200.webp" alt="Gateway Analytics: saved money over time, split by source"></a><br><b>Analytics.</b> Where each saving comes from: hidden tools, archived old results, large outputs kept in the archive and trimmed context.<br>Docs: <a href="https://contextmode.ai/docs/how-saving-works?utm_source=github&utm_medium=readme&utm_content=analytics">How saving works</a></td></tr>
333
- <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/docs/assets/readme/gateway/spend.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/gateway/spend-1200.webp" alt="Gateway Spend: spend per day by model, cost per request and cache hit rate"></a><br><b>Spend.</b> Spend per day and per model, cost per request and the cache hit rate, to help you plan a budget.<br>Docs: <a href="https://contextmode.ai/docs/prompt-caching?utm_source=github&utm_medium=readme&utm_content=spend">Prompt caching</a></td><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/docs/assets/readme/gateway/memory.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/gateway/memory-top-1200.webp" alt="Gateway Memory: money saved by Recall and searches per day"></a><br><b>Memory.</b> Facts and decisions carry across sessions and agents. The screen shows what Recall saved and how many searches found an answer.<br>Docs: <a href="https://contextmode.ai/docs/memory?utm_source=github&utm_medium=readme&utm_content=memory">Memory</a></td></tr>
334
- <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/docs/assets/readme/gateway/skills.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/gateway/skills-1200.webp" alt="Gateway Skills: import from GitHub and the list of installed skills"></a><br><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.<br>Docs: <a href="https://contextmode.ai/docs/skills?utm_source=github&utm_medium=readme&utm_content=skills">Skills</a></td><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.33/docs/assets/readme/gateway/protect.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.33/docs/assets/readme/gateway/protect-1200.webp" alt="Gateway Protect: a new command rule that blocks terraform destroy"></a><br><b>Protect.</b> Rules that check each shell command before it runs. Here, a rule that stops <code>terraform destroy</code>.<br>Docs: <a href="https://contextmode.ai/docs/protect?utm_source=github&utm_medium=readme&utm_content=protect">Protect</a></td></tr>
615
+ <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/assets/readme/gateway/overview.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/gateway/overview-1200.webp" alt="Gateway Overview: money saved, AI spend, prompt-cache discount and cost per request over 30 days"></a><br><b>Overview.</b> Your spend and what the Gateway saved, per day, in one view.<br>Docs: <a href="https://contextmode.ai/docs/how-saving-works?utm_source=github&utm_medium=readme&utm_content=overview">How saving works</a></td><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/assets/readme/gateway/analytics.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/gateway/analytics-1200.webp" alt="Gateway Analytics: saved money over time, split by source"></a><br><b>Analytics.</b> Where each saving comes from: hidden tools, archived old results, large outputs kept in the archive and trimmed context.<br>Docs: <a href="https://contextmode.ai/docs/how-saving-works?utm_source=github&utm_medium=readme&utm_content=analytics">How saving works</a></td></tr>
616
+ <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/assets/readme/gateway/spend.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/gateway/spend-1200.webp" alt="Gateway Spend: spend per day by model, cost per request and cache hit rate"></a><br><b>Spend.</b> Spend per day and per model, cost per request and the cache hit rate, to help you plan a budget.<br>Docs: <a href="https://contextmode.ai/docs/prompt-caching?utm_source=github&utm_medium=readme&utm_content=spend">Prompt caching</a></td><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/assets/readme/gateway/memory.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/gateway/memory-top-1200.webp" alt="Gateway Memory: money saved by Recall and searches per day"></a><br><b>Memory.</b> Facts and decisions carry across sessions and agents. The screen shows what Recall saved and how many searches found an answer.<br>Docs: <a href="https://contextmode.ai/docs/memory?utm_source=github&utm_medium=readme&utm_content=memory">Memory</a></td></tr>
617
+ <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/assets/readme/gateway/skills.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/gateway/skills-1200.webp" alt="Gateway Skills: import from GitHub and the list of installed skills"></a><br><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.<br>Docs: <a href="https://contextmode.ai/docs/skills?utm_source=github&utm_medium=readme&utm_content=skills">Skills</a></td><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/docs/assets/readme/gateway/protect.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.37/docs/assets/readme/gateway/protect-1200.webp" alt="Gateway Protect: a new command rule that blocks terraform destroy"></a><br><b>Protect.</b> Rules that check each shell command before it runs. Here, a rule that stops <code>terraform destroy</code>.<br>Docs: <a href="https://contextmode.ai/docs/protect?utm_source=github&utm_medium=readme&utm_content=protect">Protect</a></td></tr>
335
618
  </table>
336
619
 
337
620
  Numbers in these screens 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.
@@ -371,14 +654,12 @@ Source: [contextmode.ai/docs](https://contextmode.ai/docs/how-saving-works?utm_s
371
654
 
372
655
  </details>
373
656
 
374
- Gateway cost against Claude Code alone, Claude Opus 5.5, mean dollars per session at list price:
657
+ Gateway only: its cost against Claude Code alone, Claude Opus 5.5, mean dollars per session at list price. The plugin numbers are in [Benchmarks](#benchmarks).
375
658
 
376
659
  - Six short tasks (2026-09-29): 24.5% fewer dollars pooled over 176 sessions (21% to 29% per task). [v3-opus55-short.json](https://contextmode.ai/benchmarks/data/v3-opus55-short.json?utm_source=github&utm_medium=readme&utm_content=bench)
377
660
  - Long Claude Code session, 200K window (2026-10-03/04): mean cost per session $4.8627 to $3.0353 (-37.6% in dollars, mean of 3 pairs). [ab.json](https://contextmode.ai/benchmarks/recall/200k-r2/ab.json?utm_source=github&utm_medium=readme&utm_content=bench)
378
661
  - We fixed the rules before each run: [contextmode.ai/docs/benchmarks](https://contextmode.ai/docs/benchmarks?utm_source=github&utm_medium=readme&utm_content=bench).
379
662
 
380
- Apps: Claude Code, Claude Desktop, Codex, Codex Desktop, T3 Code, OpenCode and Pi.
381
- Setup is one command, `npx @context-mode/cli`. It signs you in to your Gateway account, which has its own subscription, and writes one config change per agent (the Gateway CLI needs Node 20.12 or later, from its npm `engines` field; the plugin needs Node 24.15.0).
382
663
  The Gateway routes to Anthropic and OpenAI. The Gateway sends your requests to its server on the way to the model. It keeps a searchable record of your sessions for Recall and Search, and masks secrets and e-mail addresses when it reads archived output back. Its privacy page is at [contextmode.ai/privacy](https://contextmode.ai/privacy?utm_source=github&utm_medium=readme&utm_content=privacy).
383
664
  Keep your agent's own sandbox on next to Protect.
384
665
 
@@ -395,6 +676,6 @@ We chose ELv2 so the source stays open to all and the hosted service stays with
395
676
 
396
677
  ## Community
397
678
 
398
- Report a defect on [Discord](https://discord.gg/DCN9jUgN5v) with the full `/ctx-doctor` report, and send ideas there too. The maintainer writes every change.
679
+ Report a defect on [Discord](https://discord.gg/DCN9jUgN5v) with the full `/ctx-doctor` report, and send ideas there too. The maintainer writes every change; [CONTRIBUTING.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.37/CONTRIBUTING.md) shows how an agent files an issue.
399
680
 
400
681
  **Videos.** [Better Stack on Context Mode](https://www.youtube.com/watch?v=QUHrntlfPo4). Make your own video and share it on [Discord](https://discord.gg/DCN9jUgN5v); we add videos over 10K views here.