mem0 scopes memories by identity: user_id, agent_id, run_id. That answers whose memory it is. It doesn't answer what the memory was derived from. When several teams share one agent's memory, a summary written from restricted records looks like any other memory, and search returns it to anyone who can search that scope.
I ran into this in enterprise BI work: an agent caches an analytical result, a second agent computes a different metric from that cached value, and the new memory carries none of the original access markers — even though it transitively contains information from a column the second requester shouldn't see. We published a mechanism for it (Lineage-Aware Memory Governance, IEEE Access 2026), but the paper is a mechanism, not a mem0 integration. So I built the integration.
What I measured
Synthetic setup, and I want to be clear about that: 420 memories shared by two teams in one mem0 scope, 180 raw records and 240 agent-written summaries, aggregates, and 2- and 3-hop summaries. 240 queries at top_k=10, deterministic embedder, local Qdrant, no LLM. These numbers describe this benchmark only. They are not estimates of leak rates in production.
| Condition | Leaked / returned | Queries with a leak | Recall@10 for entitled users |
|---|---|---|---|
| Plain mem0 | 857 / 2400 (35.7%) | 71.2% | 0.650 |
| Content-only filter | 563 / 2400 (23.5%) | 62.9% | 0.816 |
| amu-mem0 gate | 0 / 2164 (0.0%) | 0.0% | 0.999 |
The row that matters most is the middle one. Filtering by each memory's own labels removes the raw restricted records, but none of what was derived from them: all 563 of the content-only filter's leaks were derived memories. If you only check what a memory is, and never what it came from, the derived copies walk straight through.
The recall column is the surprise in the other direction. The gate doesn't just block leaks — entitled users get better recall (0.999 vs 0.650), because restricted memories no longer take slots in their top 10 that entitled memories would otherwise fill.
The wrapper
amu-mem0 wraps mem0's Memory. You declare sources when you write, and derivation when a memory comes from other memories:
from mem0 import Memory from amu_mem0 import GatedMemory memory = GatedMemory(Memory()) # wrap your existing instance payroll = memory.add( "Q3 payroll total is 4.2M", agent_id="analyst", sources={"hris": ["hr.salary"]}, # raw source -> its labels )["results"][0]["id"] memory.add("Payroll cost grew 8% QoQ", agent_id="analyst", derived_from=[payroll]) memory.search("payroll", filters={"agent_id": "analyst"}, entitlements={"mkt.campaign"}) # {'results': [], 'amu_denied': [{'id': ..., 'reason': 'unentitled', 'unentitled_labels': ['hr.salary']}, ...]} memory.search("payroll", filters={"agent_id": "analyst"}, entitlements={"hr.salary"}) # both memories The rule is from the paper: serve a stored result only if every sensitive label in its derivation is one the requester holds. The closure is computed once at write time, so a summary of a summary of a summary carries every label beneath it. Entitlement changes take effect on the next read, because verdicts are never stored — only labels are.
It fails closed. A memory with no lineage metadata is denied, not treated as public. infer=True is rejected, because mem0's extraction step shows the LLM up to 10 existing memories and the caller can't declare which ones the new facts drew on.
pip install amu-mem0 The honest limits
Three things this doesn't do. First, the coverage sweep: at 90.2% of derivation edges recorded, 11.7% of queries still leak. The gate is only as complete as the lineage it sees, and leakage comes back as soon as coverage drops below 100%. Second, the search latency cost is real: p50 goes from 2.05ms to 3.07ms, p95 from 2.18ms to 12.57ms on this setup, mostly the over-fetch that keeps top_k full after filtering. Third, I haven't run the revocation-after-write test yet — changing a permission after the derived memory is written and confirming the read changes. That's the next experiment.
Where it lives
- Repo: https://github.com/sangaraju1988/amu-mem0
- PyPI: https://pypi.org/project/amu-mem0/
- Issue asking mem0 whether a docs link would be welcome: https://github.com/mem0ai/mem0/issues/7927
- The discussion where this started: https://github.com/mem0ai/mem0/discussions/7390
- The paper: https://doi.org/10.1109/ACCESS.2026.3730363
Disclosure: I'm a co-author of the IEEE paper, and I wrote amu-mem0. If you use mem0 with shared scopes, I'd be glad to hear whether this matches the shape of the problem you've seen — or where the wrapper gets it wrong.


