You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Step 2 — Register the MCP server.** Add to `~/.gemini/antigravity/mcp_config.json`:
308
+
309
+
```json
310
+
{
311
+
"mcpServers": {
312
+
"context-mode": {
313
+
"command": "context-mode"
314
+
}
315
+
}
316
+
}
317
+
```
318
+
319
+
**Step 3 — Restart Antigravity.** On first MCP server startup, a `GEMINI.md` routing instructions file is auto-created in your project root. Antigravity reads `GEMINI.md` automatically and learns to prefer context-mode sandbox tools.
320
+
321
+
**About hooks:** Antigravity does not support hooks — there is no public hook API. The `GEMINI.md` routing instructions file is the only enforcement method (~60% compliance). The model receives the instructions at session start and sometimes follows them, but there is no programmatic interception — it can run raw `run_command`, read large files via `view_file`, or bypass sandbox tools at any time.
322
+
323
+
**Auto-detection:** context-mode detects Antigravity automatically via the MCP protocol handshake (`clientInfo.name`). No environment variables or manual platform configuration needed.
324
+
325
+
Example MCP config: [`configs/antigravity/mcp_config.json`](configs/antigravity/mcp_config.json)
**Step 2 — Register the MCP server.** Add to `.kiro/settings/mcp.json` in your project root (or `~/.kiro/settings/mcp.json` for global):
340
+
341
+
```json
342
+
{
343
+
"mcpServers": {
344
+
"context-mode": {
345
+
"command": "context-mode"
346
+
}
347
+
}
348
+
}
349
+
```
350
+
351
+
**Step 3 — Restart Kiro.** On first MCP server startup, a `KIRO.md` routing instructions file is auto-created in your project root. Kiro reads `KIRO.md` automatically and learns to prefer context-mode sandbox tools.
352
+
353
+
**About hooks:** Kiro hook-based session continuity will be added once Kiro CLI hooks are fully tested. The `KIRO.md` routing instructions file is the current enforcement method (~60% compliance).
354
+
355
+
**Auto-detection:** context-mode detects Kiro automatically via the MCP protocol handshake (`clientInfo.name`). No environment variables or manual platform configuration needed.
> **Note:** Full session continuity (capture + snapshot + restore) works on **Claude Code**, **Gemini CLI**, **VS Code Copilot**, and **OpenCode**. **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. **OpenCode** uses the `experimental.session.compacting` plugin hook for compaction recovery, but SessionStart is not yet available ([#14808](https://github.com/sst/opencode/issues/14808)), so startup/resume is not supported. Codex CLI has no hook support, so session tracking is not available.
457
+
> **Note:** Full session continuity (capture + snapshot + restore) works on **Claude Code**, **Gemini CLI**, **VS Code Copilot**, and **OpenCode**. **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. **OpenCode** uses the `experimental.session.compacting` plugin hook for compaction recovery, but SessionStart is not yet available ([#14808](https://github.com/sst/opencode/issues/14808)), so startup/resume is not supported. **Codex CLI**, **Antigravity**, and **Kiro** have no hook support in the current release, so session tracking is not available.
@@ -474,26 +535,32 @@ Detailed event data is also indexed into FTS5 for on-demand retrieval via `searc
474
535
475
536
**Codex CLI** — No session support. No hooks means no event capture. Each compaction or new session starts fresh. The `AGENTS.md` routing instructions file is the only continuity mechanism.
476
537
538
+
**Antigravity** — No session support. Same as Codex CLI — no hooks, no event capture. The `GEMINI.md` routing instructions file is auto-written on first MCP server startup. Auto-detected via MCP protocol handshake (`clientInfo.name`).
539
+
540
+
**Kiro** — No session support in the current release. MCP-only. The `KIRO.md` routing instructions file is auto-written on first MCP server startup. Hook-based session continuity will be added once Kiro CLI hooks are fully tested. Auto-detected via MCP protocol handshake (`clientInfo.name`).
> **OpenCode** uses a TypeScript plugin paradigm — hooks run as in-process functions via `tool.execute.before`, `tool.execute.after`, and `experimental.session.compacting`, providing the same routing enforcement and session continuity as shell-based hooks. SessionStart is not yet available ([#14808](https://github.com/sst/opencode/issues/14808)), but compaction recovery works via the plugin's compacting hook.
495
560
>
496
-
> **Codex CLI** does not support hooks. It relies solely on routing instruction files (`AGENTS.md`) for enforcement (~60% compliance).
561
+
> **Codex CLI** and **Antigravity** do not support hooks. They rely solely on routing instruction files (`AGENTS.md` / `GEMINI.md`) for enforcement (~60% compliance). Antigravity is auto-detected via MCP protocol handshake — no manual platform configuration needed.
562
+
>
563
+
> **Kiro** is MCP-only in the current release. Hook-based enforcement will be added once Kiro CLI hooks are fully tested. Kiro is auto-detected via MCP protocol handshake (`clientInfo.name`).
497
564
498
565
### Routing Enforcement
499
566
@@ -507,6 +574,8 @@ Hooks intercept tool calls programmatically — they can block dangerous command
You have context-mode MCP tools available. These rules are NOT optional — they protect your context window from flooding. A single unrouted command can dump 56 KB into context and waste the entire session. Antigravity does NOT have hooks, so these instructions are your ONLY enforcement mechanism. Follow them strictly.
4
+
5
+
## BLOCKED commands — do NOT use these
6
+
7
+
### curl / wget — FORBIDDEN
8
+
Do NOT use `curl` or `wget` via `run_command`. They dump raw HTTP responses directly into your context window.
9
+
Instead use:
10
+
-`mcp__context-mode__ctx_fetch_and_index(url, source)` to fetch and index web pages
11
+
-`mcp__context-mode__ctx_execute(language: "javascript", code: "const r = await fetch(...)")` to run HTTP calls in sandbox
12
+
13
+
### Inline HTTP — FORBIDDEN
14
+
Do NOT run inline HTTP calls via `run_command` with `node -e "fetch(..."`, `python -c "requests.get(..."`, or similar patterns. They bypass the sandbox and flood context.
15
+
Instead use:
16
+
-`mcp__context-mode__ctx_execute(language, code)` to run HTTP calls in sandbox — only stdout enters context
17
+
18
+
### Direct web fetching — FORBIDDEN
19
+
Do NOT use `read_url_content` for large pages. Raw HTML can exceed 100 KB.
20
+
Instead use:
21
+
-`mcp__context-mode__ctx_fetch_and_index(url, source)` then `mcp__context-mode__ctx_search(queries)` to query the indexed content
22
+
23
+
## REDIRECTED tools — use sandbox equivalents
24
+
25
+
### Shell (>20 lines output)
26
+
`run_command` is ONLY for: `git`, `mkdir`, `rm`, `mv`, `cd`, `ls`, `npm install`, `pip install`, and other short-output commands.
27
+
For everything else, use:
28
+
-`mcp__context-mode__ctx_batch_execute(commands, queries)` — run multiple commands + search in ONE call
29
+
-`mcp__context-mode__ctx_execute(language: "shell", code: "...")` — run in sandbox, only stdout enters context
30
+
31
+
### File reading (for analysis)
32
+
If you are reading a file to **edit** it → `view_file` / `replace_file_content` is correct (edit needs content in context).
33
+
If you are reading to **analyze, explore, or summarize** → use `mcp__context-mode__ctx_execute_file(path, language, code)` instead. Only your printed summary enters context. The raw file stays in the sandbox.
34
+
35
+
### Search (large results)
36
+
Search results can flood context. Use `mcp__context-mode__ctx_execute(language: "shell", code: "grep ...")` to run searches in sandbox. Only your printed summary enters context.
37
+
38
+
## Tool selection hierarchy
39
+
40
+
1.**GATHER**: `mcp__context-mode__ctx_batch_execute(commands, queries)` — Primary tool. Runs all commands, auto-indexes output, returns search results. ONE call replaces 30+ individual calls.
41
+
2.**FOLLOW-UP**: `mcp__context-mode__ctx_search(queries: ["q1", "q2", ...])` — Query indexed content. Pass ALL questions as array in ONE call.
4.**WEB**: `mcp__context-mode__ctx_fetch_and_index(url, source)` then `mcp__context-mode__ctx_search(queries)` — Fetch, chunk, index, query. Raw HTML never enters context.
44
+
5.**INDEX**: `mcp__context-mode__ctx_index(content, source)` — Store content in FTS5 knowledge base for later search.
45
+
46
+
## Output constraints
47
+
48
+
- Keep responses under 500 words.
49
+
- Write artifacts (code, configs, PRDs) to FILES — never return them as inline text. Return only: file path + 1-line description.
50
+
- When indexing content, use descriptive source labels so others can `search(source: "label")` later.
51
+
52
+
## ctx commands
53
+
54
+
| Command | Action |
55
+
|---------|--------|
56
+
|`ctx stats`| Call the `stats` MCP tool and display the full output verbatim |
57
+
|`ctx doctor`| Call the `doctor` MCP tool, run the returned shell command, display as checklist |
58
+
|`ctx upgrade`| Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
0 commit comments