Antigravity
Install context-mode in the Antigravity IDE as an MCP-only host: register the context-mode MCP server and copy a GEMINI.md routing file that steers data-heavy output into the sandbox.
Antigravity is Google's AI-powered IDE, a Gemini fork built on Electron and
VSCode. It integrates context-mode as an MCP-only host — Antigravity exposes no
hook surface, so routing is steered by a GEMINI.md instruction file the host
reads natively. The ctx_* tools are always available; the host decides whether
to send data-heavy output through them.
This is the Antigravity desktop IDE. For the agy command-line tool,
see Antigravity CLI — it installs as a
full plugin with hooks.
As an MCP-only host, large-output routing is advisory rather than a hard intercept. The agent follows the instruction file most of the time — roughly 60% adherence — but is not forced to, so savings vary by session.
Install
Antigravity has no plugin marketplace, so context-mode runs as an MCP server.
Prerequisites: Node.js >= 22.5 (or Bun) and the Antigravity IDE installed.
Install the package
Install context-mode globally so the context-mode binary is on your PATH —
the MCP server launches from it.
npm install -g context-modeRegister the MCP server
Add an MCP server entry to the Antigravity MCP config. Antigravity shares the
~/.gemini/ directory with Gemini CLI but reads MCP servers from a separate
file: ~/.gemini/antigravity/mcp_config.json. Point the server at the
context-mode binary:
{
"mcpServers": {
"context-mode": {
"command": "context-mode"
}
}
}context-mode resolves the platform through a ranked set of signals, highest priority first:
| Priority | Signal | Value |
|---|---|---|
| 1 | MCP client handshake | clientInfo.name reports antigravity-client |
| 2 | Environment override | CONTEXT_MODE_PLATFORM=antigravity |
| 3 | Environment marker | ANTIGRAVITY_CLI_ALIAS |
If detection is ever ambiguous, set CONTEXT_MODE_PLATFORM=antigravity in the
server env to force it.
Copy the routing instruction file
Antigravity has no hook surface, so routing is carried by a GEMINI.md
instruction file you copy to your project root. Auto-write to project trees was
disabled to avoid polluting git working trees, so copy it manually:
cp node_modules/context-mode/configs/antigravity/GEMINI.md ./GEMINI.mdAntigravity reads GEMINI.md natively and the file tells the agent to send
data-heavy output through the ctx_* tools. Because Antigravity shares
~/.gemini/ with Gemini CLI, session data lives under
~/.gemini/context-mode/sessions/, where each session DB file is prefixed by a
project hash so different projects never collide. For the exact path derivation
and the file contents, see configuration.
Restart Antigravity
Restart the IDE so it picks up the new MCP server and reads GEMINI.md.
What you get on this host
The full ctx_* toolset is available — there is no Antigravity-specific tool
gating. The host exposes all eleven tools:
ctx_executectx_execute_filectx_batch_executectx_fetch_and_indexctx_searchctx_indexctx_statsctx_doctorctx_insightctx_upgradectx_purge
What differs from a hooked host is enforcement:
| Host type | Large-output routing | Carried by |
|---|---|---|
| Hooked host | Mandatory | Hooks |
| Antigravity (MCP-only) | Advisory | GEMINI.md the host reads |
See tool selection for how the agent decides which tool to reach for.
Verify your savings
Confirm context-mode is actually saving you tokens, not just that the tools respond.
In an Antigravity session, type ctx stats in chat to see the tokens saved and
the savings ratio for the session. Because Antigravity is MCP-only (no hooks and
no status line), ctx stats is the primary way to confirm savings — and savings
depend on the agent honoring GEMINI.md routing (~60% compliance). To confirm:
GEMINI.md is present at your project root.ctx stats.Run context-mode doctor to confirm the MCP server is registered in
~/.gemini/antigravity/mcp_config.json. It checks:
- Language runtimes
- The FTS5 knowledge base
- MCP registration
A missing registration surfaces as a WARN (not a hard FAIL), and doctor
always warns that Antigravity has no hook support.
context-mode doctorRun from a plain shell, context-mode doctor has no MCP clientInfo
handshake, so it may detect a different platform and check a different config
path. Export CONTEXT_MODE_PLATFORM=antigravity (or set
ANTIGRAVITY_CLI_ALIAS) before running it so doctor targets the Antigravity
adapter and the ~/.gemini/antigravity/mcp_config.json path.
A clean run means the MCP server is reachable and the routing file is in place.
Related
Pi
Install context-mode in the Pi Coding Agent as an extension with full in-process hooks and an auto-bridged MCP server, for high session continuity.
Antigravity CLI
Install context-mode in Antigravity CLI (agy) with one plugin command — it registers the MCP server, a routing rule, a routing skill, and bounded JSON hooks.