Skip to main content

Checkpoint

Feature Overview: Checkpoints are iFlow CLI's safety rollback system that automatically saves project state snapshots before AI tools modify files.

Learning Time: 5-10 minutes

Prerequisites: Understanding basic Git concepts and familiarity with file version management

What are Checkpoints

Checkpoints are a safety mechanism provided by iFlow CLI that automatically saves complete snapshots of your project state before AI tools modify the file system. This feature allows you to safely experiment and apply code changes, with the ability to immediately roll back to the state before tool execution, ensuring your project's safety.

Core Features

FeatureDescriptionAdvantage
Automatic CreationAutomatically saves state before AI tool executionNo manual operation required
Complete SnapshotSaves files, conversations, and tool callsComprehensive state recovery
Independent StorageDoes not interfere with project Git repositorySafe isolation
Instant RecoveryOne-click rollback to any checkpointQuick change reversal
Local StorageAll data saved locallyPrivacy and security

How It Works

Checkpoint Creation Process

Tool Call → Permission Confirmation → State Snapshot → Tool Execution → Checkpoint Complete

[AI Request] → [User Approval] → [File Backup] → [Safe Execution] → [State Saved]

Snapshot Content Components

1. Git State Snapshot

  • Creates shadow Git repository at ~/.iflow/snapshots/<project_hash>
  • Captures complete state of project files
  • Does not interfere with project's original Git repository

2. Conversation History

  • Saves complete conversation records with AI assistant
  • Includes context and interaction state
  • Supports complete conversation state recovery

3. Tool Call Information

  • Stores specific tool calls to be executed
  • Records parameters and execution context
  • Supports re-execution or modification of calls

Data Storage Locations

Data TypeStorage PathDescription
Git Snapshot~/.iflow/snapshots/<project_hash>Shadow Git repository
Conversation History~/.iflow/cache/<project_hash>/checkpointsJSON format files
Tool Calls~/.iflow/cache/<project_hash>/checkpointsCall detail records

Detailed Feature Description

Enabling Checkpoint Feature

Checkpoint feature is disabled by default and can be enabled through the following methods:

Command Line Arguments

# Enable checkpoint feature
iflow --checkpointing

Note! Must be in default mode to take effect.

After entering iflow, use Shift + Tab twice to switch to default mode.

Configuration File Settings

Add to settings.json:

{
"checkpointing": {
"enabled": true
}
}

Using Checkpoints

Creating Checkpoints

  • Checkpoints are automatically created before AI tools modify files
  • Each checkpoint has a unique timestamp identifier
  • System will notify when checkpoint creation is complete

Viewing Checkpoints

# List all checkpoints
/restore

# View checkpoint details
/restore <checkpoint-name>

Restoring Checkpoints

# Interactive checkpoint selection
/restore

# Restore specific checkpoint
/restore <checkpoint-name>

Usage Examples

Safe Code Modifications

# 1. AI suggests modifications
> I want to refactor this function to improve performance

# 2. System automatically creates checkpoint
[Checkpoint] Creating project state snapshot...
[Checkpoint] Snapshot creation complete: checkpoint_20231215_143022

# 3. AI executes modifications
# ... file modification operations ...

# 4. If rollback is needed
/restore checkpoint_20231215_143022

Experimental Changes

# Attempt large-scale refactoring
> Please help me refactor the entire project architecture

# System creates checkpoint then executes
# If results are unsatisfactory, can easily roll back
/restore

Troubleshooting

Common Issues and Solutions

IssuePossible CauseSolution
Checkpoint creation failedInsufficient disk space or permission issuesCheck disk space and file permissions
Recovery failedCheckpoint file corruptedUse other checkpoints or manual recovery
Checkpoint list emptyFeature not enabled or no modificationsEnable feature and perform file operations
Files missing after recoveryIncomplete checkpointCheck Git repository status

Security Considerations

  • Storage Space: Checkpoints consume disk space, regularly clean up old checkpoints
  • Privacy Protection: Checkpoints contain complete conversation history, be mindful of sensitive information
  • Git Conflicts: Recovery may conflict with current Git state, requiring manual handling
  • Large File Handling: Checkpoints for large projects may take considerable time

Platform Compatibility

PlatformSupport LevelSpecial Notes
WindowsFull supportPath handling automatically adapted
macOSFull supportComplete file system support
LinuxFull supportNative Git integration