Skip to content

Interview question · Context Engineering & Caching

Design compaction for a six-hour support session without losing what the customer told you.

If the only copy of what the customer said lives in the transcript, any summary can lose it. The design records facts as they are confirmed, so compaction summarises talk, not the case.

hardNewUpdated Nov 2026

TL;DR: Do not rely on the summary to remember the case. Keep a case file outside the transcript that the harness updates as facts are confirmed (identity, identifiers, what was tried, what was promised, preferences), render it on every turn, and let compaction summarise only the conversation around it. Compact at natural boundaries, check mechanically that nothing in the case file or the open commitments went missing, and replay real sessions to measure what customers had to repeat.

How to approach it

Ask what a six-hour session looks like: one long problem or several, how many tool calls, whether a human may take over. Then state the risk in the customer's terms: the failure that matters is the customer having to repeat themselves, or the agent breaking a promise it made at hour one.

A strong answer

Separate the case from the conversation. Three layers, each owned explicitly:

LayerContentsWritten bySurvives compaction
Run stateCustomer identity, account, entitlements, policy limitsHarness, from auth and systemsNever in the transcript; always rendered
Case fileIdentifiers, symptoms confirmed, steps tried and results, promises made, preferencesModel through a case_note tool, validated by the harnessYes, verbatim
ConversationEverything saidBothSummarised at boundaries

The case file is the important design choice. "Customer already rebooted the router twice" goes in when the customer says it, not when a summary later tries to recall it.

Record promises as data. "I will call back by 5 pm" or "a refund of ₹1,200 is approved pending a photo" become structured commitments with a status. A summary can phrase them however it likes; the commitment list is copied, not summarised.

Compact at boundaries, under a contract. Trigger at a threshold (say 60% of the window) or when an issue is resolved and another begins. The prompt keeps: the current issue and its state, open questions, the customer's tone and stated preferences, and anything said that is not yet in the case file. It may drop: troubleshooting chatter already captured, pleasantries, resolved sub-issues (their outcome is in the case file).

Check it mechanically before it is used.

CASE = {
    "ids": ["ord_004471", "tkt_8810"],
    "tried": ["router rebooted twice", "cable swapped"],
    "promises": [{"id": "p1", "text": "refund 1200 INR after photo",
                  "status": "open"}],
}

def missing_after_compaction(case, summary, rendered_case):
    gaps = [i for i in case["ids"] if i not in rendered_case]
    gaps += [p["id"] for p in case["promises"]
             if p["status"] == "open" and p["id"] not in rendered_case]
    if "photo" not in summary and any("photo" in p["text"] for p in case["promises"]):
        gaps.append("pending photo not mentioned in summary")
    return gaps

rendered = "ids: ord_004471, tkt_8810 | promises: p1 open (refund after photo)"
summary = "Connectivity issue; customer waiting to send the photo for the refund."
print(missing_after_compaction(CASE, summary, rendered))  # => []
bad = missing_after_compaction(CASE, "Connectivity issue.", "ids: ord_004471")
print(bad[:2], len(bad))  # => ['tkt_8810', 'p1'] 3

The checks are dull on purpose. If the rendered case loses an identifier or an open promise, the step fails and the previous context is kept (or a human is paged), instead of quietly continuing without it.

Measure on replays. Take recorded long sessions, compact where production would, and run probes the dropped text alone could answer: "What has the customer already tried?", "What did we promise and by when?" Grade the answers. In production, track how often customers repeat information ("as I said earlier", re-sent order numbers) after a compaction versus before it.

Hand-off. If a human takes over, they get the case file and the last summary, not six hours of transcript. Designing for compaction is designing the hand-off note.

What interviewers probe next

"Why not just keep the whole transcript in a 1M-token window?" Six hours of chat and tool output fills it with noise, quality falls with length, every turn rereads all of it, and it does not fit forever. The case file is better context, not just smaller.

"The model writes a wrong fact into the case file." Writes go through a tool that validates what it can (identifiers exist and belong to this customer) and records the turn it came from, so a person or a later turn can correct it.

"What about the customer's mood?" Keep one short line about tone and preferences in the summary ("frustrated about the second visit, prefers SMS"). It changes how the agent should respond and costs a dozen tokens.

How it's scored

Weak: Summarises the conversation every N turns with a generic prompt.

Hire: Keeps key facts outside the transcript, compacts at thresholds, and tests the summary.

Strong Hire: Separates run state, a validated case file and the conversation; records promises as structured commitments; compacts at boundaries under a contract; fails closed on a mechanical retention check; measures repeat-information rates on replays and in production; and treats the case file as the human hand-off.

Common mistakes

  • Letting the only record of a promise be a sentence in the transcript.
  • Compacting mid-troubleshooting instead of at an issue boundary.
  • No check after compaction, so a lost identifier is discovered by the customer.
  • Summarising identity and entitlements instead of reading them from systems each turn.
You just read a free answer. Every topic opens its first 5 answers to anyone. Sign in and the count per topic goes to 6, and the site remembers where you stopped in each one.Google sign-in · free · no payment details
HOW DID IT GO?
0
READING SIGNED OUT

Signing in raises your free answers from 5 to 6 per topic, adds an applied lesson in every topic and easy practice tests, and the site starts remembering you: mastery per topic, bookmarks, and a next-focus recommendation. Free, no card.

Sign in free
UP NEXT ON YOUR JOURNEY
DISCUSSION · 0

Nobody has commented. Post a correction or another way to answer.