Antigravity CLI — Patterns

Reusable patterns for Antigravity CLI. Multi-agent workflows, async tasks, hooks, model routing, cross-model review, and CI/CD integration.

October 20, 2026
antigravityagypatternssubagentshooksasync

Antigravity CLI — Patterns

Reusable workflow patterns for Antigravity CLI.

Multi-Agent Workflows

Antigravity CLI's subagent system lets you run multiple agents concurrently from the Agent Manager:

Background Code Review

Open /agents to launch the Agent Manager, then start a review subagent for each area and select its model in the panel. There are no task or model flags on /agents itself.

Review src/auth/ for security vulnerabilities with Claude Opus 5.5, src/ui/ for accessibility issues with Gemini 3.8 Flash, and src/api/ for error handling gaps with Claude Sonnet 5.5. Results arrive asynchronously in the Agent Manager while you continue working.

Generate + Polish Pipeline

> /model Gemini 3.8 Flash (High)
> Generate a complete CRUD API for a blog platform
> /model Claude Opus 5.5 (Thinking)
> Review the generated code for: edge cases, error handling, performance

Async Background Tasks

Delegate long-running work and keep your session free by starting subagents from /agents. The Agent Manager shows their live status and completion; use it to monitor work rather than passing task strings to the command.

Examples of work to delegate:

  • Refactor all SQL queries to use parameterized statements.
  • Write documentation for all exported functions in src/lib/ with Gemini 3.1 Pro.

Hooks Pipeline

Hooks are JSON entries in .agents/hooks.json (workspace) or ~/.gemini/config/hooks.json (global), not executable files under .gemini/hooks/. A lint/format/test pipeline:

{
  "lint-changes": {
    "PostToolUse": [
      {
        "matcher": "write_to_file|replace_file_content",
        "hooks": [
          {
            "type": "command",
            "command": "npm run lint"
          }
        ]
      }
    ]
  },
  "format-changes": {
    "PostToolUse": [
      {
        "matcher": "write_to_file|replace_file_content",
        "hooks": [
          {
            "type": "command",
            "command": "npx prettier --write ."
          }
        ]
      }
    ]
  },
  "verify-build": {
    "Stop": [
      {
        "type": "command",
        "command": "npm run build && npm test"
      }
    ]
  }
}

The agent runs matching hooks around tools and at the end of the loop; it does not retry a failing hook automatically.

Cross-Model Review

Use different models for generation vs. review:

> /model Gemini 3.8 Flash (High)
> Generate a TypeScript utility: debounce, throttle, memoize
> /model Claude Opus 5.5 (Thinking)
> Audit the generated utilities for: type safety, edge cases, performance

CI/CD Integration

PR Review (GitHub Actions)

name: AI PR Review
on: [pull_request]
jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install agy
        run: curl -fsSL https://antigravity.google/cli/install.sh | bash
      - name: Configure Gemini API key auth
        run: |
          mkdir -p ~/.gemini/antigravity-cli
          printf '%s\n' '{"modelProvider":"gemini"}' > ~/.gemini/antigravity-cli/settings.json
      - name: Review
        run: agy -p "Review this PR diff" --output-format json
        env:
          GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}

Automated Documentation

agy -p "Generate API documentation from JSDoc comments in src/api/" \
  --output-format json

Sources