Session Time-Travel
AI coding assistants often modify multiple files simultaneously. SnapBack’s Session Time-Travel groups related snapshots for atomic rollback, allowing you to navigate through your coding history with precision.
How Sessions Work
Sessions automatically group related snapshots based on your coding activity:
Automatic Grouping
SnapBack intelligently groups snapshots into sessions based on timing and context.
Atomic Rollback
Restore entire sessions with one action, ensuring consistency across all modified files.
Time Navigation
Navigate through your coding history with intuitive time-travel controls.
Session Triggers
SnapBack automatically creates new sessions based on these triggers:
Time-Based Triggers
- 105s Idle Gap: After 105 seconds of inactivity, a new session begins
- Window Blur: When you switch away from VS Code, the current session ends
Action-Based Triggers
- Git Commit: Each Git commit starts a new session
- Task Completion: Finishing a coding task (configured in settings)
Manual Triggers
You can also manually create sessions:
# Create a new session manually
snapback session create --name "Implement user authentication"
# End current session
snapback session end
Session Structure
Each session contains:
- Metadata: Timestamp, duration, trigger event
- File Changes: All snapshots created during the session
- AI Detection Results: Any risks detected during the session
- User Notes: Optional notes added during the session
Time-Travel Navigation
Navigate through your coding history with intuitive controls:
VS Code Extension
- Open the SnapBack panel (
View → SnapBack) - Switch to the “Sessions” tab
- Browse through your session history
- Click on any session to view its snapshots
- Restore the entire session or individual snapshots
CLI Tool
# List all sessions
snapback session list
# View session details
snapback session view --id session_12345
# Restore a session
snapback session restore --id session_12345
# Compare sessions
snapback session diff --id session_12345 --id session_67890
Session vs Snapshot Differences
Understanding the relationship between sessions and snapshots:
| Concept | Description | Scope |
|---|---|---|
| Snapshot | Point-in-time capture of a single file | Single file |
| Session | Group of related snapshots with shared context | Multiple files |
Recovery Process
Restoring from a session is simple and safe:
Step 1: Identify the Session
Find the session you want to restore:
Step 2: Review Changes
Before restoring, review what will be changed:
Step 3: Restore
Perform the restoration:
# Restore an entire session
snapback session restore --id session_12345
# Restore specific files from a session
snapback session restore --id session_12345 --files src/index.js,src/utils.js
# Preview changes before restoring
snapback session restore --id session_12345 --dry-run
Best Practices
🏷️ Name Important Sessions
Give meaningful names to important sessions to make them easier to find later.
📝 Add Context Notes
Add notes to sessions explaining what you were working on and any important context.
⏰ Be Mindful of Timing
Take breaks to allow natural session boundaries, making it easier to navigate your history.
🔍 Review Before Restore
Always review session changes before restoring to avoid unintended modifications.
Advanced Features
Session Comparison
Compare different sessions to understand changes over time:
# Compare two sessions
snapback session diff --id session_12345 --id session_67890
# Export session comparison as HTML report
snapback session diff --id session_12345 --id session_67890 --format html > comparison.html
Session Export
Export sessions for backup or sharing:
# Export a session
snapback session export --id session_12345 --output session_backup.json
# Import a session
snapback session import --input session_backup.json
Related Documentation
- Protection Levels - Granular file-level control
- AI Detection - Real-time risk analysis
- CLI Documentation - Command-line interface for automation
- VS Code Extension - IDE integration for real-time protection
💡 Pro Tip: Use sessions as a natural checkpoint in your development workflow. Before starting a major refactor or implementing a new feature, take a moment to let the current session end naturally.