Skip to content

feat(cli): relay Stop, PostToolUse and PreToolUse to Antigravity (agy), not only SessionStart #1194

Description

@blafourcade

Problem

On next, the Antigravity profile relays only SessionStart (cli/src/contexts/tools/domain/profiles/antigravity/antigravity-hooks.ts, MAPPED_EVENTS), with the reason "Claude and agy name their tools differently". tool-paths.md lists PreToolUse, PostToolUse and Stop as supported by the host. A hook on any of those three does nothing on agy.

Measured on 2026-11-11 with agy -p (1.5.x, the binary auto-updated from 1.5.1 to 1.5.5 during the test), project file .agents/hooks.json, disposable folder:

  • SessionStart, PreToolUse, PostToolUse, Stop all fire. agy also has PreInvocation and PostInvocation. It has no UserPromptSubmit, SubagentStop or SessionEnd.
  • Tool names differ: write_file (args Path, Content) and run_command (args CommandLine), not Write and Bash.
  • Output contract differs from the framework's scripts: a Stop hook continues the agent with {"decision":"continue","reason":...}. An empty output from a PreToolUse hook is a denial, so a script that prints nothing blocks every tool call. {"decision":"allow"} is required.
  • PostToolUse could not inject context (documented as {} only). PostInvocation injected it with {"injectSteps":[{"systemMessage":{"systemMessage":"..."}}]}.
  • In -p, tools are refused unless permissions are skipped, which matters for CI.
  • Not tested: --settings, subagent hooks. One run per test, small model.

Scope

  • Relay Stop and PostToolUse (and PreToolUse once its output contract is handled) to agy, with matchers translated (Bash to run_command, Write and Edit to write_file).
  • Translate the hook output (block to continue, an empty PreToolUse output to allow), or document that scripts must handle it.
  • Decide how PostToolUse context injection works on agy (PostInvocation).

Acceptance criteria

  • A Stop script that blocks once continues the turn on agy, with a guard that stops the loop.
  • A PostToolUse script runs after write_file and run_command.
  • A PreToolUse script that prints nothing does not deny every tool call.
  • Events the profile does not relay produce a warning at build time (today: the unmapped event message already exists for the profile).

Prior art in this repo

Out of scope

Telling agy to relay UserPromptSubmit or SessionEnd (they do not exist). The Antigravity IDE.

Activity

  1. blafourcade commented on Nov 25, 2026

    @blafourcade
    ContributorAuthor

    Partly landed in next with #1253 (364ca04): Stop and PostToolUse are relayed to agy; Stop continues with {"decision":"continue"} once, PostToolUse runs after write_file and run_command, and every event not relayed warns at build time. Remaining: plugin matchers are not translated (every PostToolUse handler uses *); PreToolUse relay is part of #1342; injecting context after a tool through PreInvocation is tracked in #1350. Keeping this open for the matcher translation.

  2. blafourcade commented on Nov 25, 2026

    @blafourcade
    ContributorAuthor

    Delivered on next, checked against the current code after the CLI convergence (#1253) and the follow-up merges.

    Evidence: antigravity.ts events SessionStart, PreToolUse, PostToolUse, Stop; #1355 tool names (host-tool-names.ts, antigravity-hooks.model.unit.test.ts); host-antigravity.cjs continueTurn -> decision: continue with no re-continue of a continuation; silent PreToolUse answers allow; unmapped event ... skipped warning in wrapped-command-hooks-merge.ts

    Closing as completed. Reopen with a reproduction if something is still missing.

  3. moved this from Ideation to Done in AIDD Roadmapon Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions