| name | backup-restore |
| description | Create backups before changes and restore if things go wrong.
Triggers: "backup", "restore", "undo", "go back", "roll back", "save point".
|
Backup & Restore
MANDATORY: Always create a backup before any state-changing operation on the VPS.
Creating a Backup
Full System Backup
Backs up all workspace files, the config, and the credentials file. Think of it as a save point.
ssh -i ~/.ssh/id_ed25519_github root@72.62.213.231 \
"tar -czf ~/.openclaw/backups/manual-$(date +%Y%m%d-%H%M%S).tar.gz \
~/.openclaw/workspace/ ~/.openclaw/openclaw.json ~/.openclaw/.env"
Tell Trent: "This creates a snapshot of everything. If something goes wrong, we can restore to exactly this state."
Single Agent Backup
If only one agent's files are changing:
ssh -i ~/.ssh/id_ed25519_github root@72.62.213.231 \
"tar -czf ~/.openclaw/backups/<agent>-$(date +%Y%m%d-%H%M%S).tar.gz \
~/.openclaw/workspace/"
List Available Backups
ssh -i ~/.ssh/id_ed25519_github root@72.62.213.231 \
"ls -lh ~/.openclaw/backups/ 2>/dev/null | sort -k6,7 || echo 'No backups directory found'"
Show Trent the list with dates and sizes. Explain: "Each of these is a save point you can restore from."
Restoring from Backup
Step 1: Choose the Backup
Show available backups and ask Trent which one to restore to.
Step 2: Stop the Gateway (YELLOW)
Tell Trent: "The agent will be offline for about 1-2 minutes during the restore."
ssh -i ~/.ssh/id_ed25519_github root@72.62.213.231 "systemctl stop openclaw-gateway"
Wait for confirmation before proceeding.
Step 3: Restore Files
ssh -i ~/.ssh/id_ed25519_github root@72.62.213.231 \
"cd / && tar -xzf ~/.openclaw/backups/[BACKUP_FILE].tar.gz"
Step 4: Verify Permissions
After restore, always fix permissions (the tar might not preserve them correctly):
ssh -i ~/.ssh/id_ed25519_github root@72.62.213.231 \
"chmod 600 ~/.openclaw/.env && chmod 444 ~/.openclaw/openclaw.json"
Step 5: Restart and Verify
ssh -i ~/.ssh/id_ed25519_github root@72.62.213.231 "systemctl start openclaw-gateway"
Wait 15 seconds, then dispatch the deploy-verifier agent to confirm everything is healthy.
Step 6: Confirm with Trent
"Restore complete. The system is back to the state from [backup date/time]. Everything looks healthy."
Or if verification failed: "The restore finished but there's an issue. [explain]. Would you like to try a different backup or should we troubleshoot?"
Checking Backup Health
Periodically check that backups exist and aren't too old:
ssh -i ~/.ssh/id_ed25519_github root@72.62.213.231 \
"ls -lt ~/.openclaw/backups/ 2>/dev/null | head -5"
If the most recent backup is more than 7 days old, suggest creating a fresh one.
Rules
- NEVER restore without stopping the gateway first.
- NEVER delete the only remaining backup.
- After restore, ALWAYS verify permissions on .env (600) and openclaw.json (444).
- After restore, ALWAYS run a health check to confirm recovery.
- Explain every step to Trent before executing.
- If the backups directory doesn't exist, create it:
mkdir -p ~/.openclaw/backups/