🎓 Claude Certification Prep

Home › CCAR-F › M05

Context Management & Reliability

Domain 5 15% of exam 48 practice questions ~17 min read

Preserving critical facts across long sessions, escalating at the right time, structured error propagation, exploring large codebases without filling the context, calibrating human review, and preserving information provenance.

Skills measured in this domain:
  • 5.1 Manage conversation context to preserve critical information across long interactions
  • 5.2 Design effective escalation and ambiguity resolution patterns
  • 5.3 Implement error propagation strategies across multi-agent systems
  • 5.4 Manage context effectively in large codebase exploration
  • 5.5 Design human review workflows and confidence calibration
  • 5.6 Preserve information provenance and handle uncertainty in multi-source synthesis

Domain overview

Domain 5 makes up 15% of the exam (about 9 of 60 questions) and is a primary domain in 4 of the 6 scenarios: Customer Support (1), Code Generation with Claude Code (2), Multi-Agent Research (3), and Structured Data Extraction (6). You are almost certain to see this domain.

The common thread: reliability must be designed with structured data, thresholds, and explicit workflows, not by telling the model to "be more careful". The correct answer usually keeps information structured (case facts, claim-source mappings, structured errors, manifests) rather than as prose summaries, and is a step proportionate to the root cause rather than adding infrastructure before it is needed.

Task Focus Scenarios
5.1 Preserving transactional facts, trimming tool output, countering "lost in the middle" 1, 3
5.2 Escalate, ask for clarification, or resolve autonomously 1
5.3 Structured error context between subagents and the coordinator 3
5.4 Exploring large codebases: subagents, scratchpads, manifests 2, 4
5.5 Field-level confidence, threshold calibration, sampling 6
5.6 Claim-source mappings, conflicting sources, data dates 3

Preserving critical information across long interactions (5.1)

Three ways information gets lost

  1. Progressive summarization: each time the history is condensed, numbers, percentages, dates, and customer-stated expectations tend to turn into vague sentences. "Customer wants a $89.90 refund for order #8812, no exchange" gets condensed into "customer has an issue with an order".
  2. Lost in the middle: the model processes the beginning and end of long inputs well but may omit findings from the middle.
  3. Accumulating tool results: lookup_order returns 40+ fields when only about 5 are relevant; a few turns later, the context is full of unneeded data.

In addition, the Messages API is stateless: every request must resend the entire conversation.

Matching techniques

  • Case facts block: extract transactional facts (amounts, dates, order numbers, statuses) into a fixed block that is included in every prompt, outside the summarized history. In multi-issue sessions, store each issue as a separate record.
  • Trim tool output before it accumulates: keep only the relevant fields, either inside the MCP tool itself or with a PostToolUse hook (Task 1.5), which runs before the model reads the result.
  • Counter position effects: put a summary of key findings at the beginning of aggregated input, and organize the details under clear section headers.
  • Upstream returns structured data: when downstream agents have a limited context budget, have upstream agents return key facts, citations, and relevance scores with metadata (dates, source locations, methodology) instead of prose and reasoning chains.
<case_facts>
customer_id: C-48213 (verified via get_customer)
issue_1: order #8812 | product A broken, photo provided | customer wants: REFUND $89.90, no exchange
issue_2: order #8812 | shipping fee charged twice ($12.50) | status: under investigation
</case_facts>

Exam trap

"Switch to a model with a larger context window" or "summarize the history more often" sound reasonable but are wrong. A larger context doesn't fix attention quality in the middle of the input; more summarization is exactly the mechanism that drops the numbers.

Compaction: convenient but lossy

When the context is nearly full, Claude Code compacts automatically: it summarizes, drops unneeded tool results, and may lose details. The Agent SDK also has compaction, but Anthropic's article on long-running agents notes that compaction is not sufficient because it doesn't always pass clear instructions to the next session. They add a progress file (claude-progress.txt), the git log, and a JSON feature list.

Command / mechanism Use when Notes
/compact <instructions> Same feature, context nearly full Instructions steer the summary, e.g. /compact Focus on the --version flag implementation
/clear Starting new work Clears everything; put long-lived facts in CLAUDE.md
/context Seeing what is taking up context Check before compacting or clearing
Progress file + git log Agent runs across multiple context windows The new session reads progress before starting

The sample compaction prompt in the Claude Cookbooks always keeps exact identifiers (IDs, paths, URLs), errors verbatim, user corrections verbatim, and the state of work in progress; it drops pleasantries. When something must be cut, the priority for keeping is: user corrections > errors > active work > completed work.

