Stop AI coding tools from permanently deleting your files. Transparent rm replacement that moves deleted files to recoverable trash.
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.
AI runs rm config.json
File is gone forever
AI runs rm config.jsonai-trash restore config.json brings it back
ai-trash detects AI processes by walking the full process tree — no configuration needed for supported tools.
/usr/local/bin/rm that runs before /bin/rm in your PATHrm calls pass through unchanged (in selective mode) or go to system Trash (in safe mode)find -delete, git clean, git checkout, and git reset --hardUses FSMoveObjectToTrashSync for native Finder Put Back support. Files appear in your Trash with full metadata.
Routes to ~/.local/share/Trash/ai-trash/ with sidecar metadata files. Per-volume trash on external drives.
PowerShell Remove-Item wrapper sends files to the Recycle Bin via .NET. Explorer's native Restore works.
One-line install. No shell aliases, no config files to edit. Works immediately with all supported AI tools.
MIT License. Free and open source.