docs: bring hooks reference up to date with new events#2569
Merged
dgageot merged 1 commit intodocker:mainfrom Apr 28, 2026
Merged
Conversation
rumpl
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hooks documentation was lagging behind the runtime. Brings it back in line with what the runtime actually dispatches today.
Doc changes (
docs/configuration/hooks/index.md)turn_start,before_llm_call,after_llm_call,on_error,on_max_iterations,on_agent_switch,on_session_resume,on_tool_approval_decision,before_compaction,after_compaction, plus a callout clarifying the difference betweenpre_compactandbefore_compaction.agent_nameis no longer claimed as a common field (onlystop,after_llm_call, andsubagent_stoppopulate it). Adds the previously-undocumented fields:tool_error,last_user_message,from_agent/to_agent/agent_switch_kind,previous_max_iterations/new_max_iterations,approval_decision/approval_source,input_tokens/output_tokens/context_limit/compaction_reason/summary.hook_specific_output.summary; new Context-Contributing Events section clarifying transient vs persisted context. Fixed misleading"decision": "allow"example (the field is for blocking only).turn_startto the list of context-contributing events.turn_start,before/after_llm_call,before/after_compaction,on_agent_switch,on_session_resume,on_tool_approval_decision. Notification section now points readers aton_error/on_max_iterations.</div>that was unbalancing the HTML between the LLM-Judge subsection and the CLI Flags section.Code change (
pkg/hooks/events.go)Added explicit zero-value
EventSpecentries forbefore_compaction,after_compaction,on_agent_switch,on_session_resume,on_tool_approval_decision. Behaviorally a no-op (eventSpec()already falls through to a zero-valueEventSpecfor unregistered events, which is the right default for these observational events — verified byTestPlainStdoutBecomesAdditionalContext), but it makeseventSpecs(and thus theEventSpecs()accessor) reflect the full set of events the runtime dispatches.Validation
mise lint— clean (golangci-lint, custom lint, go mod tidy)mise test— all packages pass