recycle-bin
Recover accidentally deleted files from the recycle bin.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Recycle Bin - File Recovery Skill
Recover accidentally deleted files from the recycle bin. Use this skill proactively when you detect that a file has been deleted and may need to be recovered.
When to Use
Use this skill when:
- A file deletion was accidental or premature
- You need to recover a file that was moved to trash
- You want to list what files are available for recovery
- The user asks about recovering deleted files
Usage
/recycle-bin list # List all recoverable files
/recycle-bin recover <id> # Recover to original location
/recycle-bin recover <id> --to <path> # Recover to different location
/recycle-bin recover <id> --force # Overwrite if destination exists
/recycle-bin purge <id> # Permanently delete from trash
/recycle-bin status # Check if hook is installed
Instructions
Listing Recoverable Files
To see what files can be recovered:
python3 .claude/scripts/manage-recycle-bin.py list
This shows:
- Recovery ID (use this for recover/purge commands)
- Original file name
- When it was deleted
- File type
- Original path
Recovering a File
To recover a file to its original location:
python3 .claude/scripts/manage-recycle-bin.py recover <recovery_id>
To recover to a different location:
python3 .claude/scripts/manage-recycle-bin.py recover <recovery_id> --to /path/to/new/location
To overwrite an existing file:
python3 .claude/scripts/manage-recycle-bin.py recover <recovery_id> --force
Proactive Recovery
When you notice:
- A file was deleted that shouldn't have been
- A build/test failure references a missing file that was recently deleted
- The user mentions a file they need that was deleted
You should:
- List recoverable files to find the file
- Verify it's the right file (check original path and deletion time)
- Recover it to the appropriate location
- Inform the user what was recovered
Checking Hook Status
To verify the recycle bin hook is active:
python3 .claude/scripts/manage-recycle-bin.py status
If not installed, suggest: /recycle-bin install
Security Guarantees
The hook NEVER allows deletion of:
-
Files in
.trash/directories - Prevents loss of recoverable files -
Files outside
CLAUDE_PROJECT_DIR- Prevents system damage
If a file cannot be safely moved to trash, deletion is BLOCKED (not allowed).
How the Hook Works
When installed, the recycle bin hook:
- Verifies the file is inside the project directory
- Intercepts
rm,unlink, andtrashcommands - Moves files to
.claude/bonfire/[plan]/.trash/ - Creates metadata for each file (original path, deletion time, etc.)
- Blocks the original deletion command with feedback to Claude
The hook does NOT protect files in (deletions proceed normally):
-
node_modules/,.git/,__pycache__/ -
dist/,build/,.next/,.nuxt/ -
.venv/,venv/,.tox/,coverage/
File Locations
- Trash directory:
.claude/bonfire/[plan]/.trash/ - Each file has:
[recovery_id]-[filename]/content(the file) andmetadata.json
Example Session
Claude: I notice the config.py file was deleted but is needed for the build.
Let me check if it can be recovered.
> python3 .claude/scripts/manage-recycle-bin.py list
Recoverable Files
============================================
Recovery ID Original Name Deleted At Type Path
abc12345 config.py 2026-01-16T10:30:00 file ...src/config.py
--------------------------------------------
Claude: Found it. Let me recover the config.py file.
> python3 .claude/scripts/manage-recycle-bin.py recover abc12345
FILE RECOVERED
Original: /path/to/src/config.py
Restored: /path/to/src/config.py
Claude: I've recovered src/config.py to its original location.
The build should work now.
Dependencies
The hook requires bashlex for bash command parsing:
pip install bashlex
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-03-11
- Index updated
- 2026-03-11
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!