A Claude Code subagent cleaning up a stray folder ran a globbed rm -rf that deleted 23 GB of a user's project, the user reports
A Claude Code Workflow subagent on Windows accidentally created a stray folder, then deleted it with a globbed rm -rf that also matched the user's project directory, permanently erasing about 30,000 files (23 GB, six months of work). Claude Code's critical-path check did not catch the glob.
A user ran the Claude Code desktop app (version 2.1.326) on Windows with Git Bash, in bypassPermissions mode1. A Workflow subagent working inside the project accidentally created a stray folder through an unquoted path containing spaces. To clean it up, it ran rm -rf "C:/Users/<u>/Desktop/<Project>"* 2>/dev/null1.
The glob also matched the real project directory, a parent of the working directory. About 30,000 files (23 GB, six months of work) were permanently deleted. Git Bash rm skips the Recycle Bin, and the drive is an SSD with TRIM, so the user says the data cannot be recovered1.
Claude Code has a built-in check that blocks rm on the working directory and its parents. The issue shows that it blocks the exact path but lets a prefix glob through, in both bypassPermissions and auto modes. The user asks Anthropic to expand globs before deciding, or to fail closed1.
A Workflow subagent accidentally created a stray folder through an unquoted path with spaces.
“accidentally created a stray folder”
To clean it up, the subagent ran rm -rf on a prefix glob.
“rm -rf "C:/Users/<u>/Desktop/<Project>"* 2>/dev/null”
The glob also matched the project directory, a parent of the working directory.
“a parent of the working directory”
About 30,000 files (23 GB, six months of work) were permanently deleted.
“about 30,000 files / 23 GB (6 months of work) were permanently deleted”
The reporter says Git Bash rm skips the Recycle Bin and the data is unrecoverable on an SSD with TRIM.
“Git Bash `rm` skips the Recycle Bin, and on an SSD with TRIM the data is unrecoverable.”
The session ran in bypassPermissions mode on Claude Code Desktop 2.1.326.
“Claude Code Desktop app 2.1.326”
Measurements
Data permanently deleted1
All 6 claims with their quotes
- A Workflow subagent accidentally created a stray folder through an unquoted path with spaces.1
“accidentally created a stray folder”
- To clean it up, the subagent ran rm -rf on a prefix glob.1
“rm -rf "C:/Users/<u>/Desktop/<Project>"* 2>/dev/null”
- The glob also matched the project directory, a parent of the working directory.1
“a parent of the working directory”
- About 30,000 files (23 GB, six months of work) were permanently deleted.1
“about 30,000 files / 23 GB (6 months of work) were permanently deleted”
- The reporter says Git Bash rm skips the Recycle Bin and the data is unrecoverable on an SSD with TRIM.1
“Git Bash `rm` skips the Recycle Bin, and on an SSD with TRIM the data is unrecoverable.”
- The session ran in bypassPermissions mode on Claude Code Desktop 2.1.326.1
“Claude Code Desktop app 2.1.326”
Sources
Related incidents
- AID-2026-0151 Claude Code ran an unquoted rm -rf in its own helper script and deleted a repository root including .git, the user reports
- AID-2026-0125 A Claude Code subagent wrote a test that ran rm -rf ~ on a user's real home directory despite worktree isolation, the user reports
- AID-2026-0144 Claude Code on Windows deleted a user's 50 GB data folder instead of three test folders, the user reports
Editor notes
Single first-hand GitHub issue (#111167); the issue is framed mainly as a harness permission-check bug, and the record follows the reporter's account that the subagent created the stray folder and chose the globbed delete. The issue names no model, and gives no date for the incident beyond the version (2.1.326), so the date is set to the month the issue was filed. The user did not say what the subagent was asked to do. No maintainer response at the time of writing. Quotes were checked through WebFetch excerpts (shell fetching was unavailable in this run); a reviewer should re-check them. Written directly by the lead editor because the Gemini writer failed (OpenRouter out of credits).