Covers: - Prerequisites and claude-mem installation (both via Claude Code and manual) - Plugin configuration options - How the integration works (lifecycle hooks) - Troubleshooting common issues
5.3 KiB
| summary | read_when | ||
|---|---|---|---|
| Claude-Mem memory plugin - integrates claude-mem's persistent memory system with Moltbot |
|
Memory (Claude-Mem)
The memory-claudemem plugin integrates claude-mem
with Moltbot, enabling persistent memory across sessions. It syncs a MEMORY.md file to your
workspace and records tool observations to claude-mem's database.
Prerequisites
You must install claude-mem separately before using this plugin. The plugin uses claude-mem's worker service CLI, which is only available after installation.
Installing Claude-Mem
Option 1: Via Claude Code (Recommended)
If you have Claude Code installed, run these commands in a Claude Code session:
/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem
Then restart Claude Code. The plugin files will be installed to:
~/.claude/plugins/cache/thedotmack/claude-mem/<version>/
Option 2: Manual Installation (Without Claude Code)
If you don't use Claude Code or want to install manually:
1. Clone the repository
git clone https://github.com/thedotmack/claude-mem.git
cd claude-mem
2. Install dependencies
# Using bun (recommended)
bun install
# Or using npm
npm install
3. Build the plugin
bun run build
# or
npm run build
4. Create the plugin cache directory
The Moltbot plugin expects claude-mem to be in the Claude plugins cache:
# Create the directory structure
mkdir -p ~/.claude/plugins/cache/thedotmack/claude-mem
# Copy the built plugin (use actual version number)
cp -r plugin ~/.claude/plugins/cache/thedotmack/claude-mem/9.0.12
Alternatively, symlink it:
ln -s $(pwd)/plugin ~/.claude/plugins/cache/thedotmack/claude-mem/9.0.12
5. Start the worker service
Claude-mem runs a background worker service:
# From the claude-mem directory
bun run worker:start
# Or directly
bun plugin/scripts/worker-service.cjs start
Check status:
bun run worker:status
The worker runs on http://localhost:37777 by default and provides:
- Real-time memory stream UI at http://localhost:37777
- API endpoints for memory search and retrieval
- Background observation processing
Enabling the Moltbot Plugin
Once claude-mem is installed, enable the Moltbot plugin:
Via CLI
moltbot plugins enable memory-claudemem
moltbot gateway restart
Via Config
{
plugins: {
slots: {
memory: "memory-claudemem"
}
}
}
Or explicitly in entries:
{
plugins: {
entries: {
"memory-claudemem": {
enabled: true,
config: {
syncMemoryFile: true,
project: "my-project" // optional, defaults to workspace dir name
}
}
}
}
}
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
syncMemoryFile |
boolean | true |
Sync MEMORY.md with claude-mem context on session/gateway start |
project |
string | workspace dir name | Project name for scoping observations |
How It Works
The plugin integrates with Moltbot's lifecycle hooks:
-
Session Start (
before_agent_start)- Syncs
MEMORY.mdfrom claude-mem's context (once per session) - Records the user prompt via
session-inithook
- Syncs
-
Tool Usage (
tool_result_persist)- Records tool observations to claude-mem's database
- Fire-and-forget for performance
-
Session End (
agent_end)- Triggers claude-mem's summarize hook with the last assistant message
- Generates session summaries for future context
-
Gateway Start (
gateway_start)- Syncs
MEMORY.mdwhen Moltbot starts
- Syncs
Troubleshooting
Plugin disabled: worker-service.cjs not found
The plugin couldn't find claude-mem's worker service. Check:
-
Is claude-mem installed?
ls ~/.claude/plugins/cache/thedotmack/claude-mem/ -
Does the version directory contain
scripts/worker-service.cjs?ls ~/.claude/plugins/cache/thedotmack/claude-mem/*/scripts/worker-service.cjs -
If installed manually, ensure you copied/linked the
plugindirectory correctly.
MEMORY.md not updating
-
Check if the worker is running:
curl http://localhost:37777/api/readiness -
Check claude-mem logs:
tail -f ~/.claude-mem/logs/worker-$(date +%Y-%m-%d).log -
Ensure
syncMemoryFile: truein plugin config.
Observations not being recorded
- Verify the worker is running and healthy
- Check that the project name matches between Moltbot workspace and claude-mem
- Look for errors in Moltbot gateway logs
Using with Other Memory Plugins
This is an exclusive slot plugin. Only one memory plugin can be active at a time:
memory-core(default) - Built-in vector search over workspace memory filesmemory-lancedb- LanceDB-backed long-term memorymemory-claudemem- Claude-mem integration (this plugin)
Set plugins.slots.memory = "none" to disable all memory plugins.