# Antigravity CLI

Notesoup provides a native **Antigravity CLI 1.5.17** plugin: a first-invocation notes boot and the four notes operations. It shares the same notes store, names, addressing, schemas, and rendering as the Pi and other Notesoup hosts. It does not implement native Antigravity history, context-budget reporting or context reset/compaction recovery.

## Install

From an unpacked Notesoup distribution, install the plugin directory (it contains its bundled helper, so Node.js must be on your PATH). From a source checkout, run the build first:

```sh
npm run build
agy plugin validate plugins/antigravity --strict
agy plugin install plugins/antigravity
agy plugin list
```

For upgrades, repeat `agy plugin install` with the new build. Start or resume a conversation after installation. Notesoup does not request permissive global tool settings; approve its MCP calls using Antigravity's ordinary permissions. Its native MCP server appears as `notesoup_notesoup`, with `notes_write`, `notes_update`, `notes_read`, and `notes_list`.

Run `agy plugin disable notesoup` to disable the hooks and tools or `agy plugin uninstall notesoup` to remove the plugin. Neither command deletes the notes library. The default notes location is `~/.agents/notes`; set an absolute `NOTESOUP_HOME` before launching `agy` to use a different library.

## Boot and identity

The plugin uses a `PreInvocation` command hook, which runs before Antigravity calls a model (including native subagents), and an ordinary stdio MCP server. It injects the shared Notesoup protocol as a native `systemMessage` step and the identity/pinned notes/index separately as a `userMessage` step. Writable notebooks never enter the protocol message. On the tested Gemini serialization, Antigravity itself wraps the system step as a user-role `<SYSTEM_MESSAGE>` rather than placing it in Gemini's `systemInstruction`; the actual notebook data remains a distinct user message.

The hook saves the model name and cwd that the host reports, keyed by the **native conversation ID**, under the plugin's `PLUGIN_DATA`. The conversation's first invocation emits its own boot. Subsequent invocations refresh the identity for tools without repeating the persisted boot. Resume retains that boot in the native trajectory. This is one boot per conversation, **not** one per compacted context window: there is no native compaction-boundary integration or acknowledgement of hook output persistence. If the host discards the injected steps, refresh is not automatic.

MCP tools require host-provided `_meta["antigravity.google/conversation_id"]` and `_meta["antigravity.google/root_conversation_id"]` on every operation, and an exact hook binding for the invoking conversation. Roots, children and parallel siblings have separate session notebooks; a root ID is never a replacement for a child ID. Native parent/root/agent facts are cross-checked when present in the hook and the call. Project selection uses the hook's actual cwd and the shared project namespace resolver, not the MCP process's working directory. The current hook's concrete `modelName` selects `@model` (last provider path component, slugged); absent/`auto` model facts are refused rather than assigned to an arbitrary model notebook. An identity-refresh failure stops that model invocation instead of allowing tools to reuse an older binding. Start a new conversation before switching `NOTESOUP_HOME`.

The tested host did not supply `agentName` or ancestry in either root or dynamically defined child hooks, and the corresponding calls had no `agent_name`. These conversations use the shared `anonymous` agent shelf, not a fabricated name inferred from the prompt, role or agent definition. If the host supplies an agent name, Notesoup uses it; MCP's native agent name can refine a hook that did not name an agent. This is a host limitation: an unreported named agent cannot have its own name's pins at boot. A mismatched, absent or unbound conversation is refused; no global/latest-conversation fallback exists.

See [Notes library](notes-library.md) for notes usage.

## Native verification

The host contract comes from the installed 1.5.17 `agy-customizations/docs/{plugins,hooks,mcp_servers}.md` and its changelog (1.4.4 added the root conversation ID in MCP call metadata). The adapter was also verified against the actual 1.5.17 executable in a clean disposable home, with a scripted loopback Gemini API endpoint using the CLI's supported API-key provider. No personal account credentials, external model requests, real notes, or global permission changes were used. This verifies native host behavior, not model quality.

Run the normal fixture tests and the opt-in real-host smoke:

```sh
npm run build
node --test dist/test/antigravity-plugin.test.js
NOTESOUP_AGY_LIVE="$(command -v agy)" node --test dist/test/antigravity-live.test.js
```

The live smoke installs the unmodified native plugin in the isolated home. It confirms a first-turn request already contains pinned project, human and model sentinels with no tool reads; a root plus two overlapping native children each receive their own boot and successfully write, read, update and list their own session note through MCP; resuming the root retains one original boot and reads its original updated session note. The smoke's only permission rules are exact Notesoup operation allowances inside the disposable home.
