Preparing your design workspace

Loading the problem and your latest saved attempt…

Design Memory for an AI Assistant

Store, retrieve, correct, and expire user-approved memories across assistant sessions without mixing users or reviving stale facts.

Problem statement

Design the memory subsystem for an AI assistant that can use selected facts across requests and sessions.

For this exercise, assume the assistant may propose a memory from a conversation, but only explicit user approval makes it durable across sessions.

For this exercise, assume a user can inspect, correct, delete, or set an expiry on any durable memory, and deleted or expired facts must stop appearing in new context plans.

For this exercise, assume 10 million users, 3,000 memory reads per second, 300 writes per second, and p99 retrieval under 150 ms before model generation. For this exercise, assume shared organizational knowledge, model training, autonomous behavioral profiling, and cross-user memory are out of scope.

What to build

  1. Turn a user-approved candidate fact into a durable scoped memory with provenance, expiry, and a stable identity.
  2. Select a small relevant set of active memories for a request while enforcing user isolation and a fixed context budget.
  3. Let the user inspect, correct, delete, and expire memories, preserving an audit trail without serving superseded values.
  4. Keep asynchronous indexes, caches, retries, and rebuilds from returning deleted, expired, or superseded memories.

At scale

  • For this exercise, assume 10 million users, 3,000 memory reads per second, and 300 writes per second.
  • For this exercise, target p99 memory retrieval under 150 ms before model generation.
  • For this exercise, return at most 20 memories and 4,000 memory tokens in one context plan.
  • For this exercise, a confirmed deletion must stop new retrieval within 10 seconds and remain effective after index rebuilds.