Key point

Keep: numbers, dates, IDs, customer expectations, user corrections, errors encountered, work in progress. Drop: irrelevant tool fields, pleasantries, details of the exploration path once the results are recorded.

(Sources: CCAR-F Exam Guide, Task 5.1; Anthropic Academy: Claude Code 101; Anthropic Academy: Claude Code in action; Anthropic Engineering: Effective harnesses for long-running agents; Claude Cookbooks: Session Memory Compaction)

Escalation and ambiguity resolution (5.2)

Valid triggers and unreliable proxies

Three valid escalation triggers:

  1. The customer asks for a human: escalate immediately, without investigating first.
  2. Policy exceptions or gaps: the policy is silent or ambiguous on the specific request, e.g. the customer asks for a competitor price match while the policy only covers price adjustments on the company's own website. A "complex case" is not a trigger by itself.
  3. Inability to make meaningful progress.

Two unreliable proxies: sentiment (an upset customer doesn't mean a hard case) and self-reported confidence (a model's own 1–10 rating is poorly calibrated; the model is often confidently wrong on exactly the hard cases). When the customer is upset but the issue is within the agent's capability: acknowledge the frustration, offer a resolution, and escalate only if the customer reiterates that they want a human.

When a tool returns multiple matching customers, the agent must ask for additional identifiers (email, order number) instead of choosing by a heuristic such as "the most recent record".

Situation Correct action Commonly chosen wrong option
"Let me talk to a person" escalate_to_human immediately Look up the order first "to save time"
Upset customer, broken item with photo (within policy) Acknowledge, offer exchange/refund Escalate because of sentiment
Policy says nothing about competitor price matching Escalate (policy gap) Infer from internal policy
Two customers with the same name Ask for another identifier Pick the most recent record
Refund above the threshold (e.g. > $500) Hook blocks it, redirects to escalation Only state the limit in the prompt

Implementation

  • The first, proportionate step: explicit escalation criteria with few-shot examples in the system prompt.
  • Mandatory rules (monetary thresholds) use hooks (Task 1.5), because prompts always have a non-zero failure rate.
  • Escalate with a structured handoff, because the human agent receiving it can't read the transcript (Task 1.4):
{
  "customer_id": "C-48213",
  "root_cause": "Customer requests a competitor price match; policy only covers prices on the company website",
  "amount_in_question": 42.00,
  "recommended_action": "Decide whether to grant a price-match exception for order #9120"
}

Scenario example

First-contact resolution (FCR) is only 55% (target 80%). The agent escalates even broken-item replacement cases that come with photos, yet handles cases that need a policy exception on its own. Root cause: unclear decision boundaries. Choose "explicit escalation criteria + few-shot examples". Don't choose a separate classifier (overkill before the prompt is optimized), a self-reported confidence threshold (poorly calibrated), or sentiment analysis (solves the wrong problem).

Exam trap

"Let the agent try to resolve it first, and transfer to a human only if the customer still insists" is wrong when the customer has explicitly requested a human. "Acknowledge + offer resolution" is only for customers who are upset but have not yet asked for a human.

(Source: CCAR-F Exam Guide, Tasks 5.2, 1.4, 1.5, Sample Questions (Customer Support Resolution Agent))

Error propagation in multi-agent systems (5.3)

Errors in a subagent must reach the coordinator with enough information to decide: retry with a different query, use an alternative source, or continue with partial results.

Structured error context

It includes: the failure type, what was attempted, partial results, and alternative approaches. At the MCP tool layer, use the isError flag with errorCategory (transient/validation/permission) and isRetryable (Task 2.2).

{
  "isError": true,
  "errorCategory": "transient",
  "isRetryable": true,
  "attempted": {"query": "AI in music production 2025", "local_retries": 2},
  "partial_results": [{"claim": "...", "source_url": "https://..."}],
  "alternatives": ["Narrow the query by genre"]
}

(Apart from isError, errorCategory, and isRetryable, the field names are illustrative only.)

An access failure (timeout, service not responding) needs a retry decision. A valid empty result (the query succeeded, with no matches) is information; retrying it is pointless. Lumping the two together makes the coordinator retry pointlessly or wrongly conclude that "there is no data".

Error handling approach Consequence
Generic status ("search unavailable") Hides context; the coordinator can't decide
Swallow the error, return empty marked "success" No one recovers; the report is incomplete but looks complete
Stop the whole workflow over one error Wastes completed work even though recovery was possible
Subagent retries transient errors itself, propagates only errors it can't handle, with what was attempted and partial results Correct

Synthesis output should include coverage annotations: which findings are well-supported, and which areas have gaps because sources were inaccessible. Anthropic's article on its Research system notes that errors in agents compound, so you need to resume from the point of failure instead of rerunning from the start, combining retry logic with deterministic checkpoints.

Exam trap

"Exponential backoff retries in the subagent, and when they run out, return 'search unavailable'" sounds professional but is wrong: the final message is still generic, and the coordinator loses the query attempted, the partial results, and the alternatives.

(Sources: CCAR-F Exam Guide, Tasks 5.3, 2.2; Anthropic Engineering: How we built our multi-agent research system)

Managing context in large codebase exploration (5.4)

Context degradation: in long sessions, the model gives inconsistent answers and talks about "typical patterns" instead of the specific classes it found earlier.

The toolkit

  • Grep/Glob before Read: Grep finds entry points, Glob finds files by pattern, then Read follows imports to trace the flow; don't read every file upfront (Task 2.5).
  • Subagents for specific questions ("find all test files", "trace refund flow dependencies"). A subagent such as the built-in Explore reads dozens of files in its own context and returns only a summary; the main agent stays in the coordinating role.
  • Scratchpad file: record key findings (classes, paths, relationships) and refer back to it for later questions.
  • Per-phase summaries: at the end of a phase, summarize and inject the summary into the initial context of the next phase's subagents (subagents don't automatically inherit the parent agent's context).
  • Manifest for crash recovery: each agent exports its state to a known location; on resume, the coordinator loads the manifest and injects it into the agents' prompts.
  • /compact when the context fills with verbose discovery output.
{
  "phase": 2,
  "phase_1_summary": "scratch/phase1-findings.md",
  "agents": [
    {"name": "find-tests", "status": "done", "state": "state/find-tests.json"},
    {"name": "trace-refund", "status": "in_progress", "state": "state/trace-refund.json"}
  ]
}

The Introduction to Subagents course gives a rule: "does the intermediate work matter?" If not, delegate it to a subagent; if so, keep it in the main thread. Avoid subagents that run tests (they return only "tests failed", hiding the output you need for debugging) and sequential pipelines where each step depends on the previous one. A subagent's output format should include an "Obstacles Encountered" section so the main thread doesn't have to rediscover workarounds.

If the code has changed since the previous session, the old tool results are stale: opening a new session with a structured summary is more reliable than resuming. If you still use --resume <session-name>, state exactly which files changed (Task 1.7).

Scenario example

Scenario 2: after two hours exploring a legacy system, Claude Code describes the refund flow in generic terms such as "typically the service calls the repository". The right approach: record findings in a scratchpad, run /compact with instructions or open a new session with a summary, and delegate the next exploration questions to the Explore subagent.

Exam tip

"Answers get more generic/contradictory over a long session" → scratchpad + subagents + summary//compact. "Agent crashes midway, and rerunning is very expensive" → manifest state export.

(Sources: CCAR-F Exam Guide, Tasks 5.4, 2.5, 3.4, 1.7; Anthropic Academy: Introduction to subagents)

Human review workflows and confidence calibration (5.5)

The focus of Scenario 6: reduce manual review without letting errors slip through.

An overall accuracy of "97%" can mask that one document type (scanned invoices) or one field (due date) is often wrong. Before automating the high-confidence portion, you must analyze accuracy by document type and by field.

Calibration process

  1. The model outputs field-level confidence, not a single score for the whole document.
  2. Calibrate thresholds with a labeled validation set: measure the actual accuracy at each confidence level.
  3. Route to humans: fields with low confidence, or ambiguous/contradictory source documents (e.g. conflict_detected: true, calculated_total differs from stated_total, Task 4.4), prioritizing limited reviewer capacity.
  4. Apply stratified random sampling to the auto-approved high-confidence portion as well, to measure error rates continuously and detect novel error patterns.
{
  "document_type": "invoice",
  "fields": {
    "stated_total": {"value": 1840.50, "confidence": 0.95},
    "due_date": {"value": null, "confidence": 0.40}
  },
  "calculated_total": 1790.50,
  "conflict_detected": true
}
Criterion Self-reported confidence (5.2) Calibrated field-level confidence (5.5)
Used for Deciding whether to escalate a conversation Routing extracted fields to review
Basis The model rates itself, with no reference Checked against a labeled validation set
Verdict Poor proxy for case complexity Valid for setting thresholds, together with sampling

