Describe the three-tier memory hierarchy used by modern LLM agent systems
Working memory (scratchpad, dies at turn end), short-term memory (session history, dies at session end), and long-term memory (durable facts across sessions, split into episodic and semantic).
Picture how you remember things during a conversation with a friend. While they are asking a question, you hold partial thoughts in your head: that is working memory, and it disappears when you respond. Across the whole conversation you remember what was already said: that is short-term memory, and it fades after the conversation ends. Across years of friendship you remember things they have told you: their job, their dog's name, the time they broke their leg skiing. That is long-term memory, and it survives across visits. Some of those long-term memories are specific events ('the ski accident'), others are settled facts about who they are ('they hate coriander'). LLM agents are built with the same three-layer structure.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 to 4 min: name the three tiers by lifetime, explain the episodic vs semantic split, and walk through how 2026 frameworks specialize in each tier.
Real products, models, and research that use this idea.
- Mem0 (2024-2026) maintains a semantic-memory store with extraction pipelines and update on contradiction policies.
- Letta (formerly MemGPT) exposes memory-management tools so the agent can rewrite its own long-term store inside the prompt.
- Zep maintains a temporal knowledge graph storing episodic facts with timestamps, supporting time-aware retrieval.
- LangGraph exposes typed state that flows through nodes and supports checkpointing for short-term and long-term tiers via different stores.
- ChatGPT's memory feature (rolled out 2024-2025) is a semantic-memory implementation: user-stated preferences and durable facts surface across sessions.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhat is the write policy that decides when something gets promoted from short-term to long-term?
QHow does the agent decide what to retrieve from long-term memory at the start of a new session?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Conflating all 'memory' as one flat store, then being surprised when a fact written during a session is missing from the next session, different tiers have different lifetimes.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.