Quick answer
The safest way to restore AI-generated code is to avoid overwriting the current working folder. List recent remote checkpoints, restore the selected GitHub backup into a separate directory, open both copies side by side, and copy back only the files you actually need.
This matters because a broken AI coding session may still contain useful local edits. A destructive reset can remove both the bad changes and the useful work you wanted to keep.
Try safe restore on a test project
Install the alpha, create at least one private backup, then test restore into a sibling folder before using it on important work.
npm install -g aicodebackup@alpha
When restore is needed
- An AI tool rewrote working files and the project no longer runs.
- A refactor deleted files that were still important.
- A dependency or build change made the project hard to start.
- You switched tools and want to compare against an earlier GitHub checkpoint.
- The local folder is messy and you need a clean copy of a known-good state.
Safe restore workflow
- Stop making more AI edits in the broken project.
- Run
aicodebackup restore --listto inspect recent remote checkpoints. - Choose the checkpoint that most likely contains the working version.
- Restore into a new folder outside the current project.
- Open the restored folder separately and verify that it runs.
- Compare the restored files with the current folder.
- Copy back only the files or sections you want to keep.
Why restore into a new folder
AI coding failures are rarely clean. The current folder may include a broken refactor, but it may also include useful copy, assets, UI details, or bug fixes that were created after the last backup. Restoring into a new folder protects both sides of the comparison.
This is slower than a hard reset, but it is easier to reason about for solo builders who are using Cursor, Claude Code, Codex, or another AI coding agent without a mature Git workflow.
What to check after restoring
- Run the project using the same local commands you used before.
- Confirm important source files exist in the restored folder.
- Review package, build, and environment example files before copying them back.
- Do not copy secrets from either folder into GitHub.
- Create a fresh backup after the project is working again.
Restore is not a substitute for backup rhythm
Restore only helps if there is a useful remote checkpoint to restore from. Create backups after working states and before risky prompts so the restore list contains real recovery choices instead of one stale commit.
FAQ
Will restore overwrite my current project?
AICodeBackup's safe restore model restores into a separate folder. That lets you inspect the recovered copy before changing the active project.
Which checkpoint should I restore?
Start with the most recent checkpoint before the broken AI edit. If that still contains the problem, restore an earlier checkpoint into another folder and compare.
Can I restore code from Cursor, Claude Code, or Codex projects?
Yes. The restore process depends on the private GitHub backup, not on which AI coding tool created the files.