~/.openclaw/agents/.../sessions/ (session transcripts, if needed)
Quick Triage (Before Deleting Everything)
Symptom
OpenClaw fails to start or behaves incorrectly, but root cause is unclear.
Verification
which openclawopenclaw --versionopenclaw gateway --helpls -la ~/.openclaw
If binary exists and only state is broken, a state cleanup is usually enough.
If binary is missing/broken, do state cleanup + reinstall binary.
Cleanup Strategy (Recommended Order)
Stop running OpenClaw processes/services.
Backup ~/.openclaw (or at least config/workspace).
Remove stale local state.
Reinstall/repair the openclaw binary.
Run openclaw setup.
Reapply config and verify gateway startup.
1) Stop OpenClaw
Common Commands
# If running manually in terminal, stop with Ctrl+C first# User service example (Linux systemd user service)systemctl --user stop openclaw-gateway || true# Optional: confirm no process remainsps aux | grep openclaw
2) Backup Existing State
mkdir -p ~/openclaw-backupscp -a ~/.openclaw ~/openclaw-backups/openclaw-$(date +%Y%m%d-%H%M%S)
If disk space is a concern, back up only:
~/.openclaw/openclaw.json
~/.openclaw/workspace*
3) Clean Local State (Full Reset)
Destructive Reset (Removes Local OpenClaw State)
rm -rf ~/.openclaw
This removes config, workspaces, sessions, and cached state.
Only run after backup if you need recovery options.
Partial Cleanup (If You Want To Keep Config)
# Keep config, remove volatile runtime/session state only (adjust as needed)rm -rf ~/.openclaw/agents
Use partial cleanup first when you suspect session/transcript corruption.
4) Reinstall / Repair Binary
Verify Binary Path First
which openclaw
If the path points to a package manager install, reinstall using the same tool (npm/homebrew/manual installer used previously).
If unsure, reinstall via your normal team-approved install method.
Optional: Run Built-In Uninstall (If Supported By Your Version)
openclaw uninstall
Some versions/package channels may not provide this subcommand.
If openclaw uninstall is unavailable, uninstall via your package manager/manual install method, then reinstall.
5) Reinitialize OpenClaw
openclaw setup
Reapply Core Config (Example)
openclaw config set gateway.mode localopenclaw config set gateway.auth.token YOUR_TOKENopenclaw config set agent.model YOUR_MODEL
Replace values with your actual environment settings.
If you backed up openclaw.json, you can restore it instead of retyping config.
6) Verify Clean Reinstall
Basic Checks
openclaw --versionopenclaw config get gateway.modeopenclaw gateway --port 18789
Expected result: gateway starts without prior errors and creates a fresh ~/.openclaw tree.
Prefer partial cleanup (~/.openclaw/agents) before full reset when debugging.
Full reset is appropriate when upgrading across major versions or after repeated state corruption.
If reinstalling the binary does not help, capture exact stderr from openclaw gateway and troubleshoot the specific subsystem (config, model provider, permissions, network, extension relay).