context-mode 2.0.0-next.38 → 2.0.0-next.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@
9
9
  "name": "context-mode",
10
10
  "skills": "./claude-code/skills",
11
11
  "source": "./",
12
- "version": "2.0.0-next.38"
12
+ "version": "2.0.0-next.40"
13
13
  }
14
14
  ]
15
15
  }
@@ -13,5 +13,5 @@
13
13
  },
14
14
  "name": "context-mode",
15
15
  "skills": "./claude-code/skills",
16
- "version": "2.0.0-next.38"
16
+ "version": "2.0.0-next.40"
17
17
  }
@@ -8,5 +8,5 @@
8
8
  "mcpServers": "./.codex-plugin/mcp.json",
9
9
  "name": "context-mode",
10
10
  "skills": "./codex/skills/",
11
- "version": "2.0.0-next.38"
11
+ "version": "2.0.0-next.40"
12
12
  }
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.38/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.40/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.38/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.40/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.38/docs/assets/readme/hero-dark.png">
13
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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.40/docs/assets/readme/hero-dark.png">
13
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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)
@@ -31,8 +31,8 @@ The Context Mode plugin runs that work in a local sandbox, keeps the full output
31
31
  ## Adoption: stars and npm downloads
32
32
 
33
33
  <table><tr>
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.38/docs/assets/readme/star-history-dark.png"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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.38/docs/assets/readme/npm-downloads-dark.png"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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.40/docs/assets/readme/star-history-dark.png"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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.40/docs/assets/readme/npm-downloads-dark.png"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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>
36
36
  </tr></table>
37
37
 
38
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.
@@ -41,11 +41,11 @@ Open the [interactive chart](https://contextmode.ai/open-source/stats?utm_source
41
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)).
42
42
 
43
43
  <picture>
44
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/docs/assets/readme/stargazers-dark.png">
45
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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.40/docs/assets/readme/stargazers-dark.png">
45
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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.">
46
46
  </picture>
47
47
 
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.38/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.40/docs/assets/readme/data/stargazer-companies.json)).
49
49
 
50
50
  ## Install
51
51
 
@@ -53,7 +53,7 @@ Pick your agent: [Claude Code](#install-claude-code) · [Codex](#install-codex)
53
53
 
54
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.
55
55
 
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.38/package.json). On Windows, add Git for Windows: the shell tools run in Git Bash, and doctor checks for it.
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.40/package.json). On Windows, add Git for Windows: the shell tools run in Git Bash, and doctor checks for it.
57
57
  contextmode installs as the npm package and command `context-mode`.
58
58
  The npm commands use `@next`, the current 2.0 release tag; the plain package name gives the 1.x line.
59
59
  Claude Code, Codex, Gemini CLI and Qwen Code install from GitHub, and each of their commands names the release branch.
@@ -275,8 +275,8 @@ Every agent gets hooks, the MCP server and the plugin skills; the last line of e
275
275
  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.
276
276
  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.
277
277
  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.
278
- 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.38/docs/architecture/release/HOOKS-FIRE.md).
279
- Each agent uses its own install command, and [ADR-0023](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/docs/architecture/adr/ADR-0023-native-install.md) says why.
278
+ 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.40/docs/architecture/release/HOOKS-FIRE.md).
279
+ Each agent uses its own install command, and [ADR-0023](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/docs/architecture/adr/ADR-0023-native-install.md) says why.
280
280
 
281
281
  </details>
282
282
 
