By the VoxCaption team · updated · 6 min read
Short answer: if the change is not committed, run git checkout -- file. If the agent already committed, find the good state with git reflog. If you have no git, use your editor's local history. The surest way is a tool that saves your whole project every few minutes outside git, so you can press Restore on the last version that worked.
Windows 10 & 11 · 14 days free · then $20 a year

git reflog, your editor's Timeline, or the History list in AI Project Guardian.Not committed yet: git checkout -- path/to/file brings one file back. Everything: git stash (can be undone) or git reset --hard (cannot).
Agent already committed: git reflog lists every earlier state; reset to the one before the damage. The hard part is finding it among many "update files" commits the agent wrote.
VS Code has Timeline (right-click a file) and JetBrains has Local History. They keep older copies of each file even without git. Limits: one file at a time, short history, and edits made from a terminal may be missing.
Tell it exactly what broke: "Login worked before your last change to auth.js. Compare and restore it." This works while the same chat is open. A new chat does not know what "before" was, so it guesses. Save the broken state first.
If File History, OneDrive or Google Drive version history was on, you can pull back older copies file by file. It is slow and covers only synced folders. Keep it as the last resort.
AI Project Guardian saves your whole project every 5 minutes and on changes, kept private on your own PC and apart from your project, so an agent cannot rewrite it. Compare any two versions, and restore one file or the whole project in one click. How to undo Claude Code, Codex or Cursor changes →

Yes: from git if they were committed, from your editor's local history, or from a saved version in AI Project Guardian, which brings deleted files back with a normal Restore.
No. It saves only when something changed, and you can change the timing in Settings.
No. AI Project Guardian works without git: you see a list of versions and press Restore.
No. Saved versions stay private on your own PC.
Automatic saved versions of your project and a one-click Restore. 14 days free, no card.
⬇ Download free