Skip to content

CCAR-P · Domain 2: Claude Models, Prompting, and Context Engineering · 13% of the exam

Task 2.4: Context Composition and Token Economics

Reading what fills the context and how caching behaves against a token budget and a call volume, to find where tokens can be cut without losing what the task needs.

Study it

Sample questions

Try each one before opening the answer. Every option is explained, with the Anthropic documentation page that proves it.

Question 1 · choose 1

A finance assistant answers aggregate questions (sums, filtered counts, group-bys) over a 2,000-row orders export. Each question is sent like this:{ "model": "claude-opus-5-5", "max_tokens": 2048, "messages": [{ "role": "user", "content": [ {"type": "text", "text": "<orders_csv>\norder_id,region,sku,qty,amount,date\n... 2,000 rows ...\n</orders_csv>"}, {"type": "text", "text": "Total amount for region EMEA in Q3?"} ] }] }The table is about 90,000 input tokens per question, and many answers are wrong. Which change reduces token consumption without losing the information the questions need?

  1. AAdd a cache_control breakpoint after the table block so that later questions read the rows from the cache
  2. BKeep the pasted table and ask Claude to work through each aggregate step by step before giving the total
  3. CMove the table into the system prompt so that it is sent once per conversation instead of with every question
  4. DUpload the export once with the Files API and give Claude the code execution tool to compute over the file
Show the answer and why
  • AAdd a cache_control breakpoint after the table block so that later questions read the rows from the cache

    Incorrect

    Caching changes what the repeated rows cost; the table is still computed over as pasted text, the approach that answered poorly.

  • BKeep the pasted table and ask Claude to work through each aggregate step by step before giving the total

    Incorrect

    The rows still enter every request as about 90,000 input tokens, the cost the guidance says to remove.

  • CMove the table into the system prompt so that it is sent once per conversation instead of with every question

    Incorrect

    The Messages API is stateless: every request carries its full input, system prompt included.

  • DUpload the export once with the Files API and give Claude the code execution tool to compute over the file

    Correct

    When the model has to compute over a table, the guidance is to upload it and query it with code execution instead of pasting it.

The cost guidance says to keep data files out of the prompt: when Claude has to compute over a table, upload it with the Files API and let it query the file with the code execution tool. In Anthropic's measurement over a 1,862-row CSV, the pasted table cost about 91,000 input tokens per request and got 7 of 25 aggregate questions right; uploaded with code execution, all 25 were right at about a twelfth of the cost.

Question 2 · choose 1

A developer keeps a long Claude Code session open and runs "/loop 5m check whether the release build finished and report the result". Usage climbs fast while the session sits idle. Which change cuts the tokens this check spends, according to Claude Code's documentation?

  1. AShorten the interval to one minute, so that each run reads the conversation from a warm prompt cache
  2. BHave Claude watch the build with the Monitor tool instead of re-running a prompt on an interval
  3. CStart the loop's prompt with /clear, so that each run begins from an empty context
  4. DMove the session to the background, where a firing loop no longer sends the conversation's context
Show the answer and why
  • AShorten the interval to one minute, so that each run reads the conversation from a warm prompt cache

    Incorrect

    Each fire still sends the full context; cached reads still draw usage, and more fires mean more requests.

  • BHave Claude watch the build with the Monitor tool instead of re-running a prompt on an interval

    Correct

    Monitor streams a background script's output back, which avoids polling and is often more token-efficient.

  • CStart the loop's prompt with /clear, so that each run begins from an empty context

    Incorrect

    In a scheduled fire, built-in commands such as /clear reach Claude as plain text instead of running.

  • DMove the session to the background, where a firing loop no longer sends the conversation's context

    Incorrect

    A background session keeps running the loop, and each fire still sends the full context.

A session-scoped scheduled task fires on its interval even while the session is idle, and each fire sends the session's full context, which a long session re-reads at the cached rate at best. For watching a build, the Monitor tool runs a background script and streams each output line back, which avoids polling and is often more token-efficient and responsive than re-running a prompt on an interval. Built-in commands in a scheduled prompt arrive as plain text, and backgrounding the session carries the loop along.

Practice domain 2 →Practice all domains →