5.1 — Context Window Management
CCAR-F Domain 5 · Task 5.1
What You Need to Know
The context window is everything Claude reads on one request. Managing it is choosing what goes in.
The Progressive Summarisation Trap
Progressive summarisation systematically destroys numerical values, dates, percentages and customer-stated expectations.
Fix: Persistent case facts block — extract transactional facts into a structured block included in every prompt, outside the summarised history. Never summarise this block.
The "Lost in the Middle" Effect
Models process beginning and end of long inputs more reliably. Put a summary of main findings at the start of aggregated input, with detailed results under explicit section headers.
Tool Result Trimming
Trim verbose tool outputs to only relevant fields before they enter conversation history (PostToolUse hook or tool implementation).
Full Conversation History
Claude API is stateless. Each request must include the complete conversation history. The case facts block resolves the tension with context limits.
Upstream Agent Optimisation
Upstream agents should return structured data (facts, citations, relevance scores) rather than verbose reasoning chains.
Prompt Caching
Mark a stable prefix with cache_control. Put constant content first (system, tools, reference docs); volatile content after. Static block belongs in the top-level system parameter.
Key Concept: The persistent case facts block is the single most important pattern: transactional facts in every prompt, never summarised.
Exam Traps
- Thinking progressive summarisation is safe for transactional data
- Assuming "pay attention to everything" fixes lost-in-the-middle
- Keeping full tool results "just in case"
- Selectively truncating conversation history
Check your understanding
Practice Scenario
🔒 This practice scenario is part of Skillmarked Pro
The lessons stay free. Pro unlocks the other 23 CCAR-F practice scenarios and the 60-question timed mock exam, plus everything for every other exam.
Cancel anytime. Or €199 a year, which saves 17%.
Not sure yet? Try 10 free mock exam questions.
Already Pro? Log in.
Sources
- Effective context engineering for AI agents, Anthropic
- Context windows, Claude Platform Docs
- Compaction overview, Claude Platform Docs
- Explore the context window, Claude Code Docs