These docs track main. Latest release: v1.2.0.

antigravity-booster
Guides

Headless and MCP

How the /agb-* slash commands drive the CLI, the residual risk in agy print mode, and the agb MCP server.

agb is a CLI first. Inside Antigravity it is reached two ways: slash commands that tell the agent to run the CLI, and an MCP server that exposes the same commands as tools. Both end up running the same agb binary, so behavior, exit codes and safety rails are identical.

The slash-command model

The plugin ships eight commands: /agb (the natural-language umbrella router), /agb-bootstrap, /agb-doctor, /agb-migrate, /agb-plan, /agb-review, /agb-run and /agb-sidecar. Each is a Markdown prompt, not code. It tells the agent to run the terminal shim ~/.local/bin/agb <command> with its shell tool, pass the user's arguments through unchanged and quoted, wait, and report the output and exit code (/agb-run).

  • The shim must exist. It is written by agb bootstrap. If it is missing, the command tells the agent to stop and ask the user to bootstrap from a terminal, rather than hunting for the plugin's files (missing shim).
  • Exit codes are reported as-is: 0 pass, 2 gate failure or findings, 1 usage or internal error.
  • Long-running commands (/agb-run, /agb-sidecar) say so: the agent confirms an ambiguous plan path before run, and starts the sidecar in the background (/agb-sidecar).

The full list with arguments is in Slash commands; the plugin's files are described in Plugin layout.

Headless use

Everything works without the desktop app. Plan in an agy session (or write spec.md yourself), then run agb plan, agb run and agb status from a terminal or CI job. agb itself drives agy headlessly: each builder, prosecutor and review lens is an agy --print call (print-mode spawn).

Residual risk in print mode

The plugin's PreToolUse policy guard (hooks.json) only ever answers deny, ask or pass-through. In print mode (agy -p) there is no one to answer ask, and Antigravity treats it as allow (residual risk).

  • Sessions started by agb are safe from this. Every agy spawn is marked as a worker: AGB_WORKER_TICKET=<id> for builders, AGB_WORKER_MODE=readonly otherwise, with any inherited values removed first (worker marking). The guard treats marked sessions as headless and returns deny where it would otherwise ask (headless context, example).
  • Your own agy -p sessions are not marked. Frozen-rail and protected-root denials still apply, but any command that would have asked runs.
  • The backstop is merge time. adlc rails-guard runs before anything reaches the base branch, in agb and in CI. See Rail enforcement and Policy guard.
Do not run unattended agy -p sessions in a repo with frozen rails and assume the guard will stop a risky command. Run the work through agb, which marks its sessions, or review the result before it merges.

The MCP server

The plugin registers an MCP server named agb, launched through bin/node-launcher.sh with the bundled dist/mcp-server.mjs (mcp_config.json). It speaks JSON-RPC over stdio and exposes six tools: agb_plan, agb_run, agb_preflight, agb_status, agb_doctor and agb_review (tool list). Each tool runs the matching CLI command as a child process and returns its output, so a tool call and a slash command produce the same result.

Use the MCP tools when the agent needs structured calls (for example in recursive mode, see Sweeps); use slash commands when a person is typing. Parameters, the CLI mapping, and concurrency configuration (via plan caps) are documented in MCP tools.

On this page