context-mode 2.0.0-next.24 → 2.0.0-next.25
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +41 -41
- package/SHA256SUMS +15 -15
- package/cli.mjs +23 -14
- package/copilot/plugin.json +1 -1
- package/gemini-extension.json +1 -1
- package/hook.mjs +60 -60
- package/opencode/plugin.js +259 -112
- package/package.json +1 -1
- package/pi/index.js +290 -143
- package/qwen-extension.json +1 -1
- package/run.mjs +24 -22
- package/search.mjs +24 -22
- package/server.mjs +257 -127
package/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
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
|
-
[](https://www.npmjs.com/package/context-mode) [](https://github.com/mksglu/context-mode) [](https://news.ycombinator.com/item?id=47193064) [](https://github.com/uibm/trending-watcher/issues?q=%22mksglu%2Fcontext-mode%22) [](https://discord.gg/DCN9jUgN5v) [](https://github.com/mksglu/context-mode/blob/v2.0.0-next.
|
|
5
|
+
[](https://www.npmjs.com/package/context-mode) [](https://github.com/mksglu/context-mode) [](https://news.ycombinator.com/item?id=47193064) [](https://github.com/uibm/trending-watcher/issues?q=%22mksglu%2Fcontext-mode%22) [](https://discord.gg/DCN9jUgN5v) [](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/LICENSE)
|
|
6
6
|
|
|
7
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)
|
|
8
8
|
|
|
9
9
|
<picture>
|
|
10
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.
|
|
11
|
-
<img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.
|
|
10
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/docs/assets/readme/hero-dark.png">
|
|
11
|
+
<img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/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).">
|
|
12
12
|
</picture>
|
|
13
13
|
|
|
14
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.
|
|
@@ -62,13 +62,13 @@ Each tool result goes into the context window whole. Table 1 lists real outputs
|
|
|
62
62
|
| Docs page through WebFetch | 215,354 B | 435 B | 99.8% |
|
|
63
63
|
|
|
64
64
|
Rule for every headline number in this paper: rows with 10 KB or more of raw output, median per category.
|
|
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.
|
|
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.25/bench/results/2026-10-31-darwin-arm64.md).
|
|
66
66
|
|
|
67
67
|
## 2. Results
|
|
68
68
|
|
|
69
69
|
<picture>
|
|
70
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.
|
|
71
|
-
<img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.
|
|
70
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/docs/assets/readme/fig-saving-dark.png">
|
|
71
|
+
<img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/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%.">
|
|
72
72
|
</picture>
|
|
73
73
|
|
|
74
74
|
**Figure 2.** Median bytes saved per category, rows of 10 KB or more.
|
|
@@ -84,7 +84,7 @@ The full results file has [every row, including small outputs, where the cut is
|
|
|
84
84
|
| g. Session total | One full scripted session | 1 | 98.8% |
|
|
85
85
|
|
|
86
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.
|
|
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.
|
|
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.25/bench/README.md), [bench/evidence/](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/bench/evidence/README.md).
|
|
88
88
|
The plugin numbers are bytes; the dollar numbers come from the Gateway runs in section 8.
|
|
89
89
|
|
|
90
90
|
### 2.1 Case studies
|
|
@@ -104,17 +104,17 @@ Result: cost fell from $4.86 to $3.04 (2026-10-04) (-37.6%). 3 of 3 pairs passed
|
|
|
104
104
|
### 2.2 Longer sessions
|
|
105
105
|
|
|
106
106
|
<picture>
|
|
107
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.
|
|
108
|
-
<img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.
|
|
107
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/docs/assets/readme/fig-oss-dark.png">
|
|
108
|
+
<img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/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.">
|
|
109
109
|
</picture>
|
|
110
110
|
|
|
111
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.
|
|
112
112
|
|
|
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.
|
|
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.25/bench/results/2026-10-31-darwin-arm64.json):
|
|
114
114
|
|
|
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.
|
|
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.
|
|
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.
|
|
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.25/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.25/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.25/bench/d-externalize/README.md#d-synth-1m).
|
|
118
118
|
|
|
119
119
|
## Install
|
|
120
120
|
|
|
@@ -133,7 +133,7 @@ Until v2 is on `main`, `main` holds the old build (1.0.169), so the four GitHub-
|
|
|
133
133
|
|
|
134
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`
|
|
135
135
|
|
|
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.
|
|
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.25/docs/install/claude-code.md#already-installed-from-github), [Codex](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/install/codex.md#already-installed-from-github), [Gemini CLI](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/install/gemini.md#already-installed-from-github) and [Qwen Code](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/install/qwen.md#already-installed-from-github).
|
|
137
137
|
|
|
138
138
|
Copilot CLI, Kiro, VS Code and ZCode install through npm, which works for every agent:
|
|
139
139
|
|
|
@@ -145,30 +145,30 @@ context-mode setup
|
|
|
145
145
|
`next` is the v2 prerelease tag on npm. `latest` points to the old release, so add `@next` to get v2.
|
|
146
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.
|
|
147
147
|
`context-mode setup` is the fallback and the repair. It shows a plan, applies it, and rolls back an agent that fails.
|
|
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.
|
|
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.25/docs/install/README.md).
|
|
149
149
|
|
|
150
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.
|
|
151
151
|
|
|
152
152
|
<!-- agents:install:start (node build/readme-agents.mjs --write) -->
|
|
153
153
|
| Agent | Hooks | MCP | Skills | Install | Guide |
|
|
154
154
|
|---|---|---|---|---|---|
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.25/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.25/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.25/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.25/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.25/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.25/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.25/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.25/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.25/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.25/docs/install/zcode.md#install) |
|
|
165
165
|
<!-- agents:install:end -->
|
|
166
166
|
|
|
167
167
|
## 3. How it works
|
|
168
168
|
|
|
169
169
|
<picture>
|
|
170
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.
|
|
171
|
-
<img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.
|
|
170
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/docs/assets/readme/fig-flow-dark.png">
|
|
171
|
+
<img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/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.">
|
|
172
172
|
</picture>
|
|
173
173
|
|
|
174
174
|
**Figure 4.** One tool call, step by step. Output stays in the sandbox and the index; the agent gets the answer.
|
|
@@ -226,7 +226,7 @@ The database runs in WAL mode. On close it always runs a PASSIVE checkpoint. Con
|
|
|
226
226
|
| `ctx_upgrade` | Installs, upgrades or uninstalls; replaces old context-mode entries |
|
|
227
227
|
| `ctx_purge` | Deletes indexed data by session, source or project |
|
|
228
228
|
|
|
229
|
-
Full reference: [docs/tools.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.
|
|
229
|
+
Full reference: [docs/tools.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/tools.md).
|
|
230
230
|
|
|
231
231
|
## Commands
|
|
232
232
|
|
|
@@ -243,7 +243,7 @@ Hooks reach each agent in one of three ways: in the plugin package (Claude Code,
|
|
|
243
243
|
|
|
244
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
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.
|
|
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.25/docs/architecture/release/HOOKS-FIRE.md).
|
|
247
247
|
|
|
248
248
|
## 6. Performance
|
|
249
249
|
|
|
@@ -255,7 +255,7 @@ CI runs setup, doctor, a hook and an MCP handshake for all 10 agents from the pa
|
|
|
255
255
|
| `ctx_search`, 20 queries over 8 indexed files | 1.73 ms median, 6.54 ms max |
|
|
256
256
|
| `ctx_index`, 3 real files, 0.6 MB | 155 ms per MB |
|
|
257
257
|
|
|
258
|
-
Rows per agent and per query: [docs/performance.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.
|
|
258
|
+
Rows per agent and per query: [docs/performance.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/performance.md).
|
|
259
259
|
|
|
260
260
|
## 7. Security model
|
|
261
261
|
|
|
@@ -273,34 +273,34 @@ Code from `ctx_execute` runs on your host as your user, with your environment (m
|
|
|
273
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
274
|
Teams add it for long sessions, shared memory and cost reports. The two work together.
|
|
275
275
|
|
|
276
|
-
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.
|
|
276
|
+
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/assets/readme/gateway/overview.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/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
277
|
|
|
278
278
|
**Overview.** What you paid and what the Gateway saved, per day, in one view.
|
|
279
279
|
|
|
280
280
|
<table>
|
|
281
281
|
<tr>
|
|
282
282
|
<td width="50%" valign="top">
|
|
283
|
-
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.
|
|
283
|
+
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/assets/readme/gateway/analytics.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/docs/assets/readme/gateway/analytics-1200.webp" alt="Gateway Analytics: saved money over time, split by source" width="100%"></a><br>
|
|
284
284
|
<b>Analytics.</b> Where each saving comes from: hidden tools, archived old results, large outputs kept in the archive and trimmed context.
|
|
285
285
|
</td>
|
|
286
286
|
<td width="50%" valign="top">
|
|
287
|
-
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.
|
|
287
|
+
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/assets/readme/gateway/spend.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/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
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
289
|
</td>
|
|
290
290
|
</tr>
|
|
291
291
|
<tr>
|
|
292
292
|
<td width="50%" valign="top">
|
|
293
|
-
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.
|
|
293
|
+
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/assets/readme/gateway/memory.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/docs/assets/readme/gateway/memory-top-1200.webp" alt="Gateway Memory: money saved by Recall and searches per day" width="100%"></a><br>
|
|
294
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
295
|
</td>
|
|
296
296
|
<td width="50%" valign="top">
|
|
297
|
-
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.
|
|
297
|
+
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/assets/readme/gateway/skills.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/docs/assets/readme/gateway/skills-1200.webp" alt="Gateway Skills: import from GitHub and the list of installed skills" width="100%"></a><br>
|
|
298
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
299
|
</td>
|
|
300
300
|
</tr>
|
|
301
301
|
<tr>
|
|
302
302
|
<td colspan="2" align="center">
|
|
303
|
-
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.
|
|
303
|
+
<a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/assets/readme/gateway/protect.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/docs/assets/readme/gateway/protect-1200.webp" alt="Gateway Protect: a new command rule that blocks terraform destroy" width="50%"></a><br>
|
|
304
304
|
<b>Protect.</b> Rules that check each shell command before it runs. Here, a rule that stops <code>terraform destroy</code>.
|
|
305
305
|
</td>
|
|
306
306
|
</tr>
|
|
@@ -341,20 +341,20 @@ More at [contextmode.ai](https://contextmode.ai).
|
|
|
341
341
|
## 9. Adoption
|
|
342
342
|
|
|
343
343
|
<picture>
|
|
344
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.
|
|
345
|
-
<img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.
|
|
344
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/docs/assets/readme/star-history-dark.png">
|
|
345
|
+
<img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.25/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.">
|
|
346
346
|
</picture>
|
|
347
347
|
|
|
348
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.
|
|
349
349
|
|
|
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.
|
|
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.25/stats.json)). We have no count for plugin marketplace installs.
|
|
351
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)).
|
|
352
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)).
|
|
353
353
|
- **Companies.** Engineers at the companies under Figure 1 starred the repo.
|
|
354
354
|
|
|
355
355
|
## License
|
|
356
356
|
|
|
357
|
-
[Elastic License 2.0](https://github.com/mksglu/context-mode/blob/v2.0.0-next.
|
|
357
|
+
[Elastic License 2.0](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/LICENSE) (ELv2), source-available. You may use, copy, change and share the code, and use it at work.
|
|
358
358
|
The license keeps two uses for the licensor:
|
|
359
359
|
|
|
360
360
|
1. Offering it to others as a hosted or managed service.
|
|
@@ -367,4 +367,4 @@ We chose ELv2 so the source stays open to all and the hosted service stays with
|
|
|
367
367
|
Report a defect on [Discord](https://discord.gg/DCN9jUgN5v) with the full `/ctx-doctor` report.
|
|
368
368
|
Fixes go into v2. The maintainer writes every change; send ideas and defect reports on Discord.
|
|
369
369
|
|
|
370
|
-
Docs: [docs/install/README.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.
|
|
370
|
+
Docs: [docs/install/README.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/install/README.md) (install, options, uninstall), [docs/how-it-works.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/how-it-works.md), [docs/algorithms.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/algorithms.md) (search, ranking, size limits, deny rules), [docs/tools.md](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/docs/tools.md), [bench/evidence/](https://github.com/mksglu/context-mode/blob/v2.0.0-next.25/bench/evidence/README.md).
|
package/SHA256SUMS
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
19634af32c38fe3240faa244ff5528ab5b48b7eb216996fac7ddf613ef94c7a5 .claude-plugin/marketplace.json
|
|
2
|
+
301a8b854b699e4a230523f262747d3868a3f23d073bdcbca885c7cdc0ee7c1d .claude-plugin/plugin.json
|
|
3
3
|
187503e1455560d4ab5a72e3b8cd2f274abd4ccc5faa60dd66c37e44bb5f10c2 .codex-plugin/hooks.json
|
|
4
4
|
4edea851775bc3f0418f8d9cf6ead74f2767c3a9e3b8c05749eacb78ebb3b896 .codex-plugin/mcp.json
|
|
5
|
-
|
|
5
|
+
f249a7fefe76290647958ebae6dba98789d33f5025f4d239ef246f521a0fc915 .codex-plugin/plugin.json
|
|
6
6
|
92f11a867c41c9e575ccb978ff205ae2011c244a14aa3c576e914e537105caa0 LICENSE
|
|
7
|
-
|
|
7
|
+
19b375be1dd98dd6325c7d0c24de2c68fd8d71b8d9e3872b2f9ddd3676fc891d 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
|
-
|
|
11
|
+
25e83a0ce0ecba92641d9b91a41a316aedcb035cd4f752747cbce328290c9448 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
|
-
|
|
15
|
+
71f32768a75a71e12b67710be3f40dff63e6011a48c1e3bd614cd0c4b79c5344 copilot/plugin.json
|
|
16
16
|
e3bc6cae0bd51b806d81631879711bbc48c679fc929b2642ed4634438364167d fixtures/hook-roundtrip.json
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
79f687614cbddfdbe16ead7634adb3b7ba2e83f15d835e061d5eff3791e0d3d4 gemini-extension.json
|
|
18
|
+
7a9b99aaea8d220cc20bead47ea161008bedade54bd0f809f0e9206d485e7646 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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
b75cf3cc1426da4e7ad29dfc8a6037f432c07771b7942bd0e3188c265698614f opencode/plugin.js
|
|
28
|
+
41f5b88ea44b60839d258e04f8b7b10a0f878a58711e3bd1307ab205eadab7e5 package.json
|
|
29
|
+
4fec69ec47e96057a836304cee18ee043e9832c5d9a64f491c4248c0777eb5ee 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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
d899d085d9e1b122cf004f5ae3f44e29644f34d7df2d218bfb2c15730bc92d25 qwen-extension.json
|
|
34
|
+
cd2c35d662911b5147d1540c9549172393c8ced94239bb1fdc959424f2160b6b run.mjs
|
|
35
|
+
cd2c35d662911b5147d1540c9549172393c8ced94239bb1fdc959424f2160b6b search.mjs
|
|
36
|
+
2946a555ee90f13ef3496eaa92af01b0c118e047e3ef753833253a40744276eb 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
|
package/cli.mjs
CHANGED
|
@@ -242,6 +242,8 @@ var NODE_MIN = "24.15.0";
|
|
|
242
242
|
var DATA_ROOT = "~/.context-mode";
|
|
243
243
|
var HOST_PLUGINS_DIR_NAME = "plugins";
|
|
244
244
|
var INSTALLED_PLUGINS_FILE = "installed_plugins.json";
|
|
245
|
+
var PROJECT_PLUGIN_SCOPES = Object.freeze(["local", "project"]);
|
|
246
|
+
var PLUGIN_SCOPE_RANK = Object.freeze({ local: 0, project: 1, user: 2, managed: 2 });
|
|
245
247
|
var MCP_HINT_EVERY_DEFAULT = 10;
|
|
246
248
|
function readHintEvery(raw) {
|
|
247
249
|
if (raw === void 0 || raw.trim() === "") return MCP_HINT_EVERY_DEFAULT;
|
|
@@ -4418,7 +4420,7 @@ ${i2}
|
|
|
4418
4420
|
}).prompt();
|
|
4419
4421
|
|
|
4420
4422
|
// src/core/project/config-dir.ts
|
|
4421
|
-
import { join as join2, posix, win32 } from "node:path";
|
|
4423
|
+
import { basename, dirname as dirname2, join as join2, posix, resolve, win32 } from "node:path";
|
|
4422
4424
|
|
|
4423
4425
|
// src/core/contracts/errors.ts
|
|
4424
4426
|
var ERROR_TEXT = Object.freeze({
|
|
@@ -4554,7 +4556,7 @@ import path3 from "node:path";
|
|
|
4554
4556
|
|
|
4555
4557
|
// src/core/ops/host-config.ts
|
|
4556
4558
|
import { existsSync as existsSync2, readFileSync } from "node:fs";
|
|
4557
|
-
import { dirname as
|
|
4559
|
+
import { dirname as dirname3, join as join3 } from "node:path";
|
|
4558
4560
|
|
|
4559
4561
|
// node_modules/eslint-visitor-keys/lib/visitor-keys.js
|
|
4560
4562
|
var KEYS2 = {
|
|
@@ -7371,7 +7373,7 @@ function detectV1(agent, home, scope = {}) {
|
|
|
7371
7373
|
|
|
7372
7374
|
// src/core/ops/plugin-root.ts
|
|
7373
7375
|
import { existsSync as existsSync4, readdirSync as readdirSync3, readFileSync as readFileSync3, realpathSync as realpathSync2 } from "node:fs";
|
|
7374
|
-
import { dirname as
|
|
7376
|
+
import { dirname as dirname4, isAbsolute, join as join5, sep } from "node:path";
|
|
7375
7377
|
import { fileURLToPath } from "node:url";
|
|
7376
7378
|
|
|
7377
7379
|
// src/core/ops/doctor-config.ts
|
|
@@ -8155,7 +8157,7 @@ function askCodexHome(env) {
|
|
|
8155
8157
|
}
|
|
8156
8158
|
return void 0;
|
|
8157
8159
|
}
|
|
8158
|
-
function sameDir(a2, b3, platform) {
|
|
8160
|
+
function sameDir(a2, b3, platform = process.platform) {
|
|
8159
8161
|
if (platform !== "win32") return path10.posix.normalize(a2) === path10.posix.normalize(b3);
|
|
8160
8162
|
const norm = (p3) => {
|
|
8161
8163
|
const bare = p3.startsWith(WIN_VERBATIM_PREFIX) ? p3.slice(WIN_VERBATIM_PREFIX.length) : p3;
|
|
@@ -8206,15 +8208,21 @@ function pluginHooksFromReply(m3, pluginId) {
|
|
|
8206
8208
|
}
|
|
8207
8209
|
return out2;
|
|
8208
8210
|
}
|
|
8209
|
-
function listPluginHooks(env, pluginId, cwd) {
|
|
8211
|
+
async function listPluginHooks(env, pluginId, cwd) {
|
|
8212
|
+
const r2 = await askPluginHooks(env, pluginId, cwd);
|
|
8213
|
+
return r2.kind === "list" ? r2.hooks : void 0;
|
|
8214
|
+
}
|
|
8215
|
+
function askPluginHooks(env, pluginId, cwd) {
|
|
8210
8216
|
const bin = whichBin("codex", env);
|
|
8211
|
-
if (!bin) return Promise.resolve(
|
|
8212
|
-
return new Promise((
|
|
8217
|
+
if (!bin) return Promise.resolve({ kind: "absent" });
|
|
8218
|
+
return new Promise((resolve2) => {
|
|
8219
|
+
let asked;
|
|
8220
|
+
const done_ = (hooks) => hooks === void 0 ? { kind: "silent" } : { kind: "list", hooks, codexHome: asked };
|
|
8213
8221
|
let f2;
|
|
8214
8222
|
try {
|
|
8215
8223
|
f2 = spawnForm(bin, ["app-server"], env);
|
|
8216
8224
|
} catch {
|
|
8217
|
-
|
|
8225
|
+
resolve2({ kind: "silent" });
|
|
8218
8226
|
return;
|
|
8219
8227
|
}
|
|
8220
8228
|
const child = spawn(f2.command, f2.args, { env, cwd, stdio: ["pipe", "pipe", "ignore"], windowsVerbatimArguments: f2.windowsVerbatimArguments, windowsHide: true });
|
|
@@ -8224,7 +8232,7 @@ function listPluginHooks(env, pluginId, cwd) {
|
|
|
8224
8232
|
let result;
|
|
8225
8233
|
const settle = () => {
|
|
8226
8234
|
clearTimeout(grace);
|
|
8227
|
-
|
|
8235
|
+
resolve2(done_(result));
|
|
8228
8236
|
};
|
|
8229
8237
|
let grace;
|
|
8230
8238
|
const finish2 = (v) => {
|
|
@@ -8269,6 +8277,7 @@ function listPluginHooks(env, pluginId, cwd) {
|
|
|
8269
8277
|
}
|
|
8270
8278
|
if (!isObj3(m3)) continue;
|
|
8271
8279
|
if (m3.id === 1) {
|
|
8280
|
+
asked = codexHomeFromReply(line);
|
|
8272
8281
|
send({ method: "initialized" });
|
|
8273
8282
|
send({ id: 2, method: "hooks/list", params: { cwds: [cwd] } });
|
|
8274
8283
|
} else if (m3.id === 2) finish2(pluginHooksFromReply(m3, pluginId));
|
|
@@ -8347,12 +8356,12 @@ function frame(buf) {
|
|
|
8347
8356
|
function listCopilotHooks(env, file, cwd) {
|
|
8348
8357
|
const bin = whichBin("copilot", env);
|
|
8349
8358
|
if (!bin) return Promise.resolve(void 0);
|
|
8350
|
-
return new Promise((
|
|
8359
|
+
return new Promise((resolve2) => {
|
|
8351
8360
|
let f2;
|
|
8352
8361
|
try {
|
|
8353
8362
|
f2 = spawnForm(bin, ["--server", "--stdio", "--no-auto-update"], env);
|
|
8354
8363
|
} catch {
|
|
8355
|
-
|
|
8364
|
+
resolve2(void 0);
|
|
8356
8365
|
return;
|
|
8357
8366
|
}
|
|
8358
8367
|
const child = spawn2(f2.command, f2.args, { env, cwd, stdio: ["pipe", "pipe", "ignore"], windowsVerbatimArguments: f2.windowsVerbatimArguments, windowsHide: true });
|
|
@@ -8364,7 +8373,7 @@ function listCopilotHooks(env, file, cwd) {
|
|
|
8364
8373
|
clearTimeout(timer);
|
|
8365
8374
|
child.stdin.destroy();
|
|
8366
8375
|
child.kill();
|
|
8367
|
-
|
|
8376
|
+
resolve2(v);
|
|
8368
8377
|
};
|
|
8369
8378
|
const timer = setTimeout(() => finish2(void 0), ASK_TIMEOUT_MS2);
|
|
8370
8379
|
child.on("error", () => finish2(void 0));
|
|
@@ -8873,7 +8882,7 @@ function copyCheck(row, pkgDir) {
|
|
|
8873
8882
|
return { name: "copy", ok: false, detail: `${c3.host} runs context-mode ${old}, the installed package is ${pkg}; run ${c3.bin} ${c3.refresh.join(" ")}` };
|
|
8874
8883
|
}
|
|
8875
8884
|
function mcpCheck(cmd, env) {
|
|
8876
|
-
return new Promise((
|
|
8885
|
+
return new Promise((resolve2) => {
|
|
8877
8886
|
const child = spawn3(cmd[0], cmd.slice(1), { env, stdio: ["pipe", "pipe", "ignore"], detached: process.platform !== "win32", windowsHide: true });
|
|
8878
8887
|
const reap = () => {
|
|
8879
8888
|
child.kill();
|
|
@@ -8885,7 +8894,7 @@ function mcpCheck(cmd, env) {
|
|
|
8885
8894
|
clearTimeout(timer);
|
|
8886
8895
|
process.off("exit", reap);
|
|
8887
8896
|
child.kill();
|
|
8888
|
-
|
|
8897
|
+
resolve2({ name: "mcp", ok, detail });
|
|
8889
8898
|
};
|
|
8890
8899
|
const timer = setTimeout(() => done(false, "no MCP answer before timeout"), VERIFY_TIMEOUT_MS);
|
|
8891
8900
|
child.on("error", (e) => done(false, e.message));
|
package/copilot/plugin.json
CHANGED
package/gemini-extension.json
CHANGED