Overview of the Gemini CLI Hook System
mainGemini CLI hooks are scripts or programs executed at specific points in the agentic loop. They allow you to intercept and customize behavior (such as blocking tools, modifying inputs, or injecting context) without modifying the CLI source code.
Key Technical Details:
- Execution: Hooks run synchronously within the agent loop.
- Communication: Data is exchanged using JSON over stdin/stdout.
- Signaling: Hooks use exit codes to signal behavior to the CLI.
- Compatibility: The system mirrors the contract used by Claude Code.