Skip to content

Commit e5c2a60

Browse files
committed
Enhance checkpoints documentation: detail functionality, configuration, and usage with new images
1 parent 7255f54 commit e5c2a60

File tree

9 files changed

+224
-18
lines changed

9 files changed

+224
-18
lines changed

docs/advanced-usage/checkpoints.md

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

9-
* A task is started.
10-
* A file is created, modified, or deleted.
11-
* A command is executed.
185+
1. **Install with Homebrew (recommended)**:
186+
```
187+
brew install git
188+
```
12189

13-
## Viewing Checkpoints
190+
2. **Alternative: Install with Xcode Command Line Tools**:
191+
```
192+
xcode-select --install
193+
```
14194

15-
You can view the list of checkpoints for a task in the chat history.
195+
3. **Verify installation**:
196+
- Open Terminal
197+
- Type `git --version`
198+
- You should see a version number like `git version 2.40.0`
16199

17-
## Restoring a Checkpoint
200+
### Windows
18201

19-
To restore a checkpoint:
202+
1. **Download Git for Windows**:
203+
- Visit https://git-scm.com/download/win
204+
- The download should start automatically
20205

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**
206+
2. **Run the installer**:
207+
- Accept the license agreement
208+
- Choose installation location (default is recommended)
209+
- Select components (default options are typically sufficient)
210+
- Choose the default editor
211+
- Choose how to use Git from the command line (recommended: Git from the command line and also from 3rd-party software)
212+
- Configure line ending conversions (recommended: Checkout Windows-style, commit Unix-style)
213+
- Complete the installation
24214

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

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.
220+
### Linux
28221

29-
## Limitations
222+
**Debian/Ubuntu**:
223+
```
224+
sudo apt update
225+
sudo apt install git
226+
```
30227

31-
* Checkpoints are only created during active Roo Code tasks. Changes made outside of a task will not be captured.
228+
**Fedora**:
229+
```
230+
sudo dnf install git
231+
```
32232

33-
## Enabling/Disabling Checkpoints
233+
**Arch Linux**:
234+
```
235+
sudo pacman -S git
236+
```
34237

35-
You can enable or disable checkpoints in the Roo Code settings. Look for the "Enable automatic checkpoints" checkbox under Advanced Settings.
238+
**Verify installation**:
239+
- Open Terminal
240+
- Type `git --version`
241+
- 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)