Bug Description
The Mem0 memory provider writes memories with both user_id and agent_id, but reads them back with only user_id.
That leaves mem0_profile, mem0_search, and prefetch with partial recall on Mem0 Platform. Older un-attributed memories are visible, while memories saved with agent attribution are skipped.
Related but not a duplicate: #25084 covers gateway namespace fragmentation. This report is about the read filter missing agent-attributed rows inside the same user namespace.
Steps to Reproduce
- Configure the Mem0 provider.
- Use Hermes through a gateway session so
initialize(..., user_id=...) receives the platform user id.
- Let Hermes save memories through
sync_turn() or mem0_conclude().
- Call
mem0_profile or mem0_search.
- Compare the current read filter with an OR filter that includes the same user plus the active agent id.
Current read filter:
{"user_id": self._user_id}
Write filter:
{"user_id": self._user_id, "agent_id": self._agent_id}
Expected Behavior
Reads should include both:
- older user-only memories
- memories saved by the same user with agent attribution
Actual Behavior
Reads only return user-only memories. Agent-attributed memories are not included.
In a live Mem0 Platform account, the difference is visible with paginated get_all() calls for the same user:
{"user_id": "503782402"}
count: 153
agent_ids: {None: 153}
{"OR": [{"user_id": "503782402"}, {"user_id": "503782402", "agent_id": "hermie"}]}
count: 3379
agent_ids: {"hermie": 2520, "gideon": 447, "hermes": 259, None: 153}
Environment
- Hermes Agent: current
main
- Mem0 SDK package:
mem0ai 2.0.4
- Memory provider:
mem0
- Platform: Telegram gateway session
Proposed Fix
Change the Mem0 provider read filter to include the existing plain user scope and the active agent-attributed scope:
{
"OR": [
{"user_id": self._user_id},
{"user_id": self._user_id, "agent_id": self._agent_id},
]
}
This keeps compatibility with un-attributed memories and restores recall for memories saved with agent attribution.
Bug Description
The Mem0 memory provider writes memories with both
user_idandagent_id, but reads them back with onlyuser_id.That leaves
mem0_profile,mem0_search, and prefetch with partial recall on Mem0 Platform. Older un-attributed memories are visible, while memories saved with agent attribution are skipped.Related but not a duplicate: #25084 covers gateway namespace fragmentation. This report is about the read filter missing agent-attributed rows inside the same user namespace.
Steps to Reproduce
initialize(..., user_id=...)receives the platform user id.sync_turn()ormem0_conclude().mem0_profileormem0_search.Current read filter:
{"user_id": self._user_id}Write filter:
{"user_id": self._user_id, "agent_id": self._agent_id}Expected Behavior
Reads should include both:
Actual Behavior
Reads only return user-only memories. Agent-attributed memories are not included.
In a live Mem0 Platform account, the difference is visible with paginated
get_all()calls for the same user:Environment
mainmem0ai 2.0.4mem0Proposed Fix
Change the Mem0 provider read filter to include the existing plain user scope and the active agent-attributed scope:
{ "OR": [ {"user_id": self._user_id}, {"user_id": self._user_id, "agent_id": self._agent_id}, ] }This keeps compatibility with un-attributed memories and restores recall for memories saved with agent attribution.