context-mode
Installation

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-mode

Register 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:

~/.gemini/antigravity/mcp_config.json
{
  "mcpServers": {
    "context-mode": {
      "command": "context-mode"
    }
  }
}

context-mode resolves the platform through a ranked set of signals, highest priority first:

PrioritySignalValue
1MCP client handshakeclientInfo.name reports antigravity-client
2Environment overrideCONTEXT_MODE_PLATFORM=antigravity
3Environment markerANTIGRAVITY_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.md

Antigravity 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_execute
  • ctx_execute_file
  • ctx_batch_execute
  • ctx_fetch_and_index
  • ctx_search
  • ctx_index
  • ctx_stats
  • ctx_doctor
  • ctx_insight
  • ctx_upgrade
  • ctx_purge

What differs from a hooked host is enforcement:

Host typeLarge-output routingCarried by
Hooked hostMandatoryHooks
Antigravity (MCP-only)AdvisoryGEMINI.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:

Confirm GEMINI.md is present at your project root.
Run a few data-heavy operations.
Re-check 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.

Confirm the install
context-mode doctor

Run 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.

On this page