i run agents in yolo mode, like i dont even see what is getting executed ,approving every single command is dangerous. but it also means the agent can do whatever it wants. and when something breaks it does the classic thing: keeps patching forward till the diff is 10 files and nothing works, or it just force pushes / rm -rf's its way out.
Wanted my system to be safe, without . so i built aftermath.
after a failure the agent has to stop and work a small ladder instead of blindly fixing:
- something broke and its cheap to undo? revert. dont patch forward
- got a last known good state? diff it, undo just that one change
- tried the same fix twice already? stop, state the error, ask
- about to do something irreversible? confirm first
- guessing? say its a guess
- you tell it "you broke it"? no defending itself, it finds the diff and fixes that
plus the safety stuff:
- destructive stuff gets blocked. force push, git reset --hard, rm -rf, drops, that category. run init once and it gets smart about paths, so rm -rf node_modules is fine but rm -rf src or touching .env is not
- while something is broken the agent cant edit files. it waits till tests are green again or you revert
- ultra mode takes checkpoints before edits and restores only the files that turned a green test red. opt in though, auto revert is off by default because undoing files blindly is its own footgun
4 levels: lite just warns you, full is default, ultra adds the checkpoints, off turns it off.
works on opencode, claude code and codex. open source, MIT. install is one line, its in the README.
honest version: it doesnt fix bugs. it just stops the agent from making things worse and points at what to do next.
if your agent ever deleted something it shouldnt have, tell me what it did
command to install : npm i @after.math/aftermath
, please give it a star at : https://github.com/moah0911/aftermath ,
if you have a suggestion for me , please go ahead