Distinguish working memory from persistent memory in agent design.
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
Working memory is the context window: the system prompt, conversation, tool definitions, and tool results in the current model call. It's fast (no retrieval step), fully attended to, and expensive - paid per token per call - and it dies with the session. Persistent memory is anything that survives: files, databases, vector stores, key-value memory, user profiles. It's cheap to hold and unbounded, but useless until retrieved back into working memory, so the design problem is really the read/write policy between the two.
Full worked answer
Working memory is the context window: the system prompt, conversation, tool definitions, and tool results in the current model call. It's fast (no retrieval step), fully attended to, and expensive - paid per token per call - and it dies with the session. Persistent memory is anything that survives: files, databases, vector stores, key-value memory, user profiles. It's cheap to hold and unbounded, but useless until retrieved back into working memory, so the design problem is really the read/write policy between the two.
Write policy - what's worth persisting:
- Task state: todo lists, decisions, progress notes (enables resumability and survives compaction).
- Learned facts about the environment: "staging DB is read-only", "this user prefers TypeScript" - things that would otherwise be re-discovered at token cost every session.
- Outcomes for episodic reuse: "last time X failed, Y worked" (this is Reflexion's insight applied to production).
Persist distilled conclusions, not transcripts - raw history is bulky, and retrieval surfaces stale contradictions.
Read policy - how it gets back in:
- Always-loaded files (a
CLAUDE.md-style project memory, user profile) for small, high-value context. - On-demand via tools: the agent searches/reads its own notes - increasingly the dominant pattern (e.g., memory tools where the model explicitly reads/writes a memory store).
- Automatic retrieval (vector similarity injecting "relevant memories") - convenient but riskiest: irrelevant or stale memories injected with authority pollute the context.
Hard problems to name: staleness and conflicts (memory says X, world now says not-X - prefer timestamped facts and let fresh observation win), unbounded growth (needs consolidation/pruning passes), and privacy (persisted user data outlives the conversation's implicit consent; scope it and make it inspectable/deletable).
What a good answer covers
- Working memory is the context window
- It's fast (no retrieval step), fully attended to, and expensive - paid per token per call - and it dies…
- Persistent memory is anything that survives: files, databases, vector stores, key-value memory, user profiles
- It's cheap to hold and unbounded, but useless until retrieved back into working memory, so the design…
- Write policy - what's worth persisting
Key terms: Working memory · Persistent memory · Hard problems to name
In the glossary: Compaction
Interviewer follow-ups to expect
Would you implement memory as vector search or as files the agent greps, and why?
How do you prevent one bad "memory" from degrading every future session?
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