Domain 5 — Context Management & Reliability (15%)
Smallest domain by weight, but its concepts appear inside questions from every other domain. Reliability is what separates a demo from a production system, and this exam is about production systems.
5.1 What fills a context window
In Claude Code, a great deal loads before you type: system prompt, auto memory index, environment info, MCP tool listings, CLAUDE.md files and unconditional rules, the skill index. Then your prompt, then every file read, every tool result, every hook's additional context.
The right response to context pressure is not a bigger window. Attention dilutes across long contexts; adding room lets the problem grow. The architectural moves are:
- Delegate to subagents so voluminous intermediate work happens in a separate window and only the conclusion returns.
- Clear stale tool results that no longer inform anything.
- Offload to storage — files, a memory tool — and read back on demand.
- Trim what loads at startup: keep
CLAUDE.mdunder 200 lines, move situational instructions into path-scoped rules or skills that load only when needed.
5.2 Context editing (API side)
context_management={
"edits": [{
"type": "clear_tool_uses_20250919",
"trigger": {"type": "input_tokens", "value": 30000},
"keep": {"type": "tool_uses", "value": 3},
"clear_at_least": {"type": "input_tokens", "value": 5000},
"exclude_tools": ["web_search"],
}]
}
| Parameter | Default | Meaning |
|---|---|---|
trigger | 100,000 input tokens | When clearing activates |
keep | 3 tool uses | Most recent tool use/result pairs preserved |
clear_at_least | none | Minimum cleared per activation — makes the cache invalidation worth paying for |
exclude_tools | none | Tools whose results are never cleared |
clear_tool_inputs | false | Also clear the tool's arguments, not just its result |
Clearing is applied server-side; your client keeps the full history locally. It invalidates cached prefixes at the point of the edit, which is exactly why clear_at_least exists. Pair it with a memory tool so anything important is written down before it is cleared. clear_thinking_20251015 does the same for thinking blocks and must be listed first when combined.
5.3 Compaction in Claude Code
/compact replaces the conversation with a structured summary. What survives is specific, and the exam has asked about it:
Survives / reloads — System prompt, project CLAUDE.md (re-read from disk), auto memory, MCP tools, up to five most recently modified files re-read with their matching rules, and the body of each skill you invoked (capped ~5,000 tokens each).
Practical consequence: if a constraint matters across a long session, it belongs in CLAUDE.md, not in a message you typed an hour ago. Use /clear when starting genuinely new work — it is cheaper and cleaner than compacting a conversation you no longer need.
5.4 Prompt caching
| Breakpoints | Max 4, marked with cache_control |
|---|---|
| Order | tools → system → messages |
| TTL | 5 min default; 1 h at 2× write cost |
| Write cost | 1.25× base (5 min), 2× base (1 h) |
| Read cost | 0.1× base |
| Minimum | Model-dependent (512–4,096 tokens); shorter prefixes are not cached |
Put static content first and mark the last block that stays identical across requests. Changing tool definitions invalidates tools, system and messages; changing tool_choice or adding an image invalidates messages only. Verify with cache_read_input_tokens and cache_creation_input_tokens in the response — and remember that input_tokens counts only what follows your last breakpoint.
5.5 Choosing the right API surface
| Need | Use | Why |
|---|---|---|
| Interactive, user is waiting | Standard Messages API, streaming | Latency is the constraint |
| Long single request (>10 min) | Streaming, or Batches | Avoids connection timeouts (504) |
| Bulk, tolerant of delay | Message Batches API | 50% discount; up to 100,000 requests or 256 MB; most finish within 1 h, hard limit 24 h |
Batch statuses are in_progress → canceling → ended; per-request results are succeeded, errored, canceled, or expired (the last three are not billed). Results can return in any order — match on custom_id. Streaming is not supported inside a batch.
The cost trap — "Route all workloads through the Batches API to cut costs 50%" is a canonical wrong answer. Batch processing is asynchronous; applying it to a latency-sensitive path trades a working product for a discount.
5.6 Errors and retry policy
| Code | Type | Retry? |
|---|---|---|
| 400 | invalid_request_error | No — fix the request |
| 401 / 403 | authentication_error / permission_error | No |
| 404 | not_found_error | No |
| 413 | request_too_large | No — split the payload (32 MB Messages, 256 MB Batch, 500 MB Files) |
| 429 | rate_limit_error | Yes — honour retry-after |
| 500 | api_error | Yes — exponential backoff |
| 504 | timeout_error | Yes, but prefer streaming or Batches |
| 529 | overloaded_error | Yes — backoff |
Every response carries a request_id; log it. SDKs retry transient failures twice by default with exponential backoff. Catch typed exceptions rather than string-matching error messages — a habit the exam rewards in its own way, since the deterministic-signal principle applies here too.
5.7 Session continuity
For multi-day work, sessions are resumed by ID (--resume <session-id>, or resume: in the SDK), and subagents can be resumed by agentId within a resumed session. The durable record of decisions, though, is CLAUDE.md and committed artefacts — a plan file, an issue, a design doc. Relying on a conversation transcript as the system of record is fragile; compaction and session boundaries will eventually eat it.
← Previous: Domain 4 — Prompt Engineering & Structured Output | Next: The 14 anti-patterns →
Explore Other Certification Study Guides
Switch to another exam guide to prepare for your next Claude certification:
Claude Certified Associate — Foundations
Entry-level certification for non-coders: prompting, output evaluation, model selection, workflow integration, configuration, governance & responsible use.
Claude Certified Architect — Professional
Advanced enterprise architecture: solution design, system integration, evaluation frameworks, governance, safety & developer enablement.
Claude Certified Developer — Foundations
Build software on Claude: API integration, model selection, tools & MCP servers, agents vs workflows, security, safety & debugging.