Skip to contentllms.txt

Gemini CLI — Hooks

File format
JSON
Discovery path
.gemini/settings.json
Syllago install method
JSON merge
Symlink support
No
Config file
.gemini/settings.json
Handler types
command

Hook events

Canonical EventNative NameCategory
after_modelAfterModelModel
after_tool_executeAfterToolTool
agent_stopAfterAgentLifecycle
before_compactPreCompressContext
before_modelBeforeModelModel
before_promptBeforeAgentLifecycle
before_tool_executeBeforeToolTool
before_tool_selectionBeforeToolSelectionModel
notificationNotificationOutput
session_endSessionEndLifecycle
session_startSessionStartLifecycle

Features

How each feature converts to syllago's canonical format. See format conversion for what these statuses mean.

Fields

Native frontmatter or config fields this provider exposes. The first column is the provider's own field name; the canonical key column links to syllago's cross-provider equivalent.

Provider fieldConversionCanonical keySummary
hooksTranslatedConversion type: TranslatedActively mapped to the target provider’s equivalent field during conversion.Learn more →Eleven lifecycle events configured per-event in settings.json under the hooks key: BeforeTool, AfterTool, BeforeAgent, AfterAgent, BeforeToolSelection, BeforeModel, AfterModel, SessionStart, SessionEnd, PreCompress, and Notification.
matcherTranslatedConversion type: TranslatedActively mapped to the target provider’s equivalent field during conversion.Learn more →Optional matcher field filters which tools or triggers fire a hook, using regex for tool events and exact strings for lifecycle events.
sequentialEmbeddedConversion type: EmbeddedNo canonical equivalent — appended as prose in a conversion notes block so nothing is silently lost.Learn more →Boolean flag on a hook group that switches execution from parallel (default) to ordered, in-sequence runs.
hookSpecificOutputNot portableConversion type: Not portableUnique to this provider — can’t be carried across providers.Learn more →Per-event hookSpecificOutput fields (tool_input, additionalContext, clearContext, llm_request, toolConfig, etc.) extending the common output schema.

Other features

Behaviors, conventions, and capabilities that aren't tied to a single named field — things like path-based activation, discovery rules, and lifecycle behavior.

FeatureConversionSummary
decision_controlTranslatedConversion type: TranslatedActively mapped to the target provider’s equivalent field during conversion.Learn more →exit_code_semantics: Gemini CLI uses exit codes to signal block (non-zero) or allow (zero) decisions; no modify sub-capability documented
json_io_protocolTranslatedConversion type: TranslatedActively mapped to the target provider’s equivalent field during conversion.Learn more →hook_io_protocol: Gemini CLI hooks receive event data as JSON on stdin and return structured JSON responses on stdout
matcher_patternsTranslatedConversion type: TranslatedActively mapped to the target provider’s equivalent field during conversion.Learn more →hook_matchers: Gemini CLI hooks support event and tool name matching to filter when hooks fire
Exit code semanticsNot portableConversion type: Not portableUnique to this provider — can’t be carried across providers.Learn more →Three-tier exit code contract — 0 parses stdout as JSON, 2 blocks the action with stderr as reason, any other code is a non-fatal warning.
In-session hook management commandsNot portableConversion type: Not portableUnique to this provider — can’t be carried across providers.Learn more →/hooks slash commands (panel, enable-all, disable-all, enable, disable) toggle individual hooks or the whole system at runtime.
Project hook fingerprintingNot portableConversion type: Not portableUnique to this provider — can’t be carried across providers.Learn more →Project hooks are fingerprinted; changed name or command requires user re-approval before execution as a trust safeguard.
stdin/stdout JSON I/O protocolNot portableConversion type: Not portableUnique to this provider — can’t be carried across providers.Learn more →Hooks receive event JSON on stdin and return decision/reason/systemMessage JSON on stdout; stderr is safe for debug logs.

Sources

Source
https://raw.githubusercontent.com/google-gemini/gemini-cli/main/packages/core/src/hooks/types.ts
https://raw.githubusercontent.com/google-gemini/gemini-cli/main/schemas/settings.schema.json
https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/hooks/index.md
https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/hooks/reference.md