Hacker News new | ask | show | jobs
by ericwebb 99 days ago
Nice. I've been thinking about something tangential: using the same hook mechanism to guide the agent toward better tools, not just block bad ones.

Claude Code sometimes issues Bash commands for things it could easily do with builtin tools (e.g., shelling out to grep when it has a dedicated Grep tool). A hook that catches those and nudges the agent back — "you already have a tool for this" — could improve session quality without blocking anything.

I suspect there's a lot of overlap with what you've built: parse the command into tokens, run it against rules, decide. The difference is the output is "redirect" instead of "deny." Have you thought about non-blocking rules that warn or suggest rather than reject?

1 comments

Warn mode is the easy win and probably where I'd start. Redirect is more interesting but you're handing the agent a rewritten command it didn't ask for, which could be surprising in ways that hurt more than help.
Yeah, I’ve redirected manually to some success but nothing hook based yet. I need to put some plumbing together to try these ideas out.