Smart Backup 💾
Stop losing config changes to disk failures. Start backing up intelligently.
The Problem
Config files, skills, memory — they're all on one disk with no backup strategy. When something breaks, everything is gone. Manual backups are error-prone and inconsistent.
Smart Backup fixes this with automated backup, sync, verification, and deduplication.
Quick Start
Create a backup
node skills/smart-backup/smart-backup.js --backup /home/jarvis/.openclaw /mnt/backup
Preview backup without creating
node skills/smart-backup/smart-backup.js --backup --dry-run /home/jarvis/.openclaw /mnt/backup
Sync files between locations
node skills/smart-backup/smart-backup.js --sync /home/jarvis/.openclaw /mnt/backup/sync
Syncs only changed files, deletes extras in destination.
Preview sync
node skills/smart-backup/smart-backup.js --sync --dry-run /home/jarvis/.openclaw /mnt/backup/sync
Verify backup integrity
node skills/smart-backup/smart-backup.js --verify /path/to/backup-xxx
Checks SHA-256 hashes of all files against manifest.
Find duplicate files
node skills/smart-backup/smart-backup.js --dedup /home/jarvis
Groups files by content hash, shows sizes and paths.
List available backups
node skills/smart-backup/smart-backup.js --list
Restore from backup
node skills/smart-backup/smart-backup.js --restore /path/to/backup-xxx /restore/path
Status overview
node skills/smart-backup/smart-backup.js --status
Incremental backup
# First backup (full)
node skills/smart-backup/smart-backup.js --backup /source /dest
# Subsequent backups (only changed files)
node skills/smart-backup/smart-backup.js --backup /source /dest --incr
Hash-based change detection — skips unchanged files for 10-100x speedup.
Features
Backup with Manifest
- Creates timestamped backup directories
- SHA-256 hash for every file in manifest
- Total size and file count tracking
- Skips
.git,node_modules,.cache,.npmby default
Smart Sync
- Copies new files, updates changed files, deletes extras
- Hash-based change detection (not just timestamps)
- Dry-run mode shows what would change before doing it
Integrity Verification
- Verifies every file against stored SHA-256 hash
- Reports missing files and hash mismatches
- One-command verification of any backup
Incremental Backup
--incrflag enables hash-based change detection- Only backs up files that changed since last backup
- Skips unchanged files (10-100x speedup)
- Manifest tracks per-file SHA-256 hashes
--from-manifest <id>to base diff on specific manifest
Content-Aware Deduplication
- Groups files by SHA-256 hash
- Shows duplicate groups with sizes
- Helps identify storage waste
Compression Ready
- Manifest format supports compression (planned)
- Estimated 60% compression savings shown in dry-run
- Backup directory structure preserved
Configuration
Backups stored in: backups/smart-backups/
Manifest stored in: backups/smart-backups/manifest.json
Override data directory:
--dir /path/to/data
Agent Protocol
During heartbeats and maintenance:
- Weekly backup —
--backupyour workspace to a safe location - Verify after backup —
--verifythe latest backup - Dedup periodically —
--dedupto find and clean duplicates - List backups —
--listto check backup health - Dry-run first — Always
--dry-runbefore sync/backup on important dirs
Heartbeat Integration
Add to your HEARTBEAT.md:
### 💾 Smart Backup
- Weekly: `node skills/smart-backup/smart-backup.js --backup /home/jarvis/.openclaw /mnt/backup`
- Verify: `node skills/smart-backup/smart-backup.js --verify <latest-backup>`
- Dedup: `node skills/smart-backup/smart-backup.js --dedup /home/jarvis`
Security Notes
- File hashes are SHA-256 (integrity, not encryption)
- Backups contain all file content — ensure backup storage is secure
- Symlink-safe — uses standard fs operations
- No network calls, all local
Comparison
| Approach | Integrity Check | Dedup | Manifest | Automation |
|---|---|---|---|---|
cp -r |
❌ | ❌ | ❌ | Manual |
rsync |
⚠️ | ❌ | ❌ | Auto |
| Smart Backup | ✅ | ✅ | ✅ | Auto |
Smart Backup gives you integrity verification + dedup + manifest tracking in one tool.
Design Principles
- Zero setup — Works immediately, no config needed
- No dependencies — Pure Node.js fs/crypto/zlib, no npm packages
- Safe by default — Skips known bloat directories, dry-run available
- Transparent — Every operation reports what it did
- Persistent — Manifests survive restarts and can verify integrity later




