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.
Antigravity CLI (agy) is the command-line companion to Google Antigravity, a
Gemini-based agent. Unlike the Antigravity IDE, agy has a native plugin system
(agy plugin install) and a hook surface, so context-mode ships as a first-class
agy plugin. A single command registers the MCP server, a routing rule, a routing
skill, and bounded PreToolUse/PostToolUse/Stop hooks that steer data-heavy
tool output into the sandbox — the model writes a program that processes the data
and prints only the answer.
context-mode runs 100% locally with zero telemetry. Indexing and execution never leave your machine.
Install
The plugin install is a single agy command, but the plugin's MCP server and
hooks run the global context-mode binary, so npm install -g context-mode is a
prerequisite.
The GitHub-subpath install requires agy 1.0.7 or newer (subpath and branch
resolution landed in 1.0.7). Run agy update if you are on an older build.
Install the package
Install context-mode globally. The plugin's MCP server launches this binary, and the hooks dispatch through it.
npm install -g context-modeInstall the plugin
Run the plugin install. agy clones the repo, resolves the
configs/antigravity-cli subpath, and registers the bundle's native MCP server,
routing rule, routing skill, and hooks into its plugin profile under
~/.gemini/config/plugins/context-mode/.
agy plugin install https://github.com/mksglu/context-mode/tree/main/configs/antigravity-cliThe install wires three bounded hooks — PreToolUse, PostToolUse, and Stop —
each dispatching context-mode hook antigravity-cli <event>.
Hook scope
context-mode wires only the surfaces that have a verified mapping on agy:
- PreToolUse — bounded routing enforcement on the mapped high-flood tools
(
run_command,view_file,grep_search,web_fetch,read_url_content). Other tools are not PreToolUse-routed. - PostToolUse — capture-only. Records executed tool calls into the session database. agy's PostToolUse payload carries no tool-output text, so byte accounting for output is unavailable on this surface, but the tool call, project, and error state are still captured.
- Stop — best-effort, capture-only session-end marker. It is registered, but agy did not emit it in probes, so treat it as best-effort.
PreCompact, SessionStart, PreInvocation, and PostInvocation are not wired.
Where agy reads its config
agy reads its global MCP profile from ~/.gemini/config/mcp_config.json — not
the Antigravity IDE's ~/.gemini/antigravity/mcp_config.json — and its hooks from
~/.gemini/config/hooks.json. The plugin install instead registers everything
under its plugin profile at ~/.gemini/config/plugins/context-mode/. It shares
the ~/.gemini/ session root with the rest of the Gemini family; the session
database is keyed by project hash to prevent collisions.
Alternative (MCP only, no plugin)
If you cannot use the plugin install, register the MCP server manually by adding
context-mode to ~/.gemini/config/mcp_config.json under mcpServers. This path
ships no hooks, so routing enforcement is advisory only.
{
"mcpServers": {
"context-mode": {
"command": "context-mode",
"env": {
"CONTEXT_MODE_PLATFORM": "antigravity-cli"
}
}
}
}Verify
Confirm the install with the doctor. It checks language runtimes, the FTS5 knowledge base, MCP registration, and hook registration, then reports anything that needs attention.
context-mode doctorA clean run means the MCP server is reachable and the hooks are wired.
agy caches each server's tool schemas under
~/.gemini/antigravity-cli/mcp/context-mode/ and does not refresh them on
reconnect. If the ctx_* tools do not appear after an upgrade, delete that
cache directory and restart agy to force a re-fetch.
Related
Antigravity
Install context-mode in the Antigravity IDE as an MCP-only host: register an MCP server with npx and let a GEMINI.md routing file steer data-heavy output into the sandbox.
Kiro
Install context-mode in Kiro, the AWS agentic IDE, with an MCP server plus native preToolUse and postToolUse JSON hooks that reroute data-heavy tool output into the sandbox.