CCA-F · Personalised Edition
Exam Cheatsheet.
A condensed, personalised reference I built during prep. Organised by exam domain, with decision tables, anti-patterns, and a glossary. Useful as a final-week review. ← Back to cert details
Exam overview
Domain weights · format · scoring
Domain weights
| Domain | Weight | Key focus |
|---|---|---|
| 1. Agent Architecture & Orchestration | 27% | Agentic loop, hub-and-spoke, hooks, subagents, escalation, error propagation |
| 2. Tool Design & MCP Integration | 18% | Tool descriptions, isError, tool_choice, built-in tools, MCP scoping |
| 3. Claude Code Config & Workflows | 20% | CLAUDE.md hierarchy, .claude/rules/, skills frontmatter, CI/CD, plan mode |
| 4. Prompt Engineering & Structured Output | 20% | Few-shot vs explicit criteria, JSON schema, batch API, retry loops, self-critique |
| 5. Context Management & Reliability | 15% | Progressive summarization, lost-in-middle, provenance, confidence calibration |
Golden rules — know these cold
stop_reason == 'end_turn'is the ONLY valid loop exit signal- Programmatic hooks = 100% deterministic enforcement
- Tool description = primary selection mechanism
- Subagents have ZERO automatic context from parent
context: forkisolates verbose skill / subagent output- Project scope beats user scope — same name → project wins
.claude/rules/= path-triggered · Skills = task-triggered- Batch API = no multi-turn tool calling (async fire-and-forget)
- Coordinator owns ALL inter-agent communication
Never do these
- Parse text for 'Task completed' to end loop
- Prompt for financial/compliance rules (~3% fail rate)
- Escalate on sentiment alone (angry ≠ complex)
- Self-rated confidence (1–10) for routing decisions
- Same session to generate AND review code
- Subagent calls another subagent directly
/compactfor multi-phase tasks (lossy — use Explore subagent)- User-level
~/.claude/CLAUDE.mdfor team standards - Generic MCP error: "Operation failed" (no recovery info)
Common decision boundaries in production agent design
| Situation | Correct choice | Tempting wrong choice | Why wrong choice fails |
|---|---|---|---|
| Format/structure inconsistency across outputs | Few-shot examples | Explicit criteria | Examples demonstrate exact format; criteria specify rules — wrong tool for format problem |
| Novel pattern generalisation needed | Explicit criteria | Few-shot examples | Examples only cover shown cases; criteria extend to unseen patterns |
| Context window filling in multi-phase task (verbose Phase 1) | Explore subagent | /compact | /compact is lossy — exact numbers/dates/IDs lost; Explore returns accurate summary |
| Tool being misused for wrong purpose (fetch_url for search) | Replace with scoped version | Remove tool entirely | Removing breaks legitimate use; scoped tool makes misuse architecturally impossible |
| Skill output pollutes main conversation context | context: fork in frontmatter | Split into smaller skills | Splitting still runs in main context; fork isolates execution to subagent |
| Keyword-triggered tool misrouting (descriptions already clear) | System prompt keyword steering | Fix tool descriptions | Descriptions are clear — root cause is prompt-level routing instructions |
| Path-based auto-convention (tests scattered everywhere) | .claude/rules/ glob patterns | CLAUDE.md sections | CLAUDE.md requires Claude to infer; glob rules fire deterministically on file path |
| Task-specific context (useful for one task type only) | Skill (on-demand) | .claude/rules/ glob | Path rules fire for ALL work in that directory; skills fire only when invoked |
| Timeout ("no response") vs "0 results found" | Distinguish semantically | Report both as failures | Empty result = valid informative finding; timeout = access failure needing retry |
| Consistent explanation quality with variable per-case gaps | Self-critique / evaluator-optimizer | Few-shot examples | Examples can't cover unpredictable variable gaps; self-critique catches case-specific issues |
Domain 1 · Agent Architecture & Orchestration
27% — largest domain
The agentic loop — know this cold
while True:
response = call_claude(messages, tools)
if response.stop_reason == 'end_turn': # ← ONLY valid exit — return result
return response.content
if response.stop_reason == 'tool_use': # ← keep looping
results = execute_tools(response.content)
messages.append(assistant_message(response))
messages.append(tool_results_message(results))
# max_tokens hit? → increase max_tokens or chunk input | stop_sequence → handle per app logic
| stop_reason | Meaning | Action |
|---|---|---|
end_turn | Model finished response | Return result to user — ONLY valid exit |
tool_use | Model wants to call a tool | Execute tool, append result, loop again |
max_tokens | Token limit hit, response truncated | Increase max_tokens or chunk input |
stop_sequence | Stop sequence encountered | Handle per app logic |
Hub-and-spoke multi-agent topology
Coordinator rules
- Coordinator owns ALL inter-agent communication
- Decompose → delegate → aggregate → error handle
- Subagents get ONLY explicitly passed context
- Parallel spawn: multiple Task calls in ONE response
allowedToolsmust include 'Task' on coordinator- Observability: coordinator sees everything
- Coordinator decides retry/escalation — not subagents
- Partition research space BEFORE delegating (distinct subtopics)
Subagent anti-patterns
- Subagent calls another subagent directly
- Subagents assume they can read coordinator history
- Passing full conversation log between agents
- Coordinator decomposes topic too narrowly (misses domains)
- "Task: analyze doc" with no context or format spec
- Subagent requesting coordinator to retry upstream
- Subagent aborting on partial failure (loses completed work)
Hooks — deterministic vs probabilistic
| Method | Reliability | Use when | Example |
|---|---|---|---|
| PreToolUse hook | 100% deterministic | Financial ops, compliance, safety — MUST be 100% | Block refund > $500, redirect to escalation |
| PostToolUse hook | 100% deterministic | Data normalization, format unification | Convert Unix timestamps → ISO 8601; trim 40-field response to 5 needed fields |
| System prompt instruction | ~97% probabilistic | General preferences, formatting, style only | 'Try to resolve before escalating' |
Escalation patterns
| Situation | Action | Anti-pattern to avoid |
|---|---|---|
| Customer says 'get me a manager' | Escalate IMMEDIATELY — no investigation first | Attempting to solve it first |
| Policy gap (policy silent on competitor price match) | Escalate — do NOT invent policy | Applying nearest-matching rule |
| Agent cannot make progress after attempts | Escalate after reasonable attempts | Infinite retry loop |
| Multiple customer matches found | Ask for additional identifier (email, phone, order#) | Heuristically guess the right one |
| High negative sentiment only | Do NOT escalate on sentiment alone | Sentiment ≠ case complexity |
| Refund amount > $500 threshold | PreToolUse hook enforces blocking | System prompt instruction only (~3% fail) |
Error propagation — semantic distinctions matter
| Error type | Who handles | What to return |
|---|---|---|
| Transient (timeout, 503) | Subagent handles locally first | If unresolvable: structured context (failure type, query, partial results, alternatives) |
| Access failure (connection timeout) | Coordinator decides retry | DISTINCT from "0 results" — must be labelled as access failure, isRetryable: true |
| Valid empty result ("0 results found") | Accept as informative finding | NOT a failure — coordinator should NOT retry |
| Unresolvable (corrupted file, permission denied) | Propagate to coordinator | Include what was attempted, partial results, errorCategory: "permission" |
| Conflicting sources (govt 40% vs industry 12%) | Doc analysis completes its task | Include BOTH with attribution, conflict_detected: true → defer reconciliation to coordinator |
Task decomposition strategies
| Strategy | Use when | Example |
|---|---|---|
| Fixed pipeline (prompt chaining) | Predictable steps, known structure | Review each of 14 files, then integration pass |
| Multi-pass review | 10+ files, avoid attention dilution | Pass 1: per-file local issues · Pass 2: cross-file dataflow |
| Explore subagent | Verbose Phase 1 threatening context window | Isolates discovery output, returns accurate summary to main session |
| Dynamic decomposition | Open-ended, scope unknown upfront | Discover codebase → find 3 untested modules → prioritize |
Domain 2 · Tool Design & MCP Integration
18%
Tool description — primary selection mechanism
The model selects tools based on descriptions alone. Minimal descriptions = unreliable selection. Overlapping descriptions = misrouting. Fix tool confusion by expanding descriptions BEFORE adding routing layers or prompt instructions.
| A good description includes | Example — what to write |
|---|---|
| What it returns (exact fields) | 'Returns customer profile: name, email, order_history, account_status' |
| Input formats + examples | 'Accepts email (user@domain.com) OR numeric customer_id' |
| When to use THIS vs similar tools | 'Use BEFORE lookup_order to verify identity. lookup_order = after verification' |
| Edge cases and constraints | 'Returns multiple matches if name not unique — caller must disambiguate' |
Tool distribution — scoping principles
| Principle | Rule | Example |
|---|---|---|
| Least privilege | Each agent gets only tools it needs for its role | Synthesis agent: scoped verify_fact not full web_search |
| Constrained replacement | Misused tool → replace with scoped version (not remove) | fetch_url misused for search → load_document validates URL points to document format |
| 4–5 tools per agent | More tools = more ambiguity = more misrouting | Separate agents for web search vs document analysis |
| Scoped cross-role tools | Shared tools OK if scoped to specific operation type | Synthesis gets verify_fact; complex verifications route via coordinator |
tool_choice options
| Value | Behavior | Use when |
|---|---|---|
"auto" | Model decides: tool or text | Default for most use cases |
"any" | Model MUST call some tool | Need guaranteed structured output |
{"type":"tool","name":"x"} | Model MUST call this specific tool | Enforce step ordering, forced first step |
Structured MCP error response
Correct — structured context
isError: trueerrorCategory: "transient" | "validation" | "business" | "permission"isRetryable: true / falsemessage: "Orders API timeout"attempted_query: "order_id=12345"partial_results: null(or actual partial data)
Anti-pattern — generic error
{ "isError": true, "content": "Operation failed" }- Coordinator cannot decide: retry? change query? escalate?
- All recovery context lost — coordinator is blind
| Error category | Retryable? | Agent action |
|---|---|---|
| transient | Yes — exponential backoff | Retry (timeout, 503, network errors) |
| validation | No — fix input | Modify request parameters and retry |
| business | No | Explain to user, propose alternative (policy violation) |
| permission | No | Escalate to human (access denied) |
MCP server configuration
# .mcp.json — project scope (commit this, NOT the tokens)
{ "mcpServers": { "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" } } } }
# ${ENV_VAR} substitution = one version-controlled config + per-developer credentials via environment variables
| Scope | Location | Use for | Version controlled? |
|---|---|---|---|
| Project | .mcp.json at repo root | Shared team tooling, standard integrations | Yes — use ${TOKEN} for secrets |
| User | ~/.claude.json | Personal experiments, testing new servers | No — not shared via git |
Built-in tool selection reference
| Task | Tool | When |
|---|---|---|
| Find files by name/pattern | Glob | **/*.test.tsx, src/components/**/*.ts |
| Search within file contents | Grep | Function name, import statement, error message |
| Read a complete file | Read | Load for analysis after Grep finds it |
| Create a new file from scratch | Write | Generating new test files |
| Edit specific snippet in a file | Edit | Unique text match required — fails if non-unique |
| Edit fails (non-unique match) | Read + Write fallback | Read full file, modify in memory, write back |
Domain 3 · Claude Code Config & Workflows
20%
CLAUDE.md hierarchy — 3 levels
| Level | Location | Scope | Version controlled? | Common mistake |
|---|---|---|---|---|
| User | ~/.claude/CLAUDE.md | One developer only | No | Putting team standards here — new members miss them |
| Project | .claude/CLAUDE.md or root CLAUDE.md | All contributors | Yes | Forgetting to commit — standards exist locally only |
| Directory | CLAUDE.md in subdirectory | Files in that directory only | Yes | Duplicating test rules across every directory |
Three activation mechanisms — the key exam distinction
| Mechanism | How it fires | Best for | Location |
|---|---|---|---|
| CLAUDE.md | Always loaded for every conversation | Universal standards: coding conventions, testing requirements that always apply | .claude/CLAUDE.md (project-scoped) |
| .claude/rules/ glob | Auto-loads when editing file matching glob pattern | Path-specific conventions: test files, API handlers, migration scripts — cross-cutting | .claude/rules/testing.md with paths: ["**/*.test.tsx"] |
| Skills (slash commands) | Manually invoked via /skill-name | Task-specific workflows: PR review, deployments, migrations, endpoint generation | .claude/commands/ or .claude/skills/ (project); ~/.claude/ (personal) |
Use .claude/rules/ when
- Rules should apply to specific file types (glob paths)
- Test conventions must apply across all test files regardless of directory
- Cross-cutting patterns not tied to a single task
- Context saving matters — irrelevant rules shouldn't load
Avoid
- Directory CLAUDE.md in every subfolder (duplication)
- Root CLAUDE.md with all rules always loaded (bloat)
- README.md for instructions (documentation, not loaded)
- Relying on Claude to infer which CLAUDE.md section applies
Skills — SKILL.md frontmatter parameters
| Parameter | Effect | When to use |
|---|---|---|
context: fork | Runs skill in isolated subagent — verbose output stays out of main session; prevents context bleed | Any skill with heavy output (analysis, codebase scanning, exploration); exploration skills that could bias subsequent implementation |
allowed-tools | Restricts which tools the skill can call | Security: prevent accidental Write/Delete in read-only skills; prevent destructive operations |
argument-hint | Prompts developer for a required argument at invocation time | When skill needs a path, module name, migration name, or other specific input ($ARGUMENTS) |
Scope precedence: Project skills (
.claude/skills/) win over personal skills (~/.claude/skills/) with the SAME name. To use a personal variant alongside the project version, use a DIFFERENT name (e.g., /my-commit vs /commit). Same name = project version silently overrides.
Planning mode vs direct execution
| Mode | Use when | What it does |
|---|---|---|
| Planning mode | Dozens of files; multiple valid architectural approaches; ambiguous requirements with divergent implications (Slack: webhooks vs bot tokens vs Slack App) | Read/Grep/Glob only — investigates and proposes plan — NO changes until approved |
| Direct execution | Single file fix, clear stack trace, one validation check, unambiguous change | Executes changes immediately |
| Explore subagent | Long verbose investigation that would fill main context before Phase 1 completes | Isolates discovery output, returns only accurate summary to main session |
CI/CD integration patterns
| CI pattern | How | Why |
|---|---|---|
| Non-interactive mode | -p / --print flag | Processes prompt, prints to stdout, exits — won't hang waiting for input |
| Structured findings for inline PR comments | --output-format json + --json-schema | Enforces well-formed JSON; parse + post via GitHub API |
| Session isolation for review | Independent Claude instance (no generator context) | Generator's reasoning context biases self-review — miss same mistakes |
| No duplicate comments on re-review | Include prior review results in context | Instruct: report only NEW or still-unresolved issues |
| Better test generation (no duplicates) | Include existing test files in context | Claude avoids suggesting already-covered scenarios |
Domain 4 · Prompt Engineering & Structured Output
20%
Few-shot vs explicit criteria — the key decision boundary
Use few-shot examples when
- Format/structure inconsistency (show exact output shape)
- Output varies across cases despite clear intent
- Tool selection for ambiguous input (show: 'My order is broken' → call lookup_order, rationale: could mean damage)
- Escalation calibration (show boundary cases explicitly)
- Acceptable vs problematic code patterns
- Multi-concern request decomposition (agent handles 1 concern at a time)
- Exact output format: issue, location, severity, suggested fix
Use explicit criteria when
- Novel pattern generalisation needed (rules extend to unseen cases)
- Severity classification consistency (CRITICAL/HIGH/MEDIUM/LOW with concrete definitions)
- Binary decisions with clear conditions (flag ONLY if confidence > 0.85)
- Eliminating vague instructions ('be conservative' → 'flag only if confidence > 0.85')
- Variable per-case gaps (→ pair with evaluator-optimizer self-critique)
Evaluator-optimizer / self-critique pattern
Use when: Output quality is inconsistently complete with variable, case-specific gaps — not a format problem. The agent evaluates its own draft against explicit completeness criteria (policy context included? timeline provided? next steps listed?) before presenting to the user. Catches gaps that few-shot examples cannot anticipate because gaps vary by case.
JSON schema — design rules
| Schema rule | Why it matters | Anti-pattern |
|---|---|---|
required: only truly always-present fields | Required + absent data = model fabricates a value to satisfy constraint | Marking optional fields required |
"type": ["string", "null"] for optional fields | Model returns null instead of hallucinating a value | "type": "string" on optional field |
enum + "other" + detail field | Captures unexpected values without losing them | No catch-all = novel values lost |
enum + "unclear" option | Honest uncertainty beats wrong categorization | Forcing model to pick wrong category |
tool_choice: any for guaranteed output | Without this, model may respond in plain text instead | tool_choice: "auto" when structure required |
Critical distinction:
tool_use eliminates SYNTAX errors (invalid JSON, missing braces, wrong types). It does NOT prevent SEMANTIC errors (wrong values, totals that don't add up, info in wrong field). Use Pydantic validation + retry-with-feedback loops for semantic correctness.
Message Batches API — decision matrix
| Workflow | API | Reason |
|---|---|---|
| Pre-merge check (developer waiting) | Synchronous | Cannot tolerate 24h delay = blocking workflow |
| Interactive code review session | Synchronous | Immediate feedback required |
| Overnight tech-debt report | Batch API | Non-blocking, result needed by morning — 50% savings |
| Weekly security audit | Batch API | Scheduled, latency-tolerant — 50% savings |
| Nightly test generation | Batch API | Already async/polling — 50% savings |
| Processing 10,000 documents | Batch API | High volume, non-urgent — large absolute savings |
| Iterative review (model requests files mid-review) | Synchronous only | Batch does NOT support multi-turn tool calling — async fire-and-forget = no mid-execution intercept |
Batch API key facts: 50% cost savings · Up to 24h processing (NO latency SLA) · Does NOT support multi-turn tool calling within one request ·
custom_id field = correlate request to response · On failure: re-submit only failed docs by custom_id
Explicit criteria vs vague instructions
Correct — explicit criteria with examples
- Flag ONLY if comment CONTRADICTS actual code behavior
- Flag if comment references non-existent function
- CRITICAL: runtime failure for users (NullPointerException in payment)
- HIGH: security vulnerability (SQL injection, XSS)
- MEDIUM: logic bug without immediate user impact
- LOW: code quality (duplication, suboptimal algorithm)
Vague — leads to inconsistency
- Check code comments for accuracy
- Be conservative about reporting issues
- Be more precise in your findings
- (No severity definitions = inconsistent ratings across PRs)
Domain 5 · Context Management & Reliability
15%
Progressive summarization risks
| What gets lost when history compresses | Safe? (survives /compact) | Fix |
|---|---|---|
| Exact dollar amounts ($89.99) | No → becomes 'some money' | Extract to case facts block |
| Percentages (15% discount) | No → becomes 'a discount' | Extract to case facts block |
| Specific dates (2025-01-15) | No → becomes 'recently' | Extract to case facts block |
| Order IDs, customer IDs | No → often lost entirely | Extract to case facts block |
| Actions taken (list of tool calls) | Partially | Keep in structured handoff payload |
| General topic / issue type | Yes — usually survives | Safe to leave in history |
Case facts block pattern
# Include in EVERY prompt, OUTSIDE the summarized history — update whenever new fact appears
=== CASE FACTS ===
Customer ID: CUST-12345 | Order ID: ORD-67890 | Order Date: 2025-01-15
Order Amount: $89.99 | Discount: 15% promo SAVE15
Issue: Damaged item on delivery | Customer Request: Full refund | Status: Pending approval
===
Lost-in-the-middle effect
Problem: Models reliably process start and end of long inputs — middle sections frequently missed. 75K token input: first 15K and last 10K reliable, middle 50K often ignored.
Fix: Key findings summary at TOP (primacy) → detailed data in middle with explicit section headers (navigation) → action items at BOTTOM (recency).
Fix: Key findings summary at TOP (primacy) → detailed data in middle with explicit section headers (navigation) → action items at BOTTOM (recency).
Context architecture — multi-agent
| Technique | How | Benefit |
|---|---|---|
| Coordinator as context orchestrator | Maintains global state, allocates context budgets to subagents | Prevents one agent consuming others' context allocation |
| Constrained subagent context | Pass only task-specific data + required prior results | Subagents stay focused, fewer distractions from irrelevant context |
| Explore subagent | Delegate verbose discovery to isolated subagent, get summary back | Verbose Phase 1 output doesn't pollute main session; accurate (not lossy) |
| Scratchpad file | Agent writes key findings to investigation-scratchpad.md | Survives /compact and session resumption — persists across context resets |
| Structured state persistence | agent-state/manifest.json: {web-search: completed, ...} | Crash recovery without restarting from zero |
Provenance & source tracking
# Correct — structured claim-to-source mapping (5 components)
{"claim": "AI music market $3.2B", "source_url": "https://example.com/report",
"source_name": "Global AI Music Report 2024", "publication_date": "2024-06-15", "confidence": 0.9}
# Conflicting sources — preserve BOTH, annotate, never arbitrarily pick one
{"values": [{"value":"12%","source":"Spotify 2024-03"},{"value":"8%","source":"MIA Survey 2024-07"}],
"conflict_detected": true, "explanation": "Different methodology and time period"}
Confidence calibration & reliability
| Concept | What it means | Anti-pattern |
|---|---|---|
| Field-level confidence scores | Score each extracted field individually (not just the whole doc) | Single doc-level confidence score only |
| Stratified random sampling | Audit high-confidence extractions by document type AND field segment | Only audit low-confidence extractions |
| Aggregate metrics mislead | 97% overall accuracy can hide 40% error rate on specific doc types | Reporting only overall accuracy |
| Coverage annotations | Mark synthesis sections as FULL / PARTIAL / NOT COVERED + reason | Silent omission of missing data sources |
Session management
| Command / concept | When to use | Risk / note |
|---|---|---|
--resume session-name | Continue long investigation across sessions | Stale tool results if files changed since last session |
fork_session | Compare two approaches from same starting point | Forks diverge independently after branch point |
| Start new session | Results are stale, lots of time has passed | Provide summary: 'Here's what we found so far: …' |
/compact | Context filling — LAST RESORT for single-phase tasks only | Numeric values, dates, IDs can be lost in summary |
Common anti-patterns in production agent systems
Engineering pitfalls worth recognising and avoiding
| Anti-pattern | Why it fails | Correct approach |
|---|---|---|
| Prompt for critical compliance ('NEVER do X without approval') | ~3% failure rate — model can be overridden by context. Financial/safety must be 100% | PreToolUse hook that programmatically blocks or redirects |
| Parsing text to end agentic loop ('Task completed', 'anything else?') | Model can produce these phrases mid-task. Text parsing is fragile and unreliable | stop_reason == 'end_turn' is the ONLY valid signal |
| Sentiment analysis for escalation (escalate when customer is angry) | Sentiment ≠ case complexity. Angry customer with simple return ≠ complex policy case | Explicit criteria: escalate on policy gap / explicit request / no progress |
| Self-rated confidence (1–10) for routing ('confidence: 8 → auto-process') | Model can be confidently wrong. Calibration is poor without labeled validation data | Calibrate on labeled validation sets with stratified sampling |
| Generic MCP error response ('Operation failed') | Coordinator cannot decide recovery: retry? escalate? continues? | Structured: errorCategory, isRetryable, attempted_query, partial_results |
| Single-pass review of 10+ files | Attention dilution: shallow coverage, inconsistent depth, contradictory findings across files | Per-file pass (local issues) + integration pass (cross-file) |
User-level ~/.claude/CLAUDE.md for team standards | New team members never receive the instructions. Only exists for one developer's machine | .claude/CLAUDE.md (project level, version controlled) |
| Required fields on optional information in JSON schema | If info absent from source, model fabricates a value to satisfy the required constraint | "type": ["string", "null"] + exclude from required array |
| Batch API for blocking workflows (pre-merge checks) | Up to 24h with no latency SLA — developer blocked waiting to merge | Synchronous API for blocking; batch only for overnight/weekly scheduled tasks |
| Same session to generate AND review code | Model retains its reasoning context and is less likely to challenge its own decisions | Independent Claude instance for review without generator context |
| Subagent calls another subagent directly (bypassing coordinator) | No central observability, no uniform error handling, no control over what coordinator receives | All communication flows through coordinator only |
| Overly narrow task decomposition (creative industries → only visual art) | Subagents execute correctly within wrong scope. Bug is in coordinator's decomposition logic | Coordinator must cover full topic scope before delegating distinct subtopics |
| Silent error suppression (return empty results = success) | Coordinator thinks no matches found when search actually failed | Distinguish access failures from valid empty results explicitly with error semantics |
| Abort entire workflow on one subagent failure | Loses all partial results from successful subagents that ran before the failure | Continue with partial results, annotate coverage gaps in synthesis output |
/compact for multi-phase tasks (context window filling) | Lossy — exact numbers, dates, IDs lost in summary; subsequent phases have degraded context | Explore subagent for verbose Phase 1 — returns accurate summary to main session |
| Instructions in README.md or directory CLAUDE.md for path-specific rules | README.md is documentation — not loaded as instructions. Directory CLAUDE.md requires duplication | .claude/rules/ with glob frontmatter — auto-loads for matching file paths |
Quick reference glossary
Terms, formats, and key definitions
| Term / keyword | Definition / when used |
|---|---|
stop_reason | API response field. end_turn = done (ONLY valid exit). tool_use = execute tool and loop. max_tokens = response truncated |
tool_choice: auto | Model decides whether to call a tool or respond in text. Default for most use cases |
tool_choice: any | Model MUST call some tool. Use when guaranteed structured output is required |
tool_choice: {tool} | Model MUST call this specific tool. Use to enforce step ordering or first-step guarantees |
isError: true | MCP error response flag. Always pair with structured context (errorCategory, isRetryable, message, attempted_query) |
Task tool | How coordinator spawns subagents. Must be in coordinator's allowedTools list for parallel spawning |
allowedTools | AgentDefinition parameter listing permitted tools. Principle of least privilege — fewer = more reliable, less misuse |
context: fork | SKILL.md frontmatter. Runs skill in isolated subagent. Verbose output doesn't pollute main session. Prevents context bleed |
allowed-tools | SKILL.md frontmatter. Restricts which tools the skill can invoke. Use for security and least-privilege enforcement |
argument-hint | SKILL.md frontmatter. Prompts user to provide an argument when skill invoked without one. Uses $ARGUMENTS |
.claude/rules/ | Directory for topic-scoped rule files. YAML frontmatter with paths: glob patterns for conditional (path-triggered) loading |
paths: glob | YAML frontmatter in .claude/rules/ files. Rule loads ONLY when editing a file matching the pattern |
@import syntax | CLAUDE.md can reference external files: @./standards/testing.md. Relative to file location. Max nesting depth: 5 |
-p / --print | Claude Code CLI flag for non-interactive mode. Processes prompt, prints to stdout, exits. Required for CI/CD |
--output-format json | Claude Code CLI flag. Returns structured JSON. Pair with --json-schema for validated, schema-enforced output |
fork_session | Creates independent investigation branch from shared context. Forks diverge independently afterward |
--resume name | Continues a named session. Risk: tool results may be stale if files changed since last session |
/compact | Built-in command to summarize conversation history. Warning: exact numbers and dates may be lost. Last resort only |
custom_id | Batch API field to correlate request to response. Use to re-submit only failed docs on failure |
| hub-and-spoke | Multi-agent topology. Coordinator at center, subagents at spokes. All communication via coordinator only |
| lost-in-the-middle | Model attention effect. Start and end of long inputs processed reliably, middle sections frequently missed |
| case facts block | Structured persistent facts block included in every prompt OUTSIDE the summarized history. Update as new facts appear |
| scratchpad file | investigation-scratchpad.md: agent writes key findings, reads when context degrades or session resumes |
| stratified sampling | Audit high-confidence extractions by document type AND field segment — not just overall accuracy |
| coverage annotations | In synthesis output: mark sections as FULL COVERAGE / PARTIAL COVERAGE / NOT COVERED with reason |
| provenance | Claim-to-source mapping: claim, source_url, source_name, publication_date, confidence per claim |
| planning mode | Claude Code mode: Read/Grep/Glob only — investigates and proposes plan — no changes until approved |
| evaluator-optimizer | Pattern: agent critiques its own draft against explicit criteria before presenting. Catches variable per-case gaps |
| PreToolUse hook | Intercepts BEFORE tool call. 100% deterministic. Required for financial thresholds, compliance, safety rules |
| PostToolUse hook | Intercepts AFTER tool result. 100% deterministic. Use for data normalization, format unification, field trimming |
| constrained replacement | When a tool is misused, replace with a scoped version (not remove). Makes misuse architecturally impossible |