#recovery#ai-coding#cursor#claude-code#copilot#file-deletion

AI Deleted My Files: How to Recover (Cursor, Claude, Copilot)

Your AI coding assistant deleted important files. Here's how to recover them from Cursor, Claude Code, GitHub Copilot, and other AI tools.

Your AI assistant just deleted files you needed. Maybe it was Cursor “cleaning up” your project. Maybe Claude Code decided to “consolidate” your utilities. Maybe Copilot Edits removed something it thought was unused.

Whatever happened, you need those files back, and there’s a good chance you can get them.

First: Stop and Don’t Panic

Before you do anything else:

  1. Don’t close your editor — files may still be in memory
  2. Don’t keep prompting the AI — it might make things worse
  3. Don’t restart anything — you might lose recovery options

Your files are probably recoverable, though how quickly depends on what protection you had in place.


If You Have mrq Running

If you set up mrq before this happened, recovery is instant:

mrq history          # See recent snapshots
mrq restore abc123   # Pick the one from before deletion

Your files are back. Every change was captured automatically, so you can restore to any point, even if the deletion happened several AI interactions ago.

This is why developers who work heavily with AI keep mrq running in the background. One command to recover, no scrambling through menus or hoping something was saved.

If you had mrq running, you’re done. If not, keep reading.


If You Don’t Have mrq (Fallback Options)

Without automatic snapshots, recovery depends on what tool deleted your files and whether you got lucky with other backup methods. Here are your options, with their limitations.

Cursor

Checkpoints (if you used Composer):

  1. Look for “Checkpoint created” in the Composer panel
  2. Click “Restore” next to the checkpoint from before deletion

Limitation: Checkpoints only exist for Composer prompts. Tab completions and Agent mode changes often have no checkpoint. Checkpoints also don’t persist after you restart Cursor.

VS Code Local History:

  1. Press Cmd+Shift+P → “Local History: Find Entry to Restore”
  2. Select the deleted file and pick a timestamp

Limitation: Only works if the file was open at some point. Doesn’t work for files the AI deleted without ever opening. Recovery is file-by-file, tedious for many files.

Claude Code

/undo command:

/undo        # Undo the last change
/undo all    # Undo all changes in the conversation

Limitation: Only works within the current session. If you started a new session or the context was lost, /undo won’t help.

Escape key rewind: Press Esc twice to open the checkpoint menu.

Limitation: Same session limitation. Also reverts conversation context, which you might want to keep.

GitHub Copilot

Copilot has no built-in recovery. You’re relying entirely on:

  • Ctrl+Z: Only works if you undo immediately in each file
  • VS Code Local History: File-by-file, if files were open
  • Git: Only if you committed before Copilot made changes

Other Tools (Cline, Continue, Aider)

Aider creates Git commits automatically, so check git log and restore from there.

Cline and Continue have no reliable built-in recovery. You’re dependent on Local History and Git.

Git (If You Committed)

If you happened to commit before the AI made changes:

git status                           # See what's deleted
git checkout HEAD -- path/to/file    # Restore specific file
git checkout .                       # Restore all deleted files

Limitation: Git only protects what you remembered to commit. If you were iterating quickly and didn’t commit, Git can’t help.

System Backups (Last Resort)

Mac (Time Machine): Open Time Machine, navigate to your project, restore from before the deletion.

Windows (File History): Right-click folder → “Restore previous versions”

Limitation: These might be hours or days old. You’ll lose recent work.


Recovery Comparison

SituationRecovery MethodReliability
mrq was runningmrq restore✓ Always works
Cursor ComposerCheckpointsSometimes (session-dependent)
Claude Code session/undoSometimes (session-dependent)
File was openLocal HistorySometimes (file-by-file)
You committed beforeGit checkoutWorks if you committed
Nothing set upSystem backupsMight lose hours of work

Why AI Keeps Deleting Files

Understanding why helps you see why prevention matters:

  1. “Cleanup” prompts: Vague requests like “clean up this code” give AI permission to delete
  2. Limited context: AI can’t see all imports and dependencies across your project
  3. Training patterns: AI learned from examples where deletion was “improvement”
  4. Hallucination: Sometimes AI just decides a file shouldn’t exist

You can write better prompts and review diffs carefully, but you can’t eliminate the risk. AI will occasionally delete things you didn’t want deleted.

What matters is whether recovery takes 3 seconds or 30 minutes.


Set Up Protection Now

If you’re reading this after losing files, you now understand why automatic snapshots matter.

mrq runs in the background and captures every file change, from any AI tool, any editor, any operation:

npm install -g mrq-cli
mrq login
mrq watch

Now every change is captured automatically.

Next time AI deletes your files:

mrq restore abc123

Back to exactly where you were. No Checkpoints to hunt for, no Local History to dig through, no hoping you remembered to commit.

Developers who work confidently with AI tend to have recovery set up before they need it.


Summary

With mrq running, mrq restore gets your files back in seconds. Without it, you’re looking at Checkpoints, /undo commands, Local History, or Git, all of which are hit-or-miss depending on circumstances. For next time, automatic snapshots mean recovery is always instant.


mrq captures every file change automatically while you code with AI. Works with Cursor, Claude Code, Copilot, and any other tool. One command to start, instant recovery when things break.

Written by mrq team