Repository navigation
feat(crush): map the hook events Crush v0.99.0 fires - #3708
Merged
Merged
Conversation
Crush v0.99.0 (stable, 2026-10-29) grows its hooks from PreToolUse alone to 13 events and validates them at load time. Map the twelve that have a canonical counterpart (postToolUse, postToolUseFailure, permissionRequest, sessionStart, sessionEnd, beforeSubmitPrompt -> TurnStart, stop -> TurnEnd, stopFailure, stopCancelled -> Interrupt, preCompact, postCompact) in both directions. PermissionResult has no canonical event and stays under the crush.hooks override. Crush now rejects the whole config when a matcher is set on an event that carries no tool, so the adapter drops the matcher with a warning on every event except PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest and PermissionResult. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179ZomNiDQHCzgoxeRVmfth
An override keyed by a Crush event name (`TurnEnd`) silently replaced the shared entries of the same event, while `turn_end` became a second key that Crush concatenates on top. Resolve every override key to its event first, whatever spelling it uses: the override replaces the shared entries of that event, and override keys naming the same event are concatenated in order. Keys with no canonical event (PermissionResult) are still written verbatim, folded by Crush's normalized spelling. Also correct which Crush events can block or halt in the docs and pin the hooks docs link to v0.99.0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0179ZomNiDQHCzgoxeRVmfth
This was referenced Oct 30, 2026
Merged
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.
Summary
Crush v0.99.0 (stable, 2026-10-29) fires 13 hook events instead of
PreToolUsealone, and it now validates hooks when it loads the config. rulesync still wrote onlyPreToolUseand skipped every other event. This PR maps the rest. I checked the mapping againstinternal/hooks/events.go,internal/config/hooks.goanddocs/hooks/README.mdat thev0.99.0tag.postToolUse,postToolUseFailure,permissionRequest,sessionStart,sessionEnd,stopFailure,preCompactandpostCompactkeep their names (PascalCase in Crush). Three are renamed:beforeSubmitPrompt⇄TurnStart,stop⇄TurnEndandstopCancelled⇄Interrupt.PermissionResulthas no canonical counterpart, so it stays under thecrush.hooksoverride. Import now puts mapped events back into the sharedhooksblock.matchersits on an event without a tool. The adapter now drops the matcher with a warning on every event exceptPreToolUse,PostToolUse,PostToolUseFailure,PermissionRequestandPermissionResult. The check covers override keys too, in any spelling Crush accepts (for exampleturn_start).crush.hookskey is now resolved to its event in any spelling (stop,TurnEnd,turn_end). It replaces the shared entries of that event, and override keys that name the same event are concatenated. Before this,TurnEndsilently replaced the sharedstophooks whileturn_endbecame a second key.docs/reference/file-formats.mdand the generated hook event matrix are updated.postToolUse,sessionStart(with its matcher dropped),stop→TurnEnd, and the import ofTurnEnd/PermissionResult.Left open
The issue also suggests warning when a key under
crush.hooksis one Crush would reject as an unknown event. This PR does not do that, so it uses Refs.Refs #3672
🤖 Generated with Claude Code
https://claude.ai/code/session_0179ZomNiDQHCzgoxeRVmfth