Memory

Session Isolation

Keep one user's session state and memory unreachable from another user's agent.

Problem

A shared memory backend or a shared model context can leak one user's data into another user's response. A misindexed cache key returns user A's history to user B. A prompt-cache prefix that includes user-specific context is reused across users. A vector store query without per-user partitioning surfaces another user's documents as 'relevant'. Any of these is a privacy and security failure that can be much worse than an ordinary bug, because the leak may go unnoticed for a long time and the consequences for user trust and regulatory exposure are severe.

Solution

Session state is keyed by per-user identity (OAuth/JWT subject). Reads and writes carry that identity end-to-end. Caches are scoped per user. Prompts never include another user's content.

When to use

  • Multiple users share an agent backend and cross-user leaks are unacceptable.
  • Session state and caches can be keyed end-to-end by user identity.
  • Auth identity (OAuth, JWT subject) flows through the stack.

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related