Skip to content

ClawX shares ~/.openclaw config with system-wide OpenClaw installation #280

Description

@stone-jin

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

  1. Change getOpenClawConfigDir() to return ~/.clawx/openclaw (under the existing ClawX-specific ~/.clawx directory)
  2. Replace all hardcoded ~/.openclaw paths with getOpenClawConfigDir()
  3. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions