AGT-046DocumentedAgent identityData access

Control who can read what an agent remembers

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.

  • EffortMedium
  • Version1.0
  • Reviewed
  • Updated
  • AuthorsTrevonix Innovation

In short#

  • 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.
  • 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.
  • Defend 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#

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.

Three 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.

When to use it#

Use it when

  • Agents keep long-term memory, user profiles or summaries across sessions.
  • Several people, customers or tenants use the same agent.
  • Memories may contain personal, confidential or regulated data.

Avoid it, or add more, when

  • Agents are stateless and keep context only for the current session. Session-level controls and permission-aware retrieval (AGT-018) are enough.

Forces#

  • Personalisation against privacy. The more an agent remembers, the more useful and the more sensitive it becomes.
  • Shared learning against isolation. Teams want agents to share what they learn; people expect their details to stay theirs.
  • Model convenience against enforcement. Letting the model decide what to recall is easy and cannot be trusted for access control.
  • Deletion against investigation. Erasure duties and eDiscovery pull in opposite directions.

Solution#

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.

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
Memory partitions come from verified identity; every read and write is checked, labelled and traceable.

Controls

ControlWhat it prevents
Partition from verified token claims, not request parametersOne person's or tenant's memories returned to another
Policy check on every read and writeAgents reading memories outside their purpose
Explicit membership for shared memoriesTeam knowledge leaking to people outside the team
Provenance on each memory; trusted sources only for durable writesPoisoned memories steering later sessions
No secrets or tokens in memoryCredentials leaking through recall
Labels and retention datesSensitive memories kept forever or shared too widely
Erasure, hold and discovery coveragePrivacy and legal duties missing the memory store

How it works

  1. Inventory memory stores used by agents: framework memory, vector stores, profile stores, platform memory features.
  2. Move memory behind a service that authenticates callers and enforces policy.
  3. Derive partitions from token claims (tenant, person, agent); reject requests whose parameters disagree with the token.
  4. Define shared memories with explicit membership and fine-grained authorisation.
  5. Restrict durable writes: from the person, from trusted systems, or after confirmation; record provenance.
  6. Filter content: strip secrets and tokens; label personal and sensitive data.
  7. Extend governance: retention, legal hold, erasure and discovery; show people what agents remember and let them delete it.
  8. Log reads and writes with agent, person and correlation ID (AGT-025) and alert on unusual access (AGT-044).

Design rules#

  1. Memory is a governed data store with an owner.
  2. Partitions come from verified identity, not from the model or the request.
  3. Every read and write is authorised.
  4. Durable memories have provenance and come from trusted sources.
  5. No secrets in memory.
  6. Retention, erasure and discovery include memory.

Anti-patterns#

Anti-patternWhat goes wrong
One memory table keyed by a user ID the application passesA bug or injection returns another person's memories
Model decides what to remember and recall without policySensitive data stored and resurfaced unpredictably
Agent writes durable memories from any document it readsPlanted instructions steer later sessions
Tokens or passwords saved as memoriesCredentials leak through recall and logs
Memory excluded from retention and erasurePrivacy requests are not met; data kept indefinitely

Trade-offs#

Benefits

  • Personalisation without cross-user leakage.
  • Resistance to memory poisoning, with a way to find and remove bad memories.
  • Memory inside privacy, retention and discovery programmes.
  • People can see and control what agents remember about them.

Costs and risks

  • A memory service or platform feature with identity-aware access control.
  • Provenance and labelling work.
  • Governance processes extended to a new store.
  • Some loss of convenience for durable writes.

Recipes#

How to build this pattern on specific products. Each recipe shows its own maturity and when it was last verified.

Ping Identity recipe

Ping Identity

PingGateway with PingOne Authorize

DocumentedLast verified Nov 2026

Written from vendor documentation and design experience; not yet lab-tested by Trevonix. Validate each step in a non-production tenant first.

Per-request decisions for memory reads and writes.

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 recipe

Okta

Okta Fine-Grained Authorization or Auth0 FGA

DocumentedLast verified Nov 2026

Written from vendor documentation and design experience; not yet lab-tested by Trevonix. Validate each step in a non-production tenant first.

Relationship-based checks for memory partitions and shared memories.

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.

Microsoft Entra recipe

Microsoft Entra

Microsoft 365 Copilot memory controls and Purview retention

DocumentedLast verified Nov 2026

Written from vendor documentation and design experience; not yet lab-tested by Trevonix. Validate each step in a non-production tenant first.

Tenant and user memory controls, retention and eDiscovery; token-derived partitions for custom agents.

Configure

  1. 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.
  2. Configure 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.
  3. For custom agents on Microsoft platforms, build memory behind an API protected by Entra tokens and derive partitions from token claims.

Gotchas

  • Before the Purview update, retention policies and labels did not apply to Copilot memory; turning memory off does not delete existing memories.

Saviynt recipe

Not available

No Saviynt recipe has been published for this pattern yet.

Ask a Trevonix architect about Saviynt

Amazon Bedrock AgentCore Memory fine-grained access control recipe

Amazon Bedrock AgentCore Memory fine-grained access control

DocumentedLast verified Nov 2026

Written from vendor documentation and design experience; not yet lab-tested by Trevonix. Validate each step in a non-production tenant first.

Cedar policies binding memory access to the caller's token claims.

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.

Verification tests#

TestExpected result
Request person B's memories with person A's token and B's ID in the parametersRefused
Agent outside a team reads the team's shared memoriesRefused
External document instructs the agent to remember a ruleNot stored as a durable memory without confirmation
Search memory for secrets and tokensNone found
Erasure request for a personTheir memories removed or anonymised within the policy period
Discovery search for a person or topicMemory records included

Maturity and verification#

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).

Frequently asked questions#

Is this the same as permission-aware retrieval?

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.

Should people be able to see agent memories about them?

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.

Related patterns and references#

Cite this pattern

Trevonix (2026). Control who can read what an agent remembers (AGT-046, version 1.0). Identi Patterns. https://patterns.trevonix.com/patterns/agt-046-control-who-can-read-what-an-agent-remembers

Licensed under CC BY 4.0. Credit Trevonix and link to this page when you reuse it.

Patterns are guidance, provided as is and without warranty. Test in a non-production environment and check current vendor documentation before you rely on them. Read the full disclaimer.