# Antigravity CLI adapter

Shows the sessions of Antigravity CLI, the program `agy`, in the notch: working, done at the end of a turn, failed when its loop stops on an error, needing you while it asks you a question, what the tool in use does, its first prompt, its repository and its branch as its name, and its tool calls as steps.
Antigravity CLI reports through hooks: each hook posts its event with `curl` to a Unix socket in your own folder, `~/Library/Application Support/Blossom/antigravity/socket`, where this adapter listens. Blossom launches the adapter.
**Permissions are answered in Antigravity CLI, and Blossom does not see them.** A hook runs before every tool call, not only before the ones Antigravity asks you about, and no event says that a permission prompt is on screen; see "What to know".
The hooks are one hook named `blossom` in the hooks file of Antigravity, `~/.gemini/config/hooks.json`, next to the hooks you have there. It is not the settings file of Gemini CLI, `~/.gemini/settings.json`, which the Gemini CLI adapter uses: the two never touch each other. You can try the hooks in one folder, or install them for every session.

**This adapter was written from the documentation of Antigravity and was never run against a real Antigravity CLI.** What is documented and what is only supposed is in [../../documentation/roadmap/antigravity.md](../../documentation/roadmap/antigravity.md); the checks at the end say what to look at.

You need:

- Blossom. It includes this adapter and the Bun that runs it; from a clone, `bun run build` makes one.
- Antigravity CLI, `agy`, signed in. The hooks follow the [hooks page](https://antigravity.google/docs/hooks) of the documentation as it read on 2 December 2026.
- `curl`, `printf` and `cat`, which every hook runs by their full paths under `/usr/bin` and `/bin`, `ps`, which the hook of the start of a conversation runs as `/bin/ps`, and a POSIX shell. macOS ships them. Which shell Antigravity runs a hook with is not documented; the hooks were tested with `sh`, `bash` and `zsh`.

## Connect from Blossom

The quickest way. Blossom finds `agy` on your Mac, in `~/.local/bin` where its installer puts it or in the `PATH` of your shell, and connecting it is one click: "Continue" on the second step of the introduction, with Antigravity CLI checked, or its switch in Settings > Agents. Blossom then adds this adapter to its configuration, starts it, and writes the hook `blossom` of `adapters/antigravity/hooks.json` into `~/.gemini/config/hooks.json`. Each key of that file names one hook of yours and holds its events; Blossom adds its own key at the end and keeps every byte of the others where it was.

When the file is missing, Blossom creates it, and the folders above it, readable by you alone. When it is there, Blossom keeps a copy of it in `~/Library/Application Support/Blossom/backups/antigravity/`, named after the moment in UTC, before it writes; it writes the new content to a file next to it and moves it into place, so a failure halfway leaves the file as it was. A file with comments or a trailing comma is left alone, and the row in Settings says why. "Repair" in the row puts the hook back when it is missing or not the one this Blossom installs. "Disconnect", shown while the agent is off, takes the adapter out of Blossom and the key `blossom` out of the file, and gives back the file you had. What Blossom writes and why is in [the decision](../../documentation/decisions/connecting.md).

The Antigravity app and the Antigravity IDE read the same file, so their conversations may report too, under the same tile; that they run these hooks was not tried.

## Run Blossom with the adapter

From the root of the clone:

```sh
bun install && bun run bootstrap && bun run build
BLOSSOM_CONFIGURATION=adapters/antigravity/configuration.json apps/macos/build/Build/Products/Debug/Blossom.app/Contents/MacOS/Blossom
```

`bootstrap` installs the toolchain the build needs; see [../../documentation/contributing.md](../../documentation/contributing.md).

The notch shows nothing until a session of Antigravity CLI reports. Run one Blossom at a time: the adapter holds the socket, and the adapter of a second Blossom logs `cannot listen for the hooks of antigravity` and exits.

### From Finder

An app opened from Finder reads `~/Library/Application Support/Blossom/configuration.json`. Name the adapter by its package, which Blossom includes, so neither a path nor Bun is needed:

```json
{ "adapters": [{ "package": "antigravity" }] }
```

If the file already exists, add the adapter to its `adapters` list instead.

## Try it in one folder

Antigravity also reads the hooks of a project from `.agents/hooks.json` in the folder where you start `agy`. So try the hooks in a folder made for it, and nothing of yours changes:

```sh
cd "$(mktemp -d)"
mkdir -p .agents && cp "<absolute path of the clone>/adapters/antigravity/hooks.json" .agents/hooks.json
agy
```

What you should see:

- Nothing when `agy` opens. The tile appears with the first prompt, named after the first line of that prompt and the folder, with no badge while it works and the tool in use in live.
- The amber badge while Antigravity asks you a question, and no request panel: answer there.
- No badge while Antigravity asks you to allow a tool: the session still says it works. Answer in Antigravity.
- The green badge when a turn ends; the red one when its loop stops on an error.
- The tile gone within seconds after you quit `agy`.

`/hooks` inside `agy` lists the hooks it loaded, `blossom` among them.

## Install by hand

For a clone without the app. Without a hooks file, copy the template; the copy never overwrites a file that is there:

```sh
mkdir -p ~/.gemini/config && cp -n adapters/antigravity/hooks.json ~/.gemini/config/hooks.json
```

With a hooks file of your own, write a merged copy, read it, and put it in place yourself:

```sh
jq -s '.[0] + .[1]' ~/.gemini/config/hooks.json adapters/antigravity/hooks.json > hooks.merged.json
```

## Remove by hand

After an install by hand; after connecting from Blossom, Disconnect does it, and removing Blossom takes out the hooks of every tool, see [Removing it](../../documentation/privacy.md#removing-it). Check that the hook `blossom` holds nothing but Blossom's hooks, which name the socket, and write a copy without it:

```sh
jq -e '[.blossom[]? | arrays | .[] | (.hooks // [.])[] | select((.command // "") | contains("Blossom/antigravity/socket") | not)] | length == 0' ~/.gemini/config/hooks.json && jq 'del(.blossom)' ~/.gemini/config/hooks.json > hooks.cleaned.json
```

If `jq` prints `false`, someone added a hook of their own to `blossom`: take out only the entries whose `command` names `Blossom/antigravity/socket`.

## What to know

- **Permissions are neither shown nor answered.** `PreToolUse` runs before every tool call, and its answer can `allow`, which leaves the call to the next hook and to your rules, `auto_approve`, which approves a call "when the default policy would otherwise prompt", `deny`, `ask`, `force_ask` or `deny_unless_prior_grant`. The hook is not told whether Antigravity was going to ask: that depends on your rules, your mode, the terminal sandbox and, in auto mode, a check of each command. Raising a request for every call would ask you about calls Antigravity runs without asking, and answering `auto_approve` would approve calls it was going to ask about. No event says that a prompt is on screen either, so while Antigravity waits for you the session shows working, with the tool in live. The hooks answer nothing, and your rules decide as before.
- **A question needs you.** Antigravity asks with its tool `ask_question`. From its `PreToolUse` to its `PostToolUse` the session needs you, and you answer in Antigravity. That the end of the tool comes after your answer is supposed.
- **A session shows up with its first call to the model.** `PreInvocation` starts it. `SessionStart` starts nothing: it fires "before the first model invocation", maybe before you type anything; its hook only finds the terminal, below. A session that was already running when Blossom started shows from its next call to the model.
- **The name comes from the first prompt and the repository.** Each `PreInvocation` carries `lastUserInput`, the last prompt of the conversation; the first line of the first one the adapter sees is the title, cut to 60 characters, and stays. A prompt that starts with `/` or `!` titles nothing. The folder is `cwd`, or the first of `workspacePaths` when `cwd` is empty; the project is the repository and the branch of that folder, read from `HEAD` and the pointers of `.git` at most once every five seconds, without running `git`. See [../../documentation/decisions/names.md](../../documentation/decisions/names.md).
- **Steps are tool calls, saying what they do.** Each call is a step from its `PreToolUse` to the `PostToolUse` with the same `toolCall.id`, failed when that `PostToolUse` carries an `error`. A step still running when the turn ends is shown failed. A step of `run_command` is its `toolSummary`, never `CommandLine`; one of `read_file`, `write_file` or `edit_file` is the verb and the name of the file, never its folder or its content; one of `call_mcp_tool` names the server; a tool whose name starts with `browser_` is "Using the browser"; every other tool of the documentation has its own words, and one the adapter does not know is "Using" and its name. Those arguments are read from the documentation, not seen in a run. Nothing a tool printed is reported.
- **The end of a turn.** `Stop` ends the turn: failed when its `terminationReason` is `ERROR` or it carries an `error`, done otherwise, an interrupt with `USER_CANCELED` included. A `Stop` with `fullyIdle` false, while background tasks still run, ends the turn too.
- **The hooks send the whole payload, and the adapter keeps a few fields.** Each hook sends `{"event":"<its event>","payload":<the payload>}`, the payload as it came, with your prompt and the arguments of tools. The adapter keeps the identifier of the conversation, the title taken from the first line of the prompt, the name of the tool, its identifier and the words of its step, the folder, and whether it failed, and drops the rest at once. Nothing else of your prompt or of a tool is kept, logged or sent to Blossom. The event is the one the hook is installed on, so no text of the payload, `hookEventName` included, can pass for another.
- **The hooks print nothing and always succeed.** Antigravity reads what a hook prints as its answer. Every command sends everything it runs to `/dev/null` and ends with `|| /usr/bin/true`, so neither a configuration file of `curl` nor whatever answers on the socket can make a hook decide anything, and with Blossom closed every tool still runs. A function of your shell named `curl`, `printf` or `cat` does not run in place of the full paths. The documentation calls `decision` required in the answer of `PreToolUse` and of `Stop`; that an empty answer leaves the call to your rules and lets the loop stop is supposed, and is the first check below.
- **The hooks ignore your curl configuration.** `-q` keeps `curl` from reading `~/.curlrc` and its siblings.
- **Without Blossom, Antigravity works as before.** With Blossom closed nothing listens on the socket: each hook gives up at once, prints nothing and ends without an error. When the adapter is alive but does not answer, every event waits one second, inside the 30 seconds Antigravity gives a hook.
- **A session whose `agy` was killed leaves within seconds, if the process is the one supposed.** Every command names the process that started its shell, in the header `Blossom-Process`. The adapter watches a process only once two events in a row name it, and every five seconds asks the system whether it still exists. No event ends a session in Antigravity, so this is how a tile leaves; that this process is `agy` for the whole conversation is supposed, not seen. If it changes with every event, nothing is watched, and a tile stays until you dismiss it.
- **The socket is yours alone.** It lives in a folder only your user can open. A process that runs as you can still post events to it, or listen on it while Blossom is closed and read the payloads, your prompts included. See [../../documentation/decisions/socket.md](../../documentation/decisions/socket.md).
- **The start of a conversation finds its terminal.** Antigravity has no event for a prompt, and `PreInvocation` comes before every call to the model, so the walk of the processes runs once a conversation, in the hook of `SessionStart`. It walks up its processes with `/bin/ps`, sixteen at most, for the terminal device and the processes above it, and reads the variables terminal programs and multiplexers set, such as `TERM_PROGRAM`, `__CFBundleIdentifier`, `TMUX_PANE` and `KITTY_WINDOW_ID`. The adapter keeps what it found, for sixty-four conversations at most, until the conversation starts working, and then hands it to Blossom, which keeps it in memory, shows it nowhere, and uses it to bring that terminal forward when you ask. Which shell and environment Antigravity gives a hook, whether a hook runs in its terminal sandbox, and whether a resumed conversation fires `SessionStart` are not documented: the hook may send less or nothing, and prints nothing either way. It adds about 50 ms to the start of a conversation, and to no other hook. Hooks connected before this version lack the hook of `SessionStart`, and Settings > Agents offers Repair.
- **Sixty-four sessions at most.** When a sixty-fifth starts, the adapter closes the one it heard from least recently.
- **`"enabled": false` in the hook `blossom` turns it off.** Blossom keeps that key, and anything else you add to its hook, when it repairs or disconnects.
- **The hooks find the socket through `$HOME`.** A session started with another `HOME` does not report.

### Not confirmed

Written from the documentation, never seen in a run:

1. That a hook that prints nothing leaves a tool call to your rules and lets the loop stop, though the documentation calls `decision` required for `PreToolUse` and `Stop`.
2. Which shell runs a hook, and that `$PPID` is the `agy` process for the whole conversation.
3. That a hook can reach the socket: whether hooks run inside the terminal sandbox is not documented.
4. That `PreInvocation` comes before every call to the model and carries the prompt of the turn, and when `SessionStart` comes.
5. That the `PostToolUse` of `ask_question` comes once you answered, and that nothing comes while a permission prompt waits.
6. Whether a subagent of `invoke_subagent` runs the hooks with a `conversationId` of its own. If it does, it shows as a session of its own.
7. What a resumed conversation, `agy -r`, sends, and whether a hooks file changed while `agy` runs is read again.
8. That Antigravity reads a file of `{}`, as Disconnect leaves one that held only Blossom's hook, as a file without hooks.

## Checks by hand

The adapter was tested with its hook commands run by `sh`, `bash` and `zsh` against the socket, with payloads written from the hooks page, never captured from a run. Each check below needs `agy` signed in. Write down the release of `agy` and what the line in italics asks.

Prepare once. To see the raw payloads first, make a folder whose hooks log what they receive, and remove it afterwards:

```sh
T=$(mktemp -d) && cd "$T" && mkdir -p .agents && echo "$T"
jq -n --arg log "$T/events.log" 'def handler($event): {type: "command", command: ("{ /bin/echo \"" + $event + " process $PPID shell $0\"; /bin/cat; /bin/echo; } >> " + $log + " 2>/dev/null; /usr/bin/true")}; {logger: (["SessionStart", "PreToolUse", "PostToolUse", "PreInvocation", "PostInvocation", "Stop"] | map(. as $event | {($event): (if ($event | endswith("ToolUse")) then [{matcher: "*", hooks: [handler($event)]}] else [handler($event)] end)}) | add)}' > .agents/hooks.json
agy
```

1. **The payloads.** Ask `hi`, then `run the shell command ls`, and quit. *Is every event of `events.log` followed by one line of JSON with `conversationId`? Did `SessionStart` come before you typed, and does `PreInvocation` carry `lastUserInput`?*
2. **An empty answer.** The logger prints nothing, like the hooks of the adapter. *Did `ls` run as it does without hooks, and did `agy` stop at the end of the turn, with no warning about a hook or a missing decision?* If not, the hooks of the adapter need an answer, and the rest waits for a change.
3. **The shell and the process.** In a second terminal, `ps -ax -o pid,ppid,command | grep '[a]gy'`. *Which shell does the log name, and is the process on every line the `agy` of the session, the same for the whole session?*
4. **A permission.** Ask `run the shell command curl -sI https://example.com` and wait. *Does Antigravity ask, and does anything reach the log between the `PreToolUse` and the `PostToolUse` of that call?*
5. **A question.** Ask `ask me to choose between two options before you answer`. *Is there a `PreToolUse` of `ask_question` before the question shows, and its `PostToolUse` only after you answer?*
6. **An interrupt.** Ask `count from 1 to 300, one number per line` and press `esc`. *Which `terminationReason` does the `Stop` carry, if one comes?*
7. **A subagent.** Ask for a task that Antigravity hands to a subagent. *Do events with another `conversationId` appear?*

Then run Blossom with the adapter and connect Antigravity CLI. Delete the folder of the logger.

8. **The file.** *Does `~/.gemini/config/hooks.json` hold your hooks as before, byte for byte, with `blossom` after them, `~/.gemini/settings.json` unchanged, and the copy in `backups/antigravity/`? Does `/hooks` in `agy` list `blossom`?*
9. **A turn.** In a new folder, start `agy` and ask `hi`. *Does the tile appear with the prompt, titled `hi` and named after the new folder, with no badge, and turn green when the answer ends?*
10. **A tool.** Ask `run the shell command sleep 5`. *Does live show the tool, does detail list it as a step, and does the tile turn green at the end?*
11. **A question.** Ask `ask me to choose between two options before you answer`. *Does the tile turn amber while Antigravity asks, and back when you answered?*
12. **A permission.** Ask `run the shell command curl -sI https://example.com`. *Does the tile stay without a badge while Antigravity asks, and does the call run once you allow it there?*
13. **The end.** Quit `agy`. *Does the tile leave within about five seconds?* Start it again, ask `hi`, and `kill -9` its process from another terminal. *Does the tile leave within about five seconds?*
14. **Quitting Blossom.** Quit Blossom and ask `run the shell command ls`. *Does the tool run, with nothing printed about a hook?*
15. **Prompt mode.** `agy -p hi` in a folder. *Does a tile appear and leave when the run ends?*
16. **The app.** If the Antigravity app or IDE is installed, start a conversation there. *Does it show in the notch?*
17. **Disconnect.** Disconnect Antigravity CLI in Settings > Agents. *Is `~/.gemini/config/hooks.json` the file you had, does a new session no longer show, and does `agy` start without a complaint about the file?*
18. **The terminal of a conversation.** Start `agy` in Terminal, in iTerm and inside tmux, and ask `hi` in each. *Does each start as quickly as before, with nothing printed about a hook?* Then `agy --resume` an earlier conversation and ask `hi`. *Does `events.log` of check 1 show a `SessionStart` for it?*
