Problem
ClawX and a locally installed OpenClaw CLI share the same ~/.openclaw configuration directory. When ClawX starts its embedded Gateway, it overwrites:
- Gateway tokens (
openclaw.json → gateway.auth.token)
- AI provider configurations (
models.providers, agents.defaults)
- Channel configs (Telegram, Discord, etc.)
- Auth profiles (
agents/*/agent/auth-profiles.json)
This breaks any standalone OpenClaw CLI setup, and vice versa — a system-wide openclaw gateway can overwrite tokens that ClawX wrote, causing WebSocket handshake failures.
Root Cause
All OpenClaw configuration paths in ClawX are hardcoded to ~/.openclaw:
electron/utils/paths.ts → getOpenClawConfigDir() returns join(homedir(), '.openclaw')
- Multiple files bypass
getOpenClawConfigDir() and use join(homedir(), '.openclaw', ...) directly
- The Gateway process is not passed
OPENCLAW_STATE_DIR, so it defaults to ~/.openclaw
Proposed Solution
- Change
getOpenClawConfigDir() to return ~/.clawx/openclaw (under the existing ClawX-specific ~/.clawx directory)
- Replace all hardcoded
~/.openclaw paths with getOpenClawConfigDir()
- Pass
OPENCLAW_STATE_DIR environment variable to the Gateway and doctor-repair spawn processes so the OpenClaw runtime also uses the isolated path
OpenClaw already supports OPENCLAW_STATE_DIR in src/config/paths.ts → resolveStateDir(), so no upstream changes are needed.
Affected Files
electron/utils/paths.ts
electron/utils/config.ts
electron/utils/openclaw-auth.ts
electron/utils/channel-config.ts
electron/utils/skill-config.ts
electron/utils/openclaw-workspace.ts
electron/utils/whatsapp-login.ts
electron/main/ipc-handlers.ts
electron/gateway/manager.ts
Problem
ClawX and a locally installed OpenClaw CLI share the same
~/.openclawconfiguration directory. When ClawX starts its embedded Gateway, it overwrites:openclaw.json→gateway.auth.token)models.providers,agents.defaults)agents/*/agent/auth-profiles.json)This breaks any standalone OpenClaw CLI setup, and vice versa — a system-wide
openclaw gatewaycan overwrite tokens that ClawX wrote, causing WebSocket handshake failures.Root Cause
All OpenClaw configuration paths in ClawX are hardcoded to
~/.openclaw:electron/utils/paths.ts→getOpenClawConfigDir()returnsjoin(homedir(), '.openclaw')getOpenClawConfigDir()and usejoin(homedir(), '.openclaw', ...)directlyOPENCLAW_STATE_DIR, so it defaults to~/.openclawProposed Solution
getOpenClawConfigDir()to return~/.clawx/openclaw(under the existing ClawX-specific~/.clawxdirectory)~/.openclawpaths withgetOpenClawConfigDir()OPENCLAW_STATE_DIRenvironment variable to the Gateway and doctor-repair spawn processes so the OpenClaw runtime also uses the isolated pathOpenClaw already supports
OPENCLAW_STATE_DIRinsrc/config/paths.ts→resolveStateDir(), so no upstream changes are needed.Affected Files
electron/utils/paths.tselectron/utils/config.tselectron/utils/openclaw-auth.tselectron/utils/channel-config.tselectron/utils/skill-config.tselectron/utils/openclaw-workspace.tselectron/utils/whatsapp-login.tselectron/main/ipc-handlers.tselectron/gateway/manager.ts