Hooks
Hooks are automated actions that trigger on specific Claude Code events. The plugin configures two hooks that provide passive, advisory code review via Gemini without any manual invocation.
Stop Hook (Worktree Review)
Trigger: When a Claude Code session ends.
Action: Sends the current worktree diff to Gemini for a quick advisory review.
What it does:
- Runs
git diff HEADto capture tracked changes in the worktree - Truncates input to 50KB to stay within token limits
- Filters out sensitive files (secrets, keys, lock files)
- Pipes the filtered diff to
ask-gemini-run - Returns a concise 3-bullet review of critical issues
This reviews tracked worktree changes at the time the session ends, not a session-scoped diff. Untracked files are not included.
Pre-Commit Hook
Trigger: Before any git commit command runs via Bash.
Action: Reviews staged changes and warns about critical issues. This is advisory only — it does not block the commit.
What it does:
- Detects when a Bash command contains
git commit - Runs
git diff --stagedto capture what's about to be committed - Filters out sensitive files
- Pipes to
ask-gemini-runfor a quick review - Outputs warnings to stderr, then exits successfully
The hook always exits 0. It warns about issues but does not prevent the commit from proceeding.
Provider
Both hooks are hardcoded to use Gemini via the ask-gemini-run binary. To use a different provider, you would need to edit hooks/hooks.json and change the binary (e.g., ask-codex-run or ask-ollama-run).
CLI Binaries
The hooks use CLI binaries that you can also call directly:
# Pipe a diff to Gemini
git diff | ask-gemini-run "Review these changes for critical issues"
# Pipe to Codex
git diff --staged | ask-codex-run "Any bugs in these staged changes?"
# Pipe to local Ollama
cat src/auth.ts | ask-ollama-run "Review this auth implementation"All three binaries accept:
- Positional argument: The prompt
- Stdin: Piped content (code, diffs, files)
- Combined:
echo 'code' | ask-gemini-run "review this"