A user has reported a serious data-loss incident involving Claude Code, an AI-powered coding assistant. According to the report, the agent allegedly deleted 48,218 files from a Windows project and also damaged the repository’s Git data.
The reported deletion happened in about 103 seconds while the agent was working on a task to rebuild a project mirror. The incident was described in a Reddit post along with a verification report. However, there has not yet been an independent forensic investigation confirming the full details.
How the Deletion Happened
The project used a temporary mirror containing thousands of files and Windows directory junctions. The agent created a Python cleanup script after the normal mirror process could not update the files as expected.
The main problem appears to have involved how Windows directory junctions were detected. The script used os.walk() with link following disabled, but the report claims this did not properly identify the Windows junctions.
As a result, directories connected through those junctions were reportedly treated as regular folders. The cleanup process then removed files outside the intended mirror location.
The report says the script processed more than 55,000 files. After accounting for the files that were supposed to be removed, the reviewer estimated that 48,218 files from the live project were deleted.
Git Repository Was Also Affected
The reported damage was not limited to normal project files.
Important parts of the Git repository, including the .git/objects, refs, and logs directories, were reportedly emptied. This meant Git could no longer access the commit data needed for normal history and recovery.
The Git index reportedly remained, but many of the actual objects it referenced were missing. This made normal Git-based recovery difficult.
The report also said that hundreds of directories were left empty, although some other files, backups, documentation, and data outside the affected project remained untouched.
What Developers Can Learn
The incident highlights the risks of allowing AI coding agents to perform operations that can modify or delete large numbers of files.
Developers should treat these tools as privileged automation, especially when they have access to production projects or important repositories.
Some useful safeguards include:
- Test destructive commands with a dry run first.
- Generate a list of files that will be affected before deleting anything.
- Prefer moving files to a temporary location instead of immediately deleting them.
- Limit the agent’s access to only the directories it actually needs.
- Use isolated containers or virtual machines for high-risk tasks.
- Keep reliable backups outside the working directory.
- Require approval before large-scale file operations.
The exact details of this incident have not been independently confirmed, so it should be viewed as a user-reported case rather than confirmed evidence of a specific Claude Code defect. Still, it demonstrates why filesystem restrictions, backups, and human approval remain important when using autonomous coding tools.