Antigravity
Your first agent task: Use execution modes and permissions as guardrails
Complete a one-file task in a synthetic repository with Antigravity CLI, and name the execution mode and permission rule that guards each step.
This page is about Antigravity CLI (the agy command). After reading it, you can have agy complete a one-file task in a synthetic repository and name the execution mode and permission rule that guards each step. This is an independent, unofficial guide; mode names, commands, and configuration keys follow the official Antigravity documentation. The example commands were not run; only the official pages were checked.
Purpose: how an agent differs from chat
Section titled “Purpose: how an agent differs from chat”Chat gives you text, and you edit files and run commands yourself. An agent reads files in your repository, edits them, runs commands, and uses the results to decide the next step. That is more capable, and mistakes cost more, so the CLI makes “ask me first” an adjustable setting:
- the execution mode sets the default level of autonomy: whether you see a diff before files change and whether you are asked before commands run;
- permission rules decide whether a specific action is denied, asked about, or allowed;
- the terminal sandbox limits which files and networks commands can reach.
The goal of the first task is to change one file with every step open to your review. For installation and sign-in, see Install and sign in to a CLI; this page assumes agy already starts.
Four execution modes and the Shift+Tab cycle
Section titled “Four execution modes and the Shift+Tab cycle”| Mode | File edits | Terminal commands | Fits |
|---|---|---|---|
default |
Pauses before changing or creating files and shows an inline diff for you to confirm | Asks before running | Everyday development, sensitive changes, careful refactoring |
accept-edits |
Creations and edits inside the workspace are approved automatically | Still asks | Iterating on trusted code while approving each command |
auto |
Edits inside the workspace are approved automatically | Runs in the sandbox by default; commands that need to run outside it are evaluated automatically, with safe, reversible ones running directly and irreversible or high-risk ones still asking | Safe edits and commands without constant interruption |
plan |
Investigates with read-only search and viewing tools, then presents a structured plan for your approval before writing code | Follows your current permission settings | Unfamiliar codebases, multi-step changes |
Press Shift + Tab in the prompt box to switch modes. The official cycle is default > accept-edits > auto > plan > default; where auto is unavailable, it skips from accept-edits straight to plan. The bottom-right status bar shows the current mode (the indicator is empty in default). You can also launch with agy --mode=accept-edits, agy --mode=auto, or agy --mode=plan, change Agent Mode in /config, or set agentMode in ~/.gemini/antigravity-cli/settings.json ("" means default).
Two points are easy to get wrong:
autohas prerequisites. The official page says it requires the terminal sandbox and is currently not available for business or enterprise accounts (including Antigravity in Gemini Enterprise). On some Windows versions, Linux hosts, or containers the sandbox may be unavailable. When it is not,autodoes not appear in theShift + Tabcycle or in/config, and setting"agentMode": "auto"or passing--mode=autoactually runs indefault.- Which mode
agystarts in depends on version and account. The official page says newer versions start inautowhere it is available and indefaultotherwise. Do not assume your first launch is indefault: check the status bar, and switch back withShift + Tabor/configif needed. Exact version numbers and platform coverage are on the official page.
The permission model: action(target) and Deny > Ask > Allow
Section titled “The permission model: action(target) and Deny > Ask > Allow”Each sensitive operation is a permission resource in the form action(target), such as command(git), write_file(src/), read_url(google.com), or mcp(linter/*). The CLI tab lists the actions read_file, write_file, read_url, execute_url, command, mcp, and, for business and enterprise accounts only, unsandboxed. Rules go in three lists under permissions in ~/.gemini/antigravity-cli/settings.json: deny, ask, and allow.
- Priority is Deny > Ask > Allow. For example, with
command(*)inaskandcommand(git)inallow, every command still prompts. - Defaults apply only when no rule matches. Reading and writing files inside the workspace is allowed by default (in
defaultmode, writes still need diff review first); files outside the workspace, reading or opening web pages, and unconfigured MCP tools default to Ask. - Execution modes and permission rules stack. Explicit
allow,ask, anddenyrules, and global overrides such as--dangerously-skip-permissionsorstrict, take precedence over the mode in every mode. commandmatches by whole-word prefix by default; for regular expressions, start the target withregex:.write_fileimpliesread_fileon the same path, and denying read also denies write.- When a command uses substitution, backticks, or similar constructs that can smuggle in arbitrary commands, prefix rules stop applying; only a rule that matches the full line exactly allows it, otherwise it falls back to Ask.
/permissions lets you view, add, and remove rules in the TUI across the project, shared, and global scopes. A conservative starting point (example, not run):
{ "permissions": { "allow": ["command(git diff)", "command(sh scripts/check.sh)"], "deny": ["command(rm -rf)", "command(sudo)", "write_file(.git/)"], "ask": ["command(git push)"] }}Sandbox: with the terminal sandbox on, commands run inside OS-level isolation. They can write to the workspace, temporary directories, and common build caches, and read system directories; sensitive files such as ~/.ssh and .env are blocked, and the network is limited to approved domains and is off by default. The sandbox is not an execution mode and is not in the Shift + Tab cycle: auto turns it on automatically, other modes can enable it in /config, and agy --sandbox forces it on for one session. Mind how rules feed the sandbox: paths granted by read_file and write_file enter its read-only and read-write allowlists, and domains granted by read_url enter its outbound allowlist, so broader grants loosen the sandbox.
Minimal example: plan mode produces a plan without changing files
Section titled “Minimal example: plan mode produces a plan without changing files”The starting material is the synthetic repository demo-notes:
demo-notes/├── README.md├── notes/│ ├── alpha.md│ └── beta.md└── scripts/ └── check.shscripts/check.sh checks whether notes/ still contains the known misspelling recieve and exits non-zero if it does. notes/alpha.md has one recieve.
Start in plan mode from the repository root:
cd demo-notesagy --mode=planSend:
README.md says files under notes/ should have no known misspellings.Investigate read-only first: find which known misspellings exist under notes/, and list the file, line number, and what you would change.Do not modify any files and do not run shell commands.Expected output: a plan naming the exact line in notes/alpha.md and the proposed replacement, then waiting for your approval. To verify, confirm the status bar shows plan, no file in the workspace changed (git status is clean), and the plan’s line numbers match the source. It is fine not to approve; the point is to see what the agent says before it writes anything.
Full example: fix one typo and review the diff in default mode
Section titled “Full example: fix one typo and review the diff in default mode”Allowed scope: only the one recieve in notes/alpha.md. Verification: sh scripts/check.sh passes and git diff shows only this one change.
-
Start
agyand look at the status bar. If it is notdefault, pressShift + Tabuntil the indicator clears, or set Agent Mode todefaultin/config. -
Send:
Change "recieve" to "receive" in notes/alpha.md, and only that one place.After the change, run sh scripts/check.sh and report the result.Do not modify other files, do not run commands unrelated to the check, and do not access paths outside the repository. -
Before editing, the agent pauses and shows an inline diff with
Accept this file edit?. Press1to accept or2to reject. To reject and explain what to do differently, highlight the reject option, pressTab, type your note, and press Enter. Pressffor a full-screen, scrollable diff. A pending edit stays open;Escdoes not dismiss it. -
After you accept, the agent asks to run
sh scripts/check.sh. Indefaultmode commands follow thetoolPermissionpolicy, which reviews before running by default: read the command before approving. PressCtrl + Gto expand it into an editor if you need to change it. -
Open the interactive diff viewer with
/diff. In All Changes, confirm onlynotes/alpha.mdchanged. The Per Turn view shows what the agent did turn by turn, and pressingCon a line adds a comment that can be sent to the agent as the next prompt when you exit.
Expected result: git diff shows one recieve turned into receive, the check script exits with code 0, and you saw a prompt at every step. If the agent wants to change other files or run other commands, reject and use the input box on rejection to state the scope.
In this flow, the gate for each step is: the file edit is guarded by default mode’s diff review; running the check is guarded by the command prompt (or a command(...) rule you configured); reading files inside the repository is allowed by the default workspace rule; and paths outside it are stopped by ask/deny rules and the sandbox.
Session management: /resume, /rewind, /fork
Section titled “Session management: /resume, /rewind, /fork”/resume(aliases/switch,/conversation) opens the conversation picker, where you can search, page, rename withF2, and delete withF4. Sessions are scoped to the current working directory, so you only see sessions for the repository you launched in. From the shell,agy -c(or--continue) resumes the most recent session for the current workspace, andagy --conversation <ID>loads a specific one. When you close the CLI, it also prints the command needed to resume that session./rewind(alias/undo) rolls the conversation history back to an earlier message. The official page says only that it rolls back conversation history; it does not say whether files on disk are restored, so do not treat it as a file-level undo. Manage file changes with Git./fork(alias/branch) clones the current conversation into a new, independent session that keeps the existing workspace. The official page warns that a fork clones the conversation thread, not your local Git checkout; to isolate files, use a Git branch or stash your changes first. If an experiment fails,/resumetakes you back to the original session.- For long sessions,
/compactsummarizes the conversation into a checkpoint, and/contextshows the token breakdown.
Counterexamples and rewrites
Section titled “Counterexamples and rewrites”Counterexample 1: “To avoid interruptions, just run agy --dangerously-skip-permissions.”
This switch auto-approves all tool permission requests, and the official page says that, like explicit rules, it takes precedence over every execution mode. In effect it removes every guardrail you set. Rewrite: write down which actions this task actually needs to allow, add rules for those, and leave the rest as prompts.
First walk through the task once in default mode in the synthetic repository and note which kinds of commands get prompted.Write only the clearly safe ones as command(...) allow rules, such as command(git diff).Leave uncertain ones in ask, and put dangerous ones in deny, such as command(sudo).Counterexample 2: “Turn on auto directly in the company’s real repository and let it fix things.”
auto approves all edits inside the workspace, so you no longer review each diff; its judgment of whether a command is “safe and reversible” is an automatic evaluation, not your own confirmation. Rewrite: in a real repository, look at the plan in plan mode first, then review every diff in default mode. To go faster, move to accept-edits and keep commands on prompts. Consider auto for low-risk tasks only after a Git branch, a recoverable checkout, and a sandbox boundary you understand are all in place, and check with /diff at the end.
Verification checklist
Section titled “Verification checklist”- The mode shown in the status bar matches what you expect; you did not assume the startup mode was
default. - You looked at a plan or a read-only result before allowing writes.
- In
defaultmode you accepted each diff yourself, and the scope stayed within the target file. - You read every command before approving it and did not approve commands you do not understand.
git diffand/diffmatch your task.- You did not use
--dangerously-skip-permissionsor putcommand(*)inallow. - The repository contains no real secrets; examples use only placeholders such as
YOUR_API_KEY; see API key safety.
Failure recovery and safety boundaries
Section titled “Failure recovery and safety boundaries”- You expect
autobut cannot find it: usually the account type or sandbox availability. Check that the account is a personal account and read the official page for platform and version requirements; do not loosen permissions to make it appear. - The agent repeats a rejected edit: when rejecting, use
Tabto say “do not change this file”, or addwrite_file(path)todeny. - Commands keep prompting: that is the default. Put only clearly safe commands in
allow, and do not open everything at once with a wildcard. - A change went wrong: use
git diffandgit restorefor files;/rewindconcerns conversation history, so do not expect it to restore files. - You want to compare two approaches:
/forkfirst and open a Git branch as needed, so two lines of work do not edit the same workspace. - Commands not run: the examples on this page were not run in a recorded environment; confirm them in your own synthetic repository first. In enterprise or managed environments, administrator policy governs.
Next: for where rules, skills, and MCP configuration belong, see Where customizations live; to write project context for a repository, see GEMINI.md project context; for automatic checks after writes, see Run automatic checks before and after tool calls with hooks; for the differences between entry points, see Choosing an Antigravity surface; for quotas and account types, see Accounts, plans, and quotas; for sign-in problems, go back to Install and sign in to a CLI.