codemap_backup_restore
Restore from a backup. Creates backup of current state before restoring. Use preview=true to see changes first.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
type | stringgroups | annotations | labels | ✅ Required | Which file to restore: groups|annotations|labels |
timestamp | string | ❌ Optional | Specific backup timestamp (omit for latest backup) |
preview | boolean | ❌ Optional | Show available backups without applying (default: false) (default: false) |
force | boolean | ❌ Optional | Skip confirmation (default: false) (default: false) |
Usage Examples
MCP Usage (for AI Agents like Claude)
json
{
"name": "codemap_backup_restore",
"arguments": {
"type": "groups",
"preview": true
}
}Example Output
JSON Response
json
{
"ok": true,
"type": "groups",
"timestamp": "latest",
"message": "Restore completed successfully"
}When to Use This Tool
-
Use
- Recover from accidental deletions or modifications
- Revert to a known good state
- Restore after failed operations
- Roll back experimental changes
- Recover from corruption
- Test backup integrity
codemap_backup_restore when you need to:
Common Patterns
Safe Restore Workflow
Emergency Recovery
Point-in-Time Recovery
1. Preview available backups
2. Choose appropriate restore point
3. Restore with specific timestamp
4. Verify restored dataEmergency Recovery
1. Identify affected type (groups/annotations/labels)
2. Restore latest backup immediately
3. Verify data integrity
4. Resume normal operationsPoint-in-Time Recovery
1. Determine target timestamp
2. Preview to verify backup exists
3. Restore specific timestamp
4. Validate resultsPro Tips
- Always preview first: Use preview=true to see available backups before restoring
- Current state is backed up: Restore creates backup of current state automatically
- Latest is default: Omit timestamp to restore most recent backup
- Daily preferred: Daily backups are more stable than turn-based
- Reload happens automatically: Groups/labels stores reload after restore
- Use force=true: Required for actual restore (prevents accidents)
Best Practices
- Preview before every restore operation
- Prefer daily backups over turn-based when available
- Document why you're restoring (for session logs)
- Verify data after restore completes
- Keep restore operations isolated (one type at a time)
- Test backup/restore workflow periodically
- Don't rely on backups as version control
Common Mistakes
❌ Mistake: Restoring without preview first
✅ Instead: Always use preview=true to verify backup exists
❌ Mistake: Forgetting force=true parameter
✅ Instead: Include force=true when ready to actually restore
❌ Mistake: Not verifying restored data
✅ Instead: Check that restored data looks correct after operation
❌ Mistake: Restoring wrong timestamp
✅ Instead: Preview first, carefully select correct timestamp
❌ Mistake: Assuming restore failed silently
✅ Instead: Check result.ok and handle errors explicitly
❌ Mistake: Restoring all types blindly
✅ Instead: Restore only the affected type to minimize changes
❌ Mistake: Using backups as undo/redo system
✅ Instead: Backups are for disaster recovery, not workflow versioning
❌ Mistake: Not understanding daily vs turn retention
✅ Instead: Daily backups (7 days) are more reliable than turn backups (last 10)
✅ Instead: Always use preview=true to verify backup exists
❌ Mistake: Forgetting force=true parameter
✅ Instead: Include force=true when ready to actually restore
❌ Mistake: Not verifying restored data
✅ Instead: Check that restored data looks correct after operation
❌ Mistake: Restoring wrong timestamp
✅ Instead: Preview first, carefully select correct timestamp
❌ Mistake: Assuming restore failed silently
✅ Instead: Check result.ok and handle errors explicitly
❌ Mistake: Restoring all types blindly
✅ Instead: Restore only the affected type to minimize changes
❌ Mistake: Using backups as undo/redo system
✅ Instead: Backups are for disaster recovery, not workflow versioning
❌ Mistake: Not understanding daily vs turn retention
✅ Instead: Daily backups (7 days) are more reliable than turn backups (last 10)