Repository navigation
Description
#553 established that Antigravity hooks fire and named the four events that work. This is the port itself: make Remember capture under agy, or establish in the same detail why it cannot.
Do not start from this body's event table. Re-derive it against the installed agy -- #553's own history is three successive corrections, and the vocabulary changed between 1.1.26 and 1.1.27 in both directions. The rule below is what to re-run.
What is established (agy 1.1.27, macOS darwin/arm64)
~/.gemini/config/hooks.json maps a hook name to an object keyed by event, each holding an array of handlers:
{
"remember": {
"enabled": true,
"SessionStart": [ { "type": "command", "command": "…", "timeout": 30 } ]
}
}Four events load and fire: SessionStart, PreInvocation, PostInvocation, Stop. PreToolUse, PostToolUse, UserPromptSubmit, SessionEnd, Notification and turn-completion are silently dropped -- the /hooks listing simply prints fewer rows than the file declares, with the parse error only in ~/.gemini/antigravity-cli/cli.log.
Hook stdin carries transcriptPath, conversationId, modelName, artifactDirectoryPath, workspacePaths; Stop adds terminationReason, fullyIdle, executionNum, error.
The mapping to design against
| Remember captures on | Antigravity analogue | note |
|---|---|---|
SessionStart |
SessionStart |
same name, carries transcriptPath at session open |
UserPromptSubmit |
PreInvocation |
fires per model invocation, not per user prompt -- a turn with several invocations fires it several times |
Stop |
Stop |
carries terminationReason |
SessionEnd |
Stop |
see below |
Stop is a turn boundary, not a teardown. cmux learned this the expensive way (manaflow-ai/cmux#5000): treating a restorable agent's turn-end as a session end destroyed the restore record after the first turn. Their adapter marks Antigravity sessionEndIsTurnBoundary and handles it non-destructively. Whatever Remember does at SessionEnd today, doing it at every Stop is the failure mode to design against, not a detail to discover in testing.
PreInvocation firing per invocation rather than per prompt has the same shape of consequence for anything that assumes one-per-prompt.
Acceptance
The bar is a capture observed end to end, not a manifest that installs:
- A hook fires under
agyand Remember writes a memory file whose content came from that session. - The transcript is read from the
transcriptPaththe hook was handed, not from a path derived by convention. That is a different format (transcript_full.jsonlunder.system_generated/logs/) from Claude Code's -- whether the existing reader can consume it is an open question this work answers. - The negative case is exercised: a session where nothing should be captured produces no file, and it is proven by a positive control in the same run. A capture path that silently saves nothing is this project's own worst failure mode and it is exactly what an unfired hook looks like.
- Cross-platform claims are labelled. Everything known here is macOS/arm64 on one
agyversion.
Scope and non-goals
- Not a README badge. Antigravity CLI 1.1.26 never loads a plugin's hooks, and silently drops two of this plugin's four events #553 settles that badging follows an exercised port; this issue produces the port, and the badge is a separate decision afterwards.
- Not the plugin-install path. A plugin's own bundled
hooks.jsonis copied in, countedhooks : 1 processed, and never loaded -- only the shared and workspace-local files load. Target~/.gemini/config/hooks.json(and evaluate<workspace>/.agents/hooks.json, untested, which the changelog says needs the folder trusted). - Not tool-scoped capture.
PreToolUse/PostToolUsefired onagy1.0.5 (Antigravity (agy): injected PreToolUse hook denies every tool call (invalid_args) — agy unusable in cmux manaflow-ai/cmux#5358) and do not parse on 1.1.27. Treat as unavailable and unstable; do not build on them.
Probing rule
A firing probe must leave a side effect the model cannot fake. "Run a command, then say DONE" produced a DONE with no tool call and an empty hook log -- a test that looked like it passed and proved nothing. Use create the file /tmp/<name> and check the file. Tool-calling turns need --dangerously-skip-permissions, which the Claude Code auto-mode classifier refuses, so that half is human-run.
A repo-local trap covering the schema, the silent drops and the log path is at .claude/jit-context/vocabulary/02-hosts/antigravity-hooks.md; keep it correct as this work moves.
[AI-generated]
Activity
docs: record how Antigravity CLI reads hooks.json (#563) (#564)
Triage tests/test_agy_hooks_563.py in the win32 skip table (#497, #563)
Port Remember capture to Antigravity CLI (agy): SessionStart, PreInvo…
Antigravity: warn before falling back to claude, and stop hiding malf…
docs: document Antigravity in the README, drop Gemini CLI (#572) (#573)
Fix: suppress the cross-plugin promo on the Antigravity delegation pa…