# Show HN: Codex/Claude-style Tab follow-up prompts for Google Antigravity (Rust)

> Source: <https://github.com/korisame/agy-ghost-prompt>
> Published: 2026-12-01 14:31:12+00:00

**Key takeaway:** Antigravity's Stop and PreInvocation hooks can drive a warm agy stream-json worker with --json-schema to return 3 ranked follow-up prompts in ~1.5–2s, surfaced by an AXObserver-driven overlay at 0.0% idle CPU.

Codex / Claude-style **`Tab`-to-accept ghost follow-up prompts** for the **Google Antigravity** macOS desktop app — built in native Rust + AppKit without patching or re-signing Antigravity.

Both Codex and Claude desktop apps predict your most likely next prompt in subtle grey ghost text inside the empty composer so you can press `Tab` to insert it. Google Antigravity doesn't have this built in yet.

`agy-ghost-prompt` adds it cleanly using Antigravity's official lifecycle hooks (`Stop` + `PreInvocation`), a pre-warmed `agy` CLI `stream-json` worker with `--json-schema`, and a zero-polling native macOS overlay daemon (~600 KB Rust binary, zero Dock icon, **0.0% idle CPU**).

- **2–3 ranked suggestions with instant cycling** — generates up to 3 distinct follow-ups in one structured`--json-schema` call (`1/3 · ⇥ Tab` ). Press**`Shift+Tab`** or**`↓` / `↑`** when the composer is empty to cycle through them, then**` Tab`** (or`→` ) to insert.
- **Zero-polling, 0.0% idle CPU** — driven entirely by native macOS`AXObserver` (`AXFocusedUIElementChanged` ,`AXTitleChanged` ,`AXValueChanged` ,`AXWindowMoved` ,`AXWindowResized` ),`NSWorkspace` activation/Space notifications, and a kernel`kqueue` directory watcher for instant state/config updates.
- **Native look & feel** — seamless click-through Cocoa`NSPanel` aligned pixel-for-pixel over Antigravity's composer (`Ask anything...` ), automatically syncing with macOS Light/Dark mode.
- **Fast (~1.5–2s) & zero extra API keys** — keeps a warm`agy --input-format stream-json` process (default`gemini-4-hydrogen-low` ) behind a local Unix socket so it reuses your existing Antigravity login and prompt cache.
- **Clipboard-free `Tab` insertion** — uses`CGEventKeyboardSetUnicodeString` to insert text directly into Electron/React without touching your clipboard or clipboard history.
- **Language-aware** — matches the language you use in each chat (e.g. English, Italian, Spanish, etc.) by anchoring on your recent user turns, even if code or assistant replies mix languages.
- **Per-conversation isolation** — resolves exact conversation titles directly from Antigravity's local`conversation_summaries.db` (via native`libsqlite3` FFI, immune to`~/.sqliterc` ) and skips subagent turns so concurrent chats never cross-contaminate.
- **Space & focus safe** — checks`CGWindowListCopyWindowInfo` z-order (never floats over other apps/Spaces), hides immediately while typing, hides while an agent is running (`PreInvocation` + toolbar`Cancel` detection), and ignores`Tab` if another field or menu is focused.
- **Update-proof** — never modifies`/Applications/Antigravity.app` .

```
Antigravity turn ends
        │
        ▼
  Stop hook (~2ms) ──► Unix socket (~/.cache/agy-ghost-prompt/worker.sock)
                                │
                                ▼
             Warm `agy` stream-json + --json-schema worker
                     (gemini-4-hydrogen-low, ~1.5s)
                                │
                                ▼
            ~/.cache/agy-ghost-prompt/state.json (top 3 ranked)
                                │
                       kernel kqueue wakeup
                                ▼
       AgyGhostPrompt.app (AppKit NSPanel + AXObserver + CGEventTap)
         • 0.0% idle CPU (no polling loop)
         • Shows ghost text + `1/3 · ⇥ Tab` over empty composer
         • Shift+Tab / ↑ / ↓ → cycle suggestions
         • Tab (or Right) → inserts via Unicode CGEvent (clipboard untouched)
         • Esc → dismisses  |  Typing → hides immediately
         • PreInvocation hook / Cancel button / Enter → hides while running
```

- **macOS** (Apple Silicon or Intel)
- **Google Antigravity** desktop app
- **Antigravity CLI (`agy`)** — install with:

```
curl -fsSL https://antigravity.google/cli/install.sh | bash
```

