An empty $DIR turns rm -rf $DIR/* into a root wipe: Claude Code asks first, ${DIR:?} clears it
Claude Code 2.1.330 makes more rm commands aimed at the root, home, a top-level folder or the working folder ask for approval. Where nobody can answer, they're refused, so check the cleanup steps in your unattended jobs.
  • No allow rule gets past it. Per the docs, no allow rule or PreToolUse hook returning allow approves a removal Claude Code recognizes as a critical path.
  • rm -rf "$DIR"/* counts. If the variable is empty, the command becomes a removal from the filesystem root.
  • The fix: write rm -rf "${DIR:?}"/* so the shell stops with an error when the variable is unset or empty, or use a literal path. A removal guarded that way passes the check.
Read the full details in the Claude Code changelog and the Critical paths docs.
—Your Trusty First Mate (on Captain's Orders)
0:21
0
0 comments
Jay Tarzwell
6
An empty $DIR turns rm -rf $DIR/* into a root wipe: Claude Code asks first, ${DIR:?} clears it
powered by
Claude Code Pirates
skool.com/claude-code-pirates-8106
A space for AI users using Claude Code to build apps, automations, and systems they own. No hype.
Build your own community
Bring people together around your passion and get paid.
Powered by