# OpenClaw Backup Guide: Save Config, State & Workspace

Learn how to back up OpenClaw state, config, credentials, sessions, and workspace files before updates, server moves, or data loss.

## Why Backups Matter

Your OpenClaw agent is a system built over time - personality, memory, credentials, workflows, and custom skills. Backups protect all of it before updates, migrations, config changes, hardware failures, and accidental deletions.

## What Is an OpenClaw Backup?

An OpenClaw backup is a compressed archive (.tar.gz) that saves your agent's important data. OpenClaw includes a built-in CLI command: `openclaw backup create`.

## What You Should Back Up

| Data | What It Is | Where It Lives |
|------|-----------|---------------|
| OpenClaw state | Internal runtime state | ~/.openclaw/ |
| Config files | Gateway settings, model config | ~/.openclaw/openclaw.json |
| Auth profiles | Authentication and access control | ~/.openclaw/ |
| Channel credentials | Telegram, Discord, WhatsApp tokens | ~/.openclaw/openclaw.json |
| Provider credentials | API keys (OpenAI, Anthropic, etc.) | ~/.openclaw/openclaw.json |
| Sessions | Conversation history | ~/.openclaw/ |
| Workspace files | SOUL.md, AGENTS.md, USER.md, MEMORY.md | ~/.openclaw/workspace/ |
| Agent memory | Daily notes and long-term memory | ~/.openclaw/workspace/memory/ |
| Custom skills | Skills you built or installed | ~/.openclaw/skills/ |
| Cron settings | Scheduled jobs | ~/.openclaw/cron/ |

The workspace is the agent's home and should be treated as private memory.

## OpenClaw Backup Commands

```bash
# Full backup
openclaw backup create

# Backup to custom folder
openclaw backup create --output ~/Backups

# Dry run (preview without creating)
openclaw backup create --dry-run --json

# Create and verify
openclaw backup create --verify

# Skip workspace files
openclaw backup create --no-include-workspace

# Config only
openclaw backup create --only-config

# Verify an existing backup
openclaw backup verify ./backup-file.tar.gz
```

## When to Create a Backup

- Before updating OpenClaw
- Before changing model providers
- Before editing credentials
- Before moving to a new server
- Before changing workspace folders
- Before adding major new workflows
- Before running risky automation
- Before cleaning old files

## Where to Store Backups

Use more than one location. A backup on the same server is not a backup.

**Good:** Local machine (different disk), external drive, private cloud storage, another server, encrypted folder.
**Bad:** Same server same disk only, public GitHub (API keys!), nowhere.

## Verify Your Backup

```bash
openclaw backup verify ./backup-file.tar.gz
```

Check: file exists, size is reasonable, archive not corrupted, workspace included if needed.

## Safety Tips

- Encrypt backups containing credentials
- Never expose API keys or bot tokens
- Do not commit backups to GitHub
- Keep 3-5 recent versions for rollback
- Test restore on a clean machine
- Store at least one backup outside the server

## Manual Backup vs Managed Hosting

| Factor | Manual | Managed (Ampere.sh) |
|--------|--------|-------------------|
| Backup process | You run commands | Automatic |
| Storage | You manage | Included |
| Restore | You extract | One-click |
| Cost | Free (your time) | $39/mo |
| Control | Full | Less infra control |

## FAQ

**What does OpenClaw backup include?**
State, config, auth, credentials, sessions, and optionally workspace files.

**Should I back up before updating?**
Yes, always. Run `openclaw backup create --verify` first.

**Are backups encrypted?**
Not by default. Encrypt manually before storing externally.

**Can I migrate with a backup?**
Yes. Backup on old server, install on new, extract, start.

---

Skip backup headaches: https://www.ampere.sh/setup
