CC Safety Net uses semantic command analysis to distinguish safe variants of potentially dangerous commands from truly destructive ones. These commands are explicitly allowed through.
Git Commands
Filesystem Commands
rm -rf is classified by target. Root/home targets (/, ~, $HOME), targets containing shell variables or backticks, the cwd itself (rm -rf .), and any path outside the cwd are blocked. Paths inside the cwd and temp paths are allowed. Note the distinction: rm -rf ./subdir is allowed, but rm -rf . (the cwd itself) is blocked.
Worktree Mode Exceptions
With CC_SAFETY_NET_WORKTREE=1, CC Safety Net relaxes local-discard rules when the command is confirmed to run inside a linked git worktree. Linked worktrees are designed as isolated, disposable workspaces — discarding changes inside one doesn’t affect the main working tree. Worktree detection is fail-closed: if CC Safety Net cannot verify that the current directory is a linked worktree, the command remains blocked.
The following commands are allowed inside a linked worktree when worktree mode is active:
git restore <file> and git restore --worktree <file>
git checkout -- <file>, git checkout <ref> -- <file>, git checkout --force, and ambiguous multi-positional checkout forms
git switch --discard-changes and git switch -f / --force
git reset --hard and git reset --merge
git clean -f (and combined flags like -fd)
These commands remain blocked even inside a linked worktree, because they reach beyond the local working tree:
git push --force — affects the remote
git branch -D — affects shared refs
git stash drop / git stash clear — the stash is shared across worktrees
git worktree remove --force — could delete another worktree
If CC Safety Net is blocking a command you believe is safe, run npx cc-safety-net explain "<command>" to see the full analysis and understand why.