Skip to content

Automations for Gemini CLI and Antigravity (agy): extension hooks and .agents/hooks.json #247

Backlog

Description

@vsn411

Part of #240. Builds on #242 and #241. Packaging: #227 (Gemini CLI row).

Gemini CLI was replaced by Antigravity CLI (agy) for unpaid-tier and Google One users on 2026-06-18, per the banner on geminicli.com. Paid/API-key users still use Gemini CLI. Cover both in one piece of work: they share skill paths and most concepts, but their hook formats differ.

Gemini CLI (checked against the docs on 2026-12-03)

Sources: Hooks reference, Extensions reference.

  • Config: hooks object in settings.json. Each group has matcher, sequential and hooks[] (type: "command", command, name, timeout). timeout is in milliseconds, default 60000. Project hooks are fingerprinted, and /hooks lets users enable or disable them.
  • Events:
    • BeforeTool: decision: "deny" or exit 2 blocks the tool.
    • AfterTool: deny hides the result. Don't use it for us.
    • AfterAgent: deny rejects the response and forces a retry. This is the turn-end hook; loop-guard it hard.
    • SessionStart: context is prepended in non-interactive mode.
    • SessionEnd, BeforeAgent, Notification, PreCompress.
  • Extensions: gemini-extension.json (mcpServers, contextFileName, settings, …). Hooks go in hooks/hooks.json, not the manifest. Also commands/*.toml (→ /secfoo:…), skills/<name>/SKILL.md, and ${extensionPath} variables. Install with gemini extensions install <github-url>.
  • Headless: hooks firing in gemini -p isn't stated explicitly. secfoo's gemini adapter runs gemini -p, so verify and keep the recursion guard.

Antigravity / agy (checked against the docs on 2026-12-03)

Sources: Hooks, Customization discovery.

  • Config: .agents/hooks.json (workspace), ~/.gemini/config/hooks.json (global), or a plugin's hooks.json. Hooks in ~/.gemini/antigravity-cli/settings.json are not loaded. timeout is in seconds, default 30. "enabled": false per hook. /hooks in the TUI.
  • Events:
    • PreToolUse: decision allow / deny / ask / …, plus reason; matcher e.g. run_command.
    • PostToolUse: no blocking.
    • PreInvocation / PostInvocation.
    • Stop: decision: "continue" keeps the agent running. Check continuationActive. fullyIdle says whether background tasks are still running.
    • SessionStart: injectSteps.
    • Matchers apply only to Pre/PostToolUse.
  • Skills: .agents/skills/<name>/SKILL.md (shared with Codex), ~/.gemini/config/skills/. The CLI also reads ~/.gemini/skills/ and turns every skill into a slash command.
  • Workflows are deprecated, so use skills, not workflows.
  • Scheduling: a schedule tool (cron, MaxIterations, daemon) and a /schedule command. Verify whether schedules survive the session; if not, document that scheduled-baseline needs CI or a cloud tool instead.

Recipe mapping

Recipe Gemini CLI Antigravity
commit-guard BeforeTool (shell tool) → decision: "deny" PreToolUse (run_command) → decision: "deny" + reason
turn-review AfterAgent → deny + findings (forces a retry; loop guard essential) Stop → decision: "continue" + findings; respect continuationActive
dependency-watch etc. AfterTool (no deny), background PostToolUse, background
session-brief SessionStart SessionStart → injectSteps
fix-findings / on-demand commands/secfoo/*.toml + skills in the extension Skills in .agents/skills/

Budgets: 30 s in Antigravity and 60 s in Gemini CLI, so blocking recipes need explicit timeouts or must use host mode (#242 item 3).

Tasks

  • hosts/gemini_cli.py and hosts/antigravity.py + fixtures for each event above
  • Gemini CLI extension (manifest + hooks/hooks.json + commands + skills) generated by Secfoo in every agent marketplace: one MCP server, local by default, optional key for the org portal #224's build step, installable from this repo's GitHub URL
  • enable --tool antigravity writes .agents/hooks.json (workspace) or ~/.gemini/config/hooks.json
  • Verify hooks under gemini -p and agy --print. Recursion guard in the gemini and agy adapters
  • Check the Gemini CLI → Antigravity migration page (/docs/cli/gcli-migration/) for whether hooks and extensions carry over, and document it
  • Verification rows for both tools: version, OS, recipes, portal shows trigger.host

Done when

Both tools run the recipes with recorded fixtures in CI. The extension installs from GitHub. Skills are shared with Codex. Every run reports back.

Activity

  1. added
    enhancement
    help wanted
    difficulty: medium
    on Dec 3, 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

    difficulty: mediumenhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions