Antigravity CLI — Patterns
Reusable patterns for Antigravity CLI. Multi-agent workflows, async tasks, hooks, model routing, cross-model review, and CI/CD integration.
Antigravity CLI — Patterns
Reusable workflow patterns for Antigravity CLI.
Multi-Agent Workflows
Antigravity CLI's subagent system lets you run multiple agents concurrently:
Background Code Review
> /agents --background --model "Claude Opus 4.6 (Thinking)"
"Review src/auth/ for security vulnerabilities"
> /agents --background --model "Gemini 3.5 Flash (High)"
"Review src/ui/ for accessibility issues"
> /agents --background --model "Claude Sonnet 4.6 (Thinking)"
"Review src/api/ for error handling gaps"
... continue working while agents run ...
Results arrive asynchronously.
Generate + Polish Pipeline
> /model Gemini 3.5 Flash (High)
> Generate a complete CRUD API for a blog platform
> /model Claude Opus 4.6 (Thinking)
> Review the generated code for: edge cases, error handling, performance
Async Background Tasks
Delegate long-running work and keep your session free:
> /agents --background "Refactor all SQL queries to use parameterized statements"
> /agents --background --model "Gemini 3.1 Pro (High)"
"Write documentation for all exported functions in src/lib/"
Check status:
> /agents status
[1] Refactoring SQL queries — 12/24 files complete
[2] Writing documentation — 8/15 functions complete
Hooks Pipeline
Combine hooks for autonomous fix → verify → report cycles:
.gemini/hooks/
├── pre-apply # Always run lint before changes
├── post-apply # Run formatter after changes
└── verify # Build + test after changes
pre-apply:
#!/bin/bash
npm run lint
post-apply:
#!/bin/bash
npx prettier --write .
verify:
#!/bin/bash
npm run build && npm test
The agent automatically runs these hooks in sequence, retrying on failure.
Cross-Model Review
Use different models for generation vs. review:
> /model Gemini 3.5 Flash (High)
> Generate a TypeScript utility: debounce, throttle, memoize
> /model Claude Opus 4.6 (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: Review
run: agy -p "Review this PR diff" --output-format json
env:
ANTIGRAVITY_API_KEY: ${{ secrets.ANTIGRAVITY_API_KEY }}
Automated Documentation
agy -p "Generate API documentation from JSDoc comments in src/api/" \
--output-format json
Related
Related Articles
GitHub Copilot — AI Coding Assistant
Complete guide to GitHub Copilot, the AI coding assistant. Covers prompt engineering, configuration, copilot-instructions.md, agent mode, and GitHub workflow integration.
Claude Code — AI Coding Agent
Complete guide to Claude Code, Anthropic's terminal-based AI coding agent. Covers installation, prompt engineering, configuration, CLAUDE.md patterns, and best practices.
OpenCode Configuration Loop with Hermes Autonomous Agent
OpenCode configures Hermes for autonomous execution, reviews the output, and adjusts the config. An iterative two-agent workflow for long-running tasks.