D1 · 27 %
Agentic architecture and orchestration
Domain 1 covers the agentic loop and multi-agent orchestration: how a loop knows when to continue or stop, how a coordinator splits, delegates and controls work, and how to manage sessions. The exam mostly tests the right level of complexity and the line between what the model decides and what code guarantees.
The agentic loop
While stop_reason is tool_use, the application runs the tools, appends the full assistant response to the history, then a user message with one tool_result per tool_use (same tool_use_id, all in that single message, before any text). end_turn marks the end, max_tokens a truncated output, and pause_turn a paused server-tool loop, resumed by sending the assistant content back unchanged. Text is never an end signal, because one response can hold both text and a tool_use; and splitting results across messages discourages the model from calling tools in parallel. The model chooses the next step by reading the results: that is what separates an agent from a coded workflow.
Workflow or agent
Start with the simplest solution and only add complexity when it improves the outcome. If the subtasks are known before the run, a coded workflow (prompt chaining, parallelization, routing) is more predictable and cheaper than an orchestrator. If they cannot be listed (a bug with an unknown path, open-ended research), an agent or orchestrator splits the work as findings come in, with a stopping condition. Likewise, a plan reviewed before editing (plan mode) pays off on an open-ended task, not on a mechanical edit.
Hub-and-spoke
The coordinator splits the request, delegates, collects the reports and synthesizes. In this model, subagents do not talk to each other: a subagent's output returns to the coordinator, which copies what matters into the next one's prompt. Centralizing the flow keeps all information traffic visible and debuggable. The flip side: if the coordinator splits the topic too narrowly, it creates coverage gaps that subagents, each correct within its scope, will not fill.
Subagent context
A subagent (other than a fork) starts with a fresh context: its system prompt, the prompt passed to the Agent tool, tool definitions and the project CLAUDE.md, but neither the parent's history nor its tool results. Everything it needs (paths, errors, decisions, other subagents' results) therefore goes into the delegation prompt. In return, only its final message comes back: its intermediate reads stay out of the parent's context, which is the whole point of isolation.
Writing a delegation
Each subagent needs an objective, an output format, guidance on the tools and sources to use, and clear boundaries. A step-by-step script makes it brittle: it gives up when a planned query fails and misses whatever falls outside the expected pattern. A vague instruction ('research X') causes the opposite problem: duplicated work across subagents and coverage gaps. So give the goal and the quality criteria, and let the subagent choose its method.
Sizing the effort
Agents are poor judges of how much effort a query deserves, so scaling rules go into the coordinator's prompt (a simple fact: one agent and a few calls; a comparison: a few subagents; complex research: more). The coordinator picks which subagents to invoke for each query, instead of sending every query through the whole pipeline. A subagent costs tokens and time because it must rebuild its context: a short task the coordinator can handle with what it already knows is not delegated.
Parallelism
To run independent tasks at the same time, the model emits several tool calls (including the Agent tool) in the same response; one call per turn forces sequential execution. With the Messages API, your code runs that batch concurrently and returns all the results together. Fanning out from the coordinator brings latency down to the slowest task while keeping every delegation visible, which an external queue or a hierarchy of nested subagents loses.
AgentDefinition and the Agent tool
In an AgentDefinition, description tells the coordinator when to delegate, prompt carries the subagent's expertise, and tools is the real restriction: when omitted, the subagent inherits every available tool. A prompt saying 'do not modify anything' is only an instruction; only the tool list (or disallowedTools) enforces it. The coordinator delegates by calling the Agent tool (named Task in older versions): if it lacks that tool, it can announce a delegation without ever performing it.
Refinement loop
A first synthesis is not the final one. The coordinator, or a reviewer agent, assesses coverage; the agent that spots a gap reports it explicitly, then the coordinator launches targeted searches and redoes the synthesis. A stop rule (no gap left, or a maximum number of rounds) caps the cost. Documenting the gap in the report or widening queries up front does not fill gaps discovered along the way.
Guarantees in code
A prompt, examples or an instruction in capitals reduce errors without removing them: the model can always decide otherwise. A rule with no exceptions (tool order, amount threshold, compliance) is coded in a hook, in the tool itself or in the orchestration, on data the model does not supply; a parameter the model fills in is not a control. To guarantee an outcome however the loop ends, code checks the ResultMessage subtype after the run (success, error_max_turns...) and triggers the fallback action itself.
PreToolUse and PostToolUse hooks
PreToolUse runs before the tool: it reads tool_input and can deny the call or modify the input; that is where you block, denying also when the check itself fails (fail closed). PostToolUse runs after: it can enrich or replace what Claude sees, but the tool's effect (payment, write, request) has already happened. The matcher only filters on the tool name (mcp__server__.* for a whole MCP server); conditions on arguments are tested in the callback.
Sessions: continue, resume, fork
continue resumes the most recent session in the directory, which is enough for one conversation at a time; resume targets an ID (or a name in Claude Code), required as soon as there are several users or sessions. A fork copies the history into a new session to explore an alternative without touching the original; it copies the conversation, not the files. When resuming, tell Claude what changed outside its view (modified files, renames); if most of it changed, a new session with a summary of the findings is better.
D2 · 18 %
Tool design and MCP integration
An agent picks and uses its tools based on what it is told about them: name, description, schema, the shape of results and errors. This domain covers designing those contracts, error handling, tool_choice, MCP integration and Claude Code's built-in tools.
Descriptions: the main lever
The model picks a tool and fills its parameters from the name, description and schema; the docs call descriptions the most important factor in tool performance. A good description says what the tool does, when to use it and when not to, its inputs, output, limits and boundary with neighboring tools. Each parameter states its meaning, format and where its value comes from ("from a find_reservation result, never guessed"): an invented parameter, or an MCP tool passed over for Bash, gets fixed there first. The order of the tools array does not matter for selection; a stable order does help the prompt cache.
Split or consolidate
Two opposite mistakes degrade selection. A catch-all tool driven by a free-text instruction, or operations with different required parameters packed into one tool, have no clear contract: split them into dedicated tools, each with only its own parameters and a defined output. Conversely, two tools answering the same need force a choice with no criterion: merge them, with an action parameter or a flag. The docs lean toward consolidating related operations; splitting is justified when contracts truly differ.
Design the tool for the agent
A tool need not mirror the API: it can chain several calls internally. If it accepts the identifier the agent already has, the intermediate call and its failure point disappear. Bundle the mechanical steps (search, then fetch abstracts), but keep the judgment step separate, since the model must make it while seeing all candidates. Values reused by a later step come back as structured fields (in MCP, structuredContent and outputSchema): reliable reading, with no guarantee on the accuracy of the source data.
How many tools per agent
The more tools an agent has, the less reliable its choice, especially when they overlap. The exam's rule of thumb: 4 to 5 tools per role, plus if needed one narrow cross-role tool (a verify_fact for simple checks) rather than another agent's whole toolkit. The tool search docs recommend it from 10 tools, or when selection accuracy drops as tools are added. In Claude Code, a subagent's tools field restricts its list.
Protocol or execution error
MCP separates two channels. Protocol error (JSON-RPC): unknown tool, request that breaks the CallToolRequest schema, server error; the model can rarely fix it. Execution error, returned in the result with isError: true: API failure, input validation, business rule; the client should show it to the model so it can self-correct. Note: spec 2025-06-18 put invalid arguments on the protocol side; spec 2025-11-25 moved them to the execution side.
Actionable errors
A generic "failed" leaves the agent guessing: it retries in a loop or gives up. The docs ask to say what went wrong and what to try next ("Rate limit exceeded. Retry after 60 seconds"). To choose between retrying, fixing the input and escalating, the agent needs a category (transient, validation, permission, business), a retryable indicator and a readable cause it can reuse with the customer. An exception raised in the handler loses all of that.
Zero results and timeouts
A search with no results succeeded: return it as a structured success (empty list, zero count), otherwise the agent assumes an outage and retries. is_error stays for cases where the tool could not answer. A timeout on an action with side effects (payment, sending) leaves the status unknown: the message must say so, advise against retrying and say how to check. Retrying is only safe for an idempotent call, which MCP flags with the idempotentHint annotation.
tool_choice
auto (the default when tools are provided) lets Claude decide, with no guarantee of a call; any requires one tool of its choice; tool requires that one; none forbids tools. With any or tool, the response starts with the tool_use: no text before it, even if asked; for an explanation, add a dedicated field to the schema, or switch to auto with an instruction. The newest models (Opus 5.5, Sonnet 5.5, Fable 5.2 and others) reject any and tool with a 400 error: the docs then suggest auto with strict tool use, or structured outputs.
MCP in Claude Code: scopes and secrets
For a standard need (tickets, production errors), connect an existing MCP server first; a custom server is justified for a team-specific workflow. Three scopes: local (default, for you, this project), project (.mcp.json under version control, shared with the team), user (for you, all projects); the two personal scopes are stored in ~/.claude.json. A shared .mcp.json holds no secret: write ${VAR} and each developer exports their variable; a ${VAR:-default} holding a real token amounts to committing it.
Several servers and tool search
The host opens one connection per configured server and gathers their tools, prefixed by server (mcp__server__tool): one request can chain tools from several servers. By default Claude Code turns on tool search: only tool names and server instructions are in context at startup, and description and schema arrive on demand; ENABLE_TOOL_SEARCH=false loads everything upfront. Adding servers therefore costs little context, but a deferred tool only gets found if its description puts the key words first.
Tools, resources, prompts
MCP offers three primitives, each controlled by a different actor. Tools are actions the model decides to call. Resources are passive, read-only data provided by the application (schemas, documentation, catalogs): when an agent piles up calls just to learn "what exists", they are what to expose; in Claude Code you attach them with an @-mention. Prompts are user-launched templates, exposed as commands in Claude Code.
Claude Code built-in tools
Grep searches file contents, Glob searches by name or path, Bash executes. To list the callers of a function re-exported under other names, first collect every alias, then search for each. Edit replaces an exact string that must be unique; when no unique anchor is possible, Read then Write the whole file. On macOS, Linux and WSL, Claude Code drops Glob and Grep by default and uses grep and find through Bash, with the same logic.
D3 · 20 %
Claude Code configuration and workflows
This domain covers configuring Claude Code (CLAUDE.md, rules, skills, hooks, permissions, MCP) and the workflows around it, locally and in CI. The common thread: pick the right mechanism depending on whether you need to guide Claude, constrain it, or give it context at the right time.
CLAUDE.md hierarchy
Four levels: managed (organization), user ~/.claude/CLAUDE.md (you, everywhere), project ./CLAUDE.md committed (the team), local CLAUDE.local.md gitignored (you, this project). They add up instead of replacing each other: when they conflict, Claude may follow either instruction, so keep them consistent. Files in parent directories load at launch, those in subdirectories on demand. If an instruction seems ignored, first check what loaded: /context all (Memory files section), and /memory to list and open the files.
Guidance vs enforcement
CLAUDE.md, rules, skills, and prompts are read by the model: it follows them almost always, with no guarantee, and emphasis (IMPORTANT, capitals) doesn't change that. deny rules and command hooks are applied by the harness, whatever Claude decides; a prompt or agent hook lets another model judge and stays probabilistic. The split: forbid -> deny (in managed settings, which nothing overrides, for an organization requirement), always do -> hook (PostToolUse on Edit|Write to format), prefer -> CLAUDE.md, because a preference has exceptions Claude can judge. Keep the enforced set small: every hook or rule sometimes fires wrongly and needs maintenance.
Targeting instructions: rules and imports
A .claude/rules/*.md file with paths: (globs) loads only when Claude reads or edits a matching file: ideal for a convention per file type, even when files are scattered (**/*.test.tsx). * covers a single level, ** any depth: terraform/**/*, not terraform/*. An @import organizes a CLAUDE.md without reducing context, since the imported file loads with it; it's useful for selective imports when only a package's owners know what applies. Per-directory CLAUDE.md fits when each team manages its own conventions.
Skills and commands
A skill in .claude/skills/<name>/SKILL.md (or a command in .claude/commands/, the older format) is committed and shared with the team; in ~/.claude/ it stays personal. Only the name and description load upfront, and the full content arrives on invocation, so a long, occasional procedure (release, review checklist) costs far less than a CLAUDE.md section. With disable-model-invocation: true, Claude can't start it on its own and nothing loads before /name: the right setting for a workflow with side effects.
Skill frontmatter
context: fork runs the skill in a subagent: only the result comes back, so a verbose investigation doesn't flood the conversation. allowed-tools pre-approves tools during the invoking turn and restricts nothing; to remove tools, use disallowed-tools, and the classic trap is reading allowed-tools as an allowlist. user-invocable: false hides the skill from the / menu, disable-model-invocation: true stops Claude from starting it on its own, and argument-hint is only an autocomplete hint.
MCP: scopes and primitives
The scope decides who gets the server: project writes to .mcp.json at the root, committed for the whole team; local (the default) and user write to ~/.claude.json, for you only, in this project (local) or in all your projects (user). So putting an experimental server in project scope forces it on the whole team. In use, Claude calls the tools, resources are referenced with @ and attached to the message, and prompts become commands (/mcp__server__prompt, arguments after it).
Plan mode or direct execution
In plan mode, Claude reads, explores, and proposes a plan without changing anything until you approve. It pays off when heading the wrong way is costly: large scale, several valid approaches, an architecture decision, a migration across dozens of files. For a local, clear change, or a bug a stack trace already pinpoints, it only adds waiting: go direct, even in a module you're new to. In a long session that spans several packages, the plan written to a file survives compaction.
Iterating effectively
Claude converges fast when it has a check that returns pass/fail: write the tests (or input/output pairs) first, have it run them, then share the actual failure rather than a description. If an exemplary file already exists, hand it over with @ instead of describing it. In an unfamiliar domain, ask Claude to interview you until it can write a SPEC. Interacting problems go in a single message; independent problems, one at a time.
Sessions
claude --continue reopens the most recent conversation in the directory; claude --resume <name|id> resumes a specific session, context included. Name a long session with /rename (or -n at launch) so you can find it again without relying on chronological order. --session-id sets a UUID for a conversation and doesn't look up names.
Claude Code in CI
claude -p processes the prompt and exits; without it the job waits for input, and -p grants no permissions (--allowedTools pre-approves, --permission-mode dontAsk refuses the rest). --append-system-prompt adds instructions to the default prompt, while --system-prompt replaces it and loses the tool guidance; --output-format json gives a result to parse. --bare skips auto-discovery (hooks, skills, MCP, CLAUDE.md) for a fast start, as long as you pass what matters explicitly. --max-turns and --max-budget-usd bound each invocation from within Claude Code; the budget is compared to an estimate, so keep headroom.
Automated code review
A reviewer that didn't watch the code being written judges better: run the review in a fresh session or subagent, and on re-runs, pass the previous findings to avoid duplicates. When the useful context isn't known in advance (callers in other files), give read and search tools with a cap rather than a static prompt. Project conventions go in CLAUDE.md, read on every run; for managed Code Review, review-only rules (nit cap, skipped paths, severity, required evidence) go in REVIEW.md at the root, on the protected default branch.
D4 · 20 %
Prompt engineering and structured output
This domain is about reliable outputs: a format guaranteed by the API, correct values through precise instructions and examples, and checks in code wherever the model guarantees nothing. It also covers automated review (criteria, independence, separate passes) and the Batch API, chosen according to the acceptable latency.
Structured output enforced by the API
To get conformant JSON on every call, the API has to enforce the schema: structured outputs (output_config.format) or a strict: true tool whose input_schema is the target record, read from tool_use.input. Constrained decoding guarantees valid JSON, types and required fields. Format instructions, a regex over text or a prefill (rejected with a 400 error since the 4.6 models) remain requests, with no guarantee.
What the schema doesn't guarantee
strict guarantees syntax, not semantics: totals that don't add up or a field filled with the wrong data pass validation. Consistency is checked in code (calculated total against stated total), and a discrepancy is flagged instead of being forced into line. The schema can also break on a refusal or a truncation: check stop_reason before parsing, and handle output that exceeds max_tokens by splitting the input, not by degrading the content.
A schema that matches the source
A required field pushes the model to invent when the information is missing: a field that may be absent is nullable, with an explicit instruction to return null. A category that is open in reality becomes an enum with other and a detail field (or unclear); otherwise the model forces the closest value. When the source holds several true values, the schema captures them all, with their condition and provenance.
Precise instructions and normalization
The model already reads the source: giving it the expected canonical format (ISO 8601, country codes) and the conversion rules, in the prompt or the field descriptions, yields uniform values at extraction time. Post-processing, by contrast, would have to cover endless variants. A simple test: would a colleague with no context follow the instruction without hesitating?
Examples (few-shot)
Examples are the most reliable lever to stabilize format and judgment: splitting compound items, keeping vague values verbatim, finding information spread across varied layouts. The docs recommend 3 to 5 relevant, diverse examples (edge cases included), wrapped in <example> tags. Annotated examples that show the reasoning generalize to cases no list of rules would have anticipated.
Targeted retry or human review
A request resent unchanged usually fails the same way. A useful retry contains the document, the failed output and the exact validation error, so the model can correct itself. If the information isn't in the source or the source contradicts itself, no retry will find it: the case goes to human review.
tool_choice
auto (the default) lets Claude decide, any requires some tool, tool requires a named tool, none forbids tools. To guarantee a mandatory step, force the tool on the first turn, then go back to auto; forcing it on every turn blocks the other tools. Opus 5.5, Sonnet 5.5, Fable 5.1 and 5.2, and Mythos 5.1 and 5.2 reject any and tool: on those models, combine auto, a clear instruction and strict: true.
Review criteria and downstream filtering
Accurate but dismissed findings point to a fuzzy definition of a problem: a concrete "report / skip" list sets the threshold, where "be conservative" leaves it to guesswork. An instruction such as "ignore anything you're unsure about" silences bugs the model actually found. It is better to report everything with severity and confidence, then filter in code or in a verification pass.
Independent review and separate passes
The session that wrote the code keeps its reasoning and tends to confirm it: an independent review runs in a fresh context (/code-review, a second session). On a large change, a single prompt dilutes attention: one pass per file, then an integration pass for cross-file flows. If two categories of issues compete within one prompt, each gets its own pass and examples, then the results are consolidated.
Batch API: when to use it
Batch costs 50% less on input and output, but processing can take up to 24 h (often under an hour, with no guarantee). It suits deferred work (overnight report, non-blocking review), never a blocking or urgent step. Each request is a single call: a client tool loop needs a new call per step, so the agent stays synchronous. Prompt caching discounts stack with the Batch discount.
Batch API: results, failures and cadence
Results come back in any order: join them on custom_id. On failure, submit a new batch with only the affected custom_ids, fixing invalid_request_errors first (an oversized request to split, for example); server errors and expirations are resent as is. To meet a deadline, the interval between two submissions plus 24 h must stay under the SLA.
Ambiguous requests
A string of questions before acting makes users give up. When the context allows a plausible reading, the model proceeds on that assumption, states it and offers to adjust; it only asks when two readings lead to materially different results. Silent choices, on the other hand, produce errors nobody sees.
D5 · 15 %
Context management and reliability
This domain covers what keeps an agent reliable over time: what goes into the context, what comes out of it, and how it is passed from one agent to another. It also covers the moments when a human takes over: escalation, confirming an action, and reviewing extractions.
Stateless API and context budget
The Messages API keeps nothing between two standard requests: every call resends the relevant history, otherwise the model 'forgets'. Everything in the request counts toward the window: system prompt, messages, tool results, tool definitions and output. A document that fits on its own can therefore overflow once these parts are added; the token counting API checks this before sending.
Exact facts outside the summary
A summary keeps the thread of the conversation but loses details: an amount, a status, a promise made to the customer. Exact facts (IDs, amounts, dates, statuses) go into a structured block, one record per topic, kept outside the summarized history and reinjected into every prompt. They then survive compaction, which can erase a detail whose importance only shows up later.
Large tool results
A tool that returns 40 fields fills the context with data the agent will not use, and accuracy drops as the context grows. Keep only the useful fields, in code: in the tool itself, or in a PostToolUse hook that replaces the output (updatedToolOutput) before the model sees it. Having the model summarize is less safe: it still reads everything and can alter a value.
Long context: structure before size
In a long prompt, information in the middle is missed more often ('lost in the middle'), and a bigger window does not help: accuracy drops as the token count grows. Put long documents at the top and the question at the end, tag each source (<document>, <source>), put a summary of key findings first, or split the work into focused passes before synthesizing.
Long conversations and resumed sessions
The right strategy is in the data: if old context is rarely used and easy to restate, a simple sliding window is enough, with no summary and no vector store. When a session resumes with stale tool results, they keep influencing answers, even with an instruction to prefer the newest ones. Start a new session instead, with a structured summary of the previous one and fresh tool calls.
Exploring a codebase without saturating context
Reading everything saturates the context. Start from an entry point (a Grep, the base class), read it, then follow calls and imports: each read points to the next. When context degrades (generic answers, forgotten details), delegate verbose work to subagents such as Explore, which return summaries, and write established facts to a file that is reread after a compaction. /compact summarizes with loss; /clear starts over and is meant for switching between unrelated tasks.
When to escalate
Three reliable triggers: the customer asks for a human (transfer right away, without investigating first), the policy is silent or ambiguous on the case, or the agent is no longer making progress. Negative sentiment, apparent complexity and self-reported confidence are not triggers: a frustrated customer whose problem can be fixed now needs the fix, with a human offered if they prefer. To correct poorly calibrated escalation, start with explicit criteria and examples in the prompt, before any infrastructure.
Resolving ambiguity and confirming actions
If a lookup returns several customers, picking the most recent or merging the accounts risks acting on the wrong person: ask for one more identifier. Before an action visible to others, the confirmation must show what will actually happen (recipient, amount, date, content). A 'Confirm?' prompt with no details gets approved by reflex and protects nothing.
Handoff to a human
The human who takes over cannot see the conversation: what is handed over must stand on its own. A structured summary (verified ID, root cause, amounts, applicable policy, what was done, recommended action and its reason) saves them from redoing the investigation. A raw transcript or a bare reference leaves them all the work.
Errors and recovery in multi-agent systems
A failure must travel up with its context: error type, what was attempted, partial results, alternatives. A timeout is not an empty result: disguising it as success suggests there was nothing to find, and stopping everything wastes the rest of the work. With the customer, do what is still possible, say what failed and offer the next step. To resume after a crash, each agent persists structured outputs and the coordinator keeps a manifest of what is done.
Human review of extractions
Overall accuracy often hides a weak document type or field: measure per type × field before automating. A model confidence score is not a probability until it is calibrated on a labeled set; the validated threshold is applied in code and returned as a decision (needs_review + reasons). After automation, stratified random sampling of accepted extractions measures the error rate and reveals drift.
Provenance and diverging figures
Each claim travels with its source in separate fields (claim, source, excerpt, date): blended into summarized text, attribution is lost at the first synthesis. Two different figures are not necessarily a contradiction: different dates show a trend, different methods explain a gap. The synthesis keeps both values with attribution, separates what is established from what is contested, and picks the format by content (tables for figures, prose for a story).