Home / CCA-F / Context Management
DWG 05 — 15% OF EXAM

Context Management

What this domain covers

The context window and compaction, multi-agent failure modes and error propagation, cross-session coherence, and confidence, sampling, and provenance.

5.1The Context Window

Context degrades as it scales and as relevant information gets scattered across a long transcript — a model can technically "see" everything in its window and still perform worse than it would with the same information presented compactly and close together.

Token budget is a resource to allocate deliberately, not fill up: keeping headroom matters because a nearly-full context window is itself a failure mode, leaving no room for the model to actually reason, plan, or incorporate a large tool result without something being pushed out or truncated.

Compaction (/compact in Claude Code) summarizes older parts of a conversation to free up space. What survives compaction is what was written into a persistent file (like CLAUDE.md); an instruction that only ever existed as a message in the conversation is exactly the kind of thing compaction is free to summarize away — which is why durable rules belong in configuration, not in a one-off chat turn.

Key points
  • Distributed/scattered relevant information degrades performance even within window limits.
  • Keeping token headroom is not waste — a full window is itself a reliability risk.
  • Compaction can summarize away conversation-only instructions; durable rules belong in a persisted file.

Full breakdown & examples → 5.1 The Context Window

5.2Multi-Agent Failure Modes

When a subagent fails, returning structured error context lets the coordinator make an intelligent recovery decision instead of guessing. Good error context has four parts: the failure type (transient — timeout or rate limit, may succeed on retry; validation — bad input, needs a fixed query; business — a rule violation requiring escalation or an alternative path; or permission — access denied, unretryable without a change in authorization), what was attempted (the specific query or action, stated concretely rather than as "it failed"), partial results gathered before the failure, and alternatives the coordinator could still try.

Two anti-patterns recur constantly: silent suppression, where an empty or failed result is treated as if it were a valid empty answer, so the coordinator never realizes recovery is needed at all — the worst of the two, because it prevents any recovery from ever being attempted; and workflow termination, where one subagent's failure kills the entire pipeline, discarding perfectly good partial results other subagents already produced.

The right split of responsibility: subagents handle their own transient retries locally (a timeout doesn't need to escalate all the way to the coordinator), while the coordinator reserves its attention for failures that need a genuinely different strategy — a different data source, a narrower query, or a human escalation.

Key points
  • Structured error context = failure type + what was attempted + partial results + alternatives.
  • Silent suppression (empty-as-success) is worse than workflow termination, because it prevents recovery outright.
  • Subagents should self-handle transient retries; the coordinator handles strategy-level recovery.

Full breakdown & examples → 5.2 Multi-Agent Failure Modes

5.3Cross-Session Knowledge and Coherence

Work that spans multiple sessions needs a place to persist knowledge outside any single context window — external memory, written summaries, or artifacts the next session can load back in, rather than relying on everything staying in one continuous transcript.

Coherence across a long-running or resumed task means the agent picks back up with the same understanding of state it had before — the same goal, the same constraints, the same progress — which only works if what got persisted actually captured the parts that matter, not just the most recent few messages.

Key points
  • Cross-session persistence requires deliberately externalizing state — it doesn't happen automatically.
  • Coherent resumption depends on what was captured in that persisted state, not on raw transcript length.

Full breakdown & examples → 5.3 Cross-Session Knowledge and Coherence

5.4Confidence, Sampling, and Provenance

A model's own expressed confidence is a signal, not a guarantee — it can be miscalibrated, especially on questions outside common patterns in training data, so system design shouldn't treat a confident-sounding answer as equivalent to a verified one.

Sampling parameters (like temperature) trade determinism for variety: lower settings produce more consistent, repeatable output, which is usually what you want for a structured-extraction or classification task, while higher settings suit creative or exploratory generation where variety is the goal.

Provenance — tracking where a claim in the output actually came from, a specific search result, a specific document, a specific tool call — is what makes an agentic system's output auditable after the fact, and what separates a system you can debug from one where a wrong answer is a mystery.

Key points
  • Expressed confidence and actual correctness are not the same thing — don't design around confidence as ground truth.
  • Lower sampling temperature = more deterministic/repeatable output; higher = more variety.
  • Provenance tracking is what makes a wrong output debuggable instead of a mystery.

Full breakdown & examples → 5.4 Confidence, Sampling, and Provenance


Check yourself
1.A subagent's database query times out. Should it escalate to the coordinator immediately, or retry locally first?
Show answer
Retry locally first — a timeout is a transient failure, and handling it at the subagent level keeps the coordinator focused on failures that actually need a different strategy.
2.A coordinator receives an empty result from a subagent and proceeds as if the search simply found nothing. Later it turns out the search silently failed. What anti-pattern is this?
Show answer
Silent suppression — treating a failed or empty result as a valid answer. It's considered the worse of the two main anti-patterns because it prevents the coordinator from ever attempting recovery.
3.You gave Claude Code an instruction mid-conversation (not in CLAUDE.md), and after a /compact it seems to have forgotten it. Why?
Show answer
Compaction summarizes the conversation, and an instruction that only ever existed as a chat message is fair game to be summarized away. Durable rules need to live in a persisted file like CLAUDE.md, not just in the conversation.

Claude Certified Architect — Study NotesDWG 05