Shadow Git Checkpointing
The Checkpoints feature provides file-level undo/restore capabilities using a shadow git repository. This enables automatic checkpointing before file modifications, allowing you to rewind to any previous state.Overview
Checkpoints allow you to:- Save snapshots of your workspace before changes
- Restore files to any previous checkpoint
- Diff between checkpoints to see what changed
- Track all file modifications made by agents
Quick Start
How It Works
The checkpoint service creates a shadow git repository separate from your project’s git:- Isolated Storage: Checkpoints are stored in
~/.praison/checkpoints/<hash>/ - No Interference: Doesn’t affect your project’s
.gitdirectory - Automatic Tracking: Tracks all files in the workspace
- Exclude Patterns: Respects
.gitignore-style patterns
CLI Commands
Python API
CheckpointService
workspace_dir: Directory to trackstorage_dir: Where to store checkpoint data (default:~/.praison/checkpoints)enabled: Enable/disable checkpointsauto_checkpoint: Auto-checkpoint before file modificationsmax_checkpoints: Maximum checkpoints to keep
Methods
initialize()
Initialize the checkpoint service:save(message, allow_empty=False)
Save a checkpoint:restore(checkpoint_id)
Restore to a checkpoint:diff(from_id=None, to_id=None)
Get diff between checkpoints:list_checkpoints(limit=50)
List all checkpoints:Event Handlers
Subscribe to checkpoint events:Data Types
Checkpoint
CheckpointDiff
FileDiff
Configuration
Exclude Patterns
By default, these patterns are excluded:.git.praison__pycache__*.pyc.envnode_modules.venv,venv*.log
Protected Paths
The service refuses to checkpoint these paths for safety:- Home directory (
~) ~/Desktop,~/Documents,~/Downloads- System directories (
/,/tmp,/var,/etc)
Complete Example
Best Practices
- Checkpoint before major changes - Save before refactoring or large edits
- Use descriptive messages - Makes it easier to find the right checkpoint
- Don’t checkpoint too frequently - Balance between safety and storage
- Clean up old checkpoints - Use
deletewhen no longer needed - Check diff before restore - Verify you’re restoring to the right state
Performance
The checkpoint system is designed for minimal overhead:- Lazy loading: All imports via
__getattr__ - Async operations: Non-blocking git operations
- Incremental commits: Only changed files are tracked
- Configurable limits: Control max checkpoints to manage storage

