You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No way to use tool arguments in hooks - when.toolArgs is exact only and templates have no args #12
I wanted a hook that only runs for certain edit files, but hit two gaps:
when.toolArgs only does exact string matches, so I can't filter by pattern like *.ts.
run and inject templates don't have tool arguments at all. They only have id, agent, tool, cmd, stdout, stderr, exitCode, so I can't branch on the arguments inside the command either.
This is generic, not just edit. The same is true for grep with pattern, bash with command, etc. If the hook can't see the tool's arguments, there's no way to make it conditional on them.
Would it be possible to expose arguments in templates as args.<key> (for example args.filePath, args.pattern) with empty string if missing? That would let me do:
changed the title [-]No way to use tool arguments in hooks — when.toolArgs is exact only and templates have no args[/-][+]No way to use tool arguments in hooks - when.toolArgs is exact only and templates have no args[/+]on Sep 2, 2026
Activity
[-]No way to use tool arguments in hooks — when.toolArgs is exact only and templates have no args[/-][+]No way to use tool arguments in hooks - when.toolArgs is exact only and templates have no args[/+]shanebishop1 commentedon Sep 8, 2026
Hi @bendtherules, thanks for bringing this up! I agree that tool arguments should be available more generally.
0.70 has been released with the adjustments merged in #13, which solves this with a broader implementation such that:
For example, your original use case can now be configured directly:
Let me know if this works well for your use case. Thanks again for the suggestion!
bendtherules commentedon Sep 8, 2026
This looks great. Thanks for adding it 👍