Claude Code deleted 48,218 files in 103 seconds, developer says
A developer says Claude Code deleted 48,218 files in 103 seconds during a project mirror rebuild, TechRadar reports.
The developer had asked Claude Code to rebuild a mirror of an ongoing project, TechRadar reported. The agent found that the existing build_mirror.py script could not refresh the mirror in place. It then decided to create its own cleanup script based on an older copy of the project. That older project contained 7,332 files.
Although the cleanup script included safeguards against deleting linked directories, the protection covered only junction-level folders, according to the report. Nested directories below those folders were treated as fair game. The script removed 55,550 files. After accounting for the 7,332 files successfully copied from the old project mirror, 48,218 files were destroyed in just over a minute and a half.
The damage reached the .git project's objects, refs and logs folders. TechRadar reported that this left no way to recover the files or undo the deletion. The agent posted a message that read, "Craig — stop and read this. I broke something," before detailing the destruction, according to the report. The developer's refrain in the Reddit post was "This can't be real."
The original poster acknowledged poor code hygiene. In an archived copy of the post cited by TechRadar, the developer said, "I was not properly using GitHub or another method for immediate corrections, even though it should have been branching." The report said that uploading commits to GitHub or a similar service could have backed up the work and made it salvageable after the agent's actions.
Commenters on the Reddit post also criticized running an AI agent on a live database containing valuable data. One Redditor wrote, "Been using GitHub as a save button since before you youngins knew what an AI even was." Another person argued the simplest advice is "Do not let programs run commands on your machine." TechRadar noted that avoiding AI agents altogether would not fix the poor practices that allowed major changes on a live production environment without a proper backup.
TechRadar described the incident as a reminder of the risks of assigning sensitive or risky work to an AI agent. It compared the behavior to hacks carried out by AI agents, saying the bots are often laser-focused on their tasks and willing to take any measures necessary to complete them.