Exam trap

Don't conclude that "model confidence is always useless". Self-reported, uncalibrated confidence is a poor proxy for escalation; field-level confidence calibrated with labeled data is the right tool for routing review. Conversely, don't drop review for the entire high-confidence portion just because overall accuracy is high.

Key point

Monitoring must continue after going to production. The Introduction to Evals course suggests grading 1–5% of live traffic each night with an LLM judge, reading some yourself from time to time, and turning every failure into a new test case to catch drift.

(Sources: CCAR-F Exam Guide, Tasks 5.5, 4.4, 4.6; Anthropic Academy: Introduction to evals)

Preserving information provenance and handling uncertainty (5.6)

When a subagent compresses findings into prose, the claim → source link disappears. Subagents must output structured claim-source mappings (URL, document name, excerpt, date), and the synthesis agent must preserve and merge those mappings.

{
  "claim": "Market X reached $4.2 billion",
  "evidence_excerpt": "...the market reached $4.2B...",
  "source": {"url": "https://example.org/report", "page": 14},
  "published": "2025-06"
}

Credible but conflicting sources

  • Don't arbitrarily pick one value: record both with their sources and flag the conflict.
  • The analysis subagent still completes its work with the conflicting values annotated; the coordinator decides how to reconcile them before passing them to synthesis.
  • Require publication/collection dates: two different numbers may simply reflect two points in time, not a contradiction.
  • The report separates established findings from contested ones in different sections, preserving the sources' wording and methodological context.
  • Present by content type: financial data as tables, news as prose, technical findings as lists.

"Not found" is a valid answer

The Reduce hallucinations documentation advises: allow Claude to say "I don't know"; for long documents (>20k tokens), extract verbatim quotes before analyzing; after writing, find a quote for each claim and retract any claim without a supporting quote. At the API layer, Citations ("citations": {"enabled": true} on a document block) returns cited_text with its location: character indices (plain text), page numbers (PDF), block indices (custom content). For RAG, search_result blocks (source, title, content) let Claude cite your content.

Scenario example

Scenario 3: the report says "the adoption rate is 35%", while one source says 35% (2025 data) and another says 22% (2023). Root cause: the subagent didn't output publication dates and synthesis picked one value on its own. Fix: require a date field in the subagent output, keep both values with their sources, and explain the difference in terms of time.

Key point

Provenance must flow through the entire pipeline: subagent → coordinator → synthesis → report. Any link that compresses findings into prose without sources is where attribution is lost.

Exam trap

"Average the two numbers" or "pick the more reputable source" is still an arbitrary choice. The right approach is to keep both values, cite the sources, and let the coordinator decide how to reconcile them.

(Sources: CCAR-F Exam Guide, Task 5.6; Claude Docs: Reduce hallucinations; Claude Docs: Citations; Claude Docs: Search results)

Quick summary

  • Progressive summarization loses amounts, dates, percentages, and customer expectations → a case facts block outside the summarized history, included in every prompt.
  • "Lost in the middle": put the key findings summary at the beginning and use section headers; a larger context doesn't solve it.
  • Trim tool output to the relevant fields before it accumulates (40+ fields → about 5); the Messages API is stateless, so every request resends the full history.
  • /compact <instructions> steers the summary; /clear for new work; long-lived facts go in CLAUDE.md.
  • Escalate immediately when the customer asks for a human, when policy is silent/ambiguous, or when no progress is possible; don't escalate on sentiment alone.
  • Multiple matching customers → ask for additional identifiers; don't choose by heuristic.
  • Fixing miscalibrated escalation: first, explicit criteria + few-shot examples; mandatory monetary rules → hooks.
  • Subagent errors: retry transient errors locally; for errors that can't be handled locally, return the failure type, query attempted, partial results, and alternatives. Not generic, not swallowed, not stopping the whole workflow.
  • An access failure (needs a retry decision) differs from a valid empty result (query succeeded, no matches); synthesis records coverage annotations.
  • Large codebases: Grep/Glob before Read; the Explore subagent; scratchpads; summaries between phases; manifests for crash recovery.
  • 97% overall accuracy can hide errors by document type/field → analyze by segment before reducing review.
  • Field-level confidence must be calibrated with a labeled validation set; stratified sampling of the high-confidence portion.
  • Conflicting sources: keep both values with sources and dates; separate established from contested findings.