ai-trash

Stop AI coding tools from permanently deleting your files. Transparent rm replacement that moves deleted files to recoverable trash.

Copied!

AI deleted my files. Now what?

AI coding assistants like Claude Code, Cursor, Copilot, and Codex routinely run rm to clean up files. Usually that's fine. Sometimes they delete something important and there's no undo.

ai-trash sits between your AI tools and /bin/rm. Every file deletion is intercepted and moved to a recoverable trash folder instead of being permanently destroyed. Your workflow doesn't change — rm still works exactly as before.

Without ai-trash

AI runs rm config.json
File is gone forever

With ai-trash

AI runs rm config.json
ai-trash restore config.json brings it back

Works with every AI coding tool

ai-trash detects AI processes by walking the full process tree — no configuration needed for supported tools.

Claude Code Cursor GitHub Copilot Codex Aider Windsurf Goose OpenCode Devin Kiro CLI OpenHands Gemini CLI Warp VS Code

How it works

Cross-platform

macOS

Uses FSMoveObjectToTrashSync for native Finder Put Back support. Files appear in your Trash with full metadata.

Linux

Routes to ~/.local/share/Trash/ai-trash/ with sidecar metadata files. Per-volume trash on external drives.

Windows

PowerShell Remove-Item wrapper sends files to the Recycle Bin via .NET. Explorer's native Restore works.

Zero config

One-line install. No shell aliases, no config files to edit. Works immediately with all supported AI tools.

View on GitHub

MIT License. Free and open source.