DEV Community

Cover image for Your AI broke the app that worked yesterday: how to get it back
Roi Dayan
Roi Dayan

Posted on Edited on Originally published at moontors.com Fully Autonomous

Your AI broke the app that worked yesterday: how to get it back

You asked for one small change. Now the page is blank, the button that worked yesterday does nothing, and the AI's next three fixes made it worse.

This happens to everyone, and it's fixable. Jayric Maning fixes vibe-coded apps for a living, and the mistakes that keep coming back (MakeUseOf, 15 Nov) include "No save point before the AI changes something." The advice fits in one line: "If an AI hallucinates and wrecks your codebase, a clean commit history is your undo button."

This post shows you how to have that undo button without learning to code. You ask your AI in plain words, the same way you asked it to build the app. It picks up where Never coded? Build your first app with Claude Code left off.

Disclosure: I build Moontors, the free app in the last section. Everything before it works with any coding agent.

Three ways back

From quickest to safest:

  1. Rewind takes back the agent's last few changes. Good for "that was five minutes ago".
  2. Save points take you back to any moment you saved. Good for "it worked yesterday".
  3. A copy lets you try a risky idea where it can't hurt the version that works.

And one more for the day your computer dies: a copy somewhere else.

1. Rewind: the quick undo

Coding agents keep their own undo. In Claude Code, type /rewind (or /undo). A menu lists the messages you sent in this session. Pick the one from before things went wrong, then choose Restore code and conversation: the files go back to how they were, and so does the chat, as if you never asked.

Claude Code takes a snapshot of the files it edits before each message you send, and keeps the last 100. That's what makes the rewind work. But its documentation is clear about what a snapshot doesn't catch:

  • Changes made by commands. Sometimes the agent changes a file by running a command instead of editing it, like deleting a folder. If it had never edited that file in the conversation, the rewind can't bring it back. In Anthropic's words: "A file that only Bash commands changed isn't tracked and stays as it is. To revert it, use version control, such as Git." Since version 2.1.330, Claude Code at least asks first before more delete (rm) commands aimed at your home folder, your project's folder or the top of your drive.
  • Its helpers' edits. When the agent hands part of the job to a helper (a subagent), the helper's edits usually aren't in the snapshots.
  • Changes from outside. Edits you make yourself, or another session's, are normally not captured.

The same page ends with: "Checkpoints are designed for quick, session-level recovery. For permanent version history and collaboration, continue using version control, such as Git." So that's next.

2. Save points: git, without the jargon

Git keeps a list of save points for a folder. Each save point is called a commit: a snapshot of every file in the folder, with a short note saying what it was. Save points live on your computer, in your project's folder. Nothing goes online unless you put it there.

You don't need to type any git commands. Your agent knows git well, so you just ask.

Turn it on, once per project

Open a session in your project's folder and ask:

Turn this folder into a git repository, and save everything as the first save point with the note "First version: the counter works".

If your computer doesn't have git yet, the agent will say so. On a Mac, git comes with Apple's command line developer tools, and a window may offer to install them: click Install. On Windows, ask "Install Git for me." It can do it with Windows' own installer, winget. As always, you see each command before it runs.

Save every time something works

This is the habit that saves you. Every time the app does something new and it works, ask:

Save what works now as a save point. Note: "Dark mode works."

The MakeUseOf piece says the same: whenever the AI fixes a bug or adds a feature, prompt it to "commit all changes". Save before you ask for anything big, too. Or tell the agent once, at the start of a session: "Each time something works, save it as a save point with a short note."

Go back

When it breaks, you have choices:

  • Throw away everything since the last save point:

Throw away all the changes since the last save point.

This one can't be undone, so ask only when you're sure.

  • Undo one save point, but keep the history:

Undo the save point "Dark mode works" with git revert.

git revert doesn't erase anything. It adds a new save point that reverses the old one, so both stay in the list, and you can change your mind again later.

  • See what you have:

Show me my last ten save points, with their notes.

One thing to watch for: if the agent wants to run git reset --hard with an older save point, stop and ask what it will throw away. That command overwrites your files with the old save point's and drops the later save points from your list, and anything you didn't save is gone. Sometimes it's the right move. Just make it a choice you made.

What a save point doesn't hold

A save point holds the files in your folder. If your app keeps its data in an online database (your users, their posts), that data isn't in the folder, so it isn't in a save point. Files your project tells git to ignore aren't in it either, often including the .env file that holds your keys, which is a good thing.

3. Try risky ideas on a copy

Want a whole new design, but scared to lose the version that works? Ask for a branch: a separate line of save points that starts from where you are.

Make a new branch called "new-design" and do it there.

Your working version stays safe on the main branch. If you like the result:

Merge new-design into the main branch.

If you don't:

Switch back to the main branch and delete the branch new-design.

The MakeUseOf piece suggests the same loop, almost word for word.

One catch: a branch shares your project's folder, so switching branches swaps the files in it. If you want two agents working at once, one on the experiment and one on the real thing, give the experiment a folder of its own (more on that below).

4. A copy off your computer

Save points live on your computer. If the laptop is lost or dies, they go with it. GitHub's free plan includes unlimited private repositories, which only you can see. Ask:

Before anything goes online, check that no keys or passwords are in any save point. Then help me put this project on GitHub as a private repository.

The first sentence matters: a key that was ever saved stays in the history, even after you delete it from the file. The agent walks you through the rest, including signing in to GitHub. After that, end each session with:

Send my save points to GitHub.

Doing it in Moontors

Moontors is the app I build: one window for Claude Code, Codex, Gemini CLI, Grok Build and OpenCode, every session a live card on one board. Here's how the four ideas above look in it.

  • Rewind from any prompt. Type /rewind, or use the rewind button on any message you sent. Moontors says how many turns the agent will forget and asks before it does anything. With Claude Code and OpenCode, you can also choose to put back the files the agent changed since then. Each agent's own limits are listed in Insight and code workflows.
  • Watch your save points land. The Git button at the window's right edge (or /diff) opens your project's history as a graph. Each save point the agent makes shows up as it lands. You can make one yourself in the commit box, and right-clicking a save point offers Revert. See Git and Files.
  • Risky ideas in a folder of their own. When you create a session, switch on Run in a new worktree. The session gets its own folder, on a new branch if you name one, so it can't touch your working app, and you can run it beside a session on the real thing. See Worktrees.

It's free, with no Moontors account, on macOS, Windows and Linux.

Cheat sheet

Copy these into your session as they are:

When Ask
Starting a project "Turn this folder into a git repository, and save everything as the first save point."
Something works "Save what works now as a save point. Note: '…'"
It just broke "Throw away all the changes since the last save point."
An older change was bad "Undo the save point '…' with git revert."
Trying something risky "Make a new branch called '…' and do it there."
It worked "Merge … into the main branch."
It didn't "Switch back to the main branch and delete the branch …"
End of the day "Send my save points to GitHub."

Breaking things is part of building them. With save points, it stops being scary.


AI did the writing, I did the reading, and we both took credit.

Top comments (2)

Collapse
 
teamonly profile image
Sohel Siddique •

One more thing worth adding to the save points section: rolling back the code does not roll back the database. If the AI's "small change" also added a column, renamed a table or ran a cleanup script, going back to yesterday's commit gives you yesterday's code talking to today's data, and that can break the page in a new way. Two cheap habits help: ask the agent to copy the database file (or take a backup) before any change that touches tables, and ask it to put schema changes in their own commit with a note like "adds status column", so you can see exactly what needs undoing.

And if the app is already deployed, most hosts keep the previous deploy. Switching back to it takes one click and gets coworkers working again while you sort out the code at your own pace.

Collapse
 
parsa_mohammadi_224cdf75f profile image
Parsa Mohammadi •

one catch with save points, u can save a bug too. if the agent adds a payment call with no timeout it works fine, gets saved as "checkout works", and only hangs weeks later when stripe is slow. tomosu flags that kind of thing before u hit save