Patches and documentation for running dual claude-mem instances alongside a dual Claude Code installation.
This repository provides fixes for running two independent claude-mem instances when using a mirror Claude Code setup (claude + mclaude).
- claude-mem - Memory/observation system plugin for Claude Code by @thedotmack
- Claude Code - Anthropic's CLI tool (docs)
The claude-mem plugin uses bundled JavaScript (esbuild output) with hardcoded paths like ".claude-mem". When running a second Claude Code instance (mclaude) with a separate config directory, the plugin:
- Reads settings from the wrong location (
~/.claude-meminstead of~/.claude-mem-mclaude) - Connects to the wrong worker port (37777 instead of 37778)
- Fails to generate observations for the mclaude instance
The CLAUDE_MEM_DATA_DIR environment variable is set in hooks.json but not read by the bundled scripts.
Patch all bundled scripts to use .claude-mem-mclaude instead of .claude-mem.
./scripts/apply-mclaude-patches.shcd ~/.cc-mirror/mclaude/config/plugins/cache/thedotmack/claude-mem/*/scripts
sed -i '' 's/".claude-mem"/".claude-mem-mclaude"/g' *.js *.cjsMain Claude Instance Mirror Claude Instance (mclaude)
───────────────────── ───────────────────────────────
Config: ~/.claude/ Config: ~/.cc-mirror/mclaude/config/
Data: ~/.claude-mem/ Data: ~/.claude-mem-mclaude/
Port: 37777 Port: 37778
| File | Description |
|---|---|
FIX-DOCUMENTATION.md |
Complete root cause analysis and solution |
architecture.md |
System architecture overview |
scripts/apply-mclaude-patches.sh |
Reusable patch script |
# Check both workers running
lsof -i :37777 -i :37778 | grep LISTEN
# Check observation counts
sqlite3 ~/.claude-mem/claude-mem.db "SELECT COUNT(*) FROM observations;"
sqlite3 ~/.claude-mem-mclaude/claude-mem.db "SELECT COUNT(*) FROM observations;"- Patches must be re-applied after plugin updates
- Consider contributing upstream fix to claude-mem to properly read
CLAUDE_MEM_DATA_DIR
MIT