Automatic session checkpoints for AI coding agents. Undo just what went wrong.
Project description
⏪ Rewind
An undo button for AI coding agents.
Rewind watches your repository, automatically creates checkpoints whenever an AI agent starts making changes, and lets you instantly roll back to any point in the session. No commits, no branch switching, no lost work—just one command to get back to the last good state.
Your AI coding agent just destroyed 14 files.
Get back to the last good state in one command.
AI coding agents are incredible.
Until they aren't.
You ask Claude Code to add authentication.
Ten minutes later:
- 14 files changed
- Half the changes are brilliant
- The other half are a disaster
- You have absolutely no idea where things went wrong
Now what?
git checkout .
Congratulations. You just deleted the 10 minutes of good work too.
Or you can spend the next hour manually undoing files.
Or ask the agent to undo itself and hope it doesn't make things worse.
There should be a better option.
Rewind creates automatic checkpoints while your AI agent works, so you can jump back to any moment of the session instantly.
rewind jump 2
Done.
Your git history stays clean.
Your branch stays untouched.
Only the bad changes disappear.
Why Rewind Exists
Git was built for humans.
AI agents don't behave like humans.
Humans:
- Edit one file at a time
- Make deliberate changes
- Commit intentionally
AI agents:
- Touch dozens of files in seconds
- Refactor entire systems at once
- Occasionally decide working code needs "improvement"
When an AI agent goes off the rails, Git gives you two choices:
- Keep everything
- Lose everything
Rewind gives you a third option:
Keep the good work. Remove the bad work.
See It In Action
You tell Claude Code:
Add authentication to my application.
A few minutes later:
rewind list
Session checkpoints (5 total)
# Time Description Changes Branch
4 1m ago Modified middleware, routes ~4 modified main
3 4m ago Modified auth, Added utils ~2 +1 added main
2 8m ago Added auth module +3 added main
1 12m ago Modified package.json ~1 modified main
0 14m ago Session start +1 added main
Something broke after checkpoint 2.
Inspect exactly what changed:
rewind diff 3
Compare any two checkpoints directly:
rewind diff 2 4
Restore the last known good state:
rewind jump 2
Or just undo the last thing the agent did:
rewind undo
Your commits remain untouched.
Your branch remains untouched.
Your work remains intact.
The Agent Wrecked One File. Not All of Them.
Sometimes you don't need to roll back everything.
The agent did brilliant work on four files and completely broke one.
rewind undo src/auth.py
Rewind finds the last checkpoint where src/auth.py had different content and restores just that file. The rest of your working tree is untouched.
Or restore any file from any specific checkpoint:
rewind checkout 2 src/auth.py
Five files changed. One file fixed. Done.
Let Your Tests Decide
Don't want to babysit the agent at all?
rewind guard "pytest tests/"
Rewind watches for write bursts, creates a checkpoint, runs your test command, and automatically rolls back if the tests fail.
rewind checkpoint #3 — +2 added, ~3 modified — running guard...
✗ Guard failed! Rolling back to checkpoint #2...
Working tree restored. Your git history is unchanged.
The agent breaks your build. Rewind fixes it. You notice nothing.
Works with any test runner:
rewind guard "npm test"
rewind guard "cargo test"
rewind guard "make test"
Undo the Undo
Changed your mind after a restore?
Every time you run rewind jump or rewind undo, Rewind automatically captures a pre-restore backup of your working tree before touching anything.
Safety backup saved as checkpoint #7 — run rewind jump 7 to undo this restore.
Nothing is ever permanently lost.
Installation
pip install rewind-ai
Start the watcher:
rewind watch &
That's it.
Rewind now silently watches your repository and automatically creates checkpoints whenever an AI agent starts making significant changes.
No setup.
No configuration.
No cloud account.
How It Works
Rewind monitors filesystem activity and detects write bursts—the characteristic pattern of AI coding agents modifying multiple files in rapid succession.
When a burst is detected, Rewind creates a lightweight checkpoint of your working tree.
These checkpoints:
- Don't create commits
- Don't clutter your git history
- Don't touch your branch
- Don't require any action from you
They're simply there when you need them.
Under the hood: each checkpoint is a shadow git commit stored under refs/rewind/TIMESTAMP—invisible to git log, git status, and git push. Checkpoints are deduplicated by tree hash, so identical states are never stored twice. A typical session of 50 checkpoints uses 2–5 MB.
Works With Every AI Coding Agent
Because Rewind watches filesystem activity rather than integrating with specific tools, it works with virtually anything:
- Claude Code
- Cursor
- GitHub Copilot
- Aider
- OpenHands
- Devin
- Gemini CLI
- Any custom coding agent
If it writes files, Rewind can protect you from it.
Agent Self-Modification Detection
AI agents sometimes modify their own instruction files.
When Rewind detects a write burst that touches CLAUDE.md, AGENTS.md, .cursorrules, or similar files, it immediately creates a checkpoint and prints a warning:
⚠ rewind: CLAUDE.md was modified by an active write burst.
AI agents modifying their own instruction files is a known risk.
Checkpoint #7 captured this change.
Run rewind diff 7 to review.
Commands
Start Watching
rewind watch
Watch and Auto-Rollback on Test Failure
rewind guard "pytest tests/"
Stop Watching
rewind stop
Check Status
rewind status
Create Manual Checkpoint
rewind snap
rewind snap -m "before the big refactor"
View Checkpoints
rewind list # checkpoints on the current branch
rewind list --all-branches # checkpoints from all branches
rewind list -n 50 # show more history
Inspect Changes
rewind diff 4 # what changed at checkpoint 4
rewind diff 2 5 # diff between checkpoints 2 and 5
Restore Previous State
rewind jump 4 # restore entire working tree to checkpoint 4
rewind undo # restore to the checkpoint before the last one
Undo Changes to a Single File
rewind undo src/auth.py # restore this file to its previous version
rewind checkout 2 src/auth.py # restore this file from a specific checkpoint
Create Branch From Checkpoint
rewind branch 4
Remove Checkpoints
rewind clear # delete all checkpoints for this session
rewind prune # remove checkpoints older than 7 days (keeps last 200)
rewind prune --max-age 3 --max-count 50 # custom limits
Why Not Just Commit More Often?
Frequent commits help.
But they don't solve this problem.
- Commits clutter history with half-finished work
- You still can't restore to moments between commits
- You have to remember to create them
- They weren't designed for autonomous agents modifying dozens of files at once
Rewind is automatic.
It works while you're thinking about your code—not your version control strategy.
Privacy
Everything runs locally.
- No telemetry
- No analytics
- No cloud sync
- No network requests
Your code never leaves your machine.
The Future of AI Coding Needs a Better Undo Button
AI coding agents are becoming more powerful every month.
They're writing more code, touching more files, and making bigger changes than ever before.
The better they get, the more important safe rollback becomes.
Rewind isn't a replacement for Git.
It's the missing layer between "everything is fine" and "what just happened to my repository?"
Contributing
git clone https://github.com/dakshgulecha/rewind-ai
cd rewind-ai
pip install -e ".[dev]"
pytest
Issues and pull requests are welcome.
License
MIT
If Rewind saves you even once, consider giving the project a star.
⭐ It helps more developers discover it before their AI agent decides to refactor the entire codebase.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rewind_ai-0.3.0.tar.gz.
File metadata
- Download URL: rewind_ai-0.3.0.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c92857ca2eef76a804421dbb1bf72ccb255a4c5dcd640d1e5afceb77e0cad85
|
|
| MD5 |
4613d98ff59f703a04d4b3527d7de12f
|
|
| BLAKE2b-256 |
f03ff18d7588239bf5d1ab425ccb4289b0e6fafffcb2f54ef6e1799a3e4fd090
|
File details
Details for the file rewind_ai-0.3.0-py3-none-any.whl.
File metadata
- Download URL: rewind_ai-0.3.0-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44211e98288b71fc639315fd697a8f183335649a0826d474e9c643c5d6878d7f
|
|
| MD5 |
a5b6afd94570fb3391f176587128d194
|
|
| BLAKE2b-256 |
37ac469f8261a127f0c8927d5bde2b2dc6a46f845b690acb474968192eaa685d
|