Claude Context Management: Case Facts, Lost-in-the-Middle and /compact
Long conversations and long explorations degrade in predictable ways. The exam tests the patterns that keep critical information intact (Task Statements 5.1 and 5.4).
⚙️ Progressive summarisation loses precision
Rolling summaries turn “a £184.20 refund on order #A-7710 by Thursday” into “a refund is pending”. Keep a persistent case-facts block — amounts, order IDs, dates, statuses, promises and customer-stated constraints — and include it in every prompt, outside the summarised history.
<case_facts>
customer_id: C-1042 (verified)
order: #A-7710 · refund £184.20 approved · promised by Thu 14 Nov
constraint: technician visits after 17:00 only
</case_facts>
🛠️ Trim tool output before it piles up
An order lookup may return 40+ fields when only 5 matter. Trim results to the relevant fields (for example in a PostToolUse hook) before they accumulate in context. Upstream agents should return structured key facts, citations and relevance scores — not long reasoning chains — when downstream context budgets are tight.
🎯 Lost in the middle
Models reliably use information at the beginning and end of long inputs but may miss findings in the middle. Put a key-findings summary first and organise details under explicit section headers. And always send the complete conversation history — the API is stateless.
🗂️ Long codebase explorations
- Symptoms of degradation: inconsistent answers, and talk of “typical patterns” instead of the specific classes found earlier.
- Scratchpad files record key findings for later questions.
- Subagents investigate focused questions (“find all test files”) while the main agent keeps the big picture.
- Phase summaries are injected before the next phase begins.
/compactreduces context use when verbose discovery output fills it.- Crash-recovery manifests: each agent exports its state to a known location; on resume the coordinator loads the manifest and injects that state into agent prompts.
🧪 Exam-Style Practice Questions
Try these before opening the answers. They use the same scenario style as the real exam.
Question 1. Aggregated subagent results put the key findings in the middle of a 60-page input, and the synthesis misses them. What helps?
- A. Remove the headers
- B. Increase the temperature
- C. Shuffle the order
- D. Put a key-findings summary at the beginning and organise the details under clear section headers
Show answer
Answer: D. It mitigates the "lost in the middle" effect. C, A and B don't address position effects.
Question 2. A long exploration fills context with noisy grep output. Which built-in command reduces context usage?
- A. `/mcp`
- B. `/init`
- C. `/compact`
- D. `/memory`
Show answer
Answer: C. D inspects memory files. B bootstraps CLAUDE.md. A manages MCP servers.
Question 3. A downstream agent has a small context budget. What should upstream agents return?
- A. Structured key facts, citations and relevance scores
- B. Raw HTML
- C. Nothing until asked
- D. Full reasoning chains
Show answer
Answer: A. It's compact and preserves what synthesis needs. D and B bloat context. C adds round trips.
📝 Assignment
Do these tasks in order. Each one has a Done when check, so you know when it is complete. The stretch task is optional but close to what the exam expects from an architect. Keep your answers in one notes file or Git repository, and revisit them in your final week of revision together with the cheat sheet in the last lesson of this course.
- Task 1: Design a case-facts block for a support conversation with order ID, amount, deadline and one customer constraint.
✅ Done when: Your block keeps exact amounts, IDs, dates and the customer constraint, and fits in under 80 words. - Task 2: Trim a 40-field API response down to the five fields a refund decision needs.
✅ Done when: Your trimmed response keeps only the five fields the refund decision needs, with names unchanged. - Stretch: run a long Claude Code exploration with a scratchpad file and use /compact when context fills.
✅ Done when: Claude still names the specific classes it found earlier after /compact, using your scratchpad file.
❓ Frequently Asked Questions
🤔 Why do summaries lose important details?
Progressive summarisation compresses exact numbers, dates and promises into vague phrases.
🤔 What is the lost-in-the-middle effect?
Models use the start and end of long inputs more reliably than the middle, so put key findings first.
🤔 What does /compact do?
It reduces context use in Claude Code when verbose output has filled the conversation.
🤔 How do multi-agent systems recover from a crash?
Each agent exports its state to a known location, and the coordinator reloads a manifest on resume.
🏁 Summary
- Case facts live outside the summary, in every prompt.
- Trim tool output; summarise key findings first.
- Scratchpads, subagents, /compact and manifests keep long work accurate.
Next, continue with Escalation Rules and Error Propagation in Claude Agents.
Independent study material by SQA Tools. Not affiliated with, endorsed by or sponsored by Anthropic. Claude is a trademark of Anthropic. Mock questions are original practice items, not real exam content. Exam facts checked against Anthropic's official exam guides and certification FAQ on 11 November 2026.