@@ -284,7 +284,7 @@ Your first task with the plugin, step by step: [First session](https://contextmo
284
284
 
285
285
  ## Try it
286
286
 
287
- 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.38/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
+ 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.40/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`.
288
288
  After a prompt, run the stats skill and read the report yourself ([See the saving](#see-the-saving)).
289
289
  ```text
290
290
  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.
@@ -342,28 +342,28 @@ Real tool output from public projects, run through Context Mode. Bench of 2026-1
342
342
 
343
343
  | What you do | Tool | Raw | Reaches the context | Saved |
344
344
  |---|---|---:|---:|---:|
345
- | [Read a browser page](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
346
- | [List 40 issues](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
347
- | [List 25 pull requests with checks](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
348
- | [Look up library docs](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
349
- | [Run 1,106 tests](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
350
- | [Lint a source folder](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
351
- | [Install a workspace](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
352
- | [Install packages](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
353
- | [Read container logs](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
354
- | [Plan 72 resources](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/bench/a-sandbox/README.md#a-terraform-plan) | Terraform `terraform plan`, [Thinking in Code](#thinking-in-code) | 34,081 B | 166 B | 99.5% |
355
- | [Read 300 commits with file stats](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
356
- | [Read an 89 KB source file](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
357
- | [Fetch a 265 KB docs page](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
358
- | [Fetch a 214 KB API reply](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/bench/f-hook-redirect/README.md#f-bash-curl-post) | curl in Bash, replaced after it runs | 219,175 B | 291 B | 99.9% |
359
- | [Print a 187 KB git log in Bash](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/bench/f-hook-redirect/README.md#f-bash-dump-post) | Bash, output replaced after it runs | 191,120 B | 204 B | 99.9% |
360
- | [Print the same git log through a host tool](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
361
- | [Print a 214 KB GitHub API reply through a host tool](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
362
- | [Read a 45 KB log file](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
363
- | [Read a 60 KB source file](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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% |
364
- | [Debug for a full session: 8 outputs, 3 searches](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/bench/g-overhead/README.md#g-session-total) | All hooks and tools | 281,261 B | 3,266 B | 98.8% |
365
-
366
- Source: [bench/results/2026-11-01-darwin-arm64.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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.38/bench/fixtures/data/SOURCE.md) names where each input comes from.
345
+ | [Read a browser page](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
346
+ | [List 40 issues](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
347
+ | [List 25 pull requests with checks](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
348
+ | [Look up library docs](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
349
+ | [Run 1,106 tests](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
350
+ | [Lint a source folder](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
351
+ | [Install a workspace](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
352
+ | [Install packages](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
353
+ | [Read container logs](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
354
+ | [Plan 72 resources](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/bench/a-sandbox/README.md#a-terraform-plan) | Terraform `terraform plan`, [Thinking in Code](#thinking-in-code) | 34,081 B | 166 B | 99.5% |
355
+ | [Read 300 commits with file stats](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
356
+ | [Read an 89 KB source file](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
357
+ | [Fetch a 265 KB docs page](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
358
+ | [Fetch a 214 KB API reply](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/bench/f-hook-redirect/README.md#f-bash-curl-post) | curl in Bash, replaced after it runs | 219,175 B | 291 B | 99.9% |
359
+ | [Print a 187 KB git log in Bash](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/bench/f-hook-redirect/README.md#f-bash-dump-post) | Bash, output replaced after it runs | 191,120 B | 204 B | 99.9% |
360
+ | [Print the same git log through a host tool](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
361
+ | [Print a 214 KB GitHub API reply through a host tool](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
362
+ | [Read a 45 KB log file](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
363
+ | [Read a 60 KB source file](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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% |
364
+ | [Debug for a full session: 8 outputs, 3 searches](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/bench/g-overhead/README.md#g-session-total) | All hooks and tools | 281,261 B | 3,266 B | 98.8% |
365
+
366
+ Source: [bench/results/2026-11-01-darwin-arm64.json](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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.40/bench/fixtures/data/SOURCE.md) names where each input comes from.
367
367
  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.
368
368
 
369
369
  The agent gets the part it asks for. The full output stays in the local index, and `ctx_search` reads it back.
@@ -375,8 +375,8 @@ Next, how the bench counts these bytes, in [Benchmarks](#benchmarks).
375
375
  ## Benchmarks
376
376
 
377
377
  <picture>
378
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/docs/assets/readme/fig-saving-dark.png">
379
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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%.">
378
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/docs/assets/readme/fig-saving-dark.png">
379
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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%.">
380
380
  </picture>
381
381
 
382
382
  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.
@@ -391,24 +391,24 @@ All 36 such rows, the six categories below: the plugin keeps a median of 99.4% o
391
391
  | f. Hook redirect | A big Read, curl or WebFetch sent to the sandbox | 7 | 99.8% |
392
392
  | g. Session total | One full scripted session | 1 | 98.8% |
393
393
 
394
- 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.38/bench/results/2026-11-01-darwin-arm64.md).
395
- 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.38/bench/README.md) lists each scenario and its options.
394
+ 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.40/bench/results/2026-11-01-darwin-arm64.md).
395
+ 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.40/bench/README.md) lists each scenario and its options.
396
396
  Method, data files and rerun steps: [Benchmarks guide](https://contextmode.ai/docs/engine/benchmarks?utm_source=github&utm_medium=readme&utm_content=benchmarks).
397
397
 
398
398
  ### Longer sessions
399
399
 
400
400
  <picture>
401
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/docs/assets/readme/fig-oss-dark.png">
402
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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.">
401
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/docs/assets/readme/fig-oss-dark.png">
402
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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.">
403
403
  </picture>
404
404
 
405
405
  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.
406
406
 
407
407
  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.
408
408
 
409
- 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.38/bench/e-continuity/README.md#e-long-session)).
410
- 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.38/bench/d-externalize/README.md#d-synth-1m)).
411
- 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.38/docs/architecture/adr/0009-compaction-and-memory.md).
409
+ 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.40/bench/e-continuity/README.md#e-long-session)).
410
+ 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.40/bench/d-externalize/README.md#d-synth-1m)).
411
+ 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.40/docs/architecture/adr/0009-compaction-and-memory.md).
412
412
 
413
413
  ### Speed
414
414
 
@@ -420,27 +420,27 @@ Median of 5 runs, bench of 2026-11-01.
420
420
  | `ctx_search`, 20 queries over 8 indexed files | 1.62 ms median, 6.70 ms max |
421
421
  | `ctx_index`, 3 real files, 625,649 B | 150 ms per MB |
422
422
 
423
- 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.38/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.38/bench/g-overhead/README.md) show how each one runs.
423
+ 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.40/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.40/bench/g-overhead/README.md) show how each one runs.
424
424
 
425
425
  Next, what happens inside one tool call, in [How it works](#how-it-works).
426
426
 
427
427
  ## How it works
428
428
 
429
429
  <picture>
430
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/docs/assets/readme/fig-flow-dark.png">
431
- <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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.">
430
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/docs/assets/readme/fig-flow-dark.png">
431
+ <img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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.">
432
432
  </picture>
433
433
 
434
434
  One tool call, in time order, from the install to a hook error.
435
435
 
436
- 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.38/docs/architecture/adr/ADR-0023-native-install.md)).
437
- 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.38/src/core/hooks/dispatch.ts)).
438
- 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.38/src/core/policy/decide.ts)).
439
- 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.38/src/core/policy/read-deny.ts)).
440
- 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.38/src/core/tools/execute.ts)).
436
+ 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.40/docs/architecture/adr/ADR-0023-native-install.md)).
437
+ 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.40/src/core/hooks/dispatch.ts)).
438
+ 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.40/src/core/policy/decide.ts)).
439
+ 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.40/src/core/policy/read-deny.ts)).
440
+ 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.40/src/core/tools/execute.ts)).
441
441
  <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:
442
442
 
443
- `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.38/bench/evidence/try-it-2026-11-02/04-api-json.json)). The data is 1,039,898 B; the agent gets 254 B.
443
+ `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.40/bench/evidence/try-it-2026-11-02/04-api-json.json)). The data is 1,039,898 B; the agent gets 254 B.
444
444
 
445
445
  ```text
446
446
  ⏺ context-mode - ctx_execute (MCP)(language: "javascript", c…jsonplaceholder.typicode.com/photos\");
@@ -468,7 +468,7 @@ One tool call, in time order, from the install to a hook error.
468
468
  }
469
469
  ```
470
470
 
471
- `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.38/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
+ `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.40/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.
472
472
 
473
473
  ```text
474
474
  ⏺ context-mode - ctx_batch (MCP)(commands: ["cat npm-install… queries: ["cache miss","feat commit"])
@@ -480,15 +480,15 @@ One tool call, in time order, from the install to a hook error.
480
480
  npm http fetch GET 200 https://registry.npmjs.org/@esbuild%2fdarwin-arm64 99ms (cache miss)
481
481
  … +95 lines (ctrl+o to expand)
482
482
  ```
483
- 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.38/src/core/store/fts.ts)).
483
+ 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.40/src/core/store/fts.ts)).
484
484
 
485
- `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.38/bench/evidence/terminal-calls-2026-11-03/calls.json)). The file is 11,569 B; the agent gets 64 B.
485
+ `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.40/bench/evidence/terminal-calls-2026-11-03/calls.json)). The file is 11,569 B; the agent gets 64 B.
486
486
 
487
487
  ```text
488
488
  ⏺ context-mode - ctx_index (MCP)(path: "how-it-works.md")
489
489
  ⎿ Indexed 1 source(s), 17 chunk(s) from s1. Label: how-it-works.md
490
490
  ```
491
- 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.38/src/core/tools/search.ts)).
491
+ 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.40/src/core/tools/search.ts)).
492
492
 
493
493
  `ctx_search` on that index, in the same run, in a project that also holds an `AGENTS.md`. One search reads the index and every agent's memory files. The agent gets 1,268 B: one content hit and one memory hit, each with its source and heading. For memory shared across machines, agents and sessions, see [Context Mode Gateway Memory](https://contextmode.ai/docs/memory?utm_source=github&utm_medium=readme&utm_content=search-memory).
494
494
 
@@ -501,8 +501,8 @@ One tool call, in time order, from the install to a hook error.
501
501
  memory AGENTS.md #0: # Agent rules
502
502
  … +10 lines (ctrl+o to expand)
503
503
  ```
504
- 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.38/src/core/hooks/dispatch.ts)).
505
- 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.38/docs/architecture/adr/0009-compaction-and-memory.md)).
504
+ 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.40/src/core/hooks/dispatch.ts)).
505
+ 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.40/docs/architecture/adr/0009-compaction-and-memory.md)).
506
506
 
507
507
  `ctx_resume` with empty parameters returns the state block, in the same run: 209 B.
508
508
 
@@ -514,10 +514,10 @@ One tool call, in time order, from the install to a hook error.
514
514
  more: ctx_search(queries:[], scope:"session")
515
515
  </context_mode_state>
516
516
  ```
517
- 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.38/src/core/store/db.ts)).
518
- 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.38/src/core/hooks/fallback.ts)).
517
+ 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.40/src/core/store/db.ts)).
518
+ 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.40/src/core/hooks/fallback.ts)).
519
519
 
