Ctrl+Z
for your terminal.
Every interface has undo except the terminal — where small mistakes can do real damage. oops quietly backs up risky changes and catches destructive commands from AI agents like Claude Code and Cursor.
"Sweet! I could have used this years ago!" — David S.
macOS and Linux · zsh, bash, fish · zero overhead for safe commands, ~10ms for destructive ones
A safety net for AI agents
Works with CLI-based agents that run commands in your terminal — Claude Code, Cursor, Aider, and similar tools.
Run oops agent-mode on to intercept destructive commands at the PATH level. This catches rm, git reset --hard, git restore, rsync --delete, and more from CLI tools that run shell commands — even in non-interactive shells. If an agent deletes something it shouldn't have, type oops and it's back.
Note: agent mode works with tools that run commands through your system shell (Claude Code, Cursor, Aider, etc). Sandboxed environments like Claude Desktop run in isolation and can't be intercepted.
# AI agent runs a destructive command ~ $ git reset --hard HEAD~3 ▲ git reset --hard # you notice it wiped your uncommitted work ~ $ oops ✓ Undid: git reset --hard Applied stash: stash@{0}
What it catches
A shell hook intercepts destructive commands before they run and copies the affected files into local trash for a reliable restore.
| Command | What oops does | Undo |
|---|---|---|
| rm / rm -rf | Backs up files before deletion | restore |
| mv a b | Backs up the overwrite target | restore b |
| cp a b | Backs up the overwrite target | restore b |
| sed -i | Copies file before in-place edit | restore |
| perl -pi | Copies file before in-place edit | restore |
| git reset --hard | Creates a stash before reset | stash apply |
| git checkout / restore / switch -f | Creates a stash | stash apply |
| git branch -D | Logs the branch SHA | recreate |
| find -delete / rsync --delete / dd of= | Backs up affected targets | restore |
| xargs rm / fd -x rm / parallel rm | Backs up the current tree | restore |
| make clean / npm run clean | Backs up the current tree | restore |
| git worktree remove | Backs up the worktree path | restore |
| > file.txt | Snapshots before redirect | restore |
| chmod / chown | Records original permissions | restore |
| git clean -fd | Stashes untracked files | stash apply |
Install
One command. The installer downloads from GitHub Releases, verifies checksums, checks Sigstore signatures when cosign is available, adds the shell hook, lets you choose a profile with arrow keys, and runs a quick restore self-test. Open a new tab to activate.
| Command | Description |
|---|---|
| oops | Undo the last destructive action |
| oops undo --dry-run | Show what would be restored without changing files |
| oops restore --plan | Show conflicts, backup-current paths, and git actions |
| oops 2 | Undo the second-to-last action |
| oops status | Show current protection and trash state |
| oops show | Preview what an undo would restore |
| oops diff | Compare a backup with current files |
| oops log | Show undo history |
| oops keep | Keep a backup from auto-cleanup |
| oops clean | Remove old backups (--all for everything) |
| oops cleanup-service | Install or inspect hourly background cleanup |
| oops config preset agent | Apply a stricter policy preset |
| oops protect-path | Add high-safety rules for important paths |
| oops tutorial | Interactive walkthrough |
| oops doctor | Check installation health |
| oops --upgrade | Upgrade to the latest version |
Learn
Practical recovery guides for the terminal mistakes oops is built to prevent.
Type oops. Get your files back.
Single Go binary, no dependencies. Local backups, verified installs, restore plans, and auto-cleanup after 2 hours.
Star on GitHub · Read the docs · FAQ · Guides