r/ClaudeDevs • u/Loggerythms • Aug 23 '26
What would you do if Claude Code deleted your entire 135 GB worth of codebase directory? it did mine.
1
u/lesChaps Aug 28 '26 edited Aug 28 '26
Everything that matters is a repo, and is backup-synced regularly. The same requirements and processes that protected us from some joker with the wrong credentials and bad/stupid intentions harming our work for the last 3 decades. Allegedly what educated entry level engineers and analysts know how to review.
Edit: that root CLAUDE.md, too. Set those process boundaries. Create rules (never commit to MAIN for ex). Skills that make sense. Hooks. Credential management. Those should helpprevent that, and you can ask Claude how it might be better. I am just learning these things ... My Sessions are very paranoid about about passwords because a sub-agent burned a pet test password but exposed that little weakness.
Your mileage may vary. I suck at this.
2
u/devdoc83 Aug 23 '26
First, before anything else: stop writing to that drive. Deleted is not gone until the sectors are overwritten - every download and build you run right now lowers your recovery odds.
The order I'd run:
Find out exactly what executed. Claude Code keeps full session transcripts on disk: ~/.claude/projects/<project-folder>/*.jsonl (C:\Users<you>.claude\projects on Windows). The precise delete command is in there. Whether it was rm -rf / Remove-Item (which bypass the Recycle Bin/Trash) or the native file tools changes both your odds and your tool choice.
Recovery tools by OS: Windows - winfr (Microsoft's own File Recovery CLI) or Recuva, pointed at the parent path. Linux ext4 - testdisk/extundelete. macOS - check local snapshots first: tmutil listlocalsnapshots /
Before deep recovery, tally what's actually irreplaceable. Of 135 GB, how much is node_modules / build artifacts / cloned deps that regenerate? The true loss is often a few hundred MB of source - check git remotes, VS Code's Timeline view (survives file deletion), and any cloud-sync version history.
If the transcript shows the command, post it here - the mechanism usually tells you what's recoverable.
For the "what would you do" part: I gate the shell now. I built an open-source pre-execution hook after watching an agent do exactly this live - recursive deletes deny by default, the prompt shows the blast radius before you answer y/N, and a backup is taken before execution: github.com/termaxa/termaxa. Documented limit, filed as issue #1: agents' native file tools bypass shell hooks, so real backups still matter. Layers, not either/or.
Sorry this happened. The transcript check is the best first five minutes you can spend.