How to Back Up Your OpenClaw Agent and Data
Your OpenClaw agent accumulates valuable data over time: conversation history, memory, skills, and configuration files. Losing this data means starting from scratch — rebuilding your agent's personality, knowledge, and automation. This guide covers everything you need to back up and restore your OpenClaw installation.
What You Need to Back Up
1. Configuration Files
Location: ~/.openclaw/config.yaml
This file contains all your settings: model preferences, channel configurations, cron jobs, safety rules, and more. Losing this means reconfiguring everything from scratch.
2. SOUL.md
Location: ~/.openclaw/SOUL.md
Your agent's personality, instructions, and context. This is often the most time-consuming thing to recreate because it is refined over weeks of use.
3. Memory Database
Location: ~/.openclaw/data/memory.db
The SQLite database containing your agent's long-term memory, conversation history, and learned preferences. This is what makes your agent "know" you.
4. Skills
Location: ~/.openclaw/skills/
Installed skills and their configurations. While skills can be reinstalled, custom skill configurations and any locally modified skills should be preserved.
5. Cron Jobs
Location: Stored in memory.db but worth exporting separately.
6. Environment Variables
Location: ~/.openclaw/.env or system environment.
API keys and secrets. Handle these with extra care — encrypt them separately.
7. Drive/Assets
Location: ~/.openclaw/drive/
Any files your agent has created or stored.
Quick Backup (Manual)
The simplest backup is a compressed archive of the entire OpenClaw directory:
This works, but it is manual and easy to forget.
Automated Backup Script
Here is a production-ready backup script:
Make it executable:
Schedule with System Cron
Schedule with OpenClaw Cron
You can also use OpenClaw itself to trigger backups:
Cloud Backup Options
Amazon S3
Cost: ~$0.02/GB/month for S3 Standard.
Backblaze B2
Cheaper than S3 at $0.005/GB/month:
rsync to Another Server
Google Drive (via rclone)
Restore Process
Full Restore
Partial Restore
Sometimes you only need to restore specific components:
Restore to a New Server
When migrating to a new server:
- Install OpenClaw on the new server
- Copy the backup archive to the new server
- Follow the full restore process above
- Update channel webhooks (they point to the old server's URL)
- Update DNS if using a custom domain
- Test all channels
Docker Backup
If you run OpenClaw in Docker, back up the mounted volumes:
For zero-downtime backups, use Docker volume snapshots:
Backup Verification
A backup is worthless if you cannot restore it. Verify your backups regularly:
Schedule verification and get notified of failures via Inbounter:
Backup Best Practices
1. Follow the 3-2-1 Rule
- 3 copies of your data
- 2 different storage media
- 1 offsite copy
For OpenClaw: local backup + cloud backup + the live system itself.
2. Encrypt Sensitive Data
API keys, credentials, and personal conversation history should always be encrypted:
3. Test Restores Quarterly
Set a calendar reminder to test a full restore every three months. Use a separate server or Docker container for testing.
4. Monitor Backup Size
Track backup size over time. Unexpected growth might indicate a memory leak or runaway logging:
5. Exclude Unnecessary Files
Logs and temporary files waste backup space:
6. Document Your Backup Process
Store your backup scripts and restore instructions alongside your backups. Future you (or a colleague) will thank you.
Disaster Recovery Plan
Have a written plan for when things go wrong:
- Detection: How will you know something went wrong? Set up health checks that alert you via Inbounter email or SMS.
- Assessment: Check what was lost (config only? memory? everything?).
- Recovery: Follow the restore process for the appropriate scope.
- Verification: Test all channels, cron jobs, and skills after restore.
- Post-mortem: Document what caused the failure and how to prevent it.
Recovery Time Objective (RTO): With proper backups, you should be able to restore a fully functional OpenClaw agent in under 30 minutes.
Frequently Asked Questions
How often should I back up?
Daily for most users. If your agent handles critical tasks, consider more frequent database backups (every 6 hours).
How much storage do backups need?
A typical OpenClaw installation is 50-200 MB. With 30-day retention of daily backups, budget 2-6 GB of storage.
Can I back up while OpenClaw is running?
For configuration and skills, yes. For the database, use openclaw memory export or sqlite3 .backup for consistency. Copying the database file while it is being written can result in corruption.
Do I need to back up skills if they are from the public registry?
Skills can be reinstalled, but custom configurations and locally modified skills should be backed up. The backup script in this guide handles this by excluding node_modules and compressing the rest.
What if I lose my API keys?
Regenerate them from your provider's dashboard (Anthropic, OpenAI, Google). This is why encrypting your .env backup is important — it is the only copy of these keys outside the provider.
Can OpenClaw back itself up?
Yes, by scheduling a backup script via OpenClaw cron. Just make sure the backup process does not require the agent to be stopped, or use the sqlite3 .backup method for the database.
Never miss a backup failure alert. Inbounter provides email and SMS APIs for AI agents — get instant notifications when your OpenClaw backups fail.