Domain 5 · Lesson 1 · Context & Reliability (15%)

Preserving Context Across Long Interactions

Task Statements 5.1 & 5.4 — case-facts blocks, lost-in-the-middle, and codebase exploration.

Course progress: Domain 5 ▸ lesson 1 of ~3

Four failure modes of long context (5.1)

FailureWhat goes wrong
Progressive summarizationNumbers, %, dates, and customer-stated expectations get condensed into vague prose and lost
Lost-in-the-middleModels reliably use the start and end of long inputs; middle content gets dropped
Tool-output bloatTool results accumulate tokens out of proportion to relevance (40+ fields when 5 matter)
Dropped historyFailing to pass complete conversation history breaks coherence
The fixes (map each to its failure) Extract transactional facts (amounts, dates, order #s, statuses) into a persistent "case-facts" block included in every prompt, outside the summarized history. Trim verbose tool outputs to only relevant fields before they accumulate. Put key summaries first and use explicit section headers to beat position effects. For multi-issue sessions, persist structured issue data into a separate context layer.

Structured data over verbose prose

When downstream agents have limited context budgets, modify upstream agents to return structured data (key facts, citations, relevance scores) instead of verbose content and reasoning chains. Require subagents to include metadata (dates, source locations, methodological context) so downstream synthesis stays accurate.

Large codebase exploration (5.4)

Context degradation tell In extended sessions the model starts giving inconsistent answers and referencing "typical patterns" instead of the specific classes it discovered earlier. That's the signal to intervene.

Check yourself

Over a long support session the agent starts forgetting the exact refund amount and dates the customer stated. The most reliable fix is to:
Correct: option 2. A persistent case-facts block keeps transactional specifics outside lossy summarization. More summarization (1) worsens it; the middle (3) is exactly where content is dropped; a bigger window (4) doesn't stop progressive summarization from vaguing the facts.
In a long codebase session the model begins citing "typical patterns" rather than the specific classes it found earlier. The best countermeasure is to:
Correct: option 3. Scratchpad files persist findings across context boundaries and counteract degradation. Exhortation is unreliable; re-pasting everything bloats context; a bigger window delays but doesn't prevent degradation.
Decision rules Facts getting vague → case-facts block in every prompt. Verbose tool output → trim to relevant fields. Long input → key summary first + headers. Long codebase session degrading → scratchpad + subagent delegation + summarize-between-phases; crash → manifest export/reload; /compact to shrink.
Ask your teacher. Want the case-facts-block layout, or how a manifest is structured for crash recovery? Ask.