Context management interview questions
6 questions across 2 sections, in the order you would learn them. Every answer here is one that works — but an answer you have read is not an answer you can give, so use Test yourself and say it out loud first.
Working inside the window
Read the section that teaches thisIf this comes up in an interview
How do you handle a conversation that outgrows the context window?
Trim what is no longer needed, especially old tool results. Summarise older turns while keeping recent ones verbatim. Offload large content to storage with an id. Order everything from stable to volatile so prompt caching still applies.
What gets lost when you compact a conversation, and why does it matter?
The risk is losing the original task, user corrections, decisions already made and failures already hit. The agent then continues confidently while solving a slightly different problem, which is hard to spot because nothing errors.
Why not just use a model with a larger context window?
Cost scales with every token on every call, latency grows, and recall across a long window is uneven with material in the middle attended to least. A bigger window postpones the problem and makes it more expensive.
Memory across sessions
Read the section that teaches thisIf this comes up in an interview
How would you give an assistant long-term memory?
Memory is three parts, not a model feature: durable storage, a write policy and a retrieval policy. Store stable facts and decisions rather than transcripts, keyed by what they are about so a new value supersedes the old one. Retrieve by scope first, then relevance with a floor, then a hard token budget. And let users see, correct and delete what is stored.
Then they push further
Why key by subject rather than appending a row per turn?
An append-only store grows with conversation length and keeps every superseded version, so retrieval eventually returns several mutually exclusive memories about the same thing and the model has no way to pick. One slot per subject makes superseding automatic, bounds growth at the number of things the user has actually told you, and means staleness has nowhere to accumulate.
What happens when a request matches nothing?
Nothing should be retrieved. A top-k search with no relevance floor always returns k memories however irrelevant, and the model cannot tell that the context it was handed is noise, so it answers as though it were not. The floor is what makes an empty result possible.
What gets marked up. Strong answers separate the write policy from the retrieval policy and say which one a given failure belongs to. Describing memory as something the model does is the usual weak answer.
Why not store the whole conversation history as memory?
It recreates the context problem at larger scale: expensive to include and mostly irrelevant. Distilled facts and decisions are what is worth carrying between sessions.
A user says the assistant is confidently wrong about their project. How do you debug it?
Look at the retrieved set for that request before looking at the model. Usually one of three things: a stale memory that was never superseded, a memory retrieved above the floor that belongs to a different subject, or a fact stored without recording what it was about, which then matches anything on topic. All three are write or retrieval policy bugs, and none of them produces an error, which is why the memory has to be inspectable per user.
These are the questions for one topic. The whole question bank covers every topic on the site.