context-mode 1.0.162 → 1.0.164
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 +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.openclaw-plugin/openclaw.plugin.json +1 -1
- package/.openclaw-plugin/package.json +1 -1
- package/README.md +149 -30
- package/bin/statusline.mjs +24 -4
- package/build/adapters/antigravity/index.d.ts +1 -1
- package/build/adapters/antigravity-cli/index.d.ts +51 -0
- package/build/adapters/antigravity-cli/index.js +342 -0
- package/build/adapters/claude-code/hooks.d.ts +1 -0
- package/build/adapters/claude-code/hooks.js +3 -0
- package/build/adapters/claude-code/index.js +24 -5
- package/build/adapters/client-map.js +5 -0
- package/build/adapters/codex/hooks.d.ts +5 -1
- package/build/adapters/codex/hooks.js +5 -1
- package/build/adapters/codex/index.d.ts +9 -1
- package/build/adapters/codex/index.js +87 -5
- package/build/adapters/copilot-cli/hooks.d.ts +33 -0
- package/build/adapters/copilot-cli/hooks.js +64 -0
- package/build/adapters/copilot-cli/index.d.ts +48 -0
- package/build/adapters/copilot-cli/index.js +341 -0
- package/build/adapters/detect.d.ts +1 -1
- package/build/adapters/detect.js +71 -3
- package/build/adapters/openclaw/mcp-tools.js +1 -1
- package/build/adapters/opencode/index.js +31 -17
- package/build/adapters/opencode/zod3tov4.js +27 -6
- package/build/adapters/pi/extension.d.ts +2 -12
- package/build/adapters/pi/extension.js +128 -109
- package/build/adapters/types.d.ts +5 -4
- package/build/adapters/types.js +4 -3
- package/build/cache-heal.d.ts +48 -0
- package/build/cache-heal.js +150 -0
- package/build/cli.js +37 -97
- package/build/executor.d.ts +25 -0
- package/build/executor.js +143 -22
- package/build/lifecycle.d.ts +48 -0
- package/build/lifecycle.js +111 -0
- package/build/opencode-plugin.js +5 -2
- package/build/routing-block.d.ts +8 -0
- package/build/routing-block.js +86 -0
- package/build/runtime.d.ts +0 -36
- package/build/runtime.js +107 -27
- package/build/search/flood-guard.d.ts +57 -0
- package/build/search/flood-guard.js +80 -0
- package/build/security.d.ts +73 -3
- package/build/security.js +293 -33
- package/build/server.d.ts +14 -0
- package/build/server.js +441 -354
- package/build/session/analytics.d.ts +1 -1
- package/build/session/analytics.js +5 -1
- package/build/session/db.js +23 -3
- package/build/session/extract.js +78 -0
- package/build/store.d.ts +1 -1
- package/build/store.js +139 -25
- package/build/tool-naming.d.ts +4 -0
- package/build/tool-naming.js +24 -0
- package/build/util/jsonc.d.ts +14 -0
- package/build/util/jsonc.js +104 -0
- package/cli.bundle.mjs +253 -250
- package/configs/antigravity/GEMINI.md +2 -2
- package/configs/antigravity-cli/hooks/hooks.json +37 -0
- package/configs/antigravity-cli/hooks.json +37 -0
- package/configs/antigravity-cli/mcp_config.json +10 -0
- package/configs/antigravity-cli/plugin.json +14 -0
- package/configs/antigravity-cli/rules/context-mode.md +77 -0
- package/configs/antigravity-cli/skills/context-mode/SKILL.md +77 -0
- package/configs/claude-code/CLAUDE.md +2 -2
- package/configs/codex/AGENTS.md +2 -2
- package/configs/copilot-cli/.github/plugin/plugin.json +23 -0
- package/configs/copilot-cli/.mcp.json +12 -0
- package/configs/copilot-cli/README.md +47 -0
- package/configs/copilot-cli/hooks.json +41 -0
- package/configs/copilot-cli/skills/context-mode/SKILL.md +38 -0
- package/configs/gemini-cli/GEMINI.md +2 -2
- package/configs/jetbrains-copilot/copilot-instructions.md +2 -2
- package/configs/kilo/AGENTS.md +2 -2
- package/configs/kiro/KIRO.md +2 -2
- package/configs/omp/SYSTEM.md +2 -2
- package/configs/openclaw/AGENTS.md +2 -2
- package/configs/opencode/AGENTS.md +2 -2
- package/configs/qwen-code/QWEN.md +2 -2
- package/configs/vscode-copilot/copilot-instructions.md +2 -2
- package/configs/zed/AGENTS.md +2 -2
- package/hooks/antigravity-cli/payload.mjs +98 -0
- package/hooks/antigravity-cli/posttooluse.mjs +138 -0
- package/hooks/antigravity-cli/pretooluse.mjs +78 -0
- package/hooks/antigravity-cli/stop.mjs +58 -0
- package/hooks/codex/pretooluse.mjs +14 -4
- package/hooks/codex/stop.mjs +12 -4
- package/hooks/copilot-cli/posttooluse.mjs +79 -0
- package/hooks/copilot-cli/precompact.mjs +66 -0
- package/hooks/copilot-cli/pretooluse.mjs +41 -0
- package/hooks/copilot-cli/sessionstart.mjs +121 -0
- package/hooks/copilot-cli/stop.mjs +59 -0
- package/hooks/copilot-cli/userpromptsubmit.mjs +77 -0
- package/hooks/core/codex-caps.mjs +112 -0
- package/hooks/core/formatters.mjs +158 -7
- package/hooks/core/mcp-ready.mjs +37 -8
- package/hooks/core/routing.mjs +94 -8
- package/hooks/core/tool-naming.mjs +3 -0
- package/hooks/hooks.json +12 -1
- package/hooks/pretooluse.mjs +6 -2
- package/hooks/routing-block.mjs +3 -4
- package/hooks/security.bundle.mjs +2 -1
- package/hooks/session-db.bundle.mjs +5 -5
- package/hooks/session-directive.mjs +88 -20
- package/hooks/session-extract.bundle.mjs +2 -2
- package/hooks/session-helpers.mjs +21 -0
- package/hooks/sessionstart.mjs +37 -5
- package/hooks/stop.mjs +49 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -10
- package/server.bundle.mjs +206 -200
- package/skills/ctx-insight/SKILL.md +12 -17
- package/build/util/db-lock.d.ts +0 -65
- package/build/util/db-lock.js +0 -166
- package/insight/index.html +0 -13
- package/insight/package.json +0 -55
- package/insight/server.mjs +0 -1265
- package/insight/src/components/analytics.tsx +0 -112
- package/insight/src/components/ui/badge.tsx +0 -52
- package/insight/src/components/ui/button.tsx +0 -58
- package/insight/src/components/ui/card.tsx +0 -103
- package/insight/src/components/ui/chart.tsx +0 -371
- package/insight/src/components/ui/collapsible.tsx +0 -19
- package/insight/src/components/ui/input.tsx +0 -20
- package/insight/src/components/ui/progress.tsx +0 -83
- package/insight/src/components/ui/scroll-area.tsx +0 -55
- package/insight/src/components/ui/separator.tsx +0 -23
- package/insight/src/components/ui/table.tsx +0 -114
- package/insight/src/components/ui/tabs.tsx +0 -82
- package/insight/src/components/ui/tooltip.tsx +0 -64
- package/insight/src/lib/api.ts +0 -144
- package/insight/src/lib/utils.ts +0 -6
- package/insight/src/main.tsx +0 -22
- package/insight/src/routeTree.gen.ts +0 -189
- package/insight/src/router.tsx +0 -19
- package/insight/src/routes/__root.tsx +0 -55
- package/insight/src/routes/enterprise.tsx +0 -316
- package/insight/src/routes/index.tsx +0 -1482
- package/insight/src/routes/knowledge.tsx +0 -221
- package/insight/src/routes/knowledge_.$dbHash.$sourceId.tsx +0 -137
- package/insight/src/routes/search.tsx +0 -97
- package/insight/src/routes/sessions.tsx +0 -179
- package/insight/src/routes/sessions_.$dbHash.$sessionId.tsx +0 -181
- package/insight/src/styles.css +0 -104
- package/insight/tsconfig.json +0 -29
- package/insight/vite.config.ts +0 -19
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Claude Code plugins by Mert Koseoğlu",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.164"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "context-mode",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "Claude Code MCP plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
|
|
16
|
-
"version": "1.0.
|
|
16
|
+
"version": "1.0.164",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Mert Koseoğlu"
|
|
19
19
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.164",
|
|
4
4
|
"description": "MCP server that saves 98% of your context window with session continuity. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and automatic state restore across compactions.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mert Koseoğlu",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.164",
|
|
4
4
|
"description": "MCP server that saves 98% of your context window with session continuity. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and automatic state restore across compactions.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mert Koseoğlu",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "Context Mode",
|
|
4
4
|
"kind": "tool",
|
|
5
5
|
"description": "OpenClaw plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.164",
|
|
7
7
|
"sandbox": {
|
|
8
8
|
"mode": "permissive",
|
|
9
9
|
"filesystem_access": "full",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.164",
|
|
4
4
|
"description": "OpenClaw plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mert Koseoğlu",
|
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Context Mode is an MCP server that solves all four sides of this problem:
|
|
|
39
39
|
|
|
40
40
|
1. **Context Saving** — Sandbox tools keep raw data out of the context window. 315 KB becomes 5.4 KB. 98% reduction.
|
|
41
41
|
2. **Session Continuity** — Every file edit, git operation, task, error, and user decision is tracked in SQLite. When the conversation compacts, context-mode doesn't dump this data back into context — it indexes events into FTS5 and retrieves only what's relevant via BM25 search. The model picks up exactly where you left off. If you don't `--continue`, previous session data is deleted immediately — a fresh session means a clean slate.
|
|
42
|
-
3. **Think in Code** — The LLM should program the analysis, not compute it. Instead of reading 50 files into context to count functions, the agent writes a script that does the counting and `console.log()`s only the result. One script replaces ten tool calls and saves 100x context. This is a mandatory paradigm across all
|
|
42
|
+
3. **Think in Code** — The LLM should program the analysis, not compute it. Instead of reading 50 files into context to count functions, the agent writes a script that does the counting and `console.log()`s only the result. One script replaces ten tool calls and saves 100x context. This is a mandatory paradigm across all 17 supported clients, plus the OpenClaw gateway integration: stop treating the LLM as a data processor, treat it as a code generator.
|
|
43
43
|
|
|
44
44
|
```js
|
|
45
45
|
// Before: 47 × Read() = 700 KB. After: 1 × ctx_execute() = 3.6 KB.
|
|
@@ -83,7 +83,7 @@ Restart Claude Code (or run `/reload-plugins`).
|
|
|
83
83
|
|
|
84
84
|
All checks should show `[x]`. The doctor validates runtimes, hooks, FTS5, and plugin registration.
|
|
85
85
|
|
|
86
|
-
**Routing:** Automatic. The SessionStart hook injects routing instructions at runtime — no file is written to your project. The plugin registers all hooks (PreToolUse, PostToolUse, PreCompact, SessionStart) and 11 MCP tools — six sandbox tools (`ctx_batch_execute`, `ctx_execute`, `ctx_execute_file`, `ctx_index`, `ctx_search`, `ctx_fetch_and_index`) plus five meta-tools (`ctx_stats`, `ctx_doctor`, `ctx_upgrade`, `ctx_purge`, `ctx_insight`).
|
|
86
|
+
**Routing:** Automatic. The SessionStart hook injects routing instructions at runtime — no file is written to your project. The plugin registers all hooks (PreToolUse, PostToolUse, UserPromptSubmit, PreCompact, SessionStart, Stop) and 11 MCP tools — six sandbox tools (`ctx_batch_execute`, `ctx_execute`, `ctx_execute_file`, `ctx_index`, `ctx_search`, `ctx_fetch_and_index`) plus five meta-tools (`ctx_stats`, `ctx_doctor`, `ctx_upgrade`, `ctx_purge`, `ctx_insight`).
|
|
87
87
|
|
|
88
88
|
| Slash Command | What it does |
|
|
89
89
|
|---|---|
|
|
@@ -93,7 +93,7 @@ All checks should show `[x]`. The doctor validates runtimes, hooks, FTS5, and pl
|
|
|
93
93
|
| `/context-mode:ctx-search` | Search previously indexed content. |
|
|
94
94
|
| `/context-mode:ctx-upgrade` | Pull latest, rebuild, migrate cache, fix hooks. |
|
|
95
95
|
| `/context-mode:ctx-purge` | Permanently delete all indexed content from the knowledge base. |
|
|
96
|
-
| `/context-mode:ctx-insight` |
|
|
96
|
+
| `/context-mode:ctx-insight` | Opens the hosted Insight dashboard ([context-mode.com/insight](https://context-mode.com/insight)) in your browser — org analytics for AI-assisted engineering teams. |
|
|
97
97
|
|
|
98
98
|
> **Note:** Slash commands are a Claude Code plugin feature. On other platforms, type `ctx stats`, `ctx doctor`, `ctx index`, `ctx search`, `ctx upgrade`, or `ctx insight` in the chat — the model calls the MCP tool automatically. See [Utility Commands](#utility-commands).
|
|
99
99
|
|
|
@@ -304,6 +304,66 @@ Full setup guide: [`docs/jetbrains-copilot.md`](docs/jetbrains-copilot.md)
|
|
|
304
304
|
|
|
305
305
|
</details>
|
|
306
306
|
|
|
307
|
+
<details>
|
|
308
|
+
<summary><strong>GitHub Copilot CLI</strong> — MCP + hooks</summary>
|
|
309
|
+
|
|
310
|
+
**Prerequisites:** Node.js >= 22.5 (or Bun), GitHub Copilot CLI (`copilot`) installed. Set `COPILOT_HOME` first if you use an isolated Copilot home.
|
|
311
|
+
|
|
312
|
+
**Install — Option A (plugin, one command — recommended):**
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
npm install -g context-mode # the plugin's MCP server runs the global binary
|
|
316
|
+
copilot plugin install mksglu/context-mode:configs/copilot-cli # registers MCP + hooks + routing skill
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
The bundle's `.mcp.json` pins `CONTEXT_MODE_PLATFORM=copilot-cli`, so context-mode self-identifies as Copilot — `ctx_upgrade` and platform detection resolve `copilot-cli` even when Claude Code is co-installed (whose `~/.claude/` would otherwise win). No `context-mode upgrade` / agent call needed. To try it from a local clone before it lands on the default branch, point Copilot at the bundle directory: `copilot --plugin-dir /path/to/context-mode/configs/copilot-cli`.
|
|
320
|
+
|
|
321
|
+
**Install — Option B (manual, no plugin):**
|
|
322
|
+
|
|
323
|
+
1. Install context-mode globally:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
npm install -g context-mode
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
2. Register the MCP server with Copilot CLI's built-in command (writes `~/.copilot/mcp-config.json` for you):
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
copilot mcp add context-mode -- context-mode
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
3. Configure hooks in `~/.copilot/hooks/context-mode.json` (or `$COPILOT_HOME/hooks/context-mode.json`). The config uses flat `{ "type": "command", "command": "..." }` entries; context-mode also writes a top-level `"version": 1`, but that field is **optional** — the Copilot CLI accepts hook configs that omit it (it is pinned only for self-documentation). Copilot CLI fires six events context-mode uses:
|
|
336
|
+
|
|
337
|
+
```json
|
|
338
|
+
{
|
|
339
|
+
"version": 1,
|
|
340
|
+
"hooks": {
|
|
341
|
+
"preToolUse": [{ "type": "command", "command": "context-mode hook copilot-cli pretooluse" }],
|
|
342
|
+
"postToolUse": [{ "type": "command", "command": "context-mode hook copilot-cli posttooluse" }],
|
|
343
|
+
"preCompact": [{ "type": "command", "command": "context-mode hook copilot-cli precompact" }],
|
|
344
|
+
"sessionStart": [{ "type": "command", "command": "context-mode hook copilot-cli sessionstart" }],
|
|
345
|
+
"userPromptSubmitted": [{ "type": "command", "command": "context-mode hook copilot-cli userpromptsubmit" }],
|
|
346
|
+
"agentStop": [{ "type": "command", "command": "context-mode hook copilot-cli stop" }]
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Or let context-mode write **this hooks file** for you: `context-mode upgrade` (run from a Copilot CLI context, or with `CONTEXT_MODE_PLATFORM=copilot-cli`). `upgrade` writes the **hooks file only** — register the MCP server with `copilot mcp add` in step 2.
|
|
352
|
+
|
|
353
|
+
4. Restart Copilot CLI.
|
|
354
|
+
|
|
355
|
+
> **Plugins:** Option A above uses Copilot CLI's plugin system, which registers MCP servers (`.mcp.json`), hooks (`hooks.json`), and skills (`skills/`) together — not just skills/agents. The shipped bundle is `configs/copilot-cli/`; `copilot plugin install owner/repo:path` installs it in one command (no clone). Option B is the equivalent without a plugin.
|
|
356
|
+
|
|
357
|
+
> **Version note:** the hook commands run the **global** `context-mode` (`context-mode hook copilot-cli …`), so they need a context-mode version with Copilot CLI support. On an older global the hooks are inert (no routing/capture) until you upgrade — but they do **not** block your tools (context-mode fails open). Upgrade with `npm install -g context-mode@latest`.
|
|
358
|
+
|
|
359
|
+
**Verify:** In a Copilot CLI session, type `ctx stats`. Context-mode tools should appear and respond. Run `context-mode doctor` to confirm hook + MCP registration.
|
|
360
|
+
|
|
361
|
+
**Routing:** Automatic via hooks (PreToolUse interception + SessionStart routing block). Auto-detected via MCP `clientInfo.name` (`GitHub Copilot CLI`) or, in a bare shell, a context-mode-written marker (`~/.copilot/mcp-config.json` or `~/.copilot/hooks/context-mode.json`) — not a bare `~/.copilot/` dir, so a co-installed-but-unconfigured Copilot CLI is not mis-detected as context-mode-on-copilot.
|
|
362
|
+
|
|
363
|
+
See [`docs/platform-support.md`](docs/platform-support.md#github-copilot-cli) for the full reference. Tracking: [#775](https://github.com/mksglu/context-mode/issues/775).
|
|
364
|
+
|
|
365
|
+
</details>
|
|
366
|
+
|
|
307
367
|
<details>
|
|
308
368
|
<summary><strong>Cursor</strong> — hooks with stop support</summary>
|
|
309
369
|
|
|
@@ -323,7 +383,7 @@ After Cursor lists context-mode in the [Marketplace](https://cursor.com/marketpl
|
|
|
323
383
|
git clone https://github.com/mksglu/context-mode.git
|
|
324
384
|
cd context-mode
|
|
325
385
|
robocopy . "$env:USERPROFILE\.cursor\plugins\local\context-mode" /MIR `
|
|
326
|
-
/XD node_modules .git build
|
|
386
|
+
/XD node_modules .git build web tests scripts .vscode `
|
|
327
387
|
/XF *.log .gitignore *.bundle.mjs.map
|
|
328
388
|
```
|
|
329
389
|
|
|
@@ -706,6 +766,8 @@ The Codex plugin manifest provides MCP via `.codex-plugin/mcp.json`, skills via
|
|
|
706
766
|
CM_ROOT="$(npm root -g)/context-mode"; cp "$CM_ROOT/configs/codex/AGENTS.md" ~/.kimi-code/AGENTS.md
|
|
707
767
|
```
|
|
708
768
|
|
|
769
|
+
Full documentation: [`docs/adapters/kimi-code.md`](docs/adapters/kimi-code.md)
|
|
770
|
+
|
|
709
771
|
</details>
|
|
710
772
|
|
|
711
773
|
<details>
|
|
@@ -763,9 +825,11 @@ The Codex plugin manifest provides MCP via `.codex-plugin/mcp.json`, skills via
|
|
|
763
825
|
</details>
|
|
764
826
|
|
|
765
827
|
<details>
|
|
766
|
-
<summary><strong>Antigravity</strong> — MCP-only, no hooks</summary>
|
|
828
|
+
<summary><strong>Antigravity IDE</strong> — MCP-only, no hooks</summary>
|
|
829
|
+
|
|
830
|
+
> This is the Antigravity **desktop IDE**. For the `agy` **command-line tool**, see **Antigravity CLI (`agy`)** below — it installs as a full plugin with hooks.
|
|
767
831
|
|
|
768
|
-
**Prerequisites:** Node.js >= 22.5 (or Bun), Antigravity installed.
|
|
832
|
+
**Prerequisites:** Node.js >= 22.5 (or Bun), the Antigravity IDE installed.
|
|
769
833
|
|
|
770
834
|
**Install:**
|
|
771
835
|
|
|
@@ -803,6 +867,34 @@ Full configs: [`configs/antigravity/mcp_config.json`](configs/antigravity/mcp_co
|
|
|
803
867
|
|
|
804
868
|
</details>
|
|
805
869
|
|
|
870
|
+
<details>
|
|
871
|
+
<summary><strong>Antigravity CLI (<code>agy</code>)</strong> — plugin (MCP + skill + hooks)</summary>
|
|
872
|
+
|
|
873
|
+
> The `agy` **command-line tool**, not the Antigravity desktop IDE above.
|
|
874
|
+
|
|
875
|
+
**Prerequisites:** Node.js >= 22.5 (or Bun), Antigravity CLI (`agy`) **≥ 1.0.7** (`agy update` to upgrade). Verified on agy 1.0.10.
|
|
876
|
+
|
|
877
|
+
**Install:**
|
|
878
|
+
|
|
879
|
+
```bash
|
|
880
|
+
npm install -g context-mode # the plugin's MCP server + hooks run the global binary
|
|
881
|
+
agy plugin install https://github.com/mksglu/context-mode/tree/main/configs/antigravity-cli # registers MCP + rule + skill + hooks
|
|
882
|
+
```
|
|
883
|
+
|
|
884
|
+
Restart `agy`.
|
|
885
|
+
|
|
886
|
+
**MCP-only (no plugin, no hooks):** if you only want the `ctx_*` tools, skip the plugin and add context-mode to agy's global MCP profile `~/.gemini/config/mcp_config.json` (distinct from the Antigravity IDE's `~/.gemini/antigravity/` path), then restart `agy`:
|
|
887
|
+
|
|
888
|
+
```json
|
|
889
|
+
{ "mcpServers": { "context-mode": { "command": "context-mode" } } }
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
**Verify:** type `ctx stats` in an agy session, or run any prompt from [Try It](#try-it) and check the savings. `context-mode doctor` confirms MCP + hook registration. Remove with `agy plugin uninstall context-mode`.
|
|
893
|
+
|
|
894
|
+
**Routing:** the routing rule and skill provide the instruction layer; bounded `PreToolUse` blocks high-flood tools and `PostToolUse` captures sessions. The bundle pins `CONTEXT_MODE_PLATFORM=antigravity-cli` so agy is detected even when Claude Code is co-installed ([#774](https://github.com/mksglu/context-mode/issues/774)).
|
|
895
|
+
|
|
896
|
+
</details>
|
|
897
|
+
|
|
806
898
|
<details>
|
|
807
899
|
<summary><strong>Kiro</strong> — hooks with steering file</summary>
|
|
808
900
|
|
|
@@ -1146,16 +1238,17 @@ Context Mode captures every meaningful event during your session and persists th
|
|
|
1146
1238
|
|
|
1147
1239
|
Session continuity requires 5 hooks working together:
|
|
1148
1240
|
|
|
1149
|
-
| Hook | Role | Claude Code | Gemini CLI | VS Code Copilot | JetBrains Copilot | Cursor | OpenCode | KiloCode | OpenClaw | Codex CLI | Antigravity | Kiro | Zed | Pi | OMP |
|
|
1150
|
-
|
|
1151
|
-
| **PreToolUse** | Enforces sandbox routing before tool execution | Yes | -- | -- | -- | Yes | -- | -- | -- | Yes | -- | Yes | -- | ✓ (via tool_call event) | ✓ (via tool_call event) |
|
|
1152
|
-
| **PostToolUse** | Captures events after each tool call | Yes | Yes | Yes | Yes | Yes | Plugin | Plugin | Plugin | Yes | -- | Yes | -- | ✓ (via tool_result event) | ✓ (via tool_result event) |
|
|
1153
|
-
| **UserPromptSubmit** | Captures user decisions and corrections | Yes | -- | -- | -- | -- | Plugin (via chat.message) | Plugin (via chat.message) | -- | Yes | -- | -- | -- | -- | -- |
|
|
1154
|
-
| **
|
|
1155
|
-
| **
|
|
1156
|
-
| |
|
|
1241
|
+
| Hook | Role | Claude Code | Gemini CLI | VS Code Copilot | JetBrains Copilot | GitHub Copilot CLI | Cursor | OpenCode | KiloCode | OpenClaw | Codex CLI | Antigravity | Antigravity CLI (`agy`) | Kiro | Zed | Pi | OMP |
|
|
1242
|
+
|---|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
|
1243
|
+
| **PreToolUse** | Enforces sandbox routing before tool execution | Yes | -- | -- | -- | Yes | Yes | -- | -- | -- | Yes | -- | Bounded | Yes | -- | ✓ (via tool_call event) | ✓ (via tool_call event) |
|
|
1244
|
+
| **PostToolUse** | Captures events after each tool call | Yes | Yes | Yes | Yes | Yes | Yes | Plugin | Plugin | Plugin | Yes | -- | Yes (capture-only) | Yes | -- | ✓ (via tool_result event) | ✓ (via tool_result event) |
|
|
1245
|
+
| **UserPromptSubmit** | Captures user decisions and corrections | Yes | -- | -- | -- | Yes | -- | Plugin (via chat.message) | Plugin (via chat.message) | -- | Yes | -- | -- | -- | -- | -- | -- |
|
|
1246
|
+
| **Stop** | Captures assistant turn-end state | Yes | -- | -- | -- | Yes | Yes | -- | -- | -- | Yes | -- | Best-effort | -- | -- | -- | -- |
|
|
1247
|
+
| **PreCompact** | Builds snapshot before compaction | Yes | Yes | Yes | Yes | Yes | -- | Plugin | Plugin | Plugin | Yes | -- | -- | -- | -- | ✓ (via session_before_compact) | ✓ (via session_before_compact) |
|
|
1248
|
+
| **SessionStart** | Restores state after compaction or resume | Yes | Yes | Yes | Yes | Yes | -- | ✓ (via experimental.chat.system.transform) | ✓ (via experimental.chat.system.transform) | Plugin | Yes | -- | -- | -- | -- | ✓ (via session_start event) | ✓ (via session_start event) |
|
|
1249
|
+
| | **Session completeness** | **Full** | **High** | **High** | **High** | **High** | **Partial** | **Full** | **Full** | **High** | **Partial** | **--** | **Partial** | **Partial** | **--** | **High** | **High** |
|
|
1157
1250
|
|
|
1158
|
-
> **Note:** Full session continuity (capture + snapshot + restore) works on **Claude Code**, **Gemini CLI**, **VS Code Copilot**, **JetBrains Copilot**, **OpenCode**, and **KiloCode**. **OpenCode** and **KiloCode** use `experimental.chat.system.transform` as a SessionStart surrogate to inject the routing block and restore prior sessions, plus `chat.message` for user-prompt capture; full SessionStart hook support is not yet available ([#14808](https://github.com/sst/opencode/issues/14808), [#5409](https://github.com/sst/opencode/issues/5409)), but prior-session continuity and user-decision capture work fully. **Cursor** captures tool events via `preToolUse`/`postToolUse`, but `sessionStart` is currently rejected by Cursor's validator ([forum report](https://forum.cursor.com/t/unknown-hook-type-sessionstart/149566)), so session restore after compaction is not available yet. **OpenClaw** uses native gateway plugin hooks (`api.on()`) for full session continuity. **Pi Coding Agent** provides high session continuity via extension hooks (`tool_call`, `tool_result`, `session_start`, `session_before_compact`). **Codex CLI** provides partial hook-based session tracking through PreToolUse, PostToolUse, PreCompact, SessionStart, UserPromptSubmit, and Stop; MCP tools work. **Antigravity
|
|
1251
|
+
> **Note:** Full session continuity (capture + snapshot + restore) works on **Claude Code**, **Gemini CLI**, **VS Code Copilot**, **JetBrains Copilot**, **OpenCode**, and **KiloCode**. **GitHub Copilot CLI** uses its own camelCase hook config keys (`preToolUse`, `postToolUse`, `preCompact`, `sessionStart`, `userPromptSubmitted`, `agentStop`) and top-level hook responses; it captures prompt, tool, compaction, session-start, and stop events when the plugin hooks are installed. **OpenCode** and **KiloCode** use `experimental.chat.system.transform` as a SessionStart surrogate to inject the routing block and restore prior sessions, plus `chat.message` for user-prompt capture; full SessionStart hook support is not yet available ([#14808](https://github.com/sst/opencode/issues/14808), [#5409](https://github.com/sst/opencode/issues/5409)), but prior-session continuity and user-decision capture work fully. **Cursor** captures tool events via `preToolUse`/`postToolUse`, but `sessionStart` is currently rejected by Cursor's validator ([forum report](https://forum.cursor.com/t/unknown-hook-type-sessionstart/149566)), so session restore after compaction is not available yet. **OpenClaw** uses native gateway plugin hooks (`api.on()`) for full session continuity. **Pi Coding Agent** provides high session continuity via extension hooks (`tool_call`, `tool_result`, `session_start`, `session_before_compact`). **Codex CLI** provides partial hook-based session tracking through PreToolUse, PostToolUse, PreCompact, SessionStart, UserPromptSubmit, and Stop; MCP tools work. **Antigravity IDE** and **Zed** have no hook support in the current release, so session tracking is not available there. **Antigravity CLI (`agy`)** is separate from the IDE and supports bounded `PreToolUse`, capture-only `PostToolUse`, and best-effort `Stop` through its plugin hooks. **Kiro** captures tool events via native `preToolUse`/`postToolUse` hooks, but its SessionStart equivalent (`agentSpawn`) is not yet wired, so session restore after compaction is unavailable. **OMP** (Oh My Pi) ships full plugin-based hook support — `omp plugin install context-mode` registers `tool_call`, `tool_result`, `session_start`, and `session_before_compact` handlers and storage roots cleanly under `~/.omp/context-mode/` so OMP and Pi installs never share state.
|
|
1159
1252
|
|
|
1160
1253
|
<details>
|
|
1161
1254
|
<summary><strong>What gets captured</strong></summary>
|
|
@@ -1246,6 +1339,8 @@ Detailed event data is also indexed into FTS5 for on-demand retrieval via `ctx_s
|
|
|
1246
1339
|
|
|
1247
1340
|
**JetBrains Copilot** — High coverage. Same capabilities as VS Code Copilot — PostToolUse, PreCompact, and SessionStart all fire. Uses the same hook wire protocol and response format. User decisions aren't captured but all tool-level events are.
|
|
1248
1341
|
|
|
1342
|
+
**GitHub Copilot CLI** — High coverage. Native plugin hooks use camelCase config keys (`preToolUse`, `postToolUse`, `preCompact`, `sessionStart`, `userPromptSubmitted`, `agentStop`) and top-level hook response fields. The plugin captures user prompts, tool events, compaction snapshots, session start restore, and stop events.
|
|
1343
|
+
|
|
1249
1344
|
**Cursor** — Partial coverage. Native `preToolUse` and `postToolUse` hooks capture tool events. `sessionStart` is documented by Cursor but currently rejected by their validator, so session restore is not available. Routing instructions are delivered via MCP server startup instead.
|
|
1250
1345
|
|
|
1251
1346
|
**OpenCode** — Full session support. The TypeScript plugin captures PostToolUse events via `tool.execute.after`, user prompts and decisions via `chat.message`, builds compaction snapshots via `experimental.session.compacting`, and restores prior sessions via `experimental.chat.system.transform` (SessionStart surrogate). Routing block is injected on first `chat.system.transform` per session. AGENTS.md/CLAUDE.md/CONTEXT.md rules are captured automatically on first hook fire.
|
|
@@ -1258,6 +1353,8 @@ Detailed event data is also indexed into FTS5 for on-demand retrieval via `ctx_s
|
|
|
1258
1353
|
|
|
1259
1354
|
**Antigravity** — No session support. No hooks, no event capture. Requires manually copying `GEMINI.md` to your project root. Auto-detected via MCP protocol handshake (`clientInfo.name`).
|
|
1260
1355
|
|
|
1356
|
+
**Antigravity CLI (`agy`)** — Partial coverage. The standalone CLI is separate from the IDE and supports bounded native `PreToolUse` enforcement for mapped high-flood tools, capture-only `PostToolUse`, and best-effort `Stop` through the shipped plugin hooks. It does not currently provide PreCompact/SessionStart/UserPromptSubmit coverage.
|
|
1357
|
+
|
|
1261
1358
|
**Zed** — No session support. No hooks, no event capture. Requires manually copying `AGENTS.md` to your project root. Auto-detected via MCP protocol handshake (`clientInfo.name`).
|
|
1262
1359
|
|
|
1263
1360
|
**Kiro** — Partial coverage. Native `preToolUse` and `postToolUse` hooks capture tool events and enforce sandbox routing. `agentSpawn` (the Kiro equivalent of SessionStart) is not yet implemented, so session restore after compaction is not available. Requires manually copying `KIRO.md` to your project root. Auto-detected via MCP protocol handshake (`clientInfo.name`).
|
|
@@ -1271,18 +1368,18 @@ Tool call output can be collapsed/expanded with the default Pi's default keybind
|
|
|
1271
1368
|
|
|
1272
1369
|
## Platform Compatibility
|
|
1273
1370
|
|
|
1274
|
-
| Feature | Claude Code | Qwen Code | Gemini CLI | VS Code Copilot | JetBrains Copilot | Cursor | OpenCode | KiloCode | OpenClaw | Codex CLI | Antigravity | Kiro | Zed | Pi | OMP |
|
|
1275
|
-
|
|
1276
|
-
| MCP Server / Native Tools | Yes | Yes | Yes | Yes | Yes | Yes | Native plugin | Native plugin | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
|
|
1277
|
-
| PreToolUse Hook | Yes | Yes | Yes | Yes | Yes | Yes | Plugin | Plugin | Plugin | Yes | -- | Yes | -- | Yes (extension) | Plugin |
|
|
1278
|
-
| PostToolUse Hook | Yes | Yes | Yes | Yes | Yes | Yes | Plugin | Plugin | Plugin | Yes | -- | Yes | -- | Yes (extension) | Plugin |
|
|
1279
|
-
| SessionStart Hook | Yes | Yes | Yes | Yes | Yes | -- | ✓ (via experimental.chat.system.transform) | ✓ (via experimental.chat.system.transform) | Plugin | Yes | -- | -- | -- | Yes (extension) | Plugin |
|
|
1280
|
-
| PreCompact Hook | Yes | Yes | Yes | Yes | Yes | -- | Plugin | Plugin | Plugin | Yes | -- | -- | -- | Yes (extension) | Plugin |
|
|
1281
|
-
| Can Modify Args | Yes | Yes | Yes | Yes | Yes | Yes | Plugin | Plugin | Plugin | -- | -- | -- | -- | Yes (extension) | -- |
|
|
1282
|
-
| Can Block Tools | Yes | Yes | Yes | Yes | Yes | Yes | Plugin | Plugin | Plugin | Yes | -- | Yes | -- | Yes (extension) | Plugin |
|
|
1283
|
-
| Utility Commands (ctx) | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes (/ctx-stats, /ctx-doctor) | Yes |
|
|
1284
|
-
| Slash Commands | Yes | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
|
|
1285
|
-
| Plugin Marketplace | Yes | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
|
|
1371
|
+
| Feature | Claude Code | Qwen Code | Gemini CLI | VS Code Copilot | JetBrains Copilot | GitHub Copilot CLI | Cursor | OpenCode | KiloCode | OpenClaw | Codex CLI | Kimi Code | Antigravity | Antigravity CLI (`agy`) | Kiro | Zed | Pi | OMP |
|
|
1372
|
+
|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
|
1373
|
+
| MCP Server / Native Tools | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Native plugin | Native plugin | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
|
|
1374
|
+
| PreToolUse Hook | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Plugin | Plugin | Plugin | Yes | Yes | -- | Bounded | Yes | -- | Yes (extension) | Plugin |
|
|
1375
|
+
| PostToolUse Hook | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Plugin | Plugin | Plugin | Yes | Yes | -- | Yes (capture-only) | Yes | -- | Yes (extension) | Plugin |
|
|
1376
|
+
| SessionStart Hook | Yes | Yes | Yes | Yes | Yes | Yes | -- | ✓ (via experimental.chat.system.transform) | ✓ (via experimental.chat.system.transform) | Plugin | Yes | Yes | -- | -- | -- | -- | Yes (extension) | Plugin |
|
|
1377
|
+
| PreCompact Hook | Yes | Yes | Yes | Yes | Yes | Yes | -- | Plugin | Plugin | Plugin | Yes | Yes | -- | -- | -- | -- | Yes (extension) | Plugin |
|
|
1378
|
+
| Can Modify Args | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Plugin | Plugin | Plugin | -- | Yes | -- | -- | -- | -- | Yes (extension) | -- |
|
|
1379
|
+
| Can Block Tools | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Plugin | Plugin | Plugin | Yes | Yes | -- | Bounded | Yes | -- | Yes (extension) | Plugin |
|
|
1380
|
+
| Utility Commands (ctx) | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes (/ctx-stats, /ctx-doctor) | Yes |
|
|
1381
|
+
| Slash Commands | Yes | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
|
|
1382
|
+
| Plugin Marketplace | Yes | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
|
|
1286
1383
|
|
|
1287
1384
|
> **OpenCode** uses a TypeScript plugin paradigm — hooks run as in-process functions via `tool.execute.before`, `tool.execute.after`, `experimental.session.compacting`, `experimental.chat.system.transform`, and `chat.message`, providing full routing enforcement, session continuity, and user-prompt capture. The `experimental.chat.system.transform` hook acts as a SessionStart surrogate to inject the routing block and restore prior sessions. The `chat.message` hook captures user prompts and decisions (UserPromptSubmit equivalent).
|
|
1288
1385
|
>
|
|
@@ -1292,6 +1389,8 @@ Tool call output can be collapsed/expanded with the default Pi's default keybind
|
|
|
1292
1389
|
>
|
|
1293
1390
|
> **Codex CLI** hooks require `[features].hooks = true`. MCP tools work, and hook scripts activate through `$CODEX_HOME/hooks.json` or `~/.codex/hooks.json`. PreToolUse supports `permissionDecision: "deny"` only; input modification still needs upstream `updatedInput` support ([openai/codex#18491](https://github.com/openai/codex/issues/18491)). `additionalContext` is not supported in PreToolUse (context injection works via PostToolUse and SessionStart instead; the codex formatter handles this automatically). PreCompact stores resume snapshots before compaction on Codex builds that emit the event, SessionStart restores them, and UserPromptSubmit/Stop capture prompt and turn-end continuity events. See the Codex install section for setup. **Antigravity** and **Zed** do not support hooks. They rely solely on manually-copied routing instruction files (`AGENTS.md` / `GEMINI.md`) for enforcement (~60% compliance). See each platform's install section for copy instructions. Antigravity and Zed are auto-detected via MCP protocol handshake — no manual platform configuration needed.
|
|
1294
1391
|
>
|
|
1392
|
+
> **Antigravity CLI (`agy`)** supports bounded `PreToolUse` blocking for mapped Bash/Read/Grep/WebFetch surfaces, plus `PostToolUse` capture and best-effort `Stop` capture through its plugin `hooks.json`. The routing rule and routing skill remain the broader instruction layer; `PreInvocation`/`PostInvocation` are not wired until their payload/response semantics are verified.
|
|
1393
|
+
>
|
|
1295
1394
|
> **Kiro** supports native `preToolUse` and `postToolUse` hooks for routing enforcement and tool event capture. `agentSpawn` (SessionStart equivalent) and `stop` are not yet wired. Requires manually copying `KIRO.md` to your project root. Kiro is auto-detected via MCP protocol handshake (`clientInfo.name`).
|
|
1296
1395
|
>
|
|
1297
1396
|
> **Pi Coding Agent** runs context-mode as an extension with full hook support. The extension registers `tool_call`, `tool_result`, `session_start`, and `session_before_compact` events, providing high session continuity coverage. The MCP server provides all 11 MCP tools.
|
|
@@ -1302,7 +1401,7 @@ Tool call output can be collapsed/expanded with the default Pi's default keybind
|
|
|
1302
1401
|
|
|
1303
1402
|
Hooks intercept tool calls programmatically — they can block dangerous commands and redirect them to the sandbox before execution. Instruction files guide the model via prompt instructions but cannot block anything. **Always enable hooks where supported.**
|
|
1304
1403
|
|
|
1305
|
-
> **Note:** Routing instruction files were previously auto-written to project directories on first session start. This was disabled to prevent git tree pollution ([#158](https://github.com/mksglu/context-mode/issues/158), [#164](https://github.com/mksglu/context-mode/issues/164)). Hook-capable platforms (Claude Code, Gemini CLI, VS Code Copilot, JetBrains Copilot, Cursor, OpenCode, OpenClaw, Codex CLI, OMP via plugin) inject routing
|
|
1404
|
+
> **Note:** Routing instruction files were previously auto-written to project directories on first session start. This was disabled to prevent git tree pollution ([#158](https://github.com/mksglu/context-mode/issues/158), [#164](https://github.com/mksglu/context-mode/issues/164)). Hook-capable platforms (Claude Code, Gemini CLI, VS Code Copilot, JetBrains Copilot, GitHub Copilot CLI, Cursor, OpenCode, OpenClaw, Codex CLI, Antigravity CLI for bounded tool hooks, Kiro for tool hooks, OMP via plugin) inject or enforce routing without writing files. Platforms without hook support — Zed and Antigravity IDE — require a one-time manual copy of the routing file; see each platform's install section.
|
|
1306
1405
|
|
|
1307
1406
|
| Platform | Hooks | Instruction File | With Hooks | Without Hooks |
|
|
1308
1407
|
|---|:---:|---|:---:|:---:|
|
|
@@ -1310,11 +1409,13 @@ Hooks intercept tool calls programmatically — they can block dangerous command
|
|
|
1310
1409
|
| Gemini CLI | Yes | [`GEMINI.md`](configs/gemini-cli/GEMINI.md) | **~98% saved** | ~60% saved |
|
|
1311
1410
|
| VS Code Copilot | Yes | [`copilot-instructions.md`](configs/vscode-copilot/copilot-instructions.md) | **~98% saved** | ~60% saved |
|
|
1312
1411
|
| JetBrains Copilot | Yes | [`copilot-instructions.md`](configs/vscode-copilot/copilot-instructions.md) | **~98% saved** | ~60% saved |
|
|
1412
|
+
| GitHub Copilot CLI | Yes | [`copilot-instructions.md`](configs/vscode-copilot/copilot-instructions.md) | **~98% saved** | ~60% saved |
|
|
1313
1413
|
| Cursor | Yes | [`context-mode.mdc`](configs/cursor/context-mode.mdc) | **~98% saved** | ~60% saved |
|
|
1314
1414
|
| OpenCode | Plugin | [`AGENTS.md`](configs/opencode/AGENTS.md) | **~98% saved** | ~60% saved |
|
|
1315
1415
|
| OpenClaw | Plugin | [`AGENTS.md`](configs/openclaw/AGENTS.md) | **~98% saved** | ~60% saved |
|
|
1316
1416
|
| Codex CLI | Yes | [`AGENTS.md`](configs/codex/AGENTS.md) | **~98% saved** | ~60% saved |
|
|
1317
1417
|
| Antigravity | -- | [`GEMINI.md`](configs/antigravity/GEMINI.md) | -- | ~60% saved |
|
|
1418
|
+
| Antigravity CLI (`agy`) | Bounded | routing rule + skill ([`rules`](configs/antigravity-cli/rules/context-mode.md), [`skill`](configs/antigravity-cli/skills/context-mode/SKILL.md)) | bounded Bash/Read/Grep/WebFetch enforcement | ~60% saved |
|
|
1318
1419
|
| Kiro | Yes | [`KIRO.md`](configs/kiro/KIRO.md) | **~98% saved** | ~60% saved |
|
|
1319
1420
|
| Zed | -- | [`AGENTS.md`](configs/zed/AGENTS.md) | -- | ~60% saved |
|
|
1320
1421
|
| Pi | ✓ | [`AGENTS.md`](configs/pi/AGENTS.md) | **~98% saved** | ~60% saved |
|
|
@@ -1335,7 +1436,7 @@ ctx index → index a local file or directory for later search
|
|
|
1335
1436
|
ctx search → search previously indexed content
|
|
1336
1437
|
ctx upgrade → update from GitHub, rebuild, reconfigure hooks
|
|
1337
1438
|
ctx purge → permanently delete all indexed content from the knowledge base
|
|
1338
|
-
ctx insight →
|
|
1439
|
+
ctx insight → opens the hosted Insight dashboard in your browser
|
|
1339
1440
|
```
|
|
1340
1441
|
|
|
1341
1442
|
**From your terminal** — run directly without an AI session:
|
|
@@ -1345,7 +1446,7 @@ context-mode doctor
|
|
|
1345
1446
|
context-mode index . --source project:my-app
|
|
1346
1447
|
context-mode search "authentication middleware" --source project:my-app
|
|
1347
1448
|
context-mode upgrade
|
|
1348
|
-
context-mode insight # opens
|
|
1449
|
+
context-mode insight # opens the hosted Insight dashboard in browser
|
|
1349
1450
|
bash scripts/ctx-debug.sh # full diagnostic report for bug reports
|
|
1350
1451
|
```
|
|
1351
1452
|
|
|
@@ -1453,6 +1554,24 @@ Commands chained with `&&`, `;`, or `|` are split — each part is checked separ
|
|
|
1453
1554
|
|
|
1454
1555
|
**deny** always wins over **allow**. More specific (project-level) rules override global ones.
|
|
1455
1556
|
|
|
1557
|
+
### Project-boundary containment
|
|
1558
|
+
|
|
1559
|
+
`ctx_execute_file` is confined to the project root. A `path` that resolves **outside** the workspace — an absolute path like `/home/user/secrets`, a `../../` traversal, or a project-local symlink whose target escapes the project — is refused with a `File access blocked` error. This closes the [#852](https://github.com/mksglu/context-mode/issues/852) escape vector where an agent, denied an out-of-project read by the host sandbox, retried through the MCP sandbox (the host's MCP approval prompt cannot inspect the tool's input params, so the escape was invisible to the approver).
|
|
1560
|
+
|
|
1561
|
+
The guard is **on by default** and requires no configuration. To intentionally process a file outside the project (e.g. a shared log under `/var/log`), opt that path back in with the **same `permissions.allow` rule you already use for the host `Read` tool** — there is no context-mode-specific env flag:
|
|
1562
|
+
|
|
1563
|
+
```json
|
|
1564
|
+
{
|
|
1565
|
+
"permissions": {
|
|
1566
|
+
"allow": ["Read(/var/log/**)"]
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
```
|
|
1570
|
+
|
|
1571
|
+
context-mode honors that allow rule (read from your `.claude/settings.json` / `~/.claude/settings.json`) exactly as Claude Code does, so an out-of-project grant lives in one place and stays meaningful.
|
|
1572
|
+
|
|
1573
|
+
Reviewing the prompt: the `ctx_execute` / `ctx_execute_file` approval titles now read as code execution ("Run code in a sandbox…", "Run code over a file…") so an unfamiliar reviewer can recognise the action class even though the MCP prompt renders only the tool title and raw arguments. `ctx_execute` and `ctx_batch_execute` run arbitrary code and still inherit the process's filesystem access, so the boundary guard is a defense-in-depth layer for the *file-read* tool, not a full OS sandbox — treat approving any execution tool as approving arbitrary code, and keep host-level sandboxing enabled.
|
|
1574
|
+
|
|
1456
1575
|
### Network fetch hardening
|
|
1457
1576
|
|
|
1458
1577
|
`ctx_fetch_and_index` blocks dangerous URL targets by default:
|
package/bin/statusline.mjs
CHANGED
|
@@ -96,7 +96,12 @@ function readStdinJson() {
|
|
|
96
96
|
const raw = readFileSync(0, "utf-8");
|
|
97
97
|
if (!raw.trim()) return {};
|
|
98
98
|
return JSON.parse(raw);
|
|
99
|
-
} catch {
|
|
99
|
+
} catch (err) {
|
|
100
|
+
// The payload is load-bearing — it carries session_id, which resolves the
|
|
101
|
+
// per-session KPI. Empty stdin (normal first render) returned above and
|
|
102
|
+
// stays silent; a non-empty payload that fails to parse is a real anomaly
|
|
103
|
+
// worth one latched stderr line (never pollutes the statusline's stdout).
|
|
104
|
+
warnOnce("stdin-parse", `failed to parse statusline stdin JSON: ${err?.message ?? err}`);
|
|
100
105
|
return {};
|
|
101
106
|
}
|
|
102
107
|
}
|
|
@@ -187,8 +192,23 @@ function findClaudePidDarwin() {
|
|
|
187
192
|
return process.ppid;
|
|
188
193
|
}
|
|
189
194
|
|
|
190
|
-
function resolveSessionId() {
|
|
195
|
+
function resolveSessionId(payload) {
|
|
196
|
+
// PRIMARY: the session_id Claude Code delivers in the statusLine stdin
|
|
197
|
+
// payload. This is the SAME id the recording hooks key session_events by,
|
|
198
|
+
// so it's the only source that reliably matches stored per-session data.
|
|
199
|
+
//
|
|
200
|
+
// Claude Code does NOT export a CLAUDE_SESSION_ID env var — session_id is
|
|
201
|
+
// delivered only in the stdin JSON (statusline.md "Available data"). And the
|
|
202
|
+
// /proc PID walk yields `pid-<n>`, which never matches a UUID-keyed session.
|
|
203
|
+
// So without reading the payload, the per-session KPI is unreachable and the
|
|
204
|
+
// bar falls back to the global lifetime aggregate — identical in every
|
|
205
|
+
// session and seemingly "frozen".
|
|
206
|
+
const fromPayload = payload?.session_id;
|
|
207
|
+
if (typeof fromPayload === "string" && fromPayload) return fromPayload;
|
|
208
|
+
// Fallback when the payload carries no session_id (and how test fixtures
|
|
209
|
+
// pin a deterministic id). NOT an override — payload wins when present.
|
|
191
210
|
if (process.env.CLAUDE_SESSION_ID) return process.env.CLAUDE_SESSION_ID;
|
|
211
|
+
// Last resort: walk the process tree (only matches pid-keyed events).
|
|
192
212
|
return `pid-${findClaudePid()}`;
|
|
193
213
|
}
|
|
194
214
|
|
|
@@ -208,9 +228,9 @@ function statusDot(pct) {
|
|
|
208
228
|
|
|
209
229
|
// ── Main render ──────────────────────────────────────────────────────────
|
|
210
230
|
async function main() {
|
|
211
|
-
readStdinJson(); //
|
|
231
|
+
const payload = readStdinJson(); // canonical source of session_id
|
|
212
232
|
const sessionsDir = resolveSessionDir();
|
|
213
|
-
const sessionId = resolveSessionId();
|
|
233
|
+
const sessionId = resolveSessionId(payload);
|
|
214
234
|
|
|
215
235
|
const analytics = await loadAnalytics();
|
|
216
236
|
|
|
@@ -20,7 +20,7 @@ import { BaseAdapter } from "../base.js";
|
|
|
20
20
|
import type { HookAdapter, HookParadigm, PlatformCapabilities, DiagnosticResult, PreToolUseEvent, PostToolUseEvent, PreCompactEvent, SessionStartEvent, PreToolUseResponse, PostToolUseResponse, PreCompactResponse, SessionStartResponse, HookRegistration } from "../types.js";
|
|
21
21
|
export declare class AntigravityAdapter extends BaseAdapter implements HookAdapter {
|
|
22
22
|
constructor();
|
|
23
|
-
readonly name
|
|
23
|
+
readonly name: string;
|
|
24
24
|
readonly paradigm: HookParadigm;
|
|
25
25
|
readonly capabilities: PlatformCapabilities;
|
|
26
26
|
parsePreToolUseInput(_raw: unknown): PreToolUseEvent;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* adapters/antigravity-cli — Google Antigravity CLI (`agy`) adapter.
|
|
3
|
+
*
|
|
4
|
+
* Integration: MCP tools plus agy's Claude-compatible hook surface. `agy`
|
|
5
|
+
* reads its global MCP profile from `~/.gemini/config/mcp_config.json`
|
|
6
|
+
* (distinct from the Antigravity IDE's `~/.gemini/antigravity/mcp_config.json`)
|
|
7
|
+
* and hooks from `~/.gemini/config/hooks.json`, or from an installed agy
|
|
8
|
+
* plugin's root `hooks.json`.
|
|
9
|
+
*
|
|
10
|
+
* context-mode wires only the surfaces that have a verified mapping:
|
|
11
|
+
* - PreToolUse for bounded routing enforcement on Bash/Read/Grep/WebFetch
|
|
12
|
+
* - PostToolUse capture for executed tool calls
|
|
13
|
+
* - best-effort Stop capture for session-end continuity when agy emits it
|
|
14
|
+
*
|
|
15
|
+
* PreInvocation/PostInvocation are intentionally not registered here: there is
|
|
16
|
+
* no verified payload/response contract or shared context-mode pipeline target
|
|
17
|
+
* for those agy events yet.
|
|
18
|
+
*/
|
|
19
|
+
import { AntigravityAdapter } from "../antigravity/index.js";
|
|
20
|
+
import type { DiagnosticResult, HookParadigm, PlatformCapabilities, PostToolUseEvent, PostToolUseResponse, PreToolUseEvent, PreToolUseResponse } from "../types.js";
|
|
21
|
+
export declare function antigravityCliMcpConfigPath(): string;
|
|
22
|
+
export declare function antigravityCliConfigDir(): string;
|
|
23
|
+
/** agy reads user hooks from ~/.gemini/config/hooks.json (sibling of mcp_config.json). */
|
|
24
|
+
export declare function antigravityCliHooksPath(): string;
|
|
25
|
+
/**
|
|
26
|
+
* `agy plugin install <bundle>` registers MCP + hook + skill into agy's plugin
|
|
27
|
+
* profile under ~/.gemini/config/plugins/<name>/ (verified on agy 1.0.6, re-verified 1.0.10) — the
|
|
28
|
+
* canonical install. The global mcp_config.json / hooks.json paths above are the
|
|
29
|
+
* manual (no-plugin) fallback. doctor must recognize BOTH.
|
|
30
|
+
*/
|
|
31
|
+
export declare function antigravityCliPluginDir(): string;
|
|
32
|
+
export declare class AntigravityCliAdapter extends AntigravityAdapter {
|
|
33
|
+
readonly name = "Antigravity CLI";
|
|
34
|
+
readonly paradigm: HookParadigm;
|
|
35
|
+
readonly capabilities: PlatformCapabilities;
|
|
36
|
+
getSettingsPath(): string;
|
|
37
|
+
getConfigDir(_projectDir?: string): string;
|
|
38
|
+
parsePreToolUseInput(raw: unknown): PreToolUseEvent;
|
|
39
|
+
parsePostToolUseInput(raw: unknown): PostToolUseEvent;
|
|
40
|
+
formatPreToolUseResponse(response: PreToolUseResponse): unknown;
|
|
41
|
+
formatPostToolUseResponse(_response: PostToolUseResponse): unknown;
|
|
42
|
+
checkPluginRegistration(): DiagnosticResult;
|
|
43
|
+
getInstalledVersion(): string;
|
|
44
|
+
/**
|
|
45
|
+
* Write/merge the agy hooks into ~/.gemini/config/hooks.json (manual,
|
|
46
|
+
* non-plugin path). Idempotent — unrelated hook entries are preserved.
|
|
47
|
+
*/
|
|
48
|
+
configureAllHooks(_pluginRoot: string): string[];
|
|
49
|
+
/** Report agy hook status across plugin and manual profiles. */
|
|
50
|
+
validateHooks(_pluginRoot: string): DiagnosticResult[];
|
|
51
|
+
}
|