cd /news/ai-agents/how-to-undo-the-changes-an-ai-agent-… · home › topics › ai-agents › article
[ARTICLE · art-165059] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

How to undo the changes an AI agent made to your files

OsFoundry's desktop app now provides a /rewind command that restores a local project folder to its exact state before a given AI agent turn, undoing file edits and deleting files the agent created. Before each agent write, the app copies the file's current contents into a hidden .osfoundry/checkpoints/ folder keyed by the SHA-256 hash of the contents, skipping files over 8 MB and reporting them as unrestorable rather than silently failing. Selecting an earlier turn also rolls back all later turns in the chat, and the app is free for macOS, Windows and Linux.

by read3 min views2 publishedNov 6, 2026

You ask an AI agent to clean up a messy stylesheet. It edits three files, creates a fourth, reports that styles.css went from 212 lines to 41, and the page no longer renders. If the folder is a git repository and you committed right before, git checkout gets you most of the way. More often you didn't: there are edits of your own since the last commit, a .env the agent also touched that git ignores, and a new file git leaves alone. What you actually want is the folder exactly as it was before that one request.

The osFoundry desktop app keeps that state for you when a chat works in a local folder, and /rewind puts it back. Below are the three steps and what the app does at each one.

In a Maestro chat, the bar under the message box has a folder menu. Click it, choose "Browse folder…" and pick the project. The folder's name then appears in that bar, and the agent's file tools work inside it.

From then on, before the agent writes a file, the app copies the file's current contents into a hidden folder inside the project, .osfoundry/checkpoints/. Each copy is named after the SHA-256 hash of its contents, so a version that already exists is not stored twice. If the file didn't exist yet, the app records that instead, which is how it knows to delete it later. Only files the agent writes are copied. This is not a backup of the whole folder. Files larger than 8 MB are not copied. They are listed as skipped, and a rewind tells you it could not restore them rather than pretending it did. If the project is a git repository, it's worth adding .osfoundry/ to .gitignore so the copies stay out of your commits.

Type /rewind in the message box and press Enter. The dialog lists every turn in this chat that changed files. Each one is labelled with the first line of what you asked, so you find the turn by your own words, with the number of files it touched and how long ago it ran.

The command is in the desktop app only, because the copies live on your disk next to the project. In a chat without a folder, the dialog asks you to open one first.

Click the turn that broke things. The app asks for confirmation and names the turn and the number of files.

If you pick an older turn, the confirmation also says how many later turns will be undone with it. Going back to a point means everything after it is rolled back too. Restoring only the middle turn would leave a mix of files that never existed together. Click Restore. Edited files get their earlier contents back, files the turn created are deleted, and the result says how many of each.

In this example the three edited files, styles.css, index.html and app.js, are back, and theme.css, which the agent created, is gone. Files the agent never wrote are not touched, whether or not you changed them. The turn's messages are also removed from the chat, and its checkpoint is dropped, so the list matches what is on disk.

Rewind is for after the fact. If you would rather see an agent's changes before they reach the disk at all, turn on the chat's sandbox. File changes are then staged, nothing is written until you apply them from "Review changes", and each edit can be checked as a reviewable diff. With the sandbox off, which is the default for a chat on a local folder, writes go straight to the real files, and the checkpoints are what make them reversible.

The app is free for macOS, Windows and Linux from the osFoundry download page.

── more in #ai-agents 4 stories · sorted by recency
── more on @osfoundry 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-undo-the-chan…] indexed:0 read:3min 2026-11-06 · —