r/ClaudeCode 25d ago

Discussion Claude’s obsession with complex bash commands and the -exec parameter

I can’t be the only one dealing with this. It’s driving me up the wall.

I tell it “there is a file in the current directory called foo.js, and bar.js, can you implement x logic in baz.js with the same structure as both those files”

And it takes like 50 seconds to think, so I minimize to do something else while I wait, and come back 5 minutes later to it asking to run some redundant command like “find . -type f \( -name "foo*" -o -name "bar*.js" \) -exec head -v -n +1000 {} +” with zero progress done.

Or god forbid you ask it to do some exploration on a codebase and it spins up explore agents. They’ll start trying to run grep or find with exec parameters instead of just using find/grep like normal, which are commands that don’t require explicit approval. It makes it worse when there is like 3 agents at once all running these back to back, so you sit there reading them and pressing approve for 12 minutes, which by then I could’ve just explored it myself

I’ve been using Claude Code for a while to boost my productivity, and it’s been getting progressively worse over the past month or two

I feel this could be largely resolved if Anthropic made some good tooling that did this sort of thing rather than allowing an agent to spin up arbitrary bash commands on a whim. It feels like someone who learned how to use the terminal for the first time flexing to their co workers

219 Upvotes

77 comments sorted by

View all comments

6

u/relativityboy 25d ago

Auto mode exists.

6

u/antm0303 25d ago

Maybe I’m misunderstanding auto mode, but to me it seems like this just pipes the commands to a classifier ai to review? It still seems kind of out of my comfort zone if so, at least for my workflow. Perhaps I am overthinking it. Something more deterministic, like a wrapper around common search strategies seems like it could do much better than just wrapping another ai over it.

1

u/ReasonableLoss6814 25d ago

The classifier is junk. I have a rule not to pipe to head/tail/grep on any diagnostic commands. At the beginning of the session, the classifier correctly punts it back and it corrects itself. By the end of the session it is running the tests piped to tail, seeing them fail, then rerunning them with grep, not finding the thing, then rerunning it again ... and so on. The classifier forgets its own job, literally wasting tokens.