Answer: To create a hook script for Gemini CLI, create a directory for hooks and a simple logging script; the example uses `mkdir -p .gemini/hooks` and then writes a script to `.gemini/hooks/log-tools.sh`. Status: Confirmed Entry: tool/gemini-cli/agents-and-automation/create-hook-script Revision: 1 Digest: sha256:9d19d2b3b3b33d8e (changes whenever the content changes) Timeline: Created: 2026-11-13T03:18:35Z Last changed: 2026-11-13T03:18:35Z Last verified: 2026-11-20T12:53:07Z Next check: 2026-11-21T12:53:07Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of hook directory | .gemini/hooks | [1] | 2026-11-20 script path | .gemini/hooks/log-tools.sh | [1] | 2026-11-20 JSON parsing tool | jq | [1] | 2026-11-20 Sources: [1] Google. "Writing hooks for Gemini CLI". https://geminicli.com/docs/hooks/writing-hooks.md Role: primary. Accessed: 2026-11-20T12:53:07Z Quote: "mkdir -p .gemini/hooks" (Supports: hook directory) Quote: "cat > .gemini/hooks/log-tools.sh << 'EOF'" (Supports: script path) Quote: "This example uses `jq` to parse JSON." (Supports: JSON parsing tool) Published: 2026-10-16T02:36:07Z Snapshot SHA-256: 09b54285a44502abe95396b0c740279d31f01c53d98a77a17974da2b66984775 (captured 2026-11-13T03:18:35Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T03:18:35Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:53:07Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:53:07Z Last attempt: 2026-11-20T12:53:07Z Notes and limitations: Extracted automatically from a single official source (section "Step 1: Create your hook script"). Related: https://latestn.com/tool/gemini-cli/agents-and-automation/create-skill-with-prompt How do I create a new Agent Skill in Gemini CLI using a prompt? https://latestn.com/tool/gemini-cli/agents-and-automation/define-remote-subagent How do I define a remote subagent in Gemini CLI? https://latestn.com/tool/gemini-cli/agents-and-automation/extract-structured-json-output How do I get structured JSON output from Gemini CLI for use in scripts? https://latestn.com/tool/gemini-cli/agents-and-automation/contributor-workflow-acceptance What is the contributor workflow and acceptance criteria for adding behavioral evaluations to Gemini CLI? https://latestn.com/tool/gemini-cli/agents-and-automation/create-custom-agent-skill How do I create a custom Agent Skill in Gemini CLI? https://latestn.com/tool/gemini-cli/agents-and-automation/create-custom-subagent How do I create a custom subagent in Gemini CLI? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:18:35Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/gemini-cli/agents-and-automation/create-hook-script/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/gemini-cli/agents-and-automation/create-hook-script POST: https://latestn.com/dispute/tool/gemini-cli/agents-and-automation/create-hook-script with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/gemini-cli/agents-and-automation/create-hook-script?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I create a hook script for Gemini CLI? Revision 1, last verified 2026-11-20T12:53:07Z. https://latestn.com/tool/gemini-cli/agents-and-automation/create-hook-script (accessed 2026-11-21T09:55:00Z). @misc{LatestN_tool_gemini_cli_agents_and_automation_create_hook_script_r1, title = {How do I create a hook script for Gemini CLI?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/gemini-cli/agents-and-automation/create-hook-script}}, note = {Revision 1; digest sha256:9d19d2b3b3b33d8e; last verified 2026-11-20T12:53:07Z; accessed 2026-11-21T09:55:00Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/gemini-cli/agents-and-automation/create-hook-script