Skip to content

docs: record how Antigravity CLI reads hooks.json - #564

Merged
fdaviddpt merged 1 commit into
mainfrom
docs/agy-hooks-trap
Sep 5, 2026
Merged

fdaviddpt merged 1 commit into
mainfrom
docs/agy-hooks-trap

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Records what probing Antigravity CLI (agy) 1.1.27 established about its hook manifest, as a jit-context trap plus a changelog fragment. No plugin code changes.

Why this is a trap rather than a doc page

Every failure mode here is silent. A Claude Code-shaped hooks.json does not parse, and agy -p "/hooks" then answers {"hooks":[]} -- byte-identical to having no file at all. An unrecognised event inside an otherwise valid file is dropped the same way: the listing prints fewer rows than the file declares, with no error. The only witness for either is ~/.gemini/antigravity-cli/cli.log, which nothing points you at.

That is this project's own worst failure mode -- an install that looks present and captures nothing -- landing on the host side, so it is worth the injection cost at the moment somebody types agy.

What the entry states

  • The accepted schema: a hook name mapping to an object keyed by event, each holding an array of handlers -- with the parse error quoted, since that error is the only way to tell a rejected file from an empty one.
  • Which four events load and fire on 1.1.27 (SessionStart, PreInvocation, PostInvocation, Stop), and which six are silently dropped -- including PreToolUse/PostToolUse, which the published docs list and which fired on agy 1.0.5 per Antigravity (agy): injected PreToolUse hook denies every tool call (invalid_args) — agy unusable in cmux manaflow-ai/cmux#5358.
  • The hook stdin payload, including the transcriptPath this plugin's capture needs and where Antigravity writes its transcript.
  • The probing rule: a firing test must leave a side effect. One probe here answered DONE without calling a tool at all -- it looked like a pass and proved nothing.
  • Both paths that load (~/.gemini/config/hooks.json, <workspace>/.agents/hooks.json) and the one that does not (a plugin's own bundled file, which is copied in and counted).

Two things are labelled as inference rather than measurement: the GetEnableJsonHooks flag, and the untested workspace-local path.

Verification

Rebuilt the index and drove the prompt hook in both directions rather than trusting the rebuild:

  • must fire: {"prompt":"agy hooks not firing"} -> injects the entry, matched: agy
  • must stay silent: {"prompt":"rebase the branch onto main"} -> {}

A rule that matches everything is worse than no rule, so the negative case is the one that matters. Cost is one 5.4KB injection per match, on a keyword set (antigravity, agy, gemini cli, hooks json, fourth host, jsonhook) that carries no ordinary-English word.

Measured on macOS darwin/arm64, agy 1.1.27, one machine. The entry says so; nothing is claimed for Linux, Windows or other versions. Scoped by keyword rather than by path, so it costs nothing on a session that never mentions this host.

Refs #553, #563.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bv6BGZD2EdZ9EuJ7tPDTb7

[AI-generated]

The trap entry states the schema agy 1.1.27 actually accepts -- a hook name mapping
to an object keyed by event -- and that Claude Code shape fails to parse with the
error only in ~/.gemini/antigravity-cli/cli.log, while /hooks answers identically to
having no file. It records which four events load and fire, the stdin payload
carrying transcriptPath, and the probing rule that a firing test must leave a side
effect rather than trusting the reply.

Refs #553, #563.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Bv6BGZD2EdZ9EuJ7tPDTb7
@fdaviddpt
fdaviddpt merged commit 917c5f3 into main Sep 5, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the docs/agy-hooks-trap branch September 5, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant