Skip to content

How to Migrate OpenClaw State Directory from ~/.moltbot to ~/.openclaw

I just updated OpenClaw and everything disappeared - my configuration, memory, skills, even my custom agents. All gone.

The panic was real.

I opened OpenClaw and was greeted with a fresh installation, as if I’d never used it before. No memory of previous conversations, no custom configurations, nothing. I thought all my work was lost.

But then I checked my home directory and found the culprit: a brand new ~/.openclaw folder sitting right next to my old ~/.moltbot folder.

The directory name changed, and OpenClaw stopped looking in the old location.

The Problem: Silent Breaking Change

OpenClaw renamed its default state directory from ~/.moltbot to ~/.openclaw. While this makes sense for branding consistency, the update doesn’t warn you or offer to migrate your data.

Here’s what happens if you update without migrating first:

What happens after updating
Before update:
~/.moltbot/ # Your data lives here
├── SOUL.md # AI personality config
├── USER.md # User preferences
├── MEMORY.md # Conversation history
├── agents/ # Custom agent definitions
├── skills/ # Your custom skills
└── .env # API keys and secrets
After update:
~/.moltbot/ # Still exists, but ignored
~/.openclaw/ # Fresh, empty directory created
├── SOUL.md # Default config only
├── USER.md # Default preferences
├── MEMORY.md # Empty memory
├── agents/ # Empty folder
├── skills/ # Empty folder
└── .env # Missing your keys

Your data isn’t lost - it’s just orphaned in the old directory.

The Solution: Two Paths to Recovery

Path 1: Before Updating (The Easy Way)

If you haven’t updated yet, migrate the directory first:

migrate-before-update.sh
# Check if old directory exists
ls -la ~/.moltbot
# Rename it to the new name
mv ~/.moltbot ~/.openclaw
# Verify everything moved
ls -la ~/.openclaw
# Now safe to update
npm install -g openclaw@latest

This is the clean approach - one command and you’re done.

Path 2: After Updating (The Recovery)

I already updated, so I needed the recovery path. Here’s what I did:

recover-after-update.sh
# First, verify old data still exists
ls -la ~/.moltbot
# You have three options:
# Option A: Nuclear (remove empty new dir, rename old one)
rm -rf ~/.openclaw
mv ~/.moltbot ~/.openclaw
# Option B: Conservative (backup new, then replace)
mv ~/.openclaw ~/.openclaw-empty-backup
mv ~/.moltbot ~/.openclaw
# Option C: Surgical (merge specific files if you have changes in both)
cp ~/.moltbot/SOUL.md ~/.openclaw/
cp ~/.moltbot/USER.md ~/.openclaw/
cp ~/.moltbot/MEMORY.md ~/.openclaw/
cp -r ~/.moltbot/skills ~/.openclaw/
cp -r ~/.moltbot/agents ~/.openclaw/
cp ~/.moltbot/.env ~/.openclaw/

I went with Option A since I hadn’t customized anything in the new directory yet.

Verification Steps

After migration, verify OpenClaw recognizes your configuration:

verify-migration.sh
# Check critical files exist
ls ~/.openclaw/{SOUL.md,USER.md,MEMORY.md} 2>/dev/null && echo "✓ Files present"
# Verify OpenClaw can read your config
openclaw config show
# Check if you have skills/agents
ls ~/.openclaw/skills/
ls ~/.openclaw/agents/

Alternative: Keep Using the Old Directory

If you prefer not to move files, you can point OpenClaw to the old location with an environment variable:

set-env-variable.sh
# Add to your shell configuration (~/.bashrc or ~/.zshrc)
export OPENCLAW_STATE_DIR=~/.moltbot
# Reload your shell configuration
source ~/.bashrc # or source ~/.zshrc
# Verify the variable is set
echo $OPENCLAW_STATE_DIR

This approach works but requires you to remember the variable in every environment where you run OpenClaw.

Why This Happened

The directory rename from ~/.moltbot to ~/.openclaw aligns the state directory name with the product name. The previous versions would auto-detect the old ~/.moltbot directory if ~/.openclaw didn’t exist.

However, this auto-detection was removed in the latest version, which is what caused the breakage. No migration prompt, no warning, just silent orphaning of user data.

What You Stand to Lose

If you don’t migrate, here’s what goes missing:

File/FolderWhat’s InsideImpact
SOUL.mdAI personality configurationAgent personality resets
USER.mdUser preferencesSettings reset to defaults
MEMORY.mdConversation historyContext and knowledge lost
agents/Custom agent definitionsWorkflows unavailable
skills/Custom skillsAutomation tools missing
.envEnvironment variablesAPI keys and endpoints missing

The memory loss is particularly painful if you’ve built up significant context over time.

Migration Checklist

Before I forget again, here’s the checklist I’ll follow next time:

  • Check if ~/.moltbot directory exists
  • Run mv ~/.moltbot ~/.openclaw BEFORE updating
  • Verify critical files present with ls ~/.openclaw/{SOUL.md,USER.md,MEMORY.md}
  • Test OpenClaw starts with correct configuration
  • Update any scripts that reference the old path

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments