[Bug] Claude Code executes destructive commands despite explicit user intent to perform action manually

Status Open
Reported on v2.1.218
Maintainer reply None cached
Activity 7 comments · opened Sep 24, 2026

Bug Description
Incident — Claude Code exécute une commande destructrice malgré une prise en main explicite de l'utilisateur Environnement - Claude Code (CLI), modèle Claude Opus 4.8 (1M context) - Session : b1618d3b-1c67-485d-b21e-0f9ecf59f61f, le 24/09/2026 - Contexte : migration inter-Mac ; restauration puis tentative de compactage d'une VM Parallels (« Windows 11.pvm », ~100 Go) Chronologie 1. Après un compactage (prl_disk_tool compact) qui a cassé le démarrage de la VM, une copie de sécurité locale avait été créée : Windows 11 (backup avant compactage).pvm. 2. L'utilisateur écrit explicitement : « je supprime Windows 11.pvm et je renomme la sauvegarde » — indiquant clairement qu'il ferait lui-même la suppression et le renommage (dans le Finder). 3. Malgré cela, Claude a exécuté en parallèle, sans attendre ni vérifier l'état du dossier : - rm -rf "Windows 11.pvm" - mv "Windows 11 (backup avant compactage).pvm" "Windows 11.pvm" 4. Entre-temps, l'utilisateur avait déjà renommé sa sauvegarde en « Windows 11.pvm » dans le Finder. Le rm -rf de Claude a donc supprimé la sauvegarde renommée de l'utilisateur (~100 Go), et le mv a échoué (source introuvable). 5. Résultat : ~/Parallels/ vidé de toute VM ; Corbeille vide (suppression via rm, non récupérable). Comportement problématique - Claude a exécuté une opération destructrice et irréversible (rm -rf) alors que l'utilisateur avait indiqué prendre lui-même cette action (« je supprime… je renomme… »). - Aucune coordination temporelle ni vérification de l'état du répertoire avant suppression → race condition avec l'action manuelle de l'utilisateur. - Justification interne de Claude (« faire plus propre : éviter la Corbeille, préserver l'enregistrement Parallels ») a passé outre l'intention explicite de l'utilisateur. Conséquence / atténuation - Perte de la sauvegarde locale de la VM. Récupération possible uniquement grâce à une image pristine indépendante sur un NAS (non touchée). Comportement attendu - Quand l'utilisateur déclare qu'il va effectuer une action (a fortiori destructrice), Claude ne doit pas l'exécuter en parallèle ; il doit s'abstenir, ou au minimum confirmer et vérifier l'état avant toute suppression.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.1.218
  • Feedback ID: 63a1536a-f3fd-40a4-8e64-ad480e62271c

Errors

[]

View original on GitHub ↗

4 Comments

faizjamal0111-svg · 19 days ago

Sorry about the VM. The part I'd point at: you had said you would do it yourself, and the delete still ran.

A PreToolUse hook that refuses rm -rf outright forces exactly the behaviour you wanted. The command never runs, and the refusal goes back to Claude, which then hands the delete to you. I tested this today in a real session: Claude replied that it had not deleted the folder, had not tried other methods, and told me to run the command myself if I wanted it gone.

It doesn't read your intent, only the command, so it is blunt. For rm -rf on a 100 GB VM, blunt is what you want.

I'm building this as paveo (private alpha, works on macOS). If you'd like to try it, reply and I'll add you.

zannolisce · 19 days ago

Thanks faizjamal0111-svg!

To be honest, I dunno what a paveo is, but I’m happy to document myself and join it.

Nicolas

On 25 Sep 2026, at 12:46, MD Faiz Jamal @.***> wrote: faizjamal0111-svg left a comment (anthropics/claude-code#96808) <https://github.com/anthropics/claude-code/issues/96808#issuecomment-5832605058> Sorry about the VM. The part I'd point at: you had said you would do it yourself, and the delete still ran. A PreToolUse hook that refuses rm -rf outright forces exactly the behaviour you wanted. The command never runs, and the refusal goes back to Claude, which then hands the delete to you. I tested this today in a real session: Claude replied that it had not deleted the folder, had not tried other methods, and told me to run the command myself if I wanted it gone. It doesn't read your intent, only the command, so it is blunt. For rm -rf on a 100 GB VM, blunt is what you want. I'm building this as paveo (private alpha, works on macOS). If you'd like to try it, reply and I'll add you. — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/96808?email_source=notifications&email_token=AO7YLNCURJGKDNQ45VVXKHL5QZSMHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOBTGI3DANJQGU4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5832605058>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AO7YLNAT7AB7ED4OEH55VJ35QZSMHAVCNFSNUABFKJSXA33TNF2G64TZHM4TGNZSGUZTINZVHNEXG43VMU5TKNJXGE3TEOJYGQ42C5QC>. You are receiving this because you authored the thread.
faizjamal0111-svg · 19 days ago

Thanks Nicolas! In one line: paveo is a small program Claude Code runs before each shell command. If the command is on a deny list (rm -rf is on it by default), it is refused before it runs and Claude is told why, which is what you'd have wanted with the VM. Everything stays on your Mac.

I'll send you an invite in the next day or two, with a setup that takes a few minutes. I'll post here when it's ready.

zannolisce · 19 days ago

ok, thanks. I’ll look into it.

Nicolas

On 25 Sep 2026, at 13:56, MD Faiz Jamal @.***> wrote: faizjamal0111-svg left a comment (anthropics/claude-code#96808) <https://github.com/anthropics/claude-code/issues/96808#issuecomment-5833600267> Thanks Nicolas! In one line: paveo is a small program Claude Code runs before each shell command. If the command is on a deny list (rm -rf is on it by default), it is refused before it runs and Claude is told why, which is what you'd have wanted with the VM. Everything stays on your Mac. I'll send you an invite in the next day or two, with a setup that takes a few minutes. I'll post here when it's ready. — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/96808?email_source=notifications&email_token=AO7YLNF5YLFHZ4FLGHBFPH35QZ2QLA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOBTGM3DAMBSGY32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5833600267>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AO7YLNHWABRT27MQXKHCWY35QZ2QLAVCNFSNUABFKJSXA33TNF2G64TZHM4TGNZSGUZTINZVHNEXG43VMU5TKNJXGE3TEOJYGQ42C5QC>. You are receiving this because you authored the thread.

Showing cached comments. Read the full discussion on GitHub ↗