Skip to content

Port Remember's capture to Antigravity CLI (agy): SessionStart, PreInvocation, Stop #563

Closed

Description

@fdaviddpt

#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:

  1. A hook fires under agy and Remember writes a memory file whose content came from that session.
  2. The transcript is read from the transcriptPath the hook was handed, not from a path derived by convention. That is a different format (transcript_full.jsonl under .system_generated/logs/) from Claude Code's -- whether the existing reader can consume it is an open question this work answers.
  3. 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.
  4. Cross-platform claims are labelled. Everything known here is macOS/arm64 on one agy version.

Scope and non-goals

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]

Metadata

Metadata

Assignees

Labels

priority:medium

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions