Imported from Frostthejack/hermes-tailscale-rw (
profiles/backend-eng/skills/autonomous-ai-agents/antigravity-cli/SKILL.md). Install upstream withnpx skills add Frostthejack/hermes-tailscale-rw --skill antigravity-cli. Copyright stays with the author (MIT).
Antigravity CLI — Hermes Orchestration Guide
Delegate coding tasks to Google Antigravity CLI (agy) — Google's Go-based terminal agent that replaces Gemini CLI (sunset June 18, 2026). Antigravity shares its agent engine with the Antigravity 2.0 desktop app and runs on Gemini 3.5 Flash.
Prerequisites
- Install:
curl -fsSL https://antigravity.google/cli/install.sh | bash - Verify:
agy --version(v1.0.1+) - Binary location:
~/.local/bin/agy(Unix) or%LOCALAPPDATA%\Antigravity\(Windows) - Auth: First run opens browser for Google Sign-In, or set
ANTIGRAVITY_API_KEYfor CI - Migrate from Gemini CLI:
agy plugin import gemini
Product Family
All Antigravity surfaces share the same core agent engine and settings:
| Surface | Description |
|---|---|
Antigravity CLI (agy) |
Terminal-first, lightweight TUI — fast, keyboard-centric |
| Antigravity 2.0 | Desktop app — visual orchestration, project management |
| Antigravity SDK | Python framework for custom agent builds |
| Antigravity IDE | Full AI-powered development environment |
Integration: Conversations can be exported from CLI to Antigravity 2.0 via /export. Settings changes sync bidirectionally.
Auth Modes
| Mode | How |
|---|---|
| Desktop | Google Sign-In OAuth → system keyring |
| SSH/Remote | CLI prints URL + code → open on local machine |
| CI/Scripting | export ANTIGRAVITY_API_KEY=<key> |
| Enterprise | Connect GCP project |
Two Orchestration Modes
Mode 1: Print Mode (-p) — Non-Interactive (PREFERRED for most tasks)
One-shot task execution. No PTY needed. No interactive prompts. Best for automation and kanban lanes.
terminal(
command='agy -p "Add error handling to all API calls in src/" '
'--dangerously-skip-permissions '
'--print-timeout 5m0s',
workdir="/path/to/project",
timeout=300
)
When to use print mode:
- One-shot coding tasks (fix bug, add feature, refactor)
- CI/CD automation and scripting
- Piped input processing (
cat file | agy -p "analyze this") - Kanban lane delegation (bounded implementation tasks)
- Any task where you don't need multi-turn conversation
Key print mode flags:
| Flag | Effect |
|---|---|
-p, --print |
Non-interactive, exits when done |
--prompt |
Alias for --print |
--print-timeout <duration> |
Timeout (default 5m0s) |
--output-format json |
Structured output |
--add-dir <path> |
REQUIRED to make agy modify files in the target directory. Without this, agy creates its own scratch project under ~/.gemini/antigravity-cli/scratch/ |
--dangerously-skip-permissions |
Auto-approve all tool permission requests |
--sandbox |
Run in OS-level terminal sandbox (nsjail on Linux) |
Mode 2: Interactive TUI via tmux — Multi-Turn Sessions
Full conversational REPL with slash commands, subagent management, and plugins. Requires tmux orchestration.
# Start a tmux session
terminal(command="tmux new-session -d -s agy-work -x 140 -y 40")
# Launch Antigravity CLI inside it
terminal(command="tmux send-keys -t agy-work 'cd /path/to/project && agy' Enter")
# Handle trust dialog (first visit to directory)
terminal(command="sleep 4 && tmux send-keys -t agy-work Enter")
# Send task
terminal(command="sleep 1 && tmux send-keys -t agy-work 'Refactor the auth module' Enter")
# Monitor progress
terminal(command="sleep 15 && tmux capture-pane -t agy-work -p -S -60")
# Exit when done
terminal(command="tmux send-keys -t agy-work '/exit' Enter")
When to use interactive mode:
- Multi-turn iterative work
- Tasks requiring human-in-the-loop decisions
- Exploratory coding sessions
- When you need slash commands (
/agents,/mcp,/skills,/schedule)
Print Mode Details
Structured JSON Output
terminal(
command='agy -p "Analyze auth.py for security issues" '
'--output-format json '
'--dangerously-skip-permissions '
'--print-timeout 3m0s',
workdir="/path/to/project",
timeout=180
)
Session Continuation
# Continue the most recent session in this directory
agy -p "Continue working" --continue
# Resume specific session by ID
agy -p "Continue working" --conversation <id>
Complete CLI Flags Reference
| Flag | Effect |
|---|---|
-p, --print |
Non-interactive one-shot mode |
--prompt |
Alias for --print |
--print-timeout <d> |
Timeout (default 5m0s) |
-c, --continue |
Resume most recent conversation |
--conversation <id> |
Resume specific conversation |
-i, --prompt-interactive |
Run initial prompt then stay interactive |
--add-dir <paths> |
Grant access to additional directories (repeatable) |
--dangerously-skip-permissions |
Auto-approve everything |
--sandbox |
OS-level terminal sandbox (nsjail on Linux) |
--log-file <path> |
Override log file path |
Slash Commands (Interactive Mode)
Core Commands
| Command | Purpose |
|---|---|
/help |
List all commands and keybindings |
/context |
Show token usage, checkpoints |
/usage |
Quota and rate-limit status |
/resume (/switch) |
Resume/switch sessions |
/rewind (/undo) |
Roll back to checkpoint |
/rename <name> |
Rename thread |
/permissions |
Set agent autonomy level |
/model |
Switch model mid-session |
/export |
Push session to Antigravity 2.0 GUI |
/logout |
Sign out |
Tools & Monitoring
| Command | Purpose |
|---|---|
/config or /settings |
Full settings overlay |
/statusline |
Customize status bar |
/tasks |
List/monitor/kill background tasks |
/skills |
Browse loaded agent workflows |
/mcp |
Manage MCP servers |
/agents |
Manage subagents |
/keybindings |
Edit keyboard shortcuts |
Slash Commands (Advanced)
| Command | Purpose |
|---|---|
/goal |
Agent runs until task complete |
/grill-me |
Agent asks clarifying questions first |
/fork |
Spin up a separate workspace and branch the conversation from an earlier point |
/schedule |
One-time future event or recurring schedule |
/browser |
Trigger browser subagent |
AGENTS.md — Project Context
Place at project root. Content prepended to every prompt:
# Project: My API
## Architecture
- FastAPI + SQLAlchemy, PostgreSQL, Redis
- pytest with 90% coverage target
## Key Commands
- `make test` — full test suite
- `make lint` — ruff + mypy
## Code Standards
- Type hints on all public functions
- Google-style docstrings
- No wildcard imports
Inspect what's loaded: agy inspect — prints configs, skills, plugins, hooks, MCP servers.
Subagents
Three types:
- Built-in roles (e.g., browser subagent)
- Generic clones (same capabilities as main agent)
- Dynamically registered on-the-fly
Spawning Subagents (Interactive)
/agent refactor "Convert all callback-based handlers in @internal/api to use context.Context"
Managing Subagents
/agentspanel: list active/completed subagents with status- Select for full detail view (conversation, steps, tool logs)
ctrl+kto approve pending permission without leaving main conversationctrl+jto teleport to next subagent awaiting approval
Programmatic Subagent Tools
invoke_subagent: Spawn specialized sub-agentsdefine_subagent: Create custom sub-agent (name, description, system_prompt, tool flags)manage_subagents: List or terminate active sub-agents
Hooks
Location: .agents/hooks.json (workspace) or ~/.gemini/config/hooks.json (global)
Hook Events
| Event | When It Fires |
|---|---|
PreToolUse |
Before a tool executes |
PostToolUse |
After a tool completes |
PreInvocation |
Before model call |
PostInvocation |
After tool calls finish |
Stop |
Execution loop terminates |
Example hooks.json
{
"auto-linter": {
"PostToolUse": [{
"matcher": "run_command",
"hooks": [{"type": "command", "command": "ruff check --fix", "timeout": 10}]
}]
},
"safety-gate": {
"enabled": false,
"PreToolUse": [{
"matcher": "run_command",
"hooks": [{"command": "./scripts/check-safety.sh"}]
}]
}
}
Tool Matchers
"run_command"— Exact match"run_command|view_file"— Multiple tools"browser_.*"— Regex pattern""or"*"— All tools
Plugins
Install path: ~/.gemini/antigravity-cli/plugins/<plugin_name>/
Plugin Structure
~/.gemini/antigravity-cli/plugins/<name>/
├── plugin.json # Required marker
├── mcp_config.json # Optional MCP servers
├── hooks.json # Optional hooks
├── skills/ # Optional skills
├── agents/ # Optional subagents
└── rules/ # Optional rules
Commands:
agy plugin import gemini # Migrate from Gemini CLI
agy plugin list # List installed plugins
agy plugin enable <name> # Enable a plugin
agy plugin disable <name> # Disable a plugin
agy plugin install <name> # Install a plugin
agy plugin uninstall <name> # Remove a plugin
MCP Support
# Via /mcp in interactive mode, or via mcp_config.json in plugins
Use agy inspect to verify loaded MCP servers.
Terminal Sandbox
| OS | Mechanism |
|---|---|
| Linux | nsjail |
| macOS | sandbox-exec |
| Windows | AppContainer |
Config: "enableTerminalSandbox": true in ~/.gemini/antigravity-cli/settings.json (default: false)
Settings & Configuration
Location: ~/.gemini/antigravity-cli/settings.json
Permission Levels
| Level | Behavior |
|---|---|
request-review |
Ask before each action |
always-proceed |
Auto-approve most actions |
strict |
Maximum safety gate |
Fine-Grained Permissions
{
"permissions": {
"allow": ["command(git)", "command(npm test)"],
"deny": ["command(rm -rf)"]
}
}
CLI flags override settings
--sandboxforces sandbox on even if disabled in settings.json--dangerously-skip-permissionsforces bypass even if permissions are strict
Keyboard Shortcuts (Interactive)
| Key | Action |
|---|---|
ctrl+c, esc |
Stop stream, close menus |
ctrl+d |
Exit CLI |
ctrl+l |
Clear terminal |
ctrl+z |
Suspend CLI to background |
ctrl+v |
Paste |
ctrl+g |
Open prompt in external editor |
ctrl+k |
Approve pending subagent permission |
ctrl+j |
Teleport to subagent awaiting approval |
alt+enter, ctrl+j, shift+enter |
Newline |
y / n |
Confirm / deny command execution |
e |
Edit proposed command |
Input Prefixes
| Prefix | Action |
|---|---|
! |
Execute bash directly (bypass AI) |
@ |
File/directory reference with autocomplete |
/ |
Slash commands |
Kanban Lane Integration
For delegation through Hermes Kanban, use the agent-lane skill pattern. Key points:
One-Shot Lane (Print Mode)
- Create isolated git worktree
- Construct prompt from kanban task body
- Run
agy -pwith--dangerously-skip-permissionsand--print-timeout - Review diff, run tests
- Cherry-pick commits back
kanban_completewith metadata
Interactive Lane (tmux)
- Set up tmux session
- Launch
agyinteractively - Handle trust dialog (Enter)
- Send task prompt via
tmux send-keys - Monitor via
tmux capture-pane - Reconcile and verify
kanban_completewith metadata
Hermes always owns the Kanban lifecycle. agy never calls kanban_complete or kanban_block.
Cost & Performance Tips
- Use
--print-timeoutto prevent runaway execution - Use
--dangerously-skip-permissionsto avoid interactive dialogs in print mode - Keep AGENTS.md specific — saves tokens and correction cycles
- Use subagents for parallel work — doesn't block main conversation
- Monitor
/usagefor quota tracking - Use the sandbox (
--sandbox) for untrusted operations - Use
agy inspectas first debugging step when behavior is unexpected
Pitfalls & Gotchas
- Gemini CLI sunset: June 18, 2026 — Gemini CLI stops serving free/Pro/Ultra users. Migrate now with
agy plugin import gemini. - Interactive mode REQUIRES tmux —
agyis a full TUI app likeclaude --add-diris REQUIRED for file modification — Without--add-dir <path>,agy -pwill NOT modify files in the current directory. It creates its own scratch project under~/.gemini/antigravity-cli/scratch/and works there instead. Always pass--add-dir "$WORKTREE"when delegating to a worktree.- No ACP support — Antigravity CLI cannot be used as a stdio-based agent server (unlike old Gemini CLI
--acp) - Settings path is
~/.gemini/— legacy from Gemini CLI, not renamed to~/.antigravity/ - No
--max-turnsequivalent — only--print-timeout(time-based, not turn-based) - No
--allowedToolswhitelist — tool permissions only via settings.json - No
total_cost_usdin output — no cost tracking in print mode JSON - Trust dialog only appears once per directory — then cached permanently
/exportrequires Antigravity 2.0 desktop app — not useful in headless environments- Scheduled tasks only in 2.0 desktop app —
/schedulein CLI is one-time timers only - Google Sign-In required — no Anthropic-style console login; use API key for headless
- Background tmux sessions persist — clean up with
tmux kill-session -t <name> - Scratch directory pollution —
agymay create projects under~/.gemini/antigravity-cli/scratch/. Clean up periodically. /forkrequires Antigravity 2.0 desktop app — Conversation forking is only supported via/exportto the desktop app; the CLI/forkcommand branches the conversation within the TUI only.
References
references/add-dir-test-evidence.md— Live test results (2026-05-22) proving--add-diris required. Includes side-by-side comparison ofclaude -pvsagy -pworking directory behavior, reproducibility tests, and cleanup steps.
- Prefer print mode (
-p) for single tasks — cleaner, no dialog handling - Use tmux for multi-turn work — only reliable TUI orchestration method
- Always set
workdir— keep agy focused on the right project - Set
--print-timeout— prevents infinite hangs - Monitor tmux sessions —
tmux capture-pane -t <session> -p -S -50 - Clean up tmux sessions — kill when done
- Report results to user — summarize what agy did and what changed
- Don't kill slow sessions — check progress before assuming failure