fix(plugin): drop API-key-derived user_id, restore $USER fallback
The deterministic resolver from #5076 silently rebucketed every user who hadn't set MEM0_USER_ID. With MEM0_API_KEY present (the normal case — hooks early-exit without it), the resolver picked "mem0-<sha256(api_key)[:12]>" instead of $USER, so an existing "deshraj" bucket suddenly became "mem0-f34dd1cba657" on update with no migration. The old memories aren't reachable from the plugin anymore, and the user gets a fresh empty bucket without warning. Resolution priority is now back to: 1. MEM0_USER_ID env var 2. \$USER, else "default" The ~/.mem0/identity.json cache is no longer written or read; any existing cache file becomes inert. Users on multiple machines who want a single bucket can still set MEM0_USER_ID explicitly — that's the supported path, not silent derivation. Also dropped the "regardless of which machine you're on" line from the session bootstrap header since it no longer applies.
This commit is contained in:
@@ -36,7 +36,7 @@ echo "## Mem0 Identity"
|
||||
echo ""
|
||||
echo "Active user_id: \`$MEM0_RESOLVED_USER_ID\`"
|
||||
echo ""
|
||||
echo "Always include \`{\"user_id\": \"$MEM0_RESOLVED_USER_ID\"}\` (wrapped in an \`AND\` clause) in every \`search_memories\` filter and as \`user_id\` on every \`add_memory\` call. This keeps memories under one bucket regardless of which machine you're on."
|
||||
echo "Always include \`{\"user_id\": \"$MEM0_RESOLVED_USER_ID\"}\` (wrapped in an \`AND\` clause) in every \`search_memories\` filter and as \`user_id\` on every \`add_memory\` call. This keeps the agent's MCP calls aligned with the bucket the hooks write to."
|
||||
echo ""
|
||||
|
||||
if [ "$SOURCE" = "startup" ]; then
|
||||
|
||||
Reference in New Issue
Block a user