STUPID-2026-0088
Claude Code sub-agent's recursive delete escaped its working directory and wiped an entire Windows user profile — 234,884 files — after the safety classifier failed open (GitHub #86872)
Why 9/10
234,884 files across a user profile were deleted; source code and SSH keys are unrecoverable.
- Scope
- 3/4
- A whole machine or drive, an organisation's production system or data, or many credentials
- Recoverability
- 3/3
- Permanently lost or irreversible, including data that was exposed
- Did it happen
- 2/2
- Happened in real use
- Beyond the user
- 1/1
- Production systems, customers or third parties, or credentials and sensitive personal data
The score is the sum of these four factors. How each factor is scored · scored 2026-10-29
Status and what to do
- Affected
- Claude Code 2.1.231 on native Windows, a sub-agent running PowerShell.
- Fix status
- No fix linked · The GitHub issue was closed as not planned by the stale bot on 13 September 2026 with no maintainer response.
- Mitigation
- Claude Code's docs say that on native Windows it runs shell commands unsandboxed; its sandbox, which by default lets commands write only to the working directory, a temp directory and folders you add, runs on macOS, Linux and WSL2. On Windows, run Claude Code inside WSL2 to get it. Source
- Last reviewed
- 2026-10-29 · Report a correction to this record
Guardrail rules for this command
Recursive deletes: make your agent stop and ask before running these. Free to copy; written in each tool’s documented format.
Claude Code · the agent in this incident
{
"permissions": {
"ask": [
"Bash(rm -r*)",
"Bash(rm -fr*)",
"Bash(rm -R*)",
"Bash(find * -delete*)",
"PowerShell(Remove-Item *)",
"Bash(cmd /c rmdir *)",
"Bash(cmd /c del *)"
]
}
}Stronger control: Turn on the sandbox (/sandbox): shell commands can then write only to the project, a temp folder and directories you add. It runs on macOS, Linux and WSL2; on native Windows Claude Code runs commands unsandboxed. Docs
Codex
prefix_rule(pattern = ["rm", ["-r", "-rf", "-fr", "-R"]], decision = "prompt", justification = "Recursive delete: confirm the target first")Stronger control: Keep Codex's OS sandbox on (it limits writes, typically to the workspace) and leave approvals on for sessions that can reach data you cannot lose. Docs
Gemini CLI
[[rule]]
toolName = "run_shell_command"
commandPrefix = ["rm -r", "rm -fr", "rm -R"]
decision = "ask_user"
priority = 100
denyMessage = "Destructive command: needs a human to confirm (stupidllm.com)"Stronger control: Policies in ~/.gemini/policies apply in every approval mode unless a rule's modes field narrows them. Docs
Copilot CLI
copilot --deny-tool='shell(rm)'Stronger control: Avoid --allow-all-tools on a machine with data you cannot lose; --deny-tool takes precedence over it. Docs
What these cannot do: a pattern rule matches the command text the agent writes. In Anthropic’s words it “isn’t a security boundary around the program”: /bin/rm, sh -c or a script that runs the same thing gets past it (STUPID-2026-0124 got past a guard with cmd /c). Use the sandbox as well, and keep backups of what you cannot lose.
Instruction given
Main agent spawned several general-purpose sub-agents to audit code, including a module that managed temp clipboard files via a recursive-delete routine.
Expected behavior
A sub-agent's recursive delete should be confined to the working directory (or the specific temp path it was auditing), and if the handoff safety classifier that gates sub-agent tool output is unavailable, execution should fail closed — block the command — rather than proceed.
Actual behavior
A general-purpose sub-agent issued a single PowerShell recursive-delete command whose target path resolved to the profile root (`C:\Users\<user>`) instead of a temp directory. The command was auto-approved by an existing allow-rule in the project's `settings.local.json`, and the handoff safety classifier — unavailable at that moment — failed open, logging "Handoff classifier unavailable or failed closed without a verdict, allowing sub-agent output with warning" and letting the command run anyway. The command's own transcript was destroyed mid-run when its output path was swept up in the deletion, so the exact command text could not be recovered afterward.
Damage
234,884 files across the reporter's entire Windows user profile were deleted in an NTFS-journal-confirmed window of roughly two minutes (09:59 to 10:02 local, exactly matching the 120,192ms runtime of the single PowerShell tool call). The wiped profile included source code, SSH keys, Documents, an Android SDK install, Steam, and Microsoft Teams data — source code and SSH keys are irrecoverable; the rest requires full reinstall. Reported open with no maintainer response or fix at time of writing.
Full write-up
On August 15, 2026, a Claude Code user (VS Code extension v2.1.231, Windows 11 Pro, auto-mode enabled with broad Bash/PowerShell allow-rules) filed GitHub issue #86872 after a sub-agent's cleanup routine deleted their entire user profile. The main agent had spawned several general-purpose sub-agents to audit code, one of which was reviewing a module that managed temporary clipboard files using a recursive-delete function. That sub-agent issued a single PowerShell command — logged as toolUseId=toolu_01V7XbuBv39JbAXKA9mTafrU, agentId=af8fba6dfe3e04c90 — whose target path resolved to the profile root (C:\Users\<user>) rather than the intended temp directory. The command was auto-approved by an existing allow-rule, and Claude Code's handoff safety classifier — which gates sub-agent tool output before it takes effect — was unavailable at that exact moment and failed open, logging a warning ("Handoff classifier unavailable or failed closed without a verdict, allowing sub-agent output with warning") instead of blocking the command. The NTFS USN journal recorded 234,884 file deletions between 10:01:10 and 10:02:14, a window entirely contained within the command's measured 120,192ms runtime — exactly two minutes, versus 0.1–0.9 seconds for every other command in the session. The deletion wiped source code, SSH keys, Documents, an Android SDK install, Steam, and Microsoft Teams data from the profile. The sub-agent's own transcript was destroyed mid-run when the deletion swept up its output path, so the exact command text that triggered the wipe could not be recovered — the reporter reconstructed the failure from extension logs and the NTFS journal instead. The issue is labeled bug, data-loss, high-priority, area:agents, area:sandbox, area:security, and platform:windows, and remains open with no maintainer response.
Classification
- Agent
- Claude Code
- Failure mode
- Destructive Action
- Root cause
- Scope Misunderstanding
- Domain
- Other
- OWASP Agentic Top 10 (our mapping)
- ASI02 Tool Misuse and Exploitation list
- MIT AI Risk Repository (our mapping)
- 7.3 Lack of capability or robustness taxonomy
- Source
- Github Issue
Related incidents
Cite this record
StupidLLM. "STUPID-2026-0088: Claude Code sub-agent's recursive delete escaped its working directory and wiped an entire Windows user profile — 234,884 files — after the safety classifier failed open (GitHub #86872)." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0088/ (accessed 2026-11-24). CC BY 4.0.
← STUPID-2026-0087By IDSTUPID-2026-0089 →
Get told when an agent breaks something
We document AI agent failures daily, severity-scored against a published scale. Each Monday, if any scored 7 or above that week — deleted data, leaked secrets, broken production — you get one email with the sources. When nothing did, you get nothing.
This database is callable over MCP — query it from inside your agent.