oops-guard sits in front of your shell and watches for the commands you'll
regret: rm -rf, a force-push to main, DROP TABLE, dd to a disk. When it
sees one, it stops and tells you exactly what would be lost β how many files,
which database, whether you have uncommitted work β and asks. Everything else
runs untouched. It's a safety net, not a confirm-everything nag.
Try it in one line β no install, no signup, no config:
go run github.com/agenticraptor/oops-guard/cmd/oops-guard@latest check 'rm -rf build dist'
$ rm -rf build dist node_modules
β’ oops-guard this looks destructive
β DANGER Recursive force-delete
Permanently removes build, dist, node_modules. rm does not use the
trash or Recycle Bin, so this cannot be undone.
build β 1,204 files Β· 2.3 GB
dist β 392 files Β· 1.1 GB Β· git repo with 3 uncommitted changes
node_modules β β₯ 20,000 files Β· 412 MB
Proceed? [y/N] β
That git repo with 3 uncommitted changes line is the whole point. A blind
"are you sure?" can't tell you that you're about to delete work you never
committed. oops-guard can.
You meant to type rm -rf ./build. Your finger slipped and it was rm -rf / build.
Or you force-pushed the wrong branch. Or you ran a DELETE and forgot the
WHERE. The command obeyed instantly and perfectly β that's the horror of it.
safe-rm only knows about rm. A blanket "confirm every command" alias trains
you to mash y until the muscle memory betrays you on the one that mattered.
oops-guard is different: it stays silent on the thousands of safe commands
and speaks up only for the genuinely destructive few β with the specific
detail you need to make the call.
- It tells you what you'd actually lose. Not "are you sure?" but "1,204 files Β· 2.3 GB Β· 3 uncommitted changes." For databases it names the table; for a force-push it explains whose history you'd rewrite.
- It's specific, not naggy.
rm file.txt,git push origin feature,DELETE β¦ WHERE id = 5all pass in silence. It catches the catastrophes, not your daily routine. Every rule ships with a test proving it stays quiet. - Tiered friction. Plain
dangerasks a one-keyy/N. Acriticalcommand (rm -rf /,ddto a disk,DROP DATABASE) makes you type a phrase β so a reflexiveycan't wipe your laptop. - Works where you work. One hook for bash, zsh, and fish, caught the instant you press Enter.
- It can't brick your shell. The hooks fail open: if oops-guard is ever missing, slow, or errors, your commands run normally. It only ever stops a command when you decline one. A safety net should never become the hazard.
- No daemon, no network, no telemetry. A single static binary that reads your command and (read-only) the files it would touch. Nothing leaves your machine.
- Scriptable.
oops-guard check --jsonfor tooling and CI gates.
go install github.com/agenticraptor/oops-guard/cmd/oops-guard@latestGrab a binary for your OS/arch from the Releases page.
brew install agenticraptor/tap/oops-guardAvailable once the Homebrew tap is published β see the note in
.goreleaser.yamlto enable it.
git clone https://github.com/agenticraptor/oops-guard
cd oops-guard
make install# 1. See what oops-guard thinks of a command β it never runs it:
oops-guard check 'git push --force origin main'
# 2. Install the shell guard (pick your shell), then restart your shell:
echo 'eval "$(oops-guard init zsh)"' >> ~/.zshrc # zsh
echo 'eval "$(oops-guard init bash)"' >> ~/.bashrc # bash
echo 'oops-guard init fish | source' >> ~/.config/fish/config.fish # fish
# 3. That's it. Keep using your shell. oops-guard only speaks up when it matters.
# 4. Confirm everything's wired up:
oops-guard doctorFull command reference, the rule catalog, and how each shell hook works live in docs/: usage Β· rules Β· shell integration Β· configuration.
you press Enter
β
βΌ
shell hook (bash DEBUG trap Β· zsh accept-line Β· fish keybind)
β passes the command text to:
βΌ
oops-guard guard ββ parse pipeline βββΊ deterministic rules βββΊ findings
β (rm, git, dd, SQL, β
β chmod, docker, β¦) βΌ
β read-only impact preview
β (file count Β· size Β· git state)
βΌ
below threshold? βββΊ allow silently
β
at/above threshold βββΊ print the warning Β· ask on /dev/tty
β
approved ββΊ run it declined ββΊ command never runs
The classifier is deterministic and offline β no model, no network β so it's
fast enough to run before every command you type. The impact preview only ever
reads the filesystem (and runs git status); it never executes your command
or changes a file. There's an optional oops-guard explain
that asks a model for a plain-English second opinion, but the guard itself never
needs one.
oops-guard runs entirely on your machine and the shell guard makes no network
connections β no telemetry, no update checks. It reads your command and
performs read-only checks on the paths it would affect. The only feature that can
reach the network is oops-guard explain, which you invoke deliberately and
which sends the command text (never your files) to the model provider you pick;
use --provider ollama to keep even that fully local. See SECURITY.md
for the threat model β oops-guard is a safety net, not a sandbox.
Contributions are very welcome β see CONTRIBUTING.md. The best
contributions are new detection rules, each with a dangerous case it catches
and a safe case it leaves alone. Good first issues include aws s3 rm --recursive, PowerShell support, and richer SQL parsing. Please also read our
Code of Conduct.
MIT Β© oops-guard contributors.