Repository navigation
Filter hook handlers by emitted tool profile - #97
Draft
jonathanhefner wants to merge 1 commit into
Draft
jonathanhefner wants to merge 1 commit into
jonathanhefner wants to merge 1 commit into
Conversation
Add optional `toolProfiles` lists to individual `PreToolUse` and `PostToolUse` handler configurations so clients can avoid launching processes that would immediately discard an event based on its portable profile name. Match the current emitted `tool_profile.name` by exact equality for each event occurrence. A missing profile does not match; an omitted filter preserves invocation for every occurrence. Retain existing profile-production requirements and per-handler configuration failure isolation.
This was referenced Nov 13, 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.
Note
This is based on the changes from #89.
Summary
Add an optional
toolProfilesfield to handler configurations forPreToolUseandPostToolUse. A nonempty list of portable tool profile names limits the handler to events whose emittedtool_profile.nameexactly matches a listed name.Clients evaluate the filter before launching the handler process. An event without a matching profile does not launch that handler. Omitting
toolProfilespreserves invocation for every occurrence of the configured event.Motivation
The hooks proposal launches every valid handler configured for an event. A handler interested only in
file.modifystill starts for an event with ashellprofile, reads the input, and exits without a result. With several plugins or handlers, a single tool call may launch multiple such processes.This addresses the request for declarative matching in the hooks review.
Rationale
Filtering before process launch avoids that work. Portable profile names give one filter configuration a consistent meaning across clients, whose native tool names differ. Clients can apply the filter to the event input they already produce, preserving the existing profile-production requirements. Finer filtering remains in handler code.