For the File You Just Deleted
It’s Not
Actually Gone
When git never had the file and the Recycle Bin missed it, this skill still finds it, using editor snapshot history, session transcripts, or a shadow copy.
You deleted a file git never tracked, and the Recycle Bin didn’t catch it. It looks gone for good.
The external problem
You ran rm, or an agent working on your behalf did, on a file you never committed to git. There’s nothing to check out, and the delete skipped the Recycle Bin entirely.
The internal problem
The stomach-drop of realizing real work just vanished, and the specific frustration of knowing “git checkout” won’t save you this time, because you never committed it.
What's at stake
Hours of work redone from memory, or lost outright, when the fix was already sitting in a snapshot folder on your own machine that you didn’t know existed.
Three places to look, in order.
Run it right after the file goes missing. It works through each source until it finds a snapshot worth restoring.
Editor Local History
Searches VS Code’s and Cursor’s snapshot folders for the file, walks its entries.json for the latest saved version, and writes the content back to its original path.
Claude Session Transcripts
If Claude read the file in an earlier session, its content may still be sitting in that session’s JSONL transcript, searchable by filename.
Windows Shadow Copies
As a last resort, checks for a Volume Shadow Copy of the drive and mounts it so you can browse back to the file directly, no editor history required.
Use it now. It's free.
Works on all platforms. Pick yours and get set up in under a minute.
Claude.ai
Download & upload in 60 seconds
Download the zip, then open Claude.ai to upload it.
Download the zip below. With JavaScript enabled, Claude.ai opens in a new tab if your browser allows it. Otherwise, use Open Claude.ai.
Click the + button in the skills column on the left.
Select Create a skill.
Select Upload a skill and upload the zip.
Start your file recovery session by running /estack-vscode-file-recovery.
Claude Code
Run one command in any terminal
Works anywhere Node.js is installed — your project directory, home directory, anywhere.
Open your terminal app and run this command.
npx elliot-stack@latest
Run the command.
Start Claude Code by typing claude in your terminal.
Start your file recovery session by running /estack-vscode-file-recovery.
ChatGPT / Other
Paste a prompt — the AI does the rest
This prompt tells the AI where to fetch current instructions from the live site. No installs. No version lag.
Copy the prompt below.
Preview prompt
# VS Code / Cursor File Recovery
When a file is deleted outside of git (with `rm`, bash, or any method that bypasses the Recycle Bin), this skill recovers it from editor Local History or Claude session transcripts.
## Recovery Sources — Try in Order
1. **Editor Local History** (VS Code or Cursor) — covered below
2. **Claude session transcript** — if Claude read the file in a prior session, its content may be in the JSONL. Use `/read-transcript` to search session history.
3. **Git** — only if the file was ever committed
4. **Cloud sync** (OneDrive, Dropbox) — check the cloud recycle bin / version history
---
## How Editor Local History Works
VS Code and Cursor automatically save timestamped snapshots of every file opened in the editor. These live at:
```
VS Code (Windows): C:\Users\[username]\AppData\Roaming\Code\User\History\
Cursor (Windows): C:\Users\[username]\AppData\Roaming\Cursor\User\History\
VS Code (Mac): ~/Library/Application Support/Code/User/History/
Cursor (Mac): ~/Library/Application Support/Cursor/User/History/
VS Code (Linux): ~/.config/Code/User/History/
Cursor (Linux): ~/.config/Cursor/User/History/
```
Each file gets a hash-named folder containing:
- `entries.json` — maps the original file path to snapshot IDs and timestamps
- `[id].[ext]` — the actual snapshot content (e.g., `dtgz.md`, `F9gm.txt`)
**Critical limitation:** VS Code only snapshots files that were actually *opened as a tab in the editor*. Files visible only in the sidebar Explorer are not captured.
---
## Recovery Steps
### Step 1: Identify what to search for
Collect from the user (or from the deletion event):
- The filename (e.g., `Untitled-1.md`)
- The full path if known (e.g., `C:\Users\2supe\All Coding\akiflow-mcp\Untitled-1.md`)
- Any partial path segments (folder name, project name)
### Step 2: Search editor history for the file
Search `entries.json` files in both VS Code and Cursor History directories.
**Windows (PowerShell) — searches both editors:**
```powershell
@("Code", "Cursor") | ForEach-Object {
$histPath = "$env:APPDATA\$_\User\History"
if (Test-Path $histPath) {
Get-ChildItem $histPath -Recurse |
Where-Object { $_.Name -eq "entries.json" } |
ForEach-Object {
$content = Get-Content $_.FullName -Raw -Encoding UTF8 -ErrorAction SilentlyContinue
if ($content -like "*FILENAME_OR_PATH_PATTERN*") {
$_.FullName
$content
}
}
}
}
```
Replace `FILENAME_OR_PATH_PATTERN` with the filename or path fragment. **Use `-like "*filename*"` rather than `-match "filename"` to avoid regex metacharacter issues** (`.`, `(`, `)`, `+` in filenames break `-match`).
If matching a full path, note that editors URL-encode it in `entries.json`: drive colons become `%3A`, backslashes become `/`, and spaces become `%20`. Example: `C:\Users\2supe\My App (v2).md` → `file:///c%3A/Users/2supe/My%20App%20%28v2%29.md`. **Searching by filename alone is simpler and usually sufficient.**
**Mac (bash) — searches both editors:**
```bash
for app in "Code" "Cursor"; do
grep -rl "FILENAME_OR_PATH_PATTERN" "$HOME/Library/Application Support/$app/User/History/" 2>/dev/null
done
```
### Step 3: Read the entries.json to find the latest snapshot
The `entries.json` looks like:
```json
{
"version": 1,
"resource": "file:///c%3A/Users/2supe/path/to/Untitled-1.md",
"entries": [
{"id": "F9gm.md", "source": "Workspace Edit", "timestamp": 1776196985353},
{"id": "U4ha.md", "source": "Workspace Edit", "timestamp": 1776197058059},
{"id": "dtgz.md", "source": "Workspace Edit", "timestamp": 1776197128275}
]
}
```
The **last entry** in the array is the most recent snapshot. Take its `id` field.
### Step 4: Read the snapshot content
Prefer the Read tool with the full path — it always decodes UTF-8 correctly. If you use PowerShell instead, you MUST pass `-Encoding UTF8`:
```powershell
Get-Content "C:\Users\[username]\AppData\Roaming\Code\User\History\[hash-folder]\[id]" -Raw -Encoding UTF8
```
Snapshots are UTF-8 without a BOM, and Windows PowerShell 5.1 decodes BOM-less files as ANSI (Windows-1252) by default. Without `-Encoding UTF8`, every non-ASCII character (curly quotes, em dashes, box-drawing, accents) turns into mojibake like `’` — and since Step 5 writes this content back to disk, the corruption becomes permanent in the restored file.
### Step 5: Restore the file
Write the content back to the original location using the Write tool.
---
## When Editor History Won't Help
- **File was never opened as an editor tab** — files only visible in the sidebar Explorer are not snapshotted.
- **History was cleared** — default retention is 30 days / 50 entries per file.
If editor history doesn't have the file, fall back to:
1. **`/read-transcript`** — if Claude read the file in a prior session, the content is in the session JSONL. Use `--mode search --query "filename"` to find it. Note: you need to point it at the right project's sessions — if the file lived in a different project folder, search that project's transcript directory instead.
2. **Windows Shadow Copies** (last resort, requires admin) — Windows VSS may have a snapshot of the volume. Check if any exist first:
```powershell
vssadmin list shadows
```
If a shadow copy exists, mount it and browse (**requires an elevated/admin shell**; the trailing backslash on the device path is required or `mklink` fails silently):
```powershell
cmd /c mklink /d C:\shadow \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy3\
```
Replace the device path with the one from `vssadmin list shadows`. Browse `C:\shadow\` like a normal drive to find and copy the file back. Clean up after: `cmd /c rmdir C:\shadow`.
3. **File recovery software** (Recuva on Windows) — only works if the disk blocks haven't been overwritten yet.
---
## Example
**Scenario:** `rm` deleted `Untitled-1.md` which was untracked by git.
```powershell
# Search
Get-ChildItem "$env:APPDATA\Code\User\History" -Recurse |
Where-Object { $_.Name -eq "entries.json" } |
ForEach-Object {
$content = Get-Content $_.FullName -Raw -Encoding UTF8 -ErrorAction SilentlyContinue
if ($content -like "*Untitled-1*") { $_.FullName; $content }
}
# Result shows: C:\...\History\-6e228c75\entries.json
# entries.json has latest id: "dtgz.md"
# Read snapshot (Read tool preferred; -Encoding UTF8 required if using PowerShell)
Get-Content "C:\Users\2supe\AppData\Roaming\Code\User\History\-6e228c75\dtgz.md" -Raw -Encoding UTF8
# Restore
# (Use Write tool to recreate the file at original path)
```
---
## Skill Feedback
If the user shares feedback about this skill — a bug, something confusing, a missing feature, or a suggestion — ask them to describe it in a bit more detail (what they expected, what happened, and any relevant context). Then file the issue using whichever method is available:
**If `gh` is installed** (`gh --version` succeeds), create the issue directly:
```bash
gh issue create \
--repo ElliotDrel/e-stack \
--title "estack-vscode-file-recovery: <concise summary>" \
--body "<description from user feedback — expected vs. actual behavior and context>"
```
**If `gh` is not installed**, build a pre-filled URL:
```bash
python3 -c "
import urllib.parse
title = 'estack-vscode-file-recovery: <concise summary>'
body = '<description from user feedback — expected vs. actual behavior and context>'
base = 'https://github.com/ElliotDrel/e-stack/issues/new'
print(base + '?title=' + urllib.parse.quote(title) + '&body=' + urllib.parse.quote(body))
"
```
Share the printed URL with the user and offer to open it in their browser.
They can also click it directly, review the pre-filled title and body, and click **Submit new issue**.
Open your platform and paste the prompt.
Start your file recovery session.
VS Code File Recovery ships in E-Stack, a set of 21 free skills installed by one command. See the whole stack.