agy CLI Daily Workflow & High-Frequency Commands
After installing agy, most developers spend their first few weeks stuck in a basic loop: cd into a repo, run agy, type a prompt, and wait for edits. Once you actually adopt agy as your daily driver, the bottleneck is rarely model intelligence—it is a handful of recurring workflow papercuts:
- Switching modes, picking models, and dismissing unwanted prompts every time you open a new session;
- Providing vague context so the model burns turns grepping the entire repository and still edits the wrong file;
- Long sessions getting slow and unfocused without a clear rule for when to
/compact,/fork, or/rewind; - Wiring
agyinto shell scripts or CI pipelines only to get unstable output instead of clean JSON—or worse, hanging the job indefinitely.
This guide walks through agy CLI configuration, interactive workflows, and headless mode in the exact order you use them day to day. Every command and output below was verified locally on Linux with agy v1.5.19.

1. Authentication & settings.json
1. Four Authentication Methods
The first time you run agy, it guides you through login and stores credentials in your system Keyring by default. Over SSH on a remote host with no local browser, it automatically prints an out-of-band (OOB) auth URL—open it in your local browser, authorize, and paste the callback code back into the terminal.
Four authentication modes are supported (configured via auth.type):
| Auth Mode | Use Case | Notes |
|---|---|---|
oauth-personal |
Personal Google account (Free / Pro / Ultra) | Default; lowest-friction interactive login |
oauth-business |
Gemini Enterprise account | Requires gcp.project and gcp.location |
gemini-api-key |
Direct Gemini API Key | Can be injected via the GEMINI_API_KEY env var |
agent-platform |
Gemini Enterprise Agent Platform | Supports API Key or ADC credentials |
To switch accounts, run /logout inside the TUI; the next launch triggers the login flow again.
2. My Production settings.json
Persistent CLI configuration lives at ~/.gemini/antigravity-cli/settings.json. You can edit it through the full-screen menu with /config (alias /settings) inside the TUI, or edit the JSON directly (adding $schema at the top enables autocomplete and validation in your editor).
Here is the sanitized config I actually run on my workstation:
1 | { |
A few easy-to-miss fields worth highlighting:
statusLineandtitle: Both support pointing to a local script.agystreams throttled JSON snapshots of live session state (agent_state,tool_confirmation_pending,workspace,vcs.branch,conversation_title,subagents, etc.) to the script viastdin.- Setting
"stack_with_default": trueunderstatusLinekeeps the built-in status row (mode, model, effort level) while stacking your custom line underneath. titledynamically updates the terminal window title. Mytitle.shinspectsagent_stateandtool_confirmation_pendingand prefixes the title with a status dot (🟢 idle / 🟣 running / 🟡 awaiting approval / 🔴 error), so with four or five terminal windows open I can spot a blocked approval at a glance.
- Setting
trustedWorkspaces: The first time you trust a directory, the CLI appends its path here automatically so you are not prompted again.- One-off overrides with
--settings: When you want different settings for a single run without modifyingsettings.jsonon disk, pass--settings:
1 | # Temporarily switch to read-only plan mode without saving on exit |
Real-world pitfall: When enableTerminalSandbox is true, do not use ** glob wildcards inside permissions.deny read_file(...) rules (for example, read_file(/home/user/.ssh/**)). During sandbox initialization, path validation immediately fails with sandbox configuration error: deny ...: globs not supported., breaking every command inside the sandbox. To block an entire sensitive directory, use the exact directory path: read_file(/home/user/.ssh).
2. Launching, Resuming & Multi-Repo Context
Day to day, only a handful of launch flags do almost all the work:
| Command | Behavior | When to Use |
|---|---|---|
agy |
Start a new session in the current directory | Starting a fresh, self-contained task |
agy -c |
Resume the most recent session in this directory (--continue) |
Picking up where you left off after closing the terminal or the next morning |
agy -r <id> |
Resume by conversation ID (--resume / --conversation) |
Jumping back to an older session or continuing a headless -p run |
agy -i "<task>" |
Launch with an initial prompt and stay in the interactive TUI (--prompt-interactive) |
Wrapping in shell aliases for one-command task startup |
agy --add-dir <path> |
Attach extra directories to the workspace (repeatable) | Split frontend/backend repos, or a sibling shared-proto dependency |
agy conversations list |
List locally stored conversations and disk usage | Finding a past conversation ID, or pairing with clean to prune old history |
One habit worth forming early: agy isolates conversation history by launch working directory. If you prefer working from the Git repository root, always launch from the root. Running agy at the root and later running agy -c inside backend/ resumes two completely separate conversation histories.
3. Pairing --mode with --effort
Many people never touch execution modes or reasoning tiers after installing agy—which leads to waiting thirty seconds of deep thinking for a one-line config tweak, or watching the agent scatter edits across a dozen files during a cross-module refactor before anyone agreed on a plan.
First, separate what each dimension controls:
--mode(permissions and pace): Controls whether the agent pauses for approval before editing files or running commands. Inside the TUI, pressShift + Tabanytime to cycle modes without restarting.--effort(reasoning depth): Controls the thinking budget per turn across five tiers:low,medium,high,xhigh, andmax(available tiers vary by model; runagy modelsto inspect models and supported levels on your account). Switch mid-session anytime with/effort mediumor/effort high.
Follow this decision tree and you will rarely pick the wrong combination:
flowchart TD
T["Incoming dev task"] --> Q1{"Touches >3 files<br/>or requirements still unclear?"}
Q1 -- "Yes" --> P["--mode plan + --effort high/xhigh<br/>Read code and draft a plan first, then execute"]
Q1 -- "No" --> Q2{"Debugging a complex issue<br/>or tracing deep internals?"}
Q2 -- "Yes" --> D["--mode auto + --effort high<br/>Auto-run commands in sandbox to reproduce and isolate"]
Q2 -- "No" --> Q3{"Auto-approve file edits<br/>but gate shell commands?"}
Q3 -- "Yes" --> E["--mode accept-edits + --effort low/medium<br/>Writes run freely; shell commands prompt individually"]
Q3 -- "No" --> F["--mode auto + --effort low/medium<br/>Small tasks run and self-test inside sandbox"]
Here is how the four execution modes compare:
| Mode | File Edits / Creation | Terminal Commands | Best For |
|---|---|---|---|
| Default (unset) | Prompts with diff approval | Follows permission rules + sandbox | Getting started, or touching sensitive core code |
accept-edits |
Auto-approved | Still prompted per permission rules | Trusting code edits while gating shell scripts |
auto |
Auto-approved | Auto-runs inside sandbox; prompts to escape sandbox | Daily driver—smoothest edit-and-test feedback loop |
plan |
Direct code edits blocked | Read-only exploration; produces a plan first | Large changes, cross-module refactors, unfamiliar codebases |
The most comfortable daily rhythm is setting "agentMode": "auto" as the default in settings.json. Whenever a task looks non-trivial, hit Shift + Tab to drop into plan (or run /plan), review and confirm the plan, then toggle back to auto so the agent can implement and verify tests end to end.
4. Inside the TUI: @, !, Slash Commands & Keybindings
1. @ and !: Better Than Typing Two Extra Paragraphs
@(pinpoint context): Typing@opens an autocomplete picker for file paths, directories, past conversations, rules, and connected MCP resources.- Instead of asking “check why the blog table styling wraps awkwardly”, write
@source/css/table-polish.css Why is the first column in this table wrapping?. Pointing directly at the target file skips several rounds of search tool calls, cuts latency and token usage, and keeps edits on target.
- Instead of asking “check why the blog table styling wraps awkwardly”, write
!(run local shell commands inline): Prefix a line with!to execute a shell command directly in your local terminal—for example!git status,!git diff --stat, or!yarn build. Output prints straight into the stream, so you do not need to switch tmux panes just to check branch state.
2. High-Frequency Slash Commands You Will Actually Use Daily
Type / to open the full command menu, or run /help (shortcut ?) to inspect every command supported by your installed version. These are the ones that earn a permanent spot in muscle memory:
| Command | Alias | What It Solves |
|---|---|---|
/plan [task] |
— | Explore the codebase, align on constraints, and write a reviewable plan before editing |
/diff |
— | Open an interactive diff view to review changes turn-by-turn or across uncommitted edits |
/compact [instructions] |
— | Compress long conversation history into a summary checkpoint to free context window |
/rewind |
/undo |
Roll back to an earlier turn when a thread goes off the rails—no need to re-explain context |
/fork |
/branch |
Clone a new session from the current turn to safely prototype an alternative approach |
/resume |
/switch |
Open the session picker to jump between past conversations in the current repo |
/context |
— | Inspect token usage breakdown across the context window to decide when to compact |
/model |
— | Switch models (supports /model <model> <prompt> for a single-turn override) |
/effort [level] |
— | View or adjust reasoning effort on the fly |
/config |
/settings |
Open the interactive config panel to edit settings.json |
/clear |
/new |
Clear current context and start a fresh conversation in place |
Two habits make long sessions dramatically cleaner:
- Give
/compacta focus: Avoid running a bare/compact. Tell it what must survive—for example,/compact Keep the API schema contract and the two failing unit tests—so critical constraints do not get summarized away. - Run
/forkbefore major pivots: When you are halfway through a refactor and unsure between two designs,/forka branch to test Plan B. If it does not pan out, switch right back to the original session with an untouched context.
3. Keybindings & Custom keybindings.json
Six default shortcuts cover almost every interaction:
| Shortcut | Action |
|---|---|
Shift + Tab |
Cycle execution modes (default → accept-edits → auto → plan) |
Esc |
Interrupt streaming output or dismiss the active dialog/panel |
Esc × 2 |
Quickly clear drafted text in the input box when not streaming |
Ctrl + G |
Open your external $EDITOR (Vim / VS Code) to draft multi-line prompts |
Ctrl + L |
Clear and redraw the terminal screen |
Ctrl + D × 2 |
Exit agy when the input box is empty (same as /exit) |
To remap keys, create ~/.gemini/antigravity-cli/keybindings.json (delete the file anytime to restore defaults):
1 | { |
Three protected bindings cannot be disabled or remapped: cli.exit (Ctrl + D), cli.escape (Esc / Ctrl + C), and cli.enter (Enter), preventing a bad config from locking you inside the TUI.
5. Headless Mode (-p): Wiring agy into Scripts and CI
Beyond the interactive TUI, passing -p (--print / --prompt) turns agy into a standard Unix command you can drop into shell pipelines, Git hooks, or CI jobs.
It follows clean stream separation: the final answer goes to stdout, while progress updates, warnings, and diagnostic logs go to stderr. You can safely pipe stdout straight into jq or redirect it to a file without progress-spinner noise corrupting the payload.
Headless mode reuses locally stored credentials. Before running scripts on a fresh machine or container, either complete one interactive login or set
GEMINI_API_KEY.
1. Choosing Between the Three --output-format Options
| Format | stdout Payload |
Typical Use Case |
|---|---|---|
text (default) |
Plain-text response | Commit summaries, PR comments, simple shell variable capture |
json |
Single JSON object printed on completion | Extracting fields with jq, tracking token usage and latency |
stream-json |
Line-delimited NDJSON event stream | Live monitoring of tool calls and progress, or multi-turn programmatic control with --input-format stream-json |
2. Verified Example: --output-format json + --json-schema
The biggest headache in LLM automation is chattiness—you ask for raw JSON and the model wraps it in Markdown fences or prepends “Sure, here is the result:”. Passing --json-schema enforces a strict output structure. Here is real output captured locally on agy v1.5.19:

Two fields in the JSON payload are especially useful in production pipelines:
structured_output: Whenever--json-schemais supplied, the schema-validated object lands cleanly under.structured_output. Downstream scripts can extract values directly withjq -r '.structured_output.xxx'—zero regex cleanup against.response.conversation_id: Headless runs still persist conversation history to disk. If a CI review script flags a surprising conclusion, copy theconversation_idfrom the job log and runagy -r <conversation_id>locally to pick up that exact context and interrogate the reasoning.
3. Three Safety Flags for Every CI Script
1 | # Example: inspect current branch changes in CI and emit a structured risk report |
Bake these three flags into your CI script templates:
--print-timeout 90s: Defaults to0s(no timeout). Without an explicit cap, a network hiccup or model loop can burn through your entire CI runner budget.--disable-slash-commands: Prevents lines starting with/xxxinside piped diffs, logs, or PR descriptions from being accidentally expanded as slash commands or Skills.- Explicit lightweight
--model: For batch jobs and CI checks, pin a Flash model or low effort tier to keep latency and cost predictable.

