Downloads the signed-ready universal binary (`arm64` + `x86_64`) from [Release `v0.2.0`](https://github.com/korisame/agy-ghost-prompt/releases/tag/v0.2.0) and runs `install`:

```
curl -fsSL https://github.com/korisame/agy-ghost-prompt/releases/download/v0.2.0/agy-ghost-prompt-v0.2.0-macos-universal.tar.gz \
  | tar -xz -C /tmp agy-ghost-prompt && /tmp/agy-ghost-prompt install && rm -f /tmp/agy-ghost-prompt
git clone https://github.com/korisame/agy-ghost-prompt.git
cd agy-ghost-prompt
./install.sh
```

What `install` does:

1. Installs `~/.local/bin/agy-ghost-prompt` and packages`~/Applications/AgyGhostPrompt.app` (`LSUIElement` , no Dock icon).
2. Auto-detects any local Apple Development / Developer ID codesigning certificate in your Keychain so future rebuilds preserve Accessibility trust (falls back to ad-hoc signing otherwise).
3. Safely merges the `agy-ghost-prompt`` Stop` and`PreInvocation` entries into`~/.gemini/config/hooks.json` without clobbering existing hooks.
4. Installs and starts a LaunchAgent (`~/Library/LaunchAgents/com.agy-ghost-prompt.daemon.plist` ) and opens**System Settings → Privacy & Security → Accessibility** .

In **System Settings → Privacy & Security → Accessibility**, enable **`AgyGhostPrompt`** (toggle **ON**).
Then restart the LaunchAgent once if it was already waiting:

```
launchctl kickstart -k gui/$(id -u)/com.agy-ghost-prompt.daemon
```

| Key | Action | 
|---|---|
| `Tab` (or`→` if configured) | Insert the highlighted follow-up into the composer (does not auto-send) | 
| `Shift+Tab` or`↓` | Cycle to next suggestion ( `1/3 → 2/3 → 3/3` ) | 
| `↑` | Cycle to previous suggestion | 
| `Esc` | Dismiss suggestion for the current turn | 
| Any character | Hide ghost text immediately and type normally | 

Zero config is required. To customize, create `~/.config/agy-ghost-prompt/config.json` (hot-reloaded live via `kqueue` — no restart needed):

```
{
  "model": "gemini-4-hydrogen-low",
  "theme": "auto",
  "max_chars": 110,
  "max_age_secs": 1800,
  "accept_key": "tab",
  "disabled_projects": ["private-repo", "~/work/sensitive"]
}
```

| Field | Default | Description | 
|---|---|---|
| `model` | `"gemini-4-hydrogen-low"` | Any model from `agy models` (e.g.`gpt-oss-120b-medium` ,`gemini-4-carbon-low` ). Also overridable via`AGY_GHOST_MODEL` . | 
| `theme` | `"auto"` | `"auto"` (follows macOS appearance),`"dark"` , or`"light"` . | 
| `max_chars` | `110` | Maximum suggestion length before truncation. | 
| `max_age_secs` | `1800` | Seconds before unused cached suggestions expire. | 
| `accept_key` | `"tab"` | Key used to accept the ghost prompt: `"tab"` ,`"right"` (Right Arrow), or`"both"` . | 
| `disabled_projects` | `[]` | List of project IDs, folder names, or workspace paths (supports `~/` ) where ghost suggestions are completely skipped. | 
| `agy_bin` | `null` | Optional explicit path to `agy` (also overridable via`AGY_BIN` ). | 

```
agy-ghost-prompt install                         # Install app bundle, hooks, and LaunchAgent
agy-ghost-prompt uninstall                       # Cleanly remove LaunchAgent, hooks, app, and cache
agy-ghost-prompt status                          # Inspect Accessibility trust, config, composer, and state
agy-ghost-prompt set-test "One" "Two" "Three"    # Push 1–3 test suggestions to the active chat
```

Logs live at `~/.cache/agy-ghost-prompt/daemon.log` and `~/.cache/agy-ghost-prompt/hook.log`.

- Reads only your local `transcript.jsonl` and`~/.gemini/antigravity/conversation_summaries.db` (opened read-only).
- Never modifies or injects code into `Antigravity.app` .
- Never reads or modifies your clipboard.
- Never sends conversation snippets anywhere outside your local `agy` CLI session.
- Recursion-guarded via `AGY_GHOST_PROMPT_INTERNAL=1` so the worker's own`agy` calls never trigger hooks.

```
agy-ghost-prompt uninstall
```

Removes the LaunchAgent, the `agy-ghost-prompt` entry in `~/.gemini/config/hooks.json`, `~/Applications/AgyGhostPrompt.app`, `~/.local/bin/agy-ghost-prompt`, and `~/.cache/agy-ghost-prompt`.
