How to Back Up and Restore Your OpenClaw Workspace
Back up and restore your OpenClaw workspace with DuckDB exports, file snapshots, and automated scripts. Keep your CRM data safe with these practical steps.
Backing up your OpenClaw workspace is straightforward: your entire workspace — contacts, pipeline data, notes, and configuration — lives in two places: a DuckDB database file and a directory of markdown files. Copy those two things, and you have a complete backup.
Here's how to do it properly, automate it, and restore from a backup if something goes wrong.
If you're new to the setup, read what DenchClaw is and the setup guide first.
What's in Your Workspace#
Before backing up, know what you're backing up.
By default, your DenchClaw workspace lives at:
~/.openclaw-dench/workspace/
├── workspace.duckdb # All your CRM data (contacts, pipeline, entries)
├── workspace.duckdb.wal # Write-ahead log (active transactions)
├── docs/ # Markdown knowledge base
├── skills/ # Custom and installed skills
├── apps/ # Any .dench.app files you've built
├── memory/ # Agent memory files
├── SOUL.md # Agent configuration
├── USER.md # User profile
└── AGENTS.md # Workspace rules
A complete backup needs:
workspace.duckdb(and the.walfile if it exists)- Everything else in the workspace directory
The DuckDB file is your data. The rest is configuration, skills, and documents. Both matter.
Method 1: Manual Backup#
The simplest backup — copy the workspace directory while DenchClaw is not running.
Step 1: Stop DenchClaw#
If DenchClaw is running, stop it first. Copying an active DuckDB file can produce an inconsistent backup if writes are in progress.
openclaw gateway stopVerify it's stopped:
openclaw gateway statusStep 2: Copy the Workspace#
# Create a timestamped backup
BACKUP_DIR="$HOME/backups/denchclaw/$(date +%Y-%m-%d_%H%M%S)"
mkdir -p "$BACKUP_DIR"
cp -r ~/.openclaw-dench/workspace/ "$BACKUP_DIR/"
echo "Backup complete: $BACKUP_DIR"This creates a full copy at ~/backups/denchclaw/2026-03-26_143022/ (or whatever the current timestamp is).
Step 3: Restart DenchClaw#
openclaw gateway startMethod 2: DuckDB Export (Data Only)#
If you want a portable backup of just your CRM data — contacts, pipeline, all entries — export it from DuckDB directly. This is useful for migrating data between machines or sharing a snapshot with someone else.
Export to Parquet (Recommended)#
Parquet is columnar, compressed, and readable by any DuckDB client, pandas, Arrow, and many other tools:
duckdb ~/.openclaw-dench/workspace/workspace.duckdb << 'EOF'
-- Export all tables to Parquet
EXPORT DATABASE '/tmp/denchclaw-export' (FORMAT PARQUET);
EOFThis creates /tmp/denchclaw-export/ with .parquet files for each table.
Export to CSV (Human-Readable)#
duckdb ~/.openclaw-dench/workspace/workspace.duckdb << 'EOF'
-- Export objects (CRM records)
COPY objects TO '/tmp/objects.csv' (HEADER, DELIMITER ',');
-- Export entries (field values)
COPY entries TO '/tmp/entries.csv' (HEADER, DELIMITER ',');
-- Export entry fields
COPY entry_fields TO '/tmp/entry_fields.csv' (HEADER, DELIMITER ',');
EOFExport Specific Data#
Export just your contacts as a readable CSV:
duckdb ~/.openclaw-dench/workspace/workspace.duckdb << 'EOF'
COPY (
SELECT * FROM v_contacts
) TO '/tmp/contacts_backup.csv' (HEADER, DELIMITER ',');
EOFMethod 3: Automated Backup Script#
Set this up once and it runs every day:
#!/bin/bash
# save as ~/scripts/backup-denchclaw.sh
set -e
WORKSPACE="$HOME/.openclaw-dench/workspace"
BACKUP_BASE="$HOME/backups/denchclaw"
DATE=$(date +%Y-%m-%d)
BACKUP_DIR="$BACKUP_BASE/$DATE"
# Create backup directory
mkdir -p "$BACKUP_DIR"
# Export DuckDB to Parquet (works while running, more reliable than file copy)
duckdb "$WORKSPACE/workspace.duckdb" "EXPORT DATABASE '$BACKUP_DIR/db' (FORMAT PARQUET);"
# Copy docs, skills, apps, and config files
rsync -a --exclude='*.wal' \
"$WORKSPACE/docs/" "$BACKUP_DIR/docs/" 2>/dev/null || true
rsync -a \
"$WORKSPACE/skills/" "$BACKUP_DIR/skills/" 2>/dev/null || true
rsync -a \
"$WORKSPACE/apps/" "$BACKUP_DIR/apps/" 2>/dev/null || true
cp "$WORKSPACE/SOUL.md" "$BACKUP_DIR/" 2>/dev/null || true
cp "$WORKSPACE/USER.md" "$BACKUP_DIR/" 2>/dev/null || true
cp "$WORKSPACE/AGENTS.md" "$BACKUP_DIR/" 2>/dev/null || true
# Keep only 30 days of backups
find "$BACKUP_BASE" -maxdepth 1 -type d -mtime +30 -exec rm -rf {} + 2>/dev/null || true
echo "$(date): Backup complete → $BACKUP_DIR"Make it executable and test it:
chmod +x ~/scripts/backup-denchclaw.sh
~/scripts/backup-denchclaw.shSchedule with cron#
crontab -eAdd this line to run at 2 AM daily:
0 2 * * * /Users/yourname/scripts/backup-denchclaw.sh >> /Users/yourname/logs/denchclaw-backup.log 2>&1
Note: The DuckDB EXPORT approach works while DenchClaw is running, so you don't need to stop the service for automated backups. DuckDB handles concurrent read access safely.
Method 4: Cloud Sync (Dropbox, iCloud, Backblaze)#
If you want offsite backup, the cleanest approach is to point your backup script output to a synced folder.
Dropbox#
BACKUP_BASE="$HOME/Dropbox/backups/denchclaw"iCloud Drive#
BACKUP_BASE="$HOME/Library/Mobile Documents/com~apple~CloudDocs/backups/denchclaw"Backblaze B2 with rclone#
# Install rclone and configure B2 first: rclone config
rclone sync ~/backups/denchclaw b2:your-bucket-name/denchclaw/ --progressAdd the rclone sync command to the end of your backup script.
Restoring From a Backup#
Restore a Full Workspace Backup#
-
Stop DenchClaw:
openclaw gateway stop -
Move the current workspace out of the way (don't delete it until you've verified the restore):
mv ~/.openclaw-dench/workspace ~/.openclaw-dench/workspace.bak -
Copy the backup in:
cp -r ~/backups/denchclaw/2026-03-26_143022/workspace/ ~/.openclaw-dench/workspace/ -
Restart:
openclaw gateway start -
Verify your data looks correct, then delete the
.bakfolder:rm -rf ~/.openclaw-dench/workspace.bak
Restore from DuckDB Parquet Export#
If you used the DuckDB export method and need to restore just the data:
-
Stop DenchClaw.
-
Back up the current database:
cp ~/.openclaw-dench/workspace/workspace.duckdb ~/.openclaw-dench/workspace/workspace.duckdb.bak -
Import the Parquet export:
duckdb ~/.openclaw-dench/workspace/workspace.duckdb << 'EOF' IMPORT DATABASE '/path/to/backup/db'; EOF -
Restart DenchClaw and verify.
Migrating to a New Machine#
Backup + restore is also how you migrate your workspace to a new computer.
- Create a full backup on the old machine using the method above.
- Transfer the backup to the new machine (AirDrop, USB, rsync over SSH).
- Install DenchClaw on the new machine:
npx denchclaw - Stop DenchClaw before it initializes a new workspace.
- Replace the new (empty) workspace with your backup.
- Restart.
# On new machine, after npx denchclaw runs once but before you add data:
openclaw gateway stop
rm -rf ~/.openclaw-dench/workspace
cp -r /path/to/backup/workspace ~/.openclaw-dench/workspace
openclaw gateway startBackup Verification#
A backup you've never tested is unreliable. Once a month, verify your backup actually works:
# Create a test restore in a temp location
TEMP_DIR=$(mktemp -d)
cp -r ~/backups/denchclaw/latest/* "$TEMP_DIR/"
# Verify the DuckDB file is readable
duckdb "$TEMP_DIR/workspace.duckdb" "SELECT count(*) as total_records FROM objects;"
# Clean up
rm -rf "$TEMP_DIR"
echo "Backup verified successfully"If this returns a record count matching your actual workspace, the backup is good.
FAQ#
Do I need to stop DenchClaw to back up?
For file copy (cp), yes — copying an active .wal file can be inconsistent. For DuckDB's EXPORT DATABASE command, no — DuckDB handles concurrent reads safely, so the export-based backup script works while DenchClaw is running.
How large are backups?
A typical solo-founder workspace with a few thousand contacts and a year of notes is 50–200 MB. Parquet exports are smaller than raw .duckdb files because of compression.
What if my workspace.duckdb file is corrupted?
If you have a .wal file present alongside .duckdb, DuckDB may be able to recover by replaying the log. If not, restore from your latest backup. This is why backups matter.
Can I sync my workspace directly instead of backing it up?
Syncing a live DuckDB file via Dropbox or iCloud is not recommended — these sync tools can corrupt database files by syncing mid-write. Use the export-to-Parquet approach for cloud sync, or back up to a synced folder rather than syncing the workspace folder directly.
How do I back up skills I've installed from ClawHub?
Skills are files in ~/.openclaw-dench/workspace/skills/. They're included in a full workspace backup. Alternatively, keep a skills.txt list of installed skill names so you can reinstall with clawhub install on a new machine.
Ready to try DenchClaw? Install in one command: npx denchclaw. Full setup guide →
