Skip to content

Commit ed0ca93

Browse files
Enhance checkpoints documentation: detail functionality, images (#82)
* Enhance checkpoints documentation: detail functionality, configuration, and usage with new images * Fix formatting of important notes section in checkpoints documentation * Refine checkpoints documentation: clarify how snapshots are created and stored * Update docs/advanced-usage/checkpoints.md Co-authored-by: Matt Rubens <[email protected]> * Remove redundant note about `git clean` in restoration process section of checkpoints documentation --------- Co-authored-by: Matt Rubens <[email protected]>
1 parent 7255f54 commit ed0ca93

File tree

9 files changed

+219
-18
lines changed

9 files changed

+219
-18
lines changed

docs/advanced-usage/checkpoints.md

Lines changed: 219 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,236 @@
11
# Checkpoints
22

3-
Checkpoints allow you to save the state of your project at a specific point in time during a task. This enables you to easily revert to a previous state if needed, providing a safety net for complex or potentially risky operations.
3+
Checkpoints automatically version your workspace files during Roo Code tasks, enabling non-destructive exploration of AI suggestions and easy recovery from unwanted changes.
4+
5+
Checkpoints let you:
6+
- Safely experiment with AI-suggested changes
7+
- Easily recover from undesired modifications
8+
- Compare different implementation approaches
9+
- Revert to previous project states without losing work
10+
11+
::::info Important Notes
12+
- **Checkpoints are enabled by default.**
13+
- **Git must be installed** for checkpoints to function - [see installation instructions](#git-installation)
14+
- No GitHub account or repository is required
15+
- No Git personal information configuration is needed
16+
- The shadow Git repository operates independently from your project's existing Git configuration
17+
::::
18+
19+
## Configuration Options
20+
21+
Access checkpoint settings in Roo Code settings under the "Checkpoints" section:
22+
23+
1. Open Settings by clicking the gear icon <Codicon name="gear" /> → Checkpoints
24+
2. Check or uncheck the "Enable automatic checkpoints" checkbox
25+
26+
<img src="/img/checkpoints/checkpoints.png" alt="Checkpoint settings in Roo Code configuration" width="500" />
427

528
## How Checkpoints Work
629

7-
When checkpoints are enabled, Roo Code automatically creates a new checkpoint whenever:
30+
Roo Code captures snapshots of your project's state using a shadow Git repository, separate from your main version control system. These snapshots, called checkpoints, automatically record changes throughout your AI-assisted workflow—whenever tasks begin, files change, or commands run.
31+
32+
Checkpoints are stored as Git commits in the shadow repository, capturing:
33+
34+
- File content changes
35+
- New files added
36+
- Deleted files
37+
- Renamed files
38+
- Binary file changes
39+
40+
## Working with Checkpoints
41+
42+
Checkpoints are integrated directly into your workflow through the chat interface.
43+
44+
Checkpoints appear directly in your chat history in two forms:
45+
46+
- **Initial checkpoint** marks your starting project state
47+
<img src="/img/checkpoints/checkpoints-1.png" alt="Initial checkpoint indicator in chat" width="500" />
48+
49+
- **Regular checkpoints** appear after file modifications or command execution
50+
<img src="/img/checkpoints/checkpoints-2.png" alt="Regular checkpoint indicator in chat" width="500" />
51+
52+
Each checkpoint provides two primary functions:
53+
54+
### Viewing Differences
55+
56+
To compare your current workspace with a previous checkpoint:
57+
58+
1. Locate the checkpoint in your chat history
59+
2. Click the checkpoint's `View Differences` button
60+
61+
<img src="/img/checkpoints/checkpoints-6.png" alt="View Differences button interface" width="100" />
62+
63+
3. Review the differences in the comparison view:
64+
- Added lines are highlighted in green
65+
- Removed lines are highlighted in red
66+
- Modified files are listed with detailed changes
67+
- Renamed and moved files are tracked with their path changes
68+
- New or deleted files are clearly marked
69+
70+
<img src="/img/checkpoints/checkpoints-3.png" alt="View differences option for checkpoints" width="800" />
71+
72+
### Restoring Checkpoints
73+
74+
To restore a project to a previous checkpoint state:
75+
76+
1. Locate the checkpoint in your chat history
77+
2. Click the checkpoint's `Restore Checkpoint` button
78+
<img src="/img/checkpoints/checkpoints-7.png" alt="Restore checkpoint button interface" width="100" />
79+
3. Choose one of these restoration options:
80+
81+
<img src="/img/checkpoints/checkpoints-4.png" alt="Restore checkpoint option" width="300" />
82+
83+
- **Restore Files Only** - Reverts only workspace files to checkpoint state without modifying conversation history. Ideal for comparing alternative implementations while maintaining chat context, allowing you to seamlessly switch between different project states. This option does not require confirmation and lets you quickly switch between different implementations.
84+
85+
- **Restore Files & Task** - Reverts both workspace files AND removes all subsequent conversation messages. Use when you want to completely reset both your code and conversation back to the checkpoint's point in time. This option requires confirmation in a dialog as it cannot be undone.
86+
87+
<img src="/img/checkpoints/checkpoints-9.png" alt="Confirmation dialog for restoring checkpoint with files & task" width="300" />
88+
89+
### Limitations and Considerations
90+
91+
- **Scope**: Checkpoints only capture changes made during active Roo Code tasks
92+
- **External changes**: Modifications made outside of tasks (manual edits, other tools) aren't included
93+
- **Large files**: Very large binary files may impact performance
94+
- **Unsaved work**: Restoration will overwrite any unsaved changes in your workspace
95+
96+
## Technical Implementation
97+
98+
### Checkpoint Architecture
99+
100+
The checkpoint system consists of:
101+
102+
1. **Shadow Git Repository**: A separate Git repository created specifically for checkpoint tracking that functions as the persistent storage mechanism for checkpoint state.
103+
104+
2. **Checkpoint Service**: Handles Git operations and state management through:
105+
- Repository initialization
106+
- Checkpoint creation and storage
107+
- Diff computation
108+
- State restoration
109+
110+
3. **UI Components**: Interface elements displayed in the chat that enable interaction with checkpoints.
111+
112+
### Restoration Process
113+
114+
When restoration executes, Roo Code:
115+
- Performs a hard reset to the specified checkpoint commit
116+
- Copies all files from the shadow repository to your workspace
117+
- Updates internal checkpoint tracking state
118+
119+
### Storage Type
120+
121+
Checkpoints are task-scoped, meaning they are specific to a single task.
122+
123+
### Diff Computation
124+
125+
Checkpoint comparison uses Git's underlying diff capabilities to produce structured file differences:
126+
- Modified files show line-by-line changes
127+
- Binary files are properly detected and handled
128+
- Renamed and moved files are tracked correctly
129+
- File creation and deletion are clearly identified
130+
131+
### File Exclusion and Ignore Patterns
132+
133+
The checkpoint system uses intelligent file exclusion to track only relevant files:
134+
135+
#### Built-in Exclusions
136+
137+
The system has comprehensive built-in exclusion patterns that automatically ignore:
138+
- Build artifacts and dependency directories (`node_modules/`, `dist/`, `build/`)
139+
- Media files and binary assets (images, videos, audio)
140+
- Cache and temporary files (`.cache/`, `.tmp/`, `.bak`)
141+
- Configuration files with sensitive information (`.env`)
142+
- Large data files (archives, executables, binaries)
143+
- Database files and logs
144+
145+
These patterns are written to the shadow repository's `.git/info/exclude` file during initialization.
146+
147+
#### .gitignore Support
148+
149+
The checkpoint system respects `.gitignore` patterns in your workspace:
150+
- Files excluded by `.gitignore` won't trigger checkpoint creation
151+
- Excluded files won't appear in checkpoint diffs
152+
- Standard Git ignore rules apply when staging file changes
153+
154+
#### .rooignore Behavior
155+
156+
The `.rooignore` file (which controls AI access to files) is separate from checkpoint tracking:
157+
- Files excluded by `.rooignore` but not by `.gitignore` will still be checkpointed
158+
- Changes to AI-inaccessible files can still be restored through checkpoints
159+
160+
This separation is intentional, as `.rooignore` limits which files the AI can access, not which files should be tracked for version history.
161+
162+
#### Nested Git Repositories
163+
164+
The checkpoint system includes special handling for nested Git repositories:
165+
- Temporarily renames nested `.git` directories to `.git_disabled` during operations
166+
- Restores them after operations complete
167+
- Allows proper tracking of files in nested repositories
168+
- Ensures nested repositories remain functional and unaffected
169+
170+
### Concurrency Control
171+
172+
Operations are queued to prevent concurrent Git operations that might corrupt repository state. This ensures that rapid checkpoint operations complete safely even when requested in quick succession.
173+
174+
## Git Installation
175+
176+
Checkpoints require Git to be installed on your system. The implementation uses the `simple-git` library, which relies on Git command-line tools to create and manage shadow repositories.
177+
178+
### macOS
8179

9-
* A task is started.
10-
* A file is created, modified, or deleted.
11-
* A command is executed.
180+
1. **Install with Homebrew (recommended)**:
181+
```
182+
brew install git
183+
```
12184

13-
## Viewing Checkpoints
185+
2. **Alternative: Install with Xcode Command Line Tools**:
186+
```
187+
xcode-select --install
188+
```
14189

15-
You can view the list of checkpoints for a task in the chat history.
190+
3. **Verify installation**:
191+
- Open Terminal
192+
- Type `git --version`
193+
- You should see a version number like `git version 2.40.0`
16194

17-
## Restoring a Checkpoint
195+
### Windows
18196

19-
To restore a checkpoint:
197+
1. **Download Git for Windows**:
198+
- Visit https://git-scm.com/download/win
199+
- The download should start automatically
20200

21-
1. **Open the chat view.**
22-
2. **Find the checkpoint** you want to restore in the chat history.
23-
3. **Click on the restore button**
201+
2. **Run the installer**:
202+
- Accept the license agreement
203+
- Choose installation location (default is recommended)
204+
- Select components (default options are typically sufficient)
205+
- Choose the default editor
206+
- Choose how to use Git from the command line (recommended: Git from the command line and also from 3rd-party software)
207+
- Configure line ending conversions (recommended: Checkout Windows-style, commit Unix-style)
208+
- Complete the installation
24209

25-
This will revert all files in your project to their state at that checkpoint.
210+
3. **Verify installation**:
211+
- Open Command Prompt or PowerShell
212+
- Type `git --version`
213+
- You should see a version number like `git version 2.40.0.windows.1`
26214

27-
**Note:** Restoring a checkpoint will overwrite any changes you've made since that checkpoint. It's recommended to commit your work before restoring a checkpoint.
215+
### Linux
28216

29-
## Limitations
217+
**Debian/Ubuntu**:
218+
```
219+
sudo apt update
220+
sudo apt install git
221+
```
30222

31-
* Checkpoints are only created during active Roo Code tasks. Changes made outside of a task will not be captured.
223+
**Fedora**:
224+
```
225+
sudo dnf install git
226+
```
32227

33-
## Enabling/Disabling Checkpoints
228+
**Arch Linux**:
229+
```
230+
sudo pacman -S git
231+
```
34232

35-
You can enable or disable checkpoints in the Roo Code settings. Look for the "Enable automatic checkpoints" checkbox under Advanced Settings.
233+
**Verify installation**:
234+
- Open Terminal
235+
- Type `git --version`
236+
- You should see a version number
8.62 KB
Loading
12.8 KB
Loading
179 KB
Loading
44.9 KB
Loading
4.41 KB
Loading
5.21 KB
Loading
17.4 KB
Loading
40.2 KB
Loading

0 commit comments

Comments
 (0)