
1/28/2026 · Edi Palencia, Jack Wotherspoon, Abhi Patel
What this post added
Introduces Gemini CLI hooks, a new feature allowing users to execute custom scripts at predefined points in the Gemini CLI's agent loop. This enables customization of agent behavior for tasks like adding context, validating actions, enforcing policies, logging, and sending notifications. Provides a concrete example of a `BeforeTool` hook for automated secret scanning using a shell script and `jq`. Discusses best practices for hooks, including performance, specificity, and security. Highlights the integration of hooks into Gemini CLI extensions, enabling bundled hooks for features like the 'Ralph loop' technique for iterative task completion.