Bug
The openclaw-mem0 plugin maps run_id to the OpenClaw sessionKey (e.g. agent:main:telegram:direct:5263871946), which is a durable channel identifier that survives /new and /reset commands. This means:
- Session memories are never isolated per conversation — all auto-captured memories share the same
run_id across session resets
memory_list(scope=session) returns all auto-captured memories ever, not just the current conversation
- Session memory pool grows unbounded (168+ in my case after a few days)
Expected behavior
/new should generate a fresh run_id so that session-scoped memories are isolated to the current conversation, matching Mem0's intended semantics:
| Mem0 field |
Intended scope |
Current OpenClaw mapping |
user_id |
Human identity (persistent) |
cfg.userId or ctx.agentId (inconsistent) |
run_id |
Conversation thread (ephemeral) |
sessionKey (durable channel ID) ❌ |
agent_id |
Agent identity (persistent) |
Not used |
Additional bug found
Auto-capture uses ctx.agentId (e.g. "main") as user_id, but the memory tools (memory_list, memory_search, memory_store) fall back to cfg.userId (e.g. "default"). This causes tools to miss all auto-captured memories entirely. I patched this locally by adding currentAgentUserId fallback to the tools.
Proposed fix
- Generate a new
run_id (UUID or incrementing counter) on /new//reset, pass it to the plugin instead of sessionKey
- Consistently use
user_id for the human identity across auto-capture and tools
- Use
agent_id for the agent name (currently unused)
- (Plugin-side) Fix
currentAgentUserId fallback in tool handlers (I have a working patch)
Environment
- OpenClaw 2026.2.26
- openclaw-mem0 plugin v0.1.2 (OSS mode)
- Qdrant vector store
- Mem0 SDK 2.2.1
/cc @gevertex
Bug
The
openclaw-mem0plugin mapsrun_idto the OpenClawsessionKey(e.g.agent:main:telegram:direct:5263871946), which is a durable channel identifier that survives/newand/resetcommands. This means:run_idacross session resetsmemory_list(scope=session)returns all auto-captured memories ever, not just the current conversationExpected behavior
/newshould generate a freshrun_idso that session-scoped memories are isolated to the current conversation, matching Mem0's intended semantics:user_idcfg.userIdorctx.agentId(inconsistent)run_idsessionKey(durable channel ID) ❌agent_idAdditional bug found
Auto-capture uses
ctx.agentId(e.g."main") asuser_id, but the memory tools (memory_list,memory_search,memory_store) fall back tocfg.userId(e.g."default"). This causes tools to miss all auto-captured memories entirely. I patched this locally by addingcurrentAgentUserIdfallback to the tools.Proposed fix
run_id(UUID or incrementing counter) on/new//reset, pass it to the plugin instead ofsessionKeyuser_idfor the human identity across auto-capture and toolsagent_idfor the agent name (currently unused)currentAgentUserIdfallback in tool handlers (I have a working patch)Environment
/cc @gevertex