rewind-ai 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Daksh Gulecha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,234 @@
1
+ Metadata-Version: 2.4
2
+ Name: rewind-ai
3
+ Version: 0.1.0
4
+ Summary: Automatic session checkpoints for AI coding agents. Undo just what went wrong.
5
+ Author: Daksh Gulecha
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/dakshgulecha/rewind-ai
8
+ Project-URL: Issues, https://github.com/dakshgulecha/rewind-ai/issues
9
+ Keywords: ai,claude,cursor,copilot,git,undo,checkpoint,agent
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Topic :: Software Development :: Version Control
15
+ Classifier: Topic :: Utilities
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: watchdog>=4.0.0
20
+ Requires-Dist: gitpython>=3.1.40
21
+ Requires-Dist: click>=8.1.0
22
+ Requires-Dist: rich>=13.0.0
23
+ Requires-Dist: platformdirs>=4.0.0
24
+ Requires-Dist: psutil>=5.9.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest; extra == "dev"
27
+ Requires-Dist: pytest-cov; extra == "dev"
28
+ Requires-Dist: black; extra == "dev"
29
+ Requires-Dist: ruff; extra == "dev"
30
+ Requires-Dist: mypy; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ <div align="center">
34
+
35
+ # ⏪ rewind
36
+
37
+ **Automatic session checkpoints for AI coding agents.**
38
+ When Claude Code, Cursor, or Copilot goes in the wrong direction, undo just the part that went wrong.
39
+
40
+ [![PyPI version](https://img.shields.io/pypi/v/rewind-ai.svg)](https://pypi.org/project/rewind-ai/)
41
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
43
+ [![Tests](https://github.com/rewind-ai/rewind/actions/workflows/test.yml/badge.svg)](https://github.com/rewind-ai/rewind/actions)
44
+
45
+ </div>
46
+
47
+ ---
48
+
49
+ ## The problem
50
+
51
+ You run Claude Code to "add authentication." It works for 10 minutes and modifies 14 files. Somewhere around file 11, it went in the wrong direction. Your options:
52
+
53
+ - `git checkout .` — undo **everything**, including the 10 good minutes
54
+ - Manually revert specific files — takes longer than the agent session did
55
+ - Ask the agent to undo it — now you're debugging an agent debugging itself
56
+
57
+ There is no good option. Until now.
58
+
59
+ ---
60
+
61
+ ## How rewind works
62
+
63
+ Run `rewind watch &` once. Forget about it.
64
+
65
+ Whenever rewind detects a **write burst** — multiple files changing within a few seconds, the signature of an AI agent actively writing code — it silently snapshots the working tree into a lightweight git commit on a shadow branch. Your real git history is never touched.
66
+
67
+ When something goes wrong:
68
+
69
+ ```
70
+ $ rewind list
71
+
72
+ Session checkpoints (5 total)
73
+
74
+ # When Label Changes Trigger Agent
75
+ 4 2m ago Modified routes, middleware ~4 modified burst Claude Code
76
+ 3 8m ago Modified auth, user model ~6 modified burst Claude Code ← went wrong here
77
+ 2 14m ago Added auth module +3 added burst Claude Code
78
+ 1 19m ago Modified package.json ~1 modified burst Claude Code
79
+ 0 22m ago Initial state +1 added manual
80
+
81
+ $ rewind diff 3 # see exactly what changed
82
+ $ rewind jump 2 # restore to the last known good state
83
+ ```
84
+
85
+ `rewind jump 2` restores your working tree to checkpoint 2. Your git log is unchanged. Your HEAD is unchanged. You get back 12 minutes of good work and lose only the 2 minutes that went wrong.
86
+
87
+ ---
88
+
89
+ ## Install
90
+
91
+ ```bash
92
+ pip install rewind-ai
93
+ ```
94
+
95
+ **Start the watcher** (add to your shell profile or run once per project):
96
+ ```bash
97
+ rewind watch &
98
+ ```
99
+
100
+ That's it. rewind now silently checkpoints your working tree whenever it detects AI agent activity.
101
+
102
+ ---
103
+
104
+ ## Commands
105
+
106
+ ```
107
+ rewind watch Start the background watcher (auto-checkpoints on write bursts)
108
+ rewind stop Stop the watcher
109
+ rewind status Show watcher status + checkpoint count
110
+
111
+ rewind list List all checkpoints for the current session
112
+ rewind diff [N] Show diff at checkpoint N (default: most recent)
113
+ rewind jump N Restore working tree to checkpoint N
114
+ rewind branch N Create a git branch at checkpoint N (non-destructive)
115
+
116
+ rewind snap Create a manual checkpoint right now
117
+ rewind clear Delete all checkpoints for this session
118
+ rewind install Install as a git hook (auto-starts on repo entry)
119
+ ```
120
+
121
+ ---
122
+
123
+ ## How checkpoints work (under the hood)
124
+
125
+ rewind never writes to your git history. Each checkpoint is:
126
+
127
+ 1. A **git tree object** — a snapshot of your working tree, including untracked files
128
+ 2. A **shadow commit** referenced by `refs/rewind/TIMESTAMP`
129
+ 3. Stored in your `.git` directory. Invisible to `git log`, `git status`, and `git push`. Visible to `git log --all` and GUI clients that enumerate all refs — run `rewind clear` after a session to remove them if needed.
130
+
131
+ Checkpoints are deduplicated by tree SHA — if nothing changed since the last checkpoint, no new one is created. When you run `rewind jump N`, it does a `git checkout <shadow-commit> -- .` — restoring the working tree without touching HEAD or your branch.
132
+
133
+ **Storage**: A typical session of 50 checkpoints uses ~2-5MB in `.git/objects`. Run `rewind clear` to reclaim it.
134
+
135
+ ---
136
+
137
+ ## Detecting write bursts
138
+
139
+ rewind identifies AI agent sessions by monitoring for **write bursts**: 2+ files changing within 3 seconds of each other. This is the temporal signature of a code generation agent writing an entire module at once (as opposed to a human who types one file at a time).
140
+
141
+ Write bursts to high-value files — `package.json`, `requirements.txt`, `CLAUDE.md`, `AGENTS.md`, `.cursorrules` — trigger an **immediate** checkpoint, because these files changing means something significant happened.
142
+
143
+ ---
144
+
145
+ ## Agent self-modification detection
146
+
147
+ rewind immediately checkpoints (and logs a warning) when an AI agent modifies its own instruction files:
148
+
149
+ ```
150
+ ⚠ rewind: CLAUDE.md was modified by an active write burst.
151
+ AI agents modifying their own instruction files is a known risk.
152
+ Checkpoint #7 captured the state before this change.
153
+ Run `rewind diff 7` to review.
154
+ ```
155
+
156
+ Files watched: `CLAUDE.md`, `AGENTS.md`, `.cursorrules`, `.github/copilot-instructions.md`, `GEMINI.md`
157
+
158
+ ---
159
+
160
+ ## Works with every AI coding agent
161
+
162
+ rewind watches the filesystem — it doesn't integrate with any specific tool. It works automatically with:
163
+
164
+ - **Claude Code** (Anthropic)
165
+ - **Cursor** (Anysphere)
166
+ - **GitHub Copilot Workspace**
167
+ - **Aider**
168
+ - **OpenHands / Devin**
169
+ - Any agent that writes to your filesystem
170
+
171
+ ---
172
+
173
+ ## Global install (watch all repos automatically)
174
+
175
+ ```bash
176
+ rewind install --global
177
+ ```
178
+
179
+ This installs a `post-checkout` hook into your global git hooks directory. Every time you `cd` into a git repo (via a shell that runs `git checkout`), the watcher starts automatically.
180
+
181
+ ---
182
+
183
+ ## FAQ
184
+
185
+ **Does this slow down my editor or agent?**
186
+ No. The watcher runs in a separate process and only creates checkpoints after a write burst completes (3-second quiet window). The `git write-tree` operation is typically <50ms even on large repos.
187
+
188
+ **Does this interfere with my git history?**
189
+ `git log`, `git status`, and `git push` are all clean — shadow commits are invisible to them. `git log --all` and GUI clients that enumerate all refs (GitLens, Sourcetree, Fork) will show them, because `--all` includes `refs/rewind/*`. If your GUI is noisy, run `rewind clear` at the end of each session to remove the refs, or configure your GUI to hide refs matching `refs/rewind/*`.
190
+
191
+ **What if I push to remote?**
192
+ The shadow refs are local-only. `git push` will not push them unless you explicitly specify `refs/rewind/*`.
193
+
194
+ **Can I use this on a repo with no commits yet?**
195
+ Yes. rewind handles empty repos correctly.
196
+
197
+ **Is my code leaving my machine?**
198
+ No. rewind is entirely local. No telemetry, no network calls, no cloud sync. It's just a Python daemon writing to your `.git` directory.
199
+
200
+ ---
201
+
202
+ ## Why not just commit more often?
203
+
204
+ Committing often is good practice, but:
205
+
206
+ 1. Mid-session commits pollute your git history with half-finished states
207
+ 2. You still can't restore to "between commits" — only to full commit boundaries
208
+ 3. You have to remember to do it; rewind is automatic
209
+ 4. A commit doesn't know which logical step the agent was in the middle of
210
+
211
+ ---
212
+
213
+ ## Contributing
214
+
215
+ ```bash
216
+ git clone https://github.com/rewind-ai/rewind
217
+ cd rewind
218
+ pip install -e ".[dev]"
219
+ pytest
220
+ ```
221
+
222
+ Issues and PRs welcome. The codebase is small and documented.
223
+
224
+ ---
225
+
226
+ ## License
227
+
228
+ MIT
229
+
230
+ ---
231
+
232
+ <div align="center">
233
+ <sub>Built because every developer using AI coding agents has had the moment: <i>"wait, what did it just do to all my files?"</i></sub>
234
+ </div>
@@ -0,0 +1,202 @@
1
+ <div align="center">
2
+
3
+ # ⏪ rewind
4
+
5
+ **Automatic session checkpoints for AI coding agents.**
6
+ When Claude Code, Cursor, or Copilot goes in the wrong direction, undo just the part that went wrong.
7
+
8
+ [![PyPI version](https://img.shields.io/pypi/v/rewind-ai.svg)](https://pypi.org/project/rewind-ai/)
9
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
11
+ [![Tests](https://github.com/rewind-ai/rewind/actions/workflows/test.yml/badge.svg)](https://github.com/rewind-ai/rewind/actions)
12
+
13
+ </div>
14
+
15
+ ---
16
+
17
+ ## The problem
18
+
19
+ You run Claude Code to "add authentication." It works for 10 minutes and modifies 14 files. Somewhere around file 11, it went in the wrong direction. Your options:
20
+
21
+ - `git checkout .` — undo **everything**, including the 10 good minutes
22
+ - Manually revert specific files — takes longer than the agent session did
23
+ - Ask the agent to undo it — now you're debugging an agent debugging itself
24
+
25
+ There is no good option. Until now.
26
+
27
+ ---
28
+
29
+ ## How rewind works
30
+
31
+ Run `rewind watch &` once. Forget about it.
32
+
33
+ Whenever rewind detects a **write burst** — multiple files changing within a few seconds, the signature of an AI agent actively writing code — it silently snapshots the working tree into a lightweight git commit on a shadow branch. Your real git history is never touched.
34
+
35
+ When something goes wrong:
36
+
37
+ ```
38
+ $ rewind list
39
+
40
+ Session checkpoints (5 total)
41
+
42
+ # When Label Changes Trigger Agent
43
+ 4 2m ago Modified routes, middleware ~4 modified burst Claude Code
44
+ 3 8m ago Modified auth, user model ~6 modified burst Claude Code ← went wrong here
45
+ 2 14m ago Added auth module +3 added burst Claude Code
46
+ 1 19m ago Modified package.json ~1 modified burst Claude Code
47
+ 0 22m ago Initial state +1 added manual
48
+
49
+ $ rewind diff 3 # see exactly what changed
50
+ $ rewind jump 2 # restore to the last known good state
51
+ ```
52
+
53
+ `rewind jump 2` restores your working tree to checkpoint 2. Your git log is unchanged. Your HEAD is unchanged. You get back 12 minutes of good work and lose only the 2 minutes that went wrong.
54
+
55
+ ---
56
+
57
+ ## Install
58
+
59
+ ```bash
60
+ pip install rewind-ai
61
+ ```
62
+
63
+ **Start the watcher** (add to your shell profile or run once per project):
64
+ ```bash
65
+ rewind watch &
66
+ ```
67
+
68
+ That's it. rewind now silently checkpoints your working tree whenever it detects AI agent activity.
69
+
70
+ ---
71
+
72
+ ## Commands
73
+
74
+ ```
75
+ rewind watch Start the background watcher (auto-checkpoints on write bursts)
76
+ rewind stop Stop the watcher
77
+ rewind status Show watcher status + checkpoint count
78
+
79
+ rewind list List all checkpoints for the current session
80
+ rewind diff [N] Show diff at checkpoint N (default: most recent)
81
+ rewind jump N Restore working tree to checkpoint N
82
+ rewind branch N Create a git branch at checkpoint N (non-destructive)
83
+
84
+ rewind snap Create a manual checkpoint right now
85
+ rewind clear Delete all checkpoints for this session
86
+ rewind install Install as a git hook (auto-starts on repo entry)
87
+ ```
88
+
89
+ ---
90
+
91
+ ## How checkpoints work (under the hood)
92
+
93
+ rewind never writes to your git history. Each checkpoint is:
94
+
95
+ 1. A **git tree object** — a snapshot of your working tree, including untracked files
96
+ 2. A **shadow commit** referenced by `refs/rewind/TIMESTAMP`
97
+ 3. Stored in your `.git` directory. Invisible to `git log`, `git status`, and `git push`. Visible to `git log --all` and GUI clients that enumerate all refs — run `rewind clear` after a session to remove them if needed.
98
+
99
+ Checkpoints are deduplicated by tree SHA — if nothing changed since the last checkpoint, no new one is created. When you run `rewind jump N`, it does a `git checkout <shadow-commit> -- .` — restoring the working tree without touching HEAD or your branch.
100
+
101
+ **Storage**: A typical session of 50 checkpoints uses ~2-5MB in `.git/objects`. Run `rewind clear` to reclaim it.
102
+
103
+ ---
104
+
105
+ ## Detecting write bursts
106
+
107
+ rewind identifies AI agent sessions by monitoring for **write bursts**: 2+ files changing within 3 seconds of each other. This is the temporal signature of a code generation agent writing an entire module at once (as opposed to a human who types one file at a time).
108
+
109
+ Write bursts to high-value files — `package.json`, `requirements.txt`, `CLAUDE.md`, `AGENTS.md`, `.cursorrules` — trigger an **immediate** checkpoint, because these files changing means something significant happened.
110
+
111
+ ---
112
+
113
+ ## Agent self-modification detection
114
+
115
+ rewind immediately checkpoints (and logs a warning) when an AI agent modifies its own instruction files:
116
+
117
+ ```
118
+ ⚠ rewind: CLAUDE.md was modified by an active write burst.
119
+ AI agents modifying their own instruction files is a known risk.
120
+ Checkpoint #7 captured the state before this change.
121
+ Run `rewind diff 7` to review.
122
+ ```
123
+
124
+ Files watched: `CLAUDE.md`, `AGENTS.md`, `.cursorrules`, `.github/copilot-instructions.md`, `GEMINI.md`
125
+
126
+ ---
127
+
128
+ ## Works with every AI coding agent
129
+
130
+ rewind watches the filesystem — it doesn't integrate with any specific tool. It works automatically with:
131
+
132
+ - **Claude Code** (Anthropic)
133
+ - **Cursor** (Anysphere)
134
+ - **GitHub Copilot Workspace**
135
+ - **Aider**
136
+ - **OpenHands / Devin**
137
+ - Any agent that writes to your filesystem
138
+
139
+ ---
140
+
141
+ ## Global install (watch all repos automatically)
142
+
143
+ ```bash
144
+ rewind install --global
145
+ ```
146
+
147
+ This installs a `post-checkout` hook into your global git hooks directory. Every time you `cd` into a git repo (via a shell that runs `git checkout`), the watcher starts automatically.
148
+
149
+ ---
150
+
151
+ ## FAQ
152
+
153
+ **Does this slow down my editor or agent?**
154
+ No. The watcher runs in a separate process and only creates checkpoints after a write burst completes (3-second quiet window). The `git write-tree` operation is typically <50ms even on large repos.
155
+
156
+ **Does this interfere with my git history?**
157
+ `git log`, `git status`, and `git push` are all clean — shadow commits are invisible to them. `git log --all` and GUI clients that enumerate all refs (GitLens, Sourcetree, Fork) will show them, because `--all` includes `refs/rewind/*`. If your GUI is noisy, run `rewind clear` at the end of each session to remove the refs, or configure your GUI to hide refs matching `refs/rewind/*`.
158
+
159
+ **What if I push to remote?**
160
+ The shadow refs are local-only. `git push` will not push them unless you explicitly specify `refs/rewind/*`.
161
+
162
+ **Can I use this on a repo with no commits yet?**
163
+ Yes. rewind handles empty repos correctly.
164
+
165
+ **Is my code leaving my machine?**
166
+ No. rewind is entirely local. No telemetry, no network calls, no cloud sync. It's just a Python daemon writing to your `.git` directory.
167
+
168
+ ---
169
+
170
+ ## Why not just commit more often?
171
+
172
+ Committing often is good practice, but:
173
+
174
+ 1. Mid-session commits pollute your git history with half-finished states
175
+ 2. You still can't restore to "between commits" — only to full commit boundaries
176
+ 3. You have to remember to do it; rewind is automatic
177
+ 4. A commit doesn't know which logical step the agent was in the middle of
178
+
179
+ ---
180
+
181
+ ## Contributing
182
+
183
+ ```bash
184
+ git clone https://github.com/rewind-ai/rewind
185
+ cd rewind
186
+ pip install -e ".[dev]"
187
+ pytest
188
+ ```
189
+
190
+ Issues and PRs welcome. The codebase is small and documented.
191
+
192
+ ---
193
+
194
+ ## License
195
+
196
+ MIT
197
+
198
+ ---
199
+
200
+ <div align="center">
201
+ <sub>Built because every developer using AI coding agents has had the moment: <i>"wait, what did it just do to all my files?"</i></sub>
202
+ </div>
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "rewind-ai"
7
+ version = "0.1.0"
8
+ description = "Automatic session checkpoints for AI coding agents. Undo just what went wrong."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ authors = [{ name = "Daksh Gulecha" }]
12
+ requires-python = ">=3.10"
13
+ keywords = ["ai", "claude", "cursor", "copilot", "git", "undo", "checkpoint", "agent"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Environment :: Console",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Topic :: Software Development :: Version Control",
20
+ "Topic :: Utilities",
21
+ ]
22
+ dependencies = [
23
+ "watchdog>=4.0.0",
24
+ "gitpython>=3.1.40",
25
+ "click>=8.1.0",
26
+ "rich>=13.0.0",
27
+ "platformdirs>=4.0.0",
28
+ "psutil>=5.9.0",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ dev = ["pytest", "pytest-cov", "black", "ruff", "mypy"]
33
+
34
+ [project.scripts]
35
+ rewind = "rewind.cli:main"
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/dakshgulecha/rewind-ai"
39
+ Issues = "https://github.com/dakshgulecha/rewind-ai/issues"
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["."]
43
+ include = ["rewind*"]
44
+
45
+ [tool.ruff]
46
+ line-length = 100
47
+ target-version = "py310"
48
+
49
+ [tool.mypy]
50
+ strict = true
File without changes