Design the memory and personalisation layer for an assistant serving millions of users. What do you store, when do you summarise versus retrieve, and how do you evaluate memory quality?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Memory now appears by name in applied-AI job descriptions, often framed as a "context layer" or as context engineering, so treat it as a system design question with four parts.
Full worked answer with diagram
Memory now appears by name in applied-AI job descriptions, often framed as a "context layer" or as context engineering, so treat it as a system design question with four parts.
What to store. Split memory by type. Working memory is the current conversation and lives in the context window. Episodic memory is what happened: past sessions, compacted into structured summaries at session end. Semantic memory is what is durably true about the user: stated preferences, entities, decisions, extracted as small structured facts rather than transcript blobs. Store facts with provenance (which conversation, when) so they can be corrected or expired.
Summarise versus retrieve. Both, at different layers. Summarisation is lossy compression you pay once at write time; retrieval is precise recall you pay at read time. The pattern that scales: aggressively summarise raw transcripts into episodic notes, index both notes and extracted facts for retrieval, and at query time inject a small always-on profile (top durable facts) plus retrieved episodic context relevant to the current query. Injecting everything always is a token-budget and quality failure: irrelevant memory measurably degrades answers.
Privacy boundaries. Memory is user data. Per-user isolation is enforced in the retrieval layer, never left to the model. Users need visibility and deletion, which means deletion must propagate to summaries, extracted facts, and any caches, not just raw logs. Sensitive categories (health, finances) may warrant opt-in rather than silent capture.
Evaluation. Memory quality is measurable: write a golden set of (conversation history, later query, expected recalled fact) triples and score recall precision; track contradiction rate (model asserting stale facts after correction); and A/B the whole layer against no-memory on task success and user retention, because memory that does not move product metrics is cost without benefit.
Worth sketching. Separating the write path from the read path shows where the hard problem sits, which is extraction and expiry, not similarity search.
flowchart LR
A["Session ends"] --> B["Episodic notes:<br/>structured summary"]
A --> C["Semantic facts:<br/>small, with provenance"]
B --> D["Retrieval index"]
C --> D
C --> E["Always-on profile:<br/>top durable facts"]
F["User query"] --> D
D -->|"relevant only, not everything"| G["Working memory:<br/>the context window"]
E --> G
What a good answer covers
- Memory now appears by name in applied-AI job descriptions, often framed as a "context layer" or as…
- Working memory is the current conversation and lives in the context window
- Episodic memory is what happened: past sessions, compacted into structured summaries at session end
- Semantic memory is what is durably true about the user
- Store facts with provenance (which conversation, when) so they can be corrected or expired
Key terms: What to store · Summarise versus retrieve · Privacy boundaries · Evaluation
In the glossary: Context engineering · Golden set
Interviewer follow-ups to expect
How do you handle a user correcting a fact the system extracted wrongly?
When does memory become a prompt-injection surface, and what is the mitigation?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep