Migrating Moltbot to a new machine
This guide migrates a Moltbot Gateway from one machine to another without redoing onboarding. The migration is simple conceptually:- Copy the state directory (
$CLAWDBOT_STATE_DIR, default:~/.clawdbot/) — this includes config, auth, sessions, and channel state. - Copy your workspace (
~/clawd/by default) — this includes your agent files (memory, prompts, etc.).
Before you start (what you are migrating)
1) Identify your state directory
Most installs use the default:- State dir:
~/.clawdbot/
--profile <name>(often becomes~/.clawdbot-<profile>/)CLAWDBOT_STATE_DIR=/some/path
CLAWDBOT_STATE_DIR / profile in the output. If you run multiple gateways, repeat for each profile.
2) Identify your workspace
Common defaults:~/clawd/(recommended workspace)- a custom folder you created
MEMORY.md, USER.md, and memory/*.md live.
3) Understand what you will preserve
If you copy both the state dir and workspace, you keep:- Gateway configuration (
moltbot.json) - Auth profiles / API keys / OAuth tokens
- Session history + agent state
- Channel state (e.g. WhatsApp login/session)
- Your workspace files (memory, skills notes, etc.)
- sessions
- credentials
- channel logins
$CLAWDBOT_STATE_DIR.
Migration steps (recommended)
Step 0 — Make a backup (old machine)
On the old machine, stop the gateway first so files aren’t changing mid-copy:~/.clawdbot-main, ~/.clawdbot-work), archive each.
Step 1 — Install Moltbot on the new machine
On the new machine, install the CLI (and Node if needed):- See: Install
~/.clawdbot/ — you will overwrite it in the next step.
Step 2 — Copy the state dir + workspace to the new machine
Copy both:$CLAWDBOT_STATE_DIR(default~/.clawdbot/)- your workspace (default
~/clawd/)
scpthe tarballs and extractrsync -aover SSH- external drive
- Hidden directories were included (e.g.
.clawdbot/) - File ownership is correct for the user running the gateway
Step 3 — Run Doctor (migrations + service repair)
On the new machine:Common footguns (and how to avoid them)
Footgun: profile / state-dir mismatch
If you ran the old gateway with a profile (orCLAWDBOT_STATE_DIR), and the new gateway uses a different one, you’ll see symptoms like:
- config changes not taking effect
- channels missing / logged out
- empty session history
Footgun: copying only moltbot.json
moltbot.json is not enough. Many providers store state under:
$CLAWDBOT_STATE_DIR/credentials/$CLAWDBOT_STATE_DIR/agents/<agentId>/...
$CLAWDBOT_STATE_DIR folder.
Footgun: permissions / ownership
If you copied as root or changed users, the gateway may fail to read credentials/sessions. Fix: ensure the state dir + workspace are owned by the user running the gateway.Footgun: migrating between remote/local modes
- If your UI (WebUI/TUI) points at a remote gateway, the remote host owns the session store + workspace.
- Migrating your laptop won’t move the remote gateway’s state.
Footgun: secrets in backups
$CLAWDBOT_STATE_DIR contains secrets (API keys, OAuth tokens, WhatsApp creds). Treat backups like production secrets:
- store encrypted
- avoid sharing over insecure channels
- rotate keys if you suspect exposure
Verification checklist
On the new machine, confirm:moltbot statusshows the gateway running- Your channels are still connected (e.g. WhatsApp doesn’t require re-pair)
- The dashboard opens and shows existing sessions
- Your workspace files (memory, configs) are present