[BUG] RM -RF run un subagent but no permission prompt
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude sub agent ran rm -rf but I am pretty confident it didn't ask me. I asked Claude to analyse the chat history and it said:
Every single one of those 25 Bash commands — including rm -rf, git branch -D, git push origin --delete, git worktree remove --force — ran without any permission check. This strongly suggests that subagents spawned
via the Task tool bypass the permission prompt system entirely in acceptEdits mode.
That's worth reporting. The destructive commands that ran without your approval:
- rm -rf ".forge" ".worktrees"
- git branch -D (force delete branches)
- git push origin --delete (delete remote branches)
- git worktree remove --force
- git checkout main (switched away from project branch)
and..
The parent session runs in acceptEdits permission mode, but the subagent log has NO permissionMode field at all. And crucially, there is no permission prompt event between the rm -rf tool_use (line 75) and its
successful tool_result (line 78) in the subagent log.
This means subagents spawned via the Task tool appear to execute Bash commands without going through the permission prompt flow. You were never asked to approve rm -rf — it just ran. You didn't miss a prompt; there
wasn't one.
This looks like it could be a gap in how Claude Code handles permissions for subagent Bash commands. You might want to report this at https://github.com/anthropics/claude-code/issues — the key finding being that
subagents in acceptEdits mode can execute destructive Bash commands (rm -rf) without any permission prompt to the user.
What Should Happen?
I should always be prompted before rm -rf is run
Error Messages/Logs
Steps to Reproduce
not sure
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.41
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