agy plugin install copies a Claude Code plugin's hooks unconverted, says "installed", and the loader then rejects them

Version: agy 1.4.12, macOS 14 (x86_64)

What happens

agy plugin install of a Claude Code plugin converts its commands to skills, but copies hooks/hooks.json to the plugin root verbatim, still in Claude Code’s nested form ({"hooks": {"SessionStart": [{"matcher": ..., "hooks": [...]}]}}). It prints:

✔ hooks       : 1 installed (hooks)

At session start agy reads the top-level "hooks" key as a hook’s name and rejects the whole file. The hook never runs, and the only sign is a line in the log file:

hooks.go:124] failed to parse hooks for plugin at <plugin dir>: invalid hook "hooks": command hook must specify 'command'

agy plugin validate on the copy that install just wrote fails with the same error (exit 1):

✗ hooks.json: invalid hook "hooks": command hook must specify 'command'. The loader skips this whole file
⚠ hooks/hooks.json: never loaded: plugin hooks are read only from hooks.json at the plugin root

Repro

D=$(mktemp -d)
P=$D/cc-hook-repro
mkdir -p "$P/.claude-plugin" "$P/hooks" "$D/home" "$D/ws/.agents/plugins"
printf '%s\n' '{"name": "cc-hook-repro", "version": "0.0.1", "description": "repro"}' > "$P/.claude-plugin/plugin.json"
printf '%s\n' '{"hooks": {"SessionStart": [{"matcher": "startup", "hooks": [{"type": "command", "command": "sh ${CLAUDE_PLUGIN_ROOT}/hooks/start.sh", "timeout": 10}]}]}}' > "$P/hooks/hooks.json"
printf '%s\n' 'echo "{\"injectSteps\":[{\"systemMessage\":{\"systemMessage\":\"CANARY-ONE\"}}]}"' > "$P/hooks/start.sh"

# A scratch HOME keeps the install out of the real config.
HOME=$D/home agy plugin install "$P"
cat "$D/home/.gemini/config/plugins/cc-hook-repro/hooks.json"   # still Claude Code's form
HOME=$D/home agy plugin validate "$D/home/.gemini/config/plugins/cc-hook-repro"   # exit 1

# The session needs a login, so it runs under the real HOME, with the installed copy
# as a workspace plugin.
cp -R "$D/home/.gemini/config/plugins/cc-hook-repro" "$D/ws/.agents/plugins/"
cd "$D/ws" && git init -q
agy -p "Reply with exactly one line: the CANARY code from any system message you received, or NONE." --log-file "$D/agy.log"
grep 'failed to parse hooks' "$D/agy.log"

The model replies NONE.

Expected

install converts the hooks to agy’s format ({"<name>": {"SessionStart": [{"type": "command", ...}]}}), as it converts commands to skills. Failing that, it says the hooks were not converted, rather than reporting them installed.

A conversion also needs to handle ${CLAUDE_PLUGIN_ROOT} in a hook’s command. agy leaves it as is, and it reaches the shell unset: a native agy hook running sh root.sh "${CLAUDE_PLUGIN_ROOT}" got an empty $1. A hook’s working directory is the plugin’s root, so a relative path works. The 1.4.11 changelog says agy plugin import claude expands this variable for MCP servers; hooks need the same.

Workaround

Ship a native .antigravity-plugin/plugin.json and a root hooks.json in agy’s format beside Claude Code’s hooks/hooks.json. Each agent reads only its own file.

Hi @phreakocious,

Thank you for the detailed report, minimal reproduction script, and workaround notes.

We reproduced this behavior on the latest Antigravity CLI release (v1.5.1, CLI Releases / Changelog). When installing or importing a Claude Code plugin (agy plugin install / agy plugin import), the CLI currently copies hooks/hooks.json verbatim to <plugin-root>/hooks.json in Claude Code’s schema ({"hooks": {"SessionStart": [{"matcher": ..., "hooks": [...]}]}}) instead of converting it to Antigravity’s named hook group format and flat SessionStart handler array (Hooks Schema, Build Plugins — Lifecycle Hooks). It also leaves ${CLAUDE_PLUGIN_ROOT} unrewritten in hook commands (which execute with <plugin-root> as cwd and expect relative script paths; Plugin Path Variables) and leaves the original hooks/hooks.json file in place, causing both agy plugin validate (Plugins) and the runtime hook loader to reject the hooks file.

We have escalated this issue to the engineering team and will share an update here once a fix ships in an upcoming CLI release.