Recovering from a Bad Generation¶
Not every generation is a win. The AI misunderstands the prompt, the autofix loops on a subtle bug, a "small refactor" rips out a feature you liked. Whittl has two main escape hatches, plus one auto-fix-specific prompt — use them depending on how much you need to undo.
The recovery toolkit¶
| Tool | Scope | Access |
|---|---|---|
| Undo | Character-level within the current file | Ctrl+Z |
| Project History (Archives) | Whole project, pre-generation snapshot | History tab → Restore |
| Restore Original prompt | Rolls back a failed auto-fix cycle only | Appears in chat after auto-fix gives up |
Level 1: Ctrl+Z (Undo)¶
For: "I typed something wrong" or "the AI just made a small edit I don't want."
- Ctrl+Z undoes the last change in the current file only
- Works like any editor's undo stack
- Per-file history — switching tabs doesn't lose the stack
- Works on AI edits too — a generation that edited
main.pycan be reverted character-by-character
Useful for small misfires. For anything bigger than a one-file one-round generation, skip to Level 2.
Level 2: Project History (Archives)¶
For: "the last generation broke something, roll the whole project back."
See Archives for full mechanics.
- Click the History tab in the preview panel
- Find the entry BEFORE the bad generation (the one whose prompt describes the state you want to return to)
- Click Restore on that entry
- Whittl:
- Snapshots the current (bad) state as a new archive first (so Restore is reversible)
- Copies all files from the selected archive back into the project root
- Reloads the editor
Everything except archives/ is restored. Your data, assets, project.json, and all code match the chosen point exactly.
Rolling back to the very first state¶
To get back to v1 (pre-first-generation), pick the oldest entry in the History panel — the bottom of the list — and click Restore on that one. Same flow as any other restore. Useful when the last N generations all went sideways and you want to start fresh with a different prompt.
Special case: the auto-fix "Restore Original" prompt¶
If an auto-fix cycle exhausts its rounds without getting the code green, a chat prompt appears with two buttons: Restore Original / Keep Current.
- Restore Original — roll back to the pre-cycle backup. The broken auto-fix attempt is discarded.
- Keep Current — keep the broken code so you can inspect it or fix it by hand.
"Original" in this prompt means the state just before the failed auto-fix cycle started, not v1 of the project. It's a targeted recovery specific to auto-fix failure, not a general rollback tool.
When autofix is still running¶
Stop first. If the autofix loop is in progress and you don't want to wait for it:
- Stop button in the chat panel — cancels the current auto-fix round cleanly
- Then restore via History as above
Don't kill Whittl or close the project mid-autofix — Whittl's cleanup handles cancellation better than a forced exit does.
When the project won't open¶
Rare, but possible: a generation corrupts project.json or produces a file that makes Whittl's reopen logic crash.
- Close Whittl
- Navigate to the project folder (
~/.whittl/projects/<name>_<id>/) - Look inside
archives/for the most recent good archive - Copy its contents back to the project root (overwriting the broken files)
- Reopen Whittl
Archive folders are just regular file copies — no special format. Any file manager handles the restore.
What to do BEFORE a risky generation¶
If you're about to ask for something big:
- Save your work (Ctrl+S) — triggers a flush so in-memory edits land on disk first
- Close files you don't want touched — Smart Routing excludes closed files from context, making it less likely the AI edits them accidentally
- Be specific — "add a preferences dialog WITHOUT touching any existing files except main.py" works
Archives will save you anyway, but prevention is free.
After restoring¶
Double-check that Whittl shows the right state:
- Project file list matches what you remember
- Code editor shows the expected code
- Test Run works
If Restore didn't fully take, there's likely a file outside the archive that wasn't captured. Rare but possible. Check ~/.whittl/projects/<name>_<id>/archives/<archive>/.metadata for the archive's file manifest.
What's next¶
- Archives — deeper on the snapshot system
- Debugging a Crash — preventing bad generations in the first place
- Iteration — the normal iterate-don't-regenerate workflow