Chapter 6. Using It in the Terminal — agy -p and Silent Denials
Optional Read this when you need it. You can skip it and still follow the later chapters.One-line summary:
agyis Antigravity's terminal program, andagy -p "task"runs once and exits. With-p, actions that need permission are silently denied. Yet the exit code (the number a program leaves when it finishes) is still 0 (success), so it is easy to mistake an empty result for success.
The terminal is a window where you control the computer by typing commands as text. If you are new to the terminal, you can skip this chapter. If you want to learn more about the terminal, see Claude Code Chapter 10 (optional).
The results in this chapter come from this guide actually running agy on macOS. When you follow along, run agy directly in your terminal.[1]
Installing and Getting Started
Here is the install command for macOS and Linux.[2]
curl -fsSL https://antigravity.google/cli/install.sh | bashThis command downloads an installer from the internet and runs it right away. Check that it matches the official docs (antigravity.google/docs) word for word before you run it. The command for Windows is also in the official docs.
Move into the organizer folder and type agy to open the chat screen.[3] The cd on the first line below is the command that moves into that folder. If you already signed in on the app, it signs you in right away without opening a browser.[4]
On your first run, it asks whether you trust this folder (Workspace trust, the step that registers a folder as trusted).[5] You made the organizer folder yourself, so you can answer that you trust it. Answering this way should help you avoid one of the denial pitfalls that come later (our estimate).
cd ~/hello-ai-practice/organizer
agyQuick check
What is the 'Workspace trust' check when you run agy for the first time?
Execution Modes
In interactive agy, press Shift+Tab to switch execution modes.[6]
| Mode | File edits | Running commands |
|---|---|---|
default | Shows changes and asks | Ask |
accept-edits | Automatic inside the working folder | Ask |
Source: Antigravity official docs (excerpted)[7]
Default permissions in the terminal are more cautious than in the app. It asks before writing files, running commands, or using web tools, and the fence that contains commands is off by default (Chapter 4).
Quick check
Which description of agy's accept-edits mode is accurate?
agy -p — Ask Once and Exit
-p sends a single request, gets the answer, and exits. Because there is no prompt window, actions that need permission are handled according to preset rules.[8] The text a program puts out goes two ways.[9]
- Standard output (stdout, "standard out"): the answer itself. For example, the table of files you asked for.
- Side channel (stderr, "standard error"): progress and errors. For example, a notice that a shell command was denied.
In the terminal window, you usually see both together. Don't be surprised if the answer and notices look mixed.
The official docs explain that reading and writing files inside the working folder are allowed automatically, while shell commands default to "Ask" and are silently denied (soft-deny).[10] A silent denial does not stop the run; it finishes with exit code 0 and only reports what was blocked to stderr.[11]
Quick check
What happens in agy -p when an action needs permission?
Four Pitfalls We Ran Into
Here is what actually happened while running agy -p several times in the organizer folder.
- Empty result, yet success. The agent tried to run a shell command (
ls, a command you type in the terminal) to see the folder list and got denied. Then it finished without creating anything. The exit code was 0. This happened three times.- What to do: Always check whether the output file was actually created.
- Reading and writing also denied in an untrusted folder. In the practice folder, even writing and reading files were denied at one point. The likely cause is that this folder had not yet been registered as a "trusted folder" (our estimate).[12]
- What to do: Open interactive
agyonce and answer that you trust the folder.[12:1]
- What to do: Open interactive
- The fix: one mode flag + one sentence. Adding
--mode accept-editsat the end of the command and putting "Do not use shell commands; only read and write files" at the end of the request made every run succeed.- Do not use the
--dangerously-skip-permissionsoption, which approves everything. - Text like this that starts with
--is called an option. You add it after a command to change how it runs.--mode accept-editsmeans "run in theaccept-editsmode from the table above." You can see it at the very end of the command below.
- Do not use the
- A file missing from the answer. In read-only mode, we asked for a table of the files in the notes folder. There were 3 organized files (weekly meeting notes, ad-hoc meeting notes, weekly retrospective). But the ad-hoc meeting notes were missing from the table and the empty file
.gitkeepwas listed instead.- What to do: Count the items yourself to verify the scope.
More details (click to expand)
- Item 2: The official docs say files inside the working folder are allowed automatically. Yet they were denied, so we guessed, as above, that registering a trusted folder was the cause.[12:2]
- Item 3: We did not use
--dangerously-skip-permissions, which approves everything. The official docs also recommend narrowly scoped allow rules.[13]
Here is the actual command we ran.
cd ~/hello-ai-practice/organizer
agy -p "Show the list of files in the notes folder, and tell me in one line each which template (from templates) each file uses. Do not modify any files. Keep the answer short, as a table only. Do not use shell commands; only read files." --mode accept-editsResult: agy -p output (paths on our computer replaced with ~)
| Claude Code | Codex | Antigravity | |
|---|---|---|---|
| One-shot run | claude -p | codex exec | agy -p |
| Default file writes | Needs permission | Read-only | Automatic in working folder (per docs) |
| When blocked | Denies | Stops | Silently denies, exit code 0 |
Source: Summary from this guide (each tool's terminal chapter and hands-on runs)
Quick check
agy -p finished with success (exit code 0), but the output file is missing. Based on this guide's experience, what should you do first?
Resuming and Checking Usage
Chat history in the terminal is kept separately for each folder where you ran agy.[14] Use agy -c to immediately continue the last conversation in that folder, or /resume to pick one from a list.[15] /rewind (or /undo) rolls the conversation back to an earlier message (Chapter 4). The official docs do not say whether files are also rolled back, so rely on your Git history for files.
Check your usage with /usage.[16]
Quick check
How do you jump straight back into the last chat from this folder in agy?
Try It Yourself
- Check that the install command above matches the official docs, then install it (or run
agy --versionif you already have it). - Open interactive
agyonce in the organizer folder and confirm that you trust the folder when asked. - Run the read-only
agy -pcommand above and count whether the number of files in the table matches the notes folder. - If the result is empty, read the denial notice in stderr to see what was blocked.
Up next: In Chapter 7, we cover cost, data, and safety, and decide how to use the three tools together.
Summary
agyis interactive;agy -pruns once and exits. Chat history is kept per folder.- In
-p, actions that need permission are silently denied with exit code 0. Always check the output files yourself. - File actions can also be blocked in an untrusted folder. Register the folder as trusted or use
--mode accept-edits. - Adding the sentence "Do not use shell commands" reduced stops caused by denials. Count the scope of the answer yourself.
Glossary
| Term | One-line meaning |
|---|---|
| Headless | Running once without an interactive chat screen |
| Soft-deny | Silently denying just that action without stopping the run |
| Workspace trust | The step where you register that you trust this folder |
| Exit code | The success or failure number a program leaves when it finishes |
Finished this chapter?
Progress is saved only in this browser. See your progress on the full table of contents.
Next chapter: Chapter 7. Cost, Data, Safety, and Choosing Among the Three Tools
References (16)
This chapter is based on the Antigravity official docs checked on November 1, 2026, and results from running
agy1.4.12 on macOS. For this guide's hands-on practice,agywas called from inside another AI tool. The official FAQ does not support this kind of use on individual plans (Chapter 7). ↩︎Antigravity official docs, "Get started". "curl -fsSL antigravity.google | bash" antigravity.google (checked on 2026-11-01) ↩︎
Antigravity official docs, "Get started". "|
agy| Launches the interactive TUI in the current directory. |" antigravity.google (checked on 2026-11-01) ↩︎Antigravity official docs, "Authenticate". "If a valid token profile is found, the CLI authenticates your session silently without opening a browser." antigravity.google (checked on 2026-11-01) ↩︎
Antigravity official docs, "Get started". "Workspace trust: Confirm that you trust the repository directory before the agent begins file indexing." antigravity.google (checked on 2026-11-01) ↩︎
Antigravity official docs, "Choose an execution mode". "Press Shift + Tab inside the prompt box to cycle through the active sequence:
default>accept-edits>auto>plan>default." antigravity.google (checked on 2026-11-01) ↩︎Antigravity official docs, "Choose an execution mode". "|
default| Pauses for interactive diff review before modifying or creating files, and asks before running terminal commands. | Standard development, reviewing sensitive code changes, and careful refactoring. |" / "|accept-edits| Automatically approves file creations and edits inside your workspace, but still asks before running terminal commands. | Rapid prototyping, iterating on trusted code, and reducing file-edit interruptions. |" antigravity.google (checked on 2026-11-01) ↩︎Antigravity official docs, "Headless mode". "Headless mode (also called print mode) sends a single prompt to the agent, streams or returns the response, and exits." / "There is no interactive prompt in headless mode, so tools that would normally ask for confirmation are handled by policy." antigravity.google (checked on 2026-11-01) ↩︎
Antigravity official docs, "Headless mode". "Diagnostics—errors, authentication prompts, progress, and permission notices—go to
stderr." antigravity.google (checked on 2026-11-01) ↩︎Antigravity official docs, "Headless mode". "Reading and writing files inside your active workspace is auto-allowed; actions such as shell commands default to Ask and are soft-denied in headless mode unless you grant them." antigravity.google (checked on 2026-11-01) ↩︎
Antigravity official docs, "Headless mode". "A tool that requires approval it can’t obtain is soft-denied: the run continues, exits
0, and prints a notice tostderrnaming the tool and how to allow it." antigravity.google (checked on 2026-11-01) ↩︎Antigravity official docs, "CLI commands". "|
trustedWorkspaces| string[] |[]| Folders you chose to trust when the CLI asked. The CLI adds entries for you. |" antigravity.google (checked on 2026-11-01) ↩︎Antigravity official docs, "Headless mode". "Warning:
--dangerously-skip-permissionsapproves all tool calls, including file writes and command execution. Prefer scopedpermissions.allowrules unless you fully trust the prompt and environment." antigravity.google (checked on 2026-11-01) ↩︎Antigravity official docs, "Managing conversations". "When you launch
agyfrom a specific directory, the agent only displays and resumes sessions associated with that specific local repository or subdirectory." antigravity.google (checked on 2026-11-01) ↩︎Antigravity official docs, "Managing conversations". "Antigravity CLI supports both an interactive Session Picker TUI overlay and direct command-line flags (
agy -c/agy --continue) to resume threads instantly based on your active workspace." antigravity.google (checked on 2026-11-01) ↩︎Antigravity official docs, "Model quotas (/usage)". "Antigravity CLI provides the
/usagecommand (alias/quota) to help you monitor your resource consumption." antigravity.google (checked on 2026-11-01) ↩︎