Every primitive named in the Exam Guide appendix, in one place — including the small ones the lessons only touch (max_tokens, system prompts, stop_reason values, Pydantic).
| Primitive | What to know for the exam |
|---|---|
stop_reason | Why generation stopped. Values you should recognize: "tool_use" (wants a tool → continue the loop), "end_turn" (done → stop), "max_tokens" (hit the output cap — output is truncated, not complete; not a normal completion), plus stop-sequence. Loop control keys off tool_use/end_turn. |
max_tokens | Upper bound on tokens the model may generate in one response. If output is cut off you'll see stop_reason: "max_tokens". It does not control what the model can see (that's the context window) and does not fix attention-dilution or memory issues — a recurring distractor. |
| System prompt | Top-level instructions/role/criteria. Powerful, but probabilistic — never the answer when a hard guarantee is required (use a hook/gate). Watch for keyword-sensitive wording that can override well-written tool descriptions. |
tool_use | The content block where the model requests a tool. With a JSON schema it's the most reliable route to schema-valid structured output (kills syntax errors, not semantic ones). |
tool_choice | "auto" (may answer in text) · "any" (must call some tool) · forced {"type":"tool","name":"X"} (must call X). See D2·L3. |
stop_reason → run tool + append result → repeat until end_turn. Stateless calls: results must be appended to history. (D1·L1)AgentDefinitionTask tool + allowedToolsallowedTools must include "Task". Multiple Task calls in one response = parallel subagents.PostToolUse (transform results before the model sees them) and tool-call interception (block/redirect outgoing calls). Deterministic — use for guarantees. (D1·L3)--resume <name>, fork_session, fresh+summary. (D1·L4)isError + structured metadataerrorCategory, isRetryable, human-readable text..mcp.json (shared, ${ENV} expansion) vs user ~/.claude.json. All configured servers' tools are discovered at connection time and available simultaneously.custom_id correlates request/response. Good for overnight/weekly; wrong for blocking pre-merge. (D4·L3)"other"+detail patterns, strict mode eliminates syntax errors only.-p / --print--output-format json + --json-schema/memory, /compact