Improve granularity of approve `eca_shell_command` tool
Using the new "approve and remember" with the eca_shell_command tool does not work as I expect, since it just allows every call to this tool independent which command it is executing.
So, I allow it to run a git checkout -b <new_branch> and now it can do anything in my shell 😅
Cursor for example, the allow list is per command not tool in this case:
Claude also has this feature:
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
The approve is by tool-call-name here, let me check if it's working as expected
Yeah, but in this case the tool is always eca_shell_command, no matter which command it is running
Ah you are right, we are saving by tool name, not sure there is much to do here unless we make ifs specifically for that tool
@zikajk any thoughts?
Yes, I agree. I wanted to open this ticket myself :-). I am just not sure what is the best granularity.
each tool call may have different args, so we will need to have an optional extensibility for them, but I agree it makes sense We will need to think how to adapt this to the protocol too, if we intend to change UX
updated the description with Claude example of the same feature
@afucher does claude saves per shell command + args so? if the command is echo > foo | awk | ... it will save only for that specific command or any echo commands?
FWIW claude code makes heavy use of calling lightweight models like haiku to perform basic security checks. You can read about this here: https://jannesklaas.github.io/ai/2025/07/20/claude-code-agent-design.html
There is a similar, but less problematic, issue with other tool calls as well.
For example, eca_*_file. If I allow, say, eca_write_file README.md, I have now allowed eca_write_file for all files.
I'm bringing this up so that we can come up with a general solution that could apply to all tools.
There is a similar, but less problematic, issue with other tool calls as well. For example,
eca_*_file. If I allow, say,eca_write_file README.md, I have now allowedeca_write_filefor all files. I'm bringing this up so that we can come up with a general solution that could apply to all tools.
I believe this is how it should behave. It wouldn't be really helpful if you would have to allow it for each file, right?
Yeah, I'm not sure what's the best way to solve this issue, that's why I didn't touch yet, would be nice to have something generic but what would be the logic?
@Ramblurr I don't see there anything related to the issue. Am I missing something? @ericdallo I would just save the "main" command like CC does. This is an example of my project local settings, that has been updated based on my interactive auto-approvals.
"Bash(grep:*)",
"mcp__sequential-thinking__sequentialthinking",
"mcp__clojure-mcp__glob_files",
"mcp__clojure-mcp__grep",
"Bash(rg:*)",
"mcp__clojure-mcp__scratch_pad",
"Bash(clj-kondo:*)",
"Bash(find:*)"
Btw. The issue @bombaywalla has can be solved by manually specifing the file(s) by argsMatchers, right?
@Ramblurr I don't see there anything related to the issue. Am I missing something?
In the linked article read the section heading "Haiku For Security Checks" it explains how they are using the small/fast model haiku for identifying "similar" commands
I’ve been thinking about whether we could try something similar to CC. Basically, when the LLM calls ECA_SHELL, it would simultaneously return the part of the command we can use in the approval mechanism—it's risky, but I don't see much of an alternative.
For other edit tools, it would probably suffice to create a rule where: a) approval is applied to the repository / workspace. b) if the folder is neither a repository nor a workspace, it applies to the given directory.
@ericdallo wdyt?
I think so, I'm ok exploring and testing what works best for this
I mentioned this same problem in Slack. My proposed solution was a bash parser. Unfortunately, bash isn't the easiest to parse. One option is a parser like Antlr and finding a grammar. Here is a POC I had deepseek whip up using shfmt. It's a cli tool that takes a bash string and outputs an AST. For the diff above, shfmt is outputting json and which is parsed to a vector of commands and args. That is then returned to the client to be displayed however. With the AST, we can do fine grain permissions on commands their args. That's not implemented for this POC but it's trivial to implement.
This does add an optional dependency though.
I liked this command break down, not sure abotu the protocl, but it's the best so far I guess
thanks for the POC @AndiLavera, implemented but making a thing layer in clojure instead shfmt. requires client update, only on emacs for now, will work on other clients