520
- Every number with its reason: [How it works](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/docs/how-it-works.md). The rules the hook follows: [ADR-0008](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/docs/architecture/adr/0008-enforcement-rewrite-and-cap.md). Next, the [Tools](#tools) the agent calls.
520
+ Every number with its reason: [How it works](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/docs/how-it-works.md). The rules the hook follows: [ADR-0008](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/docs/architecture/adr/0008-enforcement-rewrite-and-cap.md). Next, the [Tools](#tools) the agent calls.
521
521
 
522
522
  ## Tools
523
523
 
@@ -533,7 +533,7 @@ Every number with its reason: [How it works](https://github.com/mksglu/context-m
533
533
  | `ctx_upgrade` | Installs, upgrades or uninstalls; replaces old contextmode entries |
534
534
  | `ctx_purge` | Deletes indexed data by session, source or project |
535
535
 
536
- 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.38/bench/evidence/terminal-calls-2026-11-03/calls.json)).
536
+ 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.40/bench/evidence/terminal-calls-2026-11-03/calls.json)).
537
537
 
538
538
  `ctx_stats`: the agent gets 3,097 B, the first line is the summary.
539
539
 
@@ -574,13 +574,13 @@ Commands in the agent: `/ctx-stats` shows the `ctx_stats` result, `/ctx-doctor`
574
574
 
