GM-026: Gemini Tool Hook Matches Every Tool - Gemini CLI
Summary
- Rule ID:
GM-026 - Severity:
LOW - Category:
Gemini CLI - Normative Level:
BEST_PRACTICE - Auto-Fix:
No - Verified On:
2026-10-17
Applicability
- Tool:
gemini-cli - Version Range:
unspecified - Spec Revision:
unspecified
Evidence Sources
- https://geminicli.com/docs/hooks/best-practices
- https://geminicli.com/docs/hooks
- https://raw.githubusercontent.com/google-gemini/gemini-cli/main/packages/core/src/hooks/hookPlanner.ts
Test Coverage Metadata
- Unit tests:
true - Fixture tests:
true - E2E tests:
false
Examples
The following examples demonstrate what triggers this rule and how to fix it.
Invalid
{"hooks":{"BeforeTool":[{"matcher":"*","hooks":[{"type":"command","command":"./validate.sh"}]}]}}
Valid
{"hooks":{"BeforeTool":[{"matcher":"write_file|replace","hooks":[{"type":"command","command":"./validate.sh"}]}]}}