{"id":"AGT-046","title":"Control who can read what an agent remembers","maturity":"documented","collection":"Agent identity","category":"Data access","complexity":"Medium","intent":"Treat an agent's memory as data with an owner and access rules: partition it by person, tenant and agent, check access on every read and write using the caller's identity, keep sensitive data out or labelled, guard against poisoned memories, and honour retention and deletion duties.","summary":"Agents now remember across sessions: preferences, facts, summaries of past work. Without access rules, one person's memories surface for another, a poisoned memory steers later sessions, and deletion requests miss it. Partition memory by identity, check access on each read and write, label it, and govern retention.","problems":["Data leakage between users and tenants","Memory poisoning","Privacy and erasure requests","Retention and eDiscovery","Cross-agent data sharing"],"standards":["OWASP Top 10 for Agentic Applications 2026 (ASI06 Memory and Context Poisoning)","GDPR Articles 5 and 17 (storage limitation, erasure)","ISO/IEC 27701","NIST AI RMF"],"tags":["agent memory","long-term memory","context","personalization","namespaces","tenant isolation","memory poisoning","retention","right to erasure","eDiscovery","fine-grained authorisation","ReBAC","FGA","labels"],"roles":["IAM architect","Identity engineer","Security leader","Platform engineering","AI engineering"],"industries":["Cross-industry","Financial services","Healthcare","Retail","Public sector"],"builds_on":["AGT-003","AGT-018"],"related":["AGT-025","AGT-032","AGT-044"],"authors":"Trevonix Innovation","reviewers":"Trevonix IAM architecture","version":"1.0","last_reviewed":"2026-11-25","published":"2026-11-25","og_image":"og-agt-046.png","sections":{"summary":[{"type":"bullets","content":"**Partition memory by identity:** person, tenant, agent and purpose, with the partition derived from the **caller's verified token**, never from what the agent or model says.\n**Check access on every read and write** at the memory service, keep secrets and tokens out of memory, and **label** memories that hold personal or sensitive data.\nDefend against **memory poisoning** (only trusted sources write durable memories; memories carry provenance), and govern **retention, deletion and discovery** like any other personal data store."}],"problem":[{"type":"paragraph","content":"Agents increasingly keep memory across sessions: a customer's preferences, facts learned about a project, summaries of earlier conversations, notes the agent writes for itself. Memory makes agents far more useful, and it creates a new data store that most identity and data governance programmes have not looked at.\n\nThree things go wrong. Access: memory stored by the agent's backend under one service identity can be read for any user if the application passes the wrong key, so one customer's details appear in another's session, or one tenant's facts in another's. Integrity: a malicious document or message can plant a \"memory\" (for example, that invoices from a certain supplier are always pre-approved), which steers every later session; OWASP lists memory and context poisoning as an agentic top-ten risk. Lifecycle: memories are personal data, but retention policies, legal holds and erasure requests often do not reach them."}],"use_when":[{"type":"bullets","content":"Agents keep long-term memory, user profiles or summaries across sessions.\nSeveral people, customers or tenants use the same agent.\nMemories may contain personal, confidential or regulated data."}],"avoid_when":[{"type":"bullets","content":"Agents are stateless and keep context only for the current session. Session-level controls and permission-aware retrieval (AGT-018) are enough."}],"forces":[{"type":"bullets","content":"**Personalisation against privacy.** The more an agent remembers, the more useful and the more sensitive it becomes.\n**Shared learning against isolation.** Teams want agents to share what they learn; people expect their details to stay theirs.\n**Model convenience against enforcement.** Letting the model decide what to recall is easy and cannot be trusted for access control.\n**Deletion against investigation.** Erasure duties and eDiscovery pull in opposite directions."}],"solution":[{"type":"paragraph","content":"Run memory as a service with its own access control, not as a file or table the agent reads freely. The memory service authenticates the caller (the agent with the person's delegated token, or the agent alone), derives the partition from verified token claims (person, tenant, agent) and allows only the operations policy permits. Shared memories (team knowledge) are separate partitions with explicit membership, checked with fine-grained authorisation. Durable memories are written only from trusted inputs or with confirmation, and each carries provenance (who or what caused it, from which source, when) so suspicious memories can be found and removed. Secrets and tokens never enter memory; personal and sensitive memories are labelled. Retention, legal hold, erasure and discovery cover the memory store, and people can see and delete what agents remember about them."},{"type":"image","content":"Memory partitions come from verified identity; every read and write is checked, labelled and traceable.","title":"Solution overview","media":"agt-046-solution.png","alt":"Diagram. Left: an agent serving two customers, each with a delegated token. Centre: a memory service that derives the partition from token claims (tenant, person, agent) and checks each read and write with a policy; a shared team-knowledge partition requires explicit membership checked by fine-grain"},{"type":"table","content":"Control | What it prevents\nPartition from verified token claims, not request parameters | One person's or tenant's memories returned to another\nPolicy check on every read and write | Agents reading memories outside their purpose\nExplicit membership for shared memories | Team knowledge leaking to people outside the team\nProvenance on each memory; trusted sources only for durable writes | Poisoned memories steering later sessions\nNo secrets or tokens in memory | Credentials leaking through recall\nLabels and retention dates | Sensitive memories kept forever or shared too widely\nErasure, hold and discovery coverage | Privacy and legal duties missing the memory store","title":"Controls"},{"type":"numbered","content":"**Inventory memory stores** used by agents: framework memory, vector stores, profile stores, platform memory features.\n**Move memory behind a service** that authenticates callers and enforces policy.\n**Derive partitions from token claims** (tenant, person, agent); reject requests whose parameters disagree with the token.\n**Define shared memories** with explicit membership and fine-grained authorisation.\n**Restrict durable writes:** from the person, from trusted systems, or after confirmation; record provenance.\n**Filter content:** strip secrets and tokens; label personal and sensitive data.\n**Extend governance:** retention, legal hold, erasure and discovery; show people what agents remember and let them delete it.\n**Log reads and writes** with agent, person and correlation ID (AGT-025) and alert on unusual access (AGT-044).","title":"How it works"},{"type":"tip","content":"Ask each agent team one question: 'If customer A asks the agent what it remembers, can it ever show something from customer B?' If the answer depends on application code passing the right key, move the check into the memory service.","title":"One question that finds most problems"}],"design_rules":[{"type":"numbered","content":"**Memory is a governed data store with an owner.**\n**Partitions come from verified identity, not from the model or the request.**\n**Every read and write is authorised.**\n**Durable memories have provenance and come from trusted sources.**\n**No secrets in memory.**\n**Retention, erasure and discovery include memory.**"}],"anti_patterns":[{"type":"table","content":"Anti-pattern | What goes wrong\nOne memory table keyed by a user ID the application passes | A bug or injection returns another person's memories\nModel decides what to remember and recall without policy | Sensitive data stored and resurfaced unpredictably\nAgent writes durable memories from any document it reads | Planted instructions steer later sessions\nTokens or passwords saved as memories | Credentials leak through recall and logs\nMemory excluded from retention and erasure | Privacy requests are not met; data kept indefinitely"}],"benefits":[{"type":"bullets","content":"Personalisation without cross-user leakage.\nResistance to memory poisoning, with a way to find and remove bad memories.\nMemory inside privacy, retention and discovery programmes.\nPeople can see and control what agents remember about them."}],"costs":[{"type":"bullets","content":"A memory service or platform feature with identity-aware access control.\nProvenance and labelling work.\nGovernance processes extended to a new store.\nSome loss of convenience for durable writes."}],"tests":[{"type":"table","content":"Test | Expected result\nRequest person B's memories with person A's token and B's ID in the parameters | Refused\nAgent outside a team reads the team's shared memories | Refused\nExternal document instructs the agent to remember a rule | Not stored as a durable memory without confirmation\nSearch memory for secrets and tokens | None found\nErasure request for a person | Their memories removed or anonymised within the policy period\nDiscovery search for a person or topic | Memory records included"}],"maturity_notes":[{"type":"paragraph","content":"**Documented.** Written from OWASP's agentic risk list and vendor documentation. Platform memory features gained identity-based access control and retention support during 2026 (for example per-user memory isolation in some agent platforms, and retention for assistant memory in compliance tools)."}],"faq":[{"type":"faq","content":"Partly. Retrieval controls protect source documents. Memory is different: the agent creates it, it may combine facts from several sources and people, and it persists. It needs its own partitions, write rules and lifecycle.","title":"Is this the same as permission-aware retrieval?"},{"type":"faq","content":"Yes, show people what agents remember about them and let them delete it, subject to legal holds. It builds trust and is often required for personal data anyway.","title":"Should people be able to see agent memories about them?"}],"references":[{"type":"bullets","content":"[OWASP: Top 10 for Agentic Applications 2026](https://genai.owasp.org/2025/12/09/owasp-top-10-for-agentic-applications-the-benchmark-for-agentic-security-in-the-age-of-autonomous-ai/)\n[AWS: Amazon Bedrock AgentCore Memory fine-grained access control](https://aws.amazon.com/about-aws/whats-new/2026/08/agentcorememory-fine-grained-access-control)\n[AWS: Fine-grained access control for Memory (Cedar policy examples)](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/memory-gateway-fgac.html)\n[Microsoft Learn: Microsoft 365 Copilot memory and personalization](https://learn.microsoft.com/en-us/microsoft-365/copilot/copilot-personalization-memory)\n[Microsoft 365 message center: Purview retention for Copilot memory (MC1478965)](https://mc.merill.net/message/MC1478965)"}]},"recipes":{"ping":{"status":"documented","product_name":"PingGateway with PingOne Authorize","summary":"Per-request decisions for memory reads and writes.","last_verified":"2026-11","blocks":[{"type":"paragraph","content":"Protect the memory service as an API with PingGateway, use PingOne Authorize or PingAuthorize for per-request decisions on partition, label and purpose, and log decisions with the agent ID."}]},"okta":{"status":"documented","product_name":"Okta Fine-Grained Authorization or Auth0 FGA","summary":"Relationship-based checks for memory partitions and shared memories.","last_verified":"2026-11","blocks":[{"type":"paragraph","content":"Use Okta Fine-Grained Authorization (or Auth0 FGA) to model memory partitions and shared memories as relationships (person owns memory; team members can read team memory) and check every read and write. Pass the person's delegated token to the memory service so it can verify who is asking."}]},"entra":{"status":"documented","product_name":"Microsoft 365 Copilot memory controls and Purview retention","summary":"Tenant and user memory controls, retention and eDiscovery; token-derived partitions for custom agents.","last_verified":"2026-11","blocks":[{"type":"numbered","content":"For Microsoft 365 Copilot, decide whether memory is allowed: admins can turn off **Enhanced personalization** for the tenant or for specific users, which stops custom instructions, saved memories and chat history personalisation.\nConfigure Microsoft Purview retention for Copilot memory (rolled out from late September 2026), which keeps inactive memory versions for investigation, and use eDiscovery to search memory items.\nFor custom agents on Microsoft platforms, build memory behind an API protected by Entra tokens and derive partitions from token claims.","title":"Configure"},{"type":"bullets","content":"Before the Purview update, retention policies and labels did not apply to Copilot memory; turning memory off does not delete existing memories.","title":"Gotchas"}]},"saviynt":{"status":"not-available","product_name":"Saviynt","summary":"No memory access controls documented.","last_verified":"","blocks":[]},"misc":{"status":"documented","product_name":"Amazon Bedrock AgentCore Memory fine-grained access control","summary":"Cedar policies binding memory access to the caller's token claims.","last_verified":"2026-11","blocks":[{"type":"paragraph","content":"Amazon Bedrock AgentCore Memory supports fine-grained access control through AgentCore Gateway (August 2026): Cedar policies can require that the request's actor ID equals the JWT subject and restrict retrieval to namespaces derived from token claims. Open-source agent frameworks usually leave memory access control to the application; wrap their stores in a service that enforces it."}]}},"slug":"agt-046-control-who-can-read-what-an-agent-remembers","updated_at":"2026-12-02T09:48:49.231Z","url":"https://patterns.trevonix.com/patterns/agt-046-control-who-can-read-what-an-agent-remembers","markdown_url":"https://patterns.trevonix.com/patterns/agt-046-control-who-can-read-what-an-agent-remembers.md","publisher":"Trevonix","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"}}