575
575
  | Call | When | File |
576
576
  |---|---|---|
577
- | 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.38/src/core/sandbox/fetch.ts) |
578
- | 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.38/src/core/ops/doctor-env.ts) |
579
- | `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.38/src/core/ops/release-fetch.ts) |
580
- | `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.38/src/cli/commands.ts) |
577
+ | 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.40/src/core/sandbox/fetch.ts) |
578
+ | 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.40/src/core/ops/doctor-env.ts) |
579
+ | `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.40/src/core/ops/release-fetch.ts) |
580
+ | `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.40/src/cli/commands.ts) |
581
581
  | Your agent's own install command, npm or git | You install or update | Your agent |
582
582
 
583
- - The guard test D-PRIVACY-NET-1 in [tests/0008-enforcement.test.mjs](https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/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.
583
+ - The guard test D-PRIVACY-NET-1 in [tests/0008-enforcement.test.mjs](https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/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.
584
584
  - Doctor and the debug report remove secrets by their structure before they print.
585
585
 
586
586
  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.
@@ -607,16 +607,16 @@ npx @context-mode/cli
607
607
  `npx @context-mode/cli` signs you in to your Gateway account, which has its own subscription, and writes one config change per agent.
608
608
  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.
609
609
 
610
- <a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/docs/assets/readme/gateway/live.mp4"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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>
610
+ <a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/docs/assets/readme/gateway/live.mp4"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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>
611
611
 
612
612
  **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.
613
613
 
614
614
  Docs: [How saving works](https://contextmode.ai/docs/how-saving-works?utm_source=github&utm_medium=readme&utm_content=live)
615
615
 
616
616
  <table>
617
- <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/docs/assets/readme/gateway/overview.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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.38/docs/assets/readme/gateway/analytics.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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>
618
- <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/docs/assets/readme/gateway/spend.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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.38/docs/assets/readme/gateway/memory.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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>
619
- <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.38/docs/assets/readme/gateway/skills.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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.38/docs/assets/readme/gateway/protect.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.38/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>
617
+ <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/docs/assets/readme/gateway/overview.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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.40/docs/assets/readme/gateway/analytics.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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>
618
+ <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/docs/assets/readme/gateway/spend.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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.40/docs/assets/readme/gateway/memory.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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>
619
+ <tr><td width="50%"><a href="https://github.com/mksglu/context-mode/blob/v2.0.0-next.40/docs/assets/readme/gateway/skills.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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.40/docs/assets/readme/gateway/protect.webp"><img src="https://raw.githubusercontent.com/mksglu/context-mode/v2.0.0-next.40/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>
620
620
  </table>
621
621
 
622
622
  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.
@@ -678,6 +678,6 @@ We chose ELv2 so the source stays open to all and the hosted service stays with
678
678
 
679
679
  ## Community
680
680
 
681
- 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.38/CONTRIBUTING.md) shows how an agent files an issue.
681
+ 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.40/CONTRIBUTING.md) shows how an agent files an issue.
682
682
 
683
683
  **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.
package/SHA256SUMS CHANGED
@@ -1,22 +1,22 @@
1
- 62400bfea56d5f99224a9cc4926a41a84afab06c7f17b90a2d379e928cb0aea9 .claude-plugin/marketplace.json
2
- 90bc4a64c8e1e6e485b1a94a61d05e4fe3a4d6a2c8df71703379a50f1b7083f0 .claude-plugin/plugin.json
1
+ 0e1900ac7d428e51bff3ec78c61dc5cbdb6a931c195a9c7f679a38f561f0e78d .claude-plugin/marketplace.json
2
+ 80f0059b4950d295e59026a0057e6746c7a9b5b01740e39265a7334eb5309a06 .claude-plugin/plugin.json
3
3
  187503e1455560d4ab5a72e3b8cd2f274abd4ccc5faa60dd66c37e44bb5f10c2 .codex-plugin/hooks.json
4
4
  4edea851775bc3f0418f8d9cf6ead74f2767c3a9e3b8c05749eacb78ebb3b896 .codex-plugin/mcp.json
5
- 7c0c6cdb64a475914f6df62d3cc611d2ccf82cc2f5ee70d0d7c15e959ea3dda7 .codex-plugin/plugin.json
5
+ 5ddaad6c54ad32928c1311c1c81aee83c80773ad35cf7a1e95a560ec7223551d .codex-plugin/plugin.json
6
6
  92f11a867c41c9e575ccb978ff205ae2011c244a14aa3c576e914e537105caa0 LICENSE
7
- af4523f66a19d4e88b12c69a7205453f1561e6fe077678aba185674ea56e424c README.md
7
+ de781108c657ab3d0609ef2dd62d9a2b13ff0d13733a6bc118e4f519f7c74d06 README.md
8
8
  1773e40a89384dd1af9023ba533da1908f3e2435dbaaa7cc941edf0514148313 claude-code/skills/ctx-doctor/SKILL.md
9
9
  d12b50ba56fa8632a778948b72137c32e043b0c11b0402f07ddef1578406d495 claude-code/skills/ctx-stats/SKILL.md
10
10
  d8f835d2f2b3eb70c5902f8707e7c5857977cec9e20ace76c499378a04e178e0 claude-code/skills/ctx-upgrade/SKILL.md
11
- 92c858bf7a553eb076af205fc697786030960b692553fd6eac1b3c0644f144c0 cli.mjs
11
+ f8b9197cd8c692128c73e7f117dc9ae3676084e16360757d86ba9285cac7d7c9 cli.mjs
12
12
  83c297020ed0c592fc68c9c482546a6999d41df5d06d8a329498f10edb1bd38e codex/skills/ctx-doctor/SKILL.md
13
13
  5652e791d5fa00033aebb0f6f85b6a3c9db8ab45cfc402e74ffc5f87bdc08922 codex/skills/ctx-stats/SKILL.md
14
14
  5c12cdd19a5e3ed7d9ba3a47b24d03864a28d36cf7006876284ee07cd4221ec4 codex/skills/ctx-upgrade/SKILL.md
15
- 8f477d0f0590db86bacdea205aa89440232377e047be5109998b23d899df7e66 copilot/plugin.json
15
+ 9800ba3d05892d9fbce7014c4bce1f92e12111cb10460c5a0add216b1e0d348a copilot/plugin.json
16
16
  5fe6aeabc19a3f3b2a968bc5ef472e4e26ba8116dc6617d7503fe7f8a47d05b6 fixtures/hook-roundtrip.json
17
- 24fb67068b466177610bf1efb102cba0f12ac509e05aeec258585d1357611c2e gemini-extension.json
18
- 9f165f0dc4ad614f44755033c86566b9f9fae815396b68e3b20a15f4a9981a7d hook.mjs
19
- 1f8d8650d2b38737522cab6b875878e8baf84a74acf98cd924c7af22852d873f hooks/claude-code.json
17
+ 3d8136fe55b70c3b2b1343cff447e0842224e9880e4bfdeb152c1eda657a1d72 gemini-extension.json
18
+ b756e53126eb8b8d1733fafe1e3ee0b7104cb7dfa6f7e2484fd519e2f0cad729 hook.mjs
19
+ 676dd9cddc3bb4dbf163296cdd72aac521010fdf33ab80bd2641f647ae475dc1 hooks/claude-code.json
20
20
  2524a0eb52683b65c65943c5097db513e9845ba14e84324b39e9a8ea2bb43193 hooks/codex.json
21
21
  b656fed2b754ebcfd4c156bee81d5879c21a8083fc0d6b8e3241462b63a214b6 hooks/copilot-cli.json
22
22
  b1609f5347954e8a6a5c4f455b709490feacec9f7d747c7fa46f334172c28345 hooks/hooks.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
- 0544d59f974bf8e0511d9fbeccd9f5b4596ac2e16a58c063f50c86b00cc9ef2a opencode/plugin.js
28
- 4b525633e8b5d2ca0f9aeb7fd277ec843ea8a693cb6a7c3a27a3bec807df050b package.json
29
- ee6814e97f5abbea7a9bf49a198bd16158d41a07852f2dbc415a6183c108d543 pi/index.js
27
+ 5ff295bfb72ccc23c296569c50c33866cbe8d978fcdb6d6b230090fa69d97461 opencode/plugin.js
28
+ 943f0efeac39152ca80a6f6d28533a04d3f3f830cf5b985095e20fcd51a15ed9 package.json
29
+ 18c24754c8ca777a0142cd2bf7ccc0f98d18559cde198d6cacece3a2857aa2a8 pi/index.js
30
30
  8712881622c9905aa4836af50d903042d34a91506264e459bc7839331f6f0192 pi/skills/ctx-doctor/SKILL.md
31
31
  4ff03de9581acbb827266eb9461aa34c8da5c3d01d51a3738064e582bf466a79 pi/skills/ctx-stats/SKILL.md
32
32
  db6f9c006bc864a7271f1eeffb1e316ebb537a3414f1c22f8b9de0a896e8e3c5 pi/skills/ctx-upgrade/SKILL.md
33
- 7231515f2930d9f1c932c6895d1d91b09d8de0613ee22ba6aa0b31fb58036e0f qwen-extension.json
34
- ca864ce1b493b20aa53fc9566ad7b0c1a6abcf63372963817158aa29a8def224 run.mjs
35
- ca864ce1b493b20aa53fc9566ad7b0c1a6abcf63372963817158aa29a8def224 search.mjs
36
- c897d943daf845bf325241f2f4efcfcd700e529c8e673161311ebd0b1d3c83ac server.mjs
33
+ 5d873ae5c7c7c8045d09617364aeb5469c7f3485f6ed01c711efd7a0b2aef4f4 qwen-extension.json
34
+ 70885610ff633ae2e6dbec19cc7086cf90c661d1965fde2fdc66455c75da566f run.mjs
35
+ 70885610ff633ae2e6dbec19cc7086cf90c661d1965fde2fdc66455c75da566f search.mjs
36
+ 95f3a678228acf90ecb4559190bd3f8da98c1e98c4db2cae933ae3360306c9d9 server.mjs
37
37
  e5503a22a6238901484d123efc11d2d933aa9a54c6ac2018812cfa65ec4e53e3 skills/ctx-doctor/SKILL.md
38
38
  ad3b9875600f3d7a4970ed91ad9331903c2aa5e77d9f742c6a212015a021ad18 skills/ctx-stats/SKILL.md
39
39
  c1cac75b7506ee0d06089ce611ac6dc9314cf12435da318ce88ad50e2c5debbf skills/ctx-upgrade/SKILL.md
package/cli.mjs CHANGED
@@ -594,6 +594,9 @@ var ISSUE_FORM_URL = `https://github.com/${ISSUE_REPO_SLUG}/issues/new?template=
594
594
 
595
595
  // src/adapters/claude-code.ts
596
596
  var TOOL_NAME_PREFIX = "mcp__plugin_context-mode_context-mode__";
597
+ var SHELL_TOOL_NAMES = Object.freeze(["Bash", "PowerShell"]);
598
+ var POWERSHELL_TOOL = "PowerShell";
599
+ var SHELL_CANONICAL = "Bash";
597
600
  var CLAUDE_SHAPE_EVENTS = ["SessionStart", "UserPromptSubmit", "PreToolUse", "PostToolUse"];
598
601
  var MCP_PREFIX = "mcp__";
599
602
  var MCP_SEP = "__";
@@ -719,6 +722,7 @@ function requireFields(raw) {
719
722
  function decode(raw) {
720
723
  requireFields(raw);
721
724
  const ev = decodeClaudeShape(raw, "claude-code", TOOL_NAME_PREFIX, CLAUDE_SOURCES);
725
+ if (ev.tool !== void 0 && ev.tool.name === POWERSHELL_TOOL) ev.tool.canonicalName = SHELL_CANONICAL;
722
726
  if (ev.cwd === "") ev.cwd = process.env.CLAUDE_PROJECT_DIR || process.cwd();
723
727
  if (ev.event === "PostToolUse" && ev.tool !== void 0 && ev.tool.callId === void 0) {
724
728
  const cmd = typeof ev.tool.input.command === "string" ? ev.tool.input.command : JSON.stringify(ev.tool.input);
@@ -868,8 +872,8 @@ var RESULT_SUCCESS = "success";
868
872
  function isRecord(v) {
869
873
  return typeof v === "object" && v !== null && !Array.isArray(v);
870
874
  }
871
- var SHELL_TOOL_NAMES = Object.freeze(["bash", "powershell"]);
872
- var NATIVE_TO_CANONICAL3 = Object.fromEntries(SHELL_TOOL_NAMES.map((n3) => [n3, "Bash"]));
875
+ var SHELL_TOOL_NAMES2 = Object.freeze(["bash", "powershell"]);
876
+ var NATIVE_TO_CANONICAL3 = Object.fromEntries(SHELL_TOOL_NAMES2.map((n3) => [n3, "Bash"]));
873
877
  function canonicalName3(name) {
874
878
  if (name.startsWith(TOOL_NAME_PREFIX5)) return name.slice(TOOL_NAME_PREFIX5.length);
875
879
  if (Object.hasOwn(NATIVE_TO_CANONICAL3, name)) return NATIVE_TO_CANONICAL3[name];
@@ -950,11 +954,11 @@ var VSCODE_EVENTS = ["SessionStart", "UserPromptSubmit", "PreToolUse", "PostTool
950
954
  var MCP_PREFIX2 = "mcp_";
951
955
  var MCP_SEP2 = "_";
952
956
  var SESSION_START_NEW = "new";
953
- var SHELL_TOOL_NAMES2 = Object.freeze(["run_in_terminal", "runTerminalCommand", "bash", "powershell"]);
957
+ var SHELL_TOOL_NAMES3 = Object.freeze(["run_in_terminal", "runTerminalCommand", "bash", "powershell"]);
954
958
  var READ_TOOL_NAMES = Object.freeze(["read_file", "view"]);
955
959
  var WEBFETCH_TOOL_NAMES = Object.freeze(["fetch_webpage", "web_fetch"]);
956
960
  var NATIVE_TO_CANONICAL4 = Object.fromEntries([
957
- ...SHELL_TOOL_NAMES2.map((n3) => [n3, "Bash"]),
961
+ ...SHELL_TOOL_NAMES3.map((n3) => [n3, "Bash"]),
958
962
  ...READ_TOOL_NAMES.map((n3) => [n3, "Read"]),
959
963
  ...WEBFETCH_TOOL_NAMES.map((n3) => [n3, "WebFetch"])
960
964
  ]);
@@ -1082,8 +1086,8 @@ var KIRO_EVENTS = {
1082
1086
  };
1083
1087
  var PROMPT_ENV = "USER_PROMPT";
1084
1088
  var MCP_PREFIX3 = "mcp_";
1085
- var SHELL_TOOL_NAMES3 = Object.freeze(["execute_bash", "execute_pwsh", "shell"]);
1086
- var NATIVE_TO_CANONICAL5 = Object.fromEntries(SHELL_TOOL_NAMES3.map((n3) => [n3, "Bash"]));
1089
+ var SHELL_TOOL_NAMES4 = Object.freeze(["execute_bash", "execute_pwsh", "shell"]);
1090
+ var NATIVE_TO_CANONICAL5 = Object.fromEntries(SHELL_TOOL_NAMES4.map((n3) => [n3, "Bash"]));
1087
1091
  var MCP_SEP3 = "_";
1088
1092
  var KIRO_SOURCES = { startup: "startup", resume: "resume", clear: "clear", compact: "compact" };
1089
1093
  function canonicalName5(name) {
@@ -1225,8 +1229,8 @@ var OPENCODE_EVENTS = {
1225
1229
  "step-finish": "Usage"
1226
1230
  };
1227
1231
  var SHELL_TOOL_NAME = "bash";
1228
- var SHELL_TOOL_NAMES4 = Object.freeze([SHELL_TOOL_NAME, "shell"]);
1229
- var NATIVE_TO_CANONICAL7 = { webfetch: "WebFetch", ...Object.fromEntries(SHELL_TOOL_NAMES4.map((n3) => [n3, "Bash"])) };
1232
+ var SHELL_TOOL_NAMES5 = Object.freeze([SHELL_TOOL_NAME, "shell"]);
1233
+ var NATIVE_TO_CANONICAL7 = { webfetch: "WebFetch", ...Object.fromEntries(SHELL_TOOL_NAMES5.map((n3) => [n3, "Bash"])) };
1230
1234
  function toCanonicalTool(name) {
1231
1235
  if (name.startsWith(OWN_WIRE_PREFIX)) return name.slice(OWN_WIRE_PREFIX.length);
1232
1236
  return Object.prototype.hasOwnProperty.call(NATIVE_TO_CANONICAL7, name) ? NATIVE_TO_CANONICAL7[name] : name;
@@ -1274,13 +1278,14 @@ function encode10(ev, d, _extra) {
1274
1278
  // src/adapters/table.ts
1275
1279
  var CLAUDE_EVENTS = { SessionStart: "SessionStart", UserPromptSubmit: "UserPromptSubmit", PreToolUse: "PreToolUse", PostToolUse: "PostToolUse" };
1276
1280
  var CLAUDE_TOOLS = { shell: ["Bash"], read: ["Read"], grep: ["Grep"], webfetch: ["WebFetch"], edit: ["Write", "Edit", "NotebookEdit"] };
1281
+ var CLAUDE_CODE_TOOLS = { ...CLAUDE_TOOLS, shell: [...SHELL_TOOL_NAMES] };
1277
1282
  var ADAPTERS = Object.freeze([
1278
1283
  {
1279
1284
  id: "claude-code",
1280
1285
  installMode: "marketplace",
1281
1286
  projectSource: "env:CLAUDE_PROJECT_DIR",
1282
1287
  toolNamePrefix: TOOL_NAME_PREFIX,
1283
- nativeTools: CLAUDE_TOOLS,
1288
+ nativeTools: CLAUDE_CODE_TOOLS,
1284
1289
  execReadOnlyHint: false,
1285
1290
  eventMap: CLAUDE_EVENTS,
1286
1291
  compactDelivery: "sessionstart",
@@ -1356,7 +1361,7 @@ var ADAPTERS = Object.freeze([
1356
1361
  installMode: "plugin",
1357
1362
  projectSource: "arg:--agent+cwd",
1358
1363
  toolNamePrefix: TOOL_NAME_PREFIX5,
1359
- nativeTools: { shell: [...SHELL_TOOL_NAMES] },
1364
+ nativeTools: { shell: [...SHELL_TOOL_NAMES2] },
1360
1365
  execReadOnlyHint: false,
1361
1366
  // D-PWSH-DUMP-1
1362
1367
  eventMap: { SessionStart: "sessionStart", UserPromptSubmit: "userPromptSubmitted", PreToolUse: "preToolUse", PostToolUse: "postToolUse" },
@@ -1376,7 +1381,7 @@ var ADAPTERS = Object.freeze([
1376
1381
  projectSource: "arg:workspaceFolder",
1377
1382
  toolNamePrefix: TOOL_NAME_PREFIX6,
1378
1383
  // PreCompact sets the pending flag (ADR-0009 §6, DEVIATIONS D-M3-A4-1).
1379
- nativeTools: { shell: [...SHELL_TOOL_NAMES2], read: [...READ_TOOL_NAMES], webfetch: [...WEBFETCH_TOOL_NAMES] },
1384
+ nativeTools: { shell: [...SHELL_TOOL_NAMES3], read: [...READ_TOOL_NAMES], webfetch: [...WEBFETCH_TOOL_NAMES] },
1380
1385
  // D-HF-VSCODE-PROJECT-1, D-N7-VSCODE-TOOLS-1
1381
1386
  execReadOnlyHint: false,
1382
1387
  eventMap: { ...CLAUDE_EVENTS, PreCompact: "PreCompact" },
@@ -1395,7 +1400,7 @@ var ADAPTERS = Object.freeze([
1395
1400
  installMode: "mcp-entry",
1396
1401
  projectSource: "arg:--agent+cwd",
1397
1402
  toolNamePrefix: TOOL_NAME_PREFIX7,
1398
- nativeTools: { shell: [...SHELL_TOOL_NAMES3] },
1403
+ nativeTools: { shell: [...SHELL_TOOL_NAMES4] },
1399
1404
  execReadOnlyHint: false,
1400
1405
  // D-HF-KIRO-SHELL-1, D-N7-KIRO-1
1401
1406
  eventMap: { SessionStart: "SessionStart", UserPromptSubmit: "UserPromptSubmit", PreToolUse: "PreToolUse", PostToolUse: "PostToolUse" },