Hooks should (in my opinion) be deterministic. As an example I’ve also noticed Claude writing Python scripts to extract fields from JSON when jq is available to it. They almost always contain the same patterns, and having seen this I’m going to write a hook which triggers on those and fails the turn telling it to use jq instead.
Because custom Python scripts means burning more tokens which costs more money. Reaching for an existing tool like `jq` means burning a LOT fewer tokens.
Imagine you have application code with a function to parse some json. But every time you decide to use it, you re-implement the entire function. This is despite it working the same way every time.
It's not like it's being rewritten for efficiency. "Just because".
And on top it's far more likely to be faulty than a well-designed tool specifically crafted for the job.
Like it may issue an incorrect jq invocation but that's surely cheaper to fix than rewriting the python script. And then it's a simple problem, but let's say you clearly see that "manually editing git files instead of using git" is worse, and most tasks are somewhere in-between.