To get a notification when Google Antigravity finishes, add a Stop hook to ~/.gemini/config/hooks.json that runs your system's notification command, then start a new agy session. Stop fires when a turn ends. There is no trust step, so the hook runs from the next session. Antigravity has no "needs approval" event, so for questions and commands you use a PreToolUse hook, which must always print a decision. This works with the agy command line on Mac, Windows and Linux, and a phone app such as Antigravity Notifier can send the same moments to your phone and let you answer from there.
01The quickest option: agy's built-in setting
If you only need an alert on this computer, you may not need a hook at all. The agy command line has a Notifications setting, off by default, that rings the terminal bell and shows a desktop notification when the agent needs your approval or an answer, or finishes its turn. Turn it on in /config, or add "notifications": true to ~/.gemini/antigravity-cli/settings.json. Antigravity's built-in notifications setting has the details. Hooks, below, are for when you want to control the alert yourself or send it somewhere else.
02How Antigravity hooks are laid out
Antigravity reads hooks from two files: ~/.gemini/config/hooks.json for every session (the agy command line, the desktop app and the IDE all read it) and .agents/hooks.json inside a project. Both load and both fire, the project's first.
The top-level keys are named hook groups. Each group lists the events it handles. That makes it easy to add your own alerts without touching anything else: give them their own group, such as my-alerts, next to any group already there.
The events are SessionStart, PreInvocation, PostInvocation, PreToolUse, PostToolUse and Stop. There is no notification, permission-request or session-end event. Antigravity hooks explained covers them in detail.
StopPreToolUse, tool ask_questionPreToolUse, tool run_command03A working setup on macOS
Hook commands are easiest to keep correct as small scripts at an absolute path. Save this as ~/.gemini/hooks/done.sh and make it executable with chmod +x ~/.gemini/hooks/done.sh:
#!/bin/sh
# Antigravity Stop hook: show a macOS notification, print nothing.
osascript -e 'display notification "Antigravity has finished" with title "Antigravity"' >/dev/null 2>&1
exit 0
Then add a group to ~/.gemini/config/hooks.json (create the file if it doesn't exist; if it already has groups, add yours as another top-level key). Replace /Users/you with your home folder:
{
"my-alerts": {
"Stop": [
{ "type": "command", "command": "/Users/you/.gemini/hooks/done.sh", "timeout": 10 }
]
}
}
timeout is in seconds; the default is 30. Start a new agy session and ask for something short. When the turn ends, the notification appears.
If it doesn't, macOS may be blocking Script Editor, which osascript uses for notifications. Run the osascript line once in Terminal, then open System Settings > Notifications, find Script Editor and turn on Allow Notifications. The macOS guide has more options, including sounds and clickable alerts.
04Questions and commands: PreToolUse
Antigravity has no event for "waiting for you". The nearest is PreToolUse, which runs before every tool call. Its payload (JSON on standard input) has a toolCall with the tool's name, so a script can pick out ask_question, which is how Antigravity asks you something.
One rule matters more than any other here: Antigravity is fail-closed. A PreToolUse hook that prints no decision, exits with an error or times out blocks the tool. Your script must always print a decision, and {"decision":"allow"} leaves the call to Antigravity's own permission rules, as if the hook weren't there.
Save as ~/.gemini/hooks/tool.sh and make it executable:
#!/bin/sh
# Antigravity PreToolUse hook: alert on questions, then ALWAYS allow.
input=$(cat)
tool=$(printf '%s' "$input" | python3 -c 'import json,sys; print((json.load(sys.stdin).get("toolCall") or {}).get("name",""))' 2>/dev/null)
if [ "$tool" = "ask_question" ]; then
osascript -e 'display notification "Antigravity has a question for you" with title "Antigravity"' >/dev/null 2>&1
fi
echo '{"decision":"allow"}'
exit 0
and add it to your group:
{
"my-alerts": {
"Stop": [
{ "type": "command", "command": "/Users/you/.gemini/hooks/done.sh", "timeout": 10 }
],
"PreToolUse": [
{ "matcher": "*", "hooks": [ { "type": "command", "command": "/Users/you/.gemini/hooks/tool.sh", "timeout": 10 } ] }
]
}
}
You can alert on run_command the same way, but expect a lot of alerts. Interactive sessions start in Auto mode, where sandboxed "safe" commands run without asking, and the hook can't tell those apart from the ones that will stop and wait for you. The PreToolUse guide explains the decisions in full.
05The same setup on Linux and Windows
Keep the JSON shape and change what the scripts run.
Linux (needs a desktop notification daemon, so not on a headless server). In done.sh, replace the osascript line with:
notify-send 'Antigravity' 'Antigravity has finished'
notify-send comes from libnotify (libnotify-bin on Debian and Ubuntu).
Windows. Use a PowerShell script and call it explicitly. We have not tested Antigravity's hooks on Windows ourselves, so test it before relying on it.
06Check that it works
- Check
hooks.jsonis valid JSON:python3 -m json.tool ~/.gemini/config/hooks.json. No trailing commas, no comments. - Start a new
agysession. A running session doesn't pick up the change. - Ask for something short. The "finished" alert should appear when the turn ends.
- If you added the
PreToolUsehook and a command is suddenly blocked, the script isn't printing a decision. Run it by hand:echo '{"hookEventName":"PreToolUse","toolCall":{"name":"read_file"}}' | ~/.gemini/hooks/tool.shmust print{"decision":"allow"}.
The troubleshooting checklist covers the rest.
07Getting the alert on your phone
A desktop notification only helps while you're at the desk. For your phone there are three routes:
- Google's Remote Control. Free and built in. Turn it on in the desktop app (Settings, Application, Enable Remote Control) or with
/remote-controloragy --remote-controlin the command line, then open the dashboard in your phone's browser with the same Google account. It sends push notifications and lets you answer prompts. It runs through the session on your computer, so a session that ends shows as offline, and it may be rolled out account by account. Remote Control compared with a notifier app goes into more detail. - A push hook you run yourself, such as ntfy or a chat webhook, called with
curlfrom the sameStophook. Free, and it works from servers. It's one-way: you learn Antigravity is done, then go back to the keyboard. See the ntfy guide. - Antigravity Notifier, which installs the hooks for you and lets you answer from a native phone app.
Antigravity Notifier is independent, made by TouchTap Ltd and not affiliated with Google. It has two parts: antigravity-notifier, a free command line tool for macOS, Windows (beta) and Linux, and the iPhone and Android apps. On Mac or Linux:
curl -fsSL https://antigravitynotifier.com/install.sh | sh
On Windows, use irm https://antigravitynotifier.com/install.ps1 | iex in PowerShell. Homebrew and npx are on the antigravity-notifier page.
Pairing adds one named group, antigravity-notifier, to ~/.gemini/config/hooks.json, keeps a one-time backup and touches nothing else, so your own my-alerts group keeps working beside it. Then you get:
- "Antigravity has finished" with its last message when a turn ends, at most once per execution, and nothing when you stopped the turn yourself;
- commands that wait for your phone while you're away: allow once, allow for the rest of the session, or deny with a note that Antigravity reads;
- Antigravity's questions, answered by picking one or several options or typing;
- a box to send the next instruction right after it finishes.
It only makes Antigravity wait when you're away from the keyboard or your screen is locked, and never in agy -p scripts. It works with agy in any terminal and over SSH; the desktop app and IDE aren't supported yet. The apps need a subscription or a one-off purchase; see pricing.
08FAQ
Does the Stop hook fire after every reply or only at the end of the task?
After every turn. Antigravity doesn't know when your overall task is done, only when it hands control back. In a long back-and-forth you get one alert per reply.
Do I need to approve or trust a new hook?
No. Antigravity has no trust step: a hook in ~/.gemini/config/hooks.json runs from the next session, even in an untrusted workspace. That's convenient, and it's also why you should only add hooks you've read.
Why did my notification hook stop Antigravity from running commands?
A PreToolUse hook that prints nothing, fails or times out blocks the tool, because Antigravity is fail-closed. Make the script always print {"decision":"allow"}, even when the notification fails. A Stop hook doesn't have this problem.
Can the alert include Antigravity's last message?
Not straight from the payload: the Stop payload doesn't carry it. It's in the conversation's transcript_full.jsonl, as the last PLANNER_RESPONSE entry with content. The Stop hook guide shows how to read it.
Does this work in the desktop app?
The desktop app and the IDE read the same global hooks file. We've tested hooks with the agy command line only, so check the result in the desktop app yourself. Remote Control is the built-in option there.