How to undo changes an AI made to your code
With Asqu installed, run asqu undo. It puts your files back as they were before the AI's last change, in any AI tool. Add --dry-run to see what would change first. The undo is saved too, so you can undo it.
What are the steps?
Asqu has to be running before the AI makes its changes. After that, undo is always there.
Install Asqu and set it up
Install with
curl -fsSL https://asqu.dev/install | shon a Mac or Linux, orirm https://asqu.dev/install.ps1 | iexin Windows PowerShell. Then, in your project folder:$ asqu setup
This asks first, then adds a short note to
AGENTS.md, the instruction file most AI tools read. From then on your AI records each request and saves each change.See what the AI changed
$ asqu log #3 "Tidy up the homepage" — Edited style.css (+1 −1 lines); removed index.html (via Claude Code) #2 "Make signup faster" — Edited signup.html (+2 −4 lines) (via Claude Code)Each line is one change: what you asked for, what changed, and which AI did it.
asqu show 3lists the files in change 3.Preview the undo
$ asqu undo --dry-run Going back to #2 "Make signup faster" would: bring back index.html restore style.cssNothing changes yet. You see exactly which files come back, which are restored, and which are removed.
Undo
$ asqu undo Went back to #2. Saved as #4. Run `asqu undo` to reverse it.To go back more than one change, give a number:
asqu undo 3.Or go back in plain words
$ asqu back before the signup change $ asqu back Tuesday $ asqu back 2 hours ago $ asqu back v1 launched
You can name a day, a time, a change number such as
#3, a milestone, or describe the change. Asqu matches your words against what was asked and what changed.
What if the undo was a mistake?
Run asqu undo again. Going back never deletes history: Asqu saves the undo as a new change, so the state you left is still there to return to.
Can I undo AI changes without Asqu?
Sometimes. These are the usual options, and where each one stops.
- Your AI tool's own undo. Some tools keep checkpoints of their own edits. They work inside that tool only, and usually only for the current session.
- Git.
git restore .puts files back to your last commit. It cannot bring back anything you had not committed, and it cannot take you to a point between commits. - Your editor's undo. It works file by file, and only while the file is still open.
- A backup. Time Machine or a cloud drive may hold an older copy, though rarely one from a few minutes ago.
Asqu covers the gap between these: every change, from any AI tool, across sessions, with the reason attached.
How do I stop an AI breaking things in the first place?
- Use a Try.
asqu try start idea --why "Add a checkout"gives the AI a separate copy to work in. Your real project is not touched until you runasqu try keep idea. - Let the risk rule work. When a Try removes files or touches sensitive code such as payments, Asqu waits for your OK before keeping it. An AI cannot give that OK.
- Mark good points.
asqu mark "v1 launched"names the current state so you can return withasqu back v1 launched.
Checked against Asqu v0.1.0. The output shown is from a small example project.