MemOS icon indicating copy to clipboard operation
MemOS copied to clipboard

Bug: migrate/scan hardcodes ~/.openclaw, ignores OPENCLAW_STATE_DIR in multi-profile deployments

Open xxjj1111 opened this issue 8 months ago • 1 comments

Plugin Version

@memtensor/memos-local-openclaw-plugin v1.0.2

Problem

When OpenClaw runs with a non-default profile (e.g. OPENCLAW_STATE_DIR=~/.openclaw-family-doctor), the MemOS Memory Viewer's migrate/scan feature always scans ~/.openclaw (hardcoded), ignoring the actual OPENCLAW_STATE_DIR.

Steps to Reproduce

  1. Start OpenClaw with a non-default profile: OPENCLAW_STATE_DIR=~/.openclaw-family-doctor, viewer port 19002
  2. Open Viewer at http://localhost:19002
  3. Click the Scan / Migrate button
  4. Observe: scan results show memories from ~/.openclaw/memos-local/memos.db (~6000 records) instead of the current profile's DB (~800 records)

Root Cause

In dist/src/viewer/server.js and dist/viewer/server.js:

getOpenClawHome() {
    const home = process.env.HOME || process.env.USERPROFILE || "";
    return path.join(home, ".openclaw"); // hardcoded!
}

Fix

return process.env.OPENCLAW_STATE_DIR || path.join(home, ".openclaw");

Impact

In a dual-bot setup, clicking Scan in the secondary bot Viewer shows the primary bot 6000+ memories. If user clicks Import, memories cross-contaminate between bots.

Environment

  • @memtensor/memos-local-openclaw-plugin v1.0.2
  • OpenClaw v2026.3.13, macOS Darwin 25.3.0 arm64
  • Dual-profile: main bot ~/.openclaw (port 18789), secondary bot ~/.openclaw-family-doctor (port 19001)

xxjj1111 avatar Mar 16 '26 00:03 xxjj1111

PR submitted: #1262

已提交 PR:#1262,修复了 getOpenClawHome() 和 getOpenClawConfigPath() 中硬编码 ~/.openclaw 的问题,现在会优先使用 OPENCLAW_STATE_DIR 环境变量。PR 合并后此 issue 将自动关闭。

hijzy avatar Mar 17 '26 10:03 hijzy