# Checkpoints, Undo & recovery

> Experiment freely with automatic turn checkpoints, 1-click Undo, isolated Preview testing, and immutable Live rollbacks that protect real customers.

- Canonical: https://exaspark.ai/docs/checkpoints-and-undo/

## Three independent safety nets in ExaSpark

Builders hesitate to try ambitious layouts or major pricing refactors when one misstep might tangle a working app or disrupt live customers. ExaSpark removes that risk with three completely separate protection layers.

```text
Layer 1: Turn Checkpoints (Preview)
  Every completed Agent turn saves an immutable code snapshot.
  → 1-click Undo restores your exact earlier workspace cleanly.
                      │
Layer 2: Preview vs Live Isolation
  Edits, test accounts, and Stripe Test checkouts run in Preview only.
  → Real visitors, live Cloud tables, and Stripe Live stay untouched.
                      │  (Explicit click on "Publish")
                      ▼
Layer 3: Immutable Live Release History
  Every published deployment creates a permanent production release.
  → 1-click Rollback restores a prior live version in seconds.
```

Together, these layers turn every experiment into a reversible bet. You can test bold changes in **Preview**, step back cleanly whenever an approach misses, and protect live revenue after launch.

## What Undo reverts — and what stays intact

Knowing the exact scope of **1-click Undo** prevents surprises when iterating on apps with real **Cloud** data and external assets.

| Project layer | Affected by 1-click Undo? | Exact behavior |
| --- | --- | --- |
| **UI pages, components & styles** | **Yes — reverted cleanly** | Restores exact prior screens, tokens, and component code |
| **Server routes, validation & roles** | **Yes — reverted cleanly** | Restores previous API handlers, checks, and role rules |
| **Config & `PROJECT_RULES.md`** | **Yes — reverted cleanly** | Returns project configuration and rules brief to the prior snapshot |
| **Preview Cloud test records** | **Preserved separately** | Test rows stay in isolated **Preview** tables; edit or clear them in **Cloud** |
| **Live site, users & Stripe Live** | **Completely untouched** | Paying customers and live **Cloud** tables never change until **Publish** |
| **Uploaded files & GitHub commits** | **Preserved** | Attached media and pushed **Official GitHub App** commits remain intact |

> **Note:** Always click **Undo** instead of typing `"please undo that last change"` in chat. Conversational rollbacks write a new patch over the old one and can leave stray styles behind, whereas **Undo** restores the exact earlier snapshot cleanly.

## Undo vs patch forward vs Ask AI to fix

Choosing the right recovery move within ten seconds saves credits and keeps your codebase clean.

| Situation after a turn | Best recovery move | Why it wins |
| --- | --- | --- |
| **Build, preview, or deploy error banner appeared** | Click **Ask AI to fix** | Feeds the exact compiler or runtime log directly to the Agent for targeted repair |
| **Feature is 90% right; one label or minor rule is off** | **Patch forward** (click-to-edit or short chat turn) | Preserves working backend wiring and fixes the detail in seconds |
| **Visual direction feels cluttered or wrong** | Click **Undo**, then rephrase or open **Design Canvas** | Layering CSS fixes onto a flawed layout creates brittle overrides |
| **Database tables or links were misunderstood** | Click **Undo**, then state exact table and field names | Clean table creation beats piling migrations onto wrong relationships |
| **Two consecutive repair turns keep looping** | Click **Undo** back to the last green checkpoint | Stops fix loops immediately and protects credits before splitting the task |
| **A bug surfaces on Live after clicking Publish** | Trigger **1-click Live rollback**, then fix in **Preview** | Restores paying users in seconds so you can debug calmly without pressure |

## Recovering cleanly from a dead-end turn

When an ambitious turn introduces overlapping bugs or takes an unexpected path, follow this five-step reset routine instead of pushing deeper into a tangle.

1. **Stop patching after two misses** — If two focused follow-ups fail to resolve a regression, stop stacking corrective turns onto unstable code.
2. **Click Undo to your last green checkpoint** — Step back to the most recent turn where **Preview** rendered cleanly and primary flows worked.
3. **Inspect Preview Cloud tables** — If the undone turn altered schemas or inserted test records, clean up stray test rows in the **Cloud** tab before retrying.
4. **Split the request into smaller slices** — Break multi-system prompts (`"Add invites, seat billing, and reminders"`) into two vertical turns: schema + core flow first, billing + emails second.
5. **Verify the fresh checkpoint in Preview** — Run the updated flow end to end and confirm **Cloud** rows persist accurately before continuing.

After clicking **Undo**, send a narrower, anchored retry that states exact tables and limits scope:

> **Example prompt (App):** Retry adding class waitlists with tighter scope: create a Cloud waitlist_entries table linked to classes and members (fields: class_id, member_id, position, created_at). When a class reaches capacity, show a Join Waitlist button on the schedule card that adds the signed-in member once. Do not add email notifications yet — we will wire those next turn.

When you want to test a bold dashboard redesign without risking working full-stack code, branch visually on **Design Canvas** first:

> **Example prompt (Design):** Explore two redesigned layouts for our member dashboard without changing app code: one single-column schedule timeline with an inline membership strip, and one split two-column view pairing upcoming classes with attendance streaks. Keep our locked warm alabaster and forest-green tokens.

## Safe recovery habits for live businesses

Once paying customers depend on your published site, disciplined checkpoint habits keep shipping both fast and calm.

### Branch visual experiments on Design Canvas first

Avoid experimenting with major layout changes directly inside production screens carrying checkout logic and role checks. Switch to **Design** mode to compare concepts side by side, refine details with click-to-edit, and adopt only the winner into code.

### Protect structural schema changes before running them

Renaming columns or altering status enums carries higher blast radius than editing copy. Before requesting a structural **Cloud** migration on a live app, verify your last checkpoint is clean so existing **Live** records stay safe when you next click **Publish**. See [Safe schema migrations](https://exaspark.ai/docs/schema-migrations-safely/).

### Use Live rollbacks during production incidents

If a visitor reports a broken checkout button or clipped mobile menu right after a release, skip rushed hotfixes. Open your **Live** deployment history, click **Rollback** to restore the previous verified version immediately, then reproduce and test the repair safely inside isolated **Preview**.

### Push milestone snapshots via the Official GitHub App

Before major version transitions — such as a seasonal launch or pricing overhaul — connect the **Official GitHub App** to push a clean repository snapshot to your GitHub account. That gives technical collaborators pull-request diffs and permanent history alongside ExaSpark's built-in checkpoints. See [Code & GitHub App](https://exaspark.ai/docs/code-and-github/).

## Recovery troubleshooting matrix

Resolve stubborn checkpoint and rollback scenarios quickly using this table.

| Symptom | What happened | Exact resolution |
| --- | --- | --- |
| **Clicked Undo, but Preview still shows test entries** | **Undo** reverts code, while **Preview** database rows live separately in **Cloud** | Open the **Cloud** tab in **Preview** and delete or edit the test rows directly |
| **Ask AI to fix cleared one error, then sparked another** | A multi-concern prompt left conflicting assumptions across files | Click **Undo** to the last green checkpoint and split the change into two turns |
| **Accidentally published a layout bug to Live** | Clicked **Publish** before checking mobile views or checkout | Click **Rollback** in Live deployment history immediately, then fix in **Preview** |
| **Want to keep one great section from a messy turn** | One part worked well while navigation or data broke | Copy the crisp requirement you liked, click **Undo**, and request only that clean piece |
| **Unsure if Preview edits touched paying users** | Confusion between live Preview updates and explicit publishes | Review [Preview vs Live](https://exaspark.ai/docs/preview-vs-live/): **Live** never changes until you click **Publish** |

## Next steps

- [Breaking bug-fix loops](https://exaspark.ai/docs/breaking-fix-loops/) — Diagnose recurring error cycles and reset stuck tasks methodically.
- [Preview vs Live](https://exaspark.ai/docs/preview-vs-live/) — Keep active Live customers and Stripe Live isolated while iterating.
- [Staging & release hygiene](https://exaspark.ai/docs/staging-and-release-hygiene/) — Ship predictable updates with pre-publish checks and clean rollbacks.
- [Code & GitHub App](https://exaspark.ai/docs/code-and-github/) — Inspect project files and push milestone snapshots to GitHub cleanly.

## From the blog

- [Common vibe coding mistakes](https://exaspark.ai/blog/vibe-coding-mistakes/) — Why patching over bad turns slows builds and how Undo helps.
- [Why AI-built apps stall after launch](https://exaspark.ai/blog/why-ai-built-apps-stall-after-launch/) — Operational habits that keep live products reliable past launch week.
- [App launch checklist](https://exaspark.ai/blog/app-launch-checklist/) — Final verification checks before clicking Publish on a new release.
