Skip to content

Real Claude Code sessions

Part A of the eval counted the tokens that an agent reads to prove 30 claims with exact quotes. It used a proxy tokenizer and no model. Part B asks the same questions in real sessions of Claude Code (claude -p), in CI. The tokens and the cost come from the usage that Claude Code reports, with each model of the session.

Each run gives each claim the same prompt in each of its arms, with the same model. The arms are:

  • mcp: only the MCP tools of polite-crawler-mcp, with a new store.
  • mcp-quote: the same server with --tools quote. The session gets only crawl_fetch, crawl_find, crawl_read and crawl_verify. Only the run of 0.2.3 has this arm.
  • webfetch: only the built-in tool WebFetch.

The results:

  • WebFetch costs less than polite-crawler, also with the shorter tool text of 0.2.3. With Sonnet, the median session costs $0.0099 with WebFetch. With polite-crawler, it costs $0.0177 with 0.2.1, $0.0166 with 0.2.3 and $0.0158 with --tools quote.
  • The shorter tool text cut the tokens more than the cost. With polite-crawler-mcp 0.2.3, the median session read 30% fewer tokens, and 39% fewer with --tools quote. The new version cut the median cost of a session by 6% and 11%. It cut the cost for each quote on the page by 10% and 14%.
  • polite-crawler gives more quotes that are word for word on the page. With Sonnet, 86 and 88 of 90 sessions have each quote on the page with 0.2.3, and 88 with 0.2.1. WebFetch has 82 of 90. With Opus, the two arms are almost equal: 29 of 30 against 30 of 30.
  • The writes to the cache make the difference. A token that the main model writes to its cache costs 25 times a token that it reads from the cache. The tools of polite-crawler put text of the page into the context of the main model. The main model writes that text to its cache. WebFetch gives the page to a small model (claude-haiku-5-5), and the main model gets only a short answer.
  • Only polite-crawler lets the agent check its quote. crawl_verify finds the quote in the stored page, and the stored capture has an id that a citation can name. With WebFetch, the main model does not see the page, so it cannot check the quote.
  • The WebFetch arm started one time. The run of 0.2.3 changed only polite-crawler-mcp, so it did not start WebFetch again. For WebFetch, this page uses the sessions of the run of 0.2.1 with Sonnet.
  • The whole eval cost $8.6163 for 428 sessions, with a dry run for each version: 8 sessions in total. The run of 0.2.3 cost $3.3529, and its dry run $0.0879.
Model Run Arm Sessions The quote of the claim Quotes on the page Median cost of a session Cost for each quote on the page
Sonnet 0.2.1 mcp 90 79 88 $0.0177 $0.0220
Sonnet 0.2.3 mcp 90 81 86 $0.0166 $0.0197
Sonnet 0.2.3 mcp-quote 90 81 88 $0.0158 $0.0188
Sonnet 0.2.1 webfetch 90 83 82 $0.0099 $0.0132
Opus 0.2.1 mcp 30 26 29 $0.0408 $0.0464
Opus 0.2.1 webfetch 30 28 30 $0.0201 $0.0244

The column “Run” gives the version of polite-crawler-mcp in the run. The WebFetch arm does not use polite-crawler-mcp, and only the runs of 0.2.1 have it. The cost of a session includes each model of the session. The cost for each quote on the page is the cost of the arm, divided by the sessions with each quote on the page.

  • The quote of the claim (verified): the answer holds the quote of the claim.
  • Quotes on the page: each quote of the answer is on the page, word for word.

The two checks give different counts. An answer can quote a different sentence of the page. Then its quote is on the page, but it is not the quote of the claim. For the question “What does the map method of an array return?”, the two arms quoted “A new array with each element being the result of the callback function.” That sentence is on the page and answers the question, but the claim has a different sentence.

By the check of the claim, WebFetch has a few more. With Sonnet, it has 83, against 79 with 0.2.1 and 81 with 0.2.3. With Opus, it has 28 against 26.

With Sonnet, most quotes of WebFetch that are not on the page join or drop text. Examples are a footnote mark “[1]” in the quote, the pronunciation left out of “Alan Mathison Turing (23 June 1912 – 7 June 1954)”, and two sentences joined as one. The small model of WebFetch reads the page, and the main model gets only its answer.

The sessions of polite-crawler with no quote on the page are almost all on one claim: the status code 418 of RFC 9110. That quote is past the cut of the reader, at 50,000 characters. With 0.2.1, one session gave a quote that is not on the page. Two sessions, one with each model, stopped at the limit of turns with no answer.

With 0.2.3, the description of crawl_read tells the model where the text stops, and that crawl_verify finds a quote past that point. On the claim of the status code 418, 4 of the 6 sessions of 0.2.3 said that the stored text stops before the section. They gave no quote. One session stopped at the limit of turns.

In one session, crawl_verify found a different sentence of the section. That quote is on the page, but it is not the quote of the claim. With 0.2.3, one other session gave a quote that is not on the page, on WCAG 2.1.

Part A counted fewer tokens for polite-crawler, and 0.2.3 cut the tokens again. Why does WebFetch still cost less? The price of a token changes with its kind and with the model. These are the prices of the sessions, in USD for one million tokens:

Model Input Written to the cache Read from the cache Output
Sonnet (claude-sonnet-5-5) $2.00 $2.50 $0.10 $10.00
The small model of WebFetch (claude-haiku-5-5) $0.10 none none $0.50

The data script checks that these prices give the cost that Claude Code reported for each model of each session. The small model wrote nothing to a cache and read nothing from a cache.

The median tokens of a session with Sonnet, for each kind of token:

Median of a session mcp, 0.2.1 mcp, 0.2.3 mcp-quote, 0.2.3 webfetch
Turns 4 3 4 2
Main model: input 8 6 8 4
Main model: written to the cache 4,998 4,705 4,502 2,206
Main model: read from the cache 31,639 18,922 17,744 4,415
Main model: output 337 309 328 185
Small model: input none none none 13,133
Small model: output none none none 476
All the tokens that the models read 35,628 24,829 21,752 19,945

Each number is the median of its row, so the numbers of a column do not add up. The cost of each arm, for its 90 sessions, by the kind of token:

The cost of the arm mcp, 0.2.1 mcp, 0.2.3 mcp-quote, 0.2.3 webfetch
Main model: input $0.0014 $0.0014 $0.0014 $0.0008
Main model: written to the cache $1.2532 $1.1259 $1.1423 $0.5208
Main model: read from the cache $0.3020 $0.2337 $0.1658 $0.0460
Main model: output $0.3755 $0.3348 $0.3476 $0.2344
The small model none none none $0.2835
All $1.9321 $1.6958 $1.6571 $1.0854

These numbers show four facts:

  • The shorter tool text cut the cheapest kind of token. The tool definitions are the same in each session. Thus the main model reads them from the cache, at the lowest price. With 0.2.3, the median session of the arm mcp reads 12,717 fewer tokens from the cache than with 0.2.1. At the price of a read, that is $0.0013 for each session.
  • The writes to the cache are the largest part of the cost. They are 69% of the cost of the arm mcp-quote, and 66% of the arm mcp. The median session writes 4,502 tokens with --tools quote. The main model of WebFetch writes 2,206.
  • WebFetch keeps the page out of the context of the main model. The small model reads a median of 13,133 tokens in each session, at $0.10 for one million. That is the price of a read from the cache of Sonnet. The main model gets only the answer of the small model.
  • The writes to the cache cost more than the whole difference. For 90 sessions, the arm mcp-quote cost $0.5717 more than WebFetch. Its writes to the cache cost $0.6215 more. The small model of WebFetch cost $0.2835, and the arms of polite-crawler have no such cost.

The streams of the sessions show where the writes are. These numbers are medians from the artifacts sessions-mcp, sessions-mcp-quote and sessions-webfetch of the runs. eval-b.json does not hold them.

Median of a session, from the streams mcp, 0.2.1 mcp, 0.2.3 mcp-quote, 0.2.3 webfetch
The first request: read from the cache 5,823 4,652 2,412 1,254
The first request: written to the cache 2,258 2,139 2,128 1,905
The later requests: written to the cache 2,751 2,574 2,370 304
Characters of the tool results 5,308 4,689 4,462 357
  • The first request of a session reads the text that the sessions of an arm share. That text holds the tool definitions, so the shorter tool text of 0.2.3 is easy to see there. The first request writes a little more with polite-crawler than with WebFetch.
  • The later requests write the new part of the context. That part holds the tool results and the turns of the model. The tool results of polite-crawler hold text of the page. The result of WebFetch is the short answer of the small model.

Thus the shorter tool text made a cheap part of the session smaller. The expensive part is the new text in the context of the main model. With polite-crawler, the later requests write 2,066 to 2,270 more tokens to the cache than with WebFetch. With WebFetch, the text of the page goes to the small model, and it does not come into that context.

The fixed part of the cost is large. With Sonnet, the cheapest session cost $0.0129 with polite-crawler 0.2.1, $0.0122 with 0.2.3 and $0.0071 with WebFetch. On the shortest page, RFC 1149, a session cost $0.0159 with polite-crawler 0.2.1, $0.0145 with --tools quote and $0.0078 with WebFetch.

The cost of a session for each claim, the shortest page first on a linear axis in USD, with each model counted. The grid lines are at each $0.02.
  • polite-crawler
  • polite-crawler, four tools
  • WebFetch, from the run of 0.2.1
  • each of the 3 sessions. The full mark is the median.
  • polite-crawler costs less (2 claims)

RFC 9110: Why can HTTP not use the 418 status code?

With Sonnet, a session with polite-crawler cost $0.0498, with the four tools $0.0393, and a session with WebFetch $0.0327 (the median of 3 sessions in each arm, polite-crawler-mcp 0.2.3, WebFetch from the run of 0.2.1). polite-crawler costs 1.5× more.

polite-crawler0 of 3 with the quote on the page

  • $0.0342, 8 turns, no quote
  • $0.0719, 13 turns, no quote
  • $0.0498, 11 turns, no quote

polite-crawler, four tools1 of 3 with the quote on the page

  • $0.0442, 11 turns, no quote
  • $0.0393, 10 turns, the quote is on the page
  • $0.0382, 9 turns, no quote

WebFetch2 of 3 with the quote on the page, from the run of 0.2.1

  • $0.0327, 4 turns, a quote is not on the page
  • $0.0230, 3 turns, the quote is on the page
  • $0.0416, 5 turns, the quote is on the page
Show each claim as a table
Page and questionpolite-crawlerpolite-crawler, four toolsWebFetch, from the run of 0.2.1polite-crawler ÷ WebFetchpolite-crawler, four tools ÷ WebFetchOn the page: polite-crawlerOn the page: polite-crawler, four toolsOn the page: WebFetch
RFC 1149What kind of service do avian carriers provide for IP datagrams?$0.0152$0.0145$0.00781.961.873 of 33 of 33 of 3
PEP 20What is the first aphorism of the Zen of Python?$0.0150$0.0143$0.00722.091.993 of 33 of 33 of 3
RFC 2119What does the key word MUST mean in an RFC?$0.0165$0.0158$0.00812.041.963 of 33 of 33 of 3
Declaration of IndependenceWhich truths does the Declaration of Independence hold to be self-evident?$0.0138$0.0158$0.01041.331.523 of 33 of 33 of 3
RFC 4180How are the records of a CSV file separated?$0.0129$0.0148$0.00811.591.823 of 33 of 33 of 3
RFC 6585What does the HTTP status code 429 mean?$0.0205$0.0199$0.00852.432.353 of 33 of 33 of 3
Human Rights Act 1998Does the UK Human Rights Act protect the right to life?$0.0129$0.0149$0.00881.471.693 of 33 of 33 of 3
RFC 2324What happens when someone tries to brew coffee with a teapot?$0.0160$0.0151$0.00871.841.743 of 33 of 33 of 3
MDN: JSON.parseWhat does JSON.parse do?$0.0190$0.0186$0.00932.041.993 of 33 of 33 of 3
Data Protection Act 2018What does the UK Data Protection Act 2018 make provision about?$0.0205$0.0212$0.00842.452.543 of 33 of 33 of 3
MDN: Promise.allWhat does Promise.all take as input?$0.0198$0.0223$0.00982.032.293 of 33 of 33 of 3
RFC 9309How long can a crawler use a cached robots.txt file?$0.0164$0.0157$0.00921.781.703 of 33 of 33 of 3
RFC 9309What is the smallest robots.txt parsing limit that a crawler can use?$0.0220$0.0235$0.01012.192.343 of 33 of 33 of 3
Node.js: pathWhat does the Node.js path module do?$0.0122$0.0152$0.00861.431.783 of 33 of 33 of 3
MDN: Array.mapWhat does the map method of an array return?$0.0195$0.0164$0.00932.101.783 of 33 of 33 of 3
US ConstitutionWhy did the people of the United States ordain the Constitution?$0.0147$0.0140$0.01141.281.223 of 33 of 33 of 3
RFC 8259Which character encoding must JSON text use between systems?$0.0133$0.0155$0.00911.451.693 of 33 of 33 of 3
Python: jsonWhat kind of format is JSON, according to the Python documentation?$0.0222$0.0190$0.00992.241.923 of 33 of 30 of 3
Python: collectionsWhat does the Python collections module implement?$0.0164$0.0151$0.01041.571.453 of 33 of 33 of 3
Wikipedia: Robots.txtWhat is the file robots.txt for?$0.0188$0.0181$0.01251.501.443 of 33 of 31 of 3
Node.js: eventsWhich architecture is the Node.js core API built around?$0.0125$0.0146$0.01221.031.203 of 33 of 33 of 3
Wikipedia: Web crawlerWhat is a web crawler?$0.0182$0.0179$0.01491.221.203 of 33 of 33 of 3
Python: functionsAre the built-in functions of Python always available?$0.0170$0.0145$0.01131.511.283 of 33 of 33 of 3
WCAG 2.1What does WCAG 2.1 cover?$0.0208$0.0152$0.02500.83 (polite-crawler costs less)0.61 (polite-crawler, four tools costs less)2 of 33 of 33 of 3
Wikipedia: Python (programming language)Which language did Python succeed?$0.0215$0.0329$0.01251.722.623 of 33 of 33 of 3
RFC 8446What is the primary goal of TLS 1.3?$0.0164$0.0151$0.01311.251.153 of 33 of 33 of 3
Wikipedia: Alan TuringWhen was Alan Turing born?$0.0314$0.0306$0.02101.501.463 of 33 of 31 of 3
Node.js: fsWhat is the Node.js fs module modeled on?$0.0153$0.0147$0.01191.281.233 of 33 of 33 of 3
RFC 9110What does the 404 Not Found status code mean?$0.0167$0.0157$0.02000.84 (polite-crawler costs less)0.79 (polite-crawler, four tools costs less)3 of 33 of 33 of 3
RFC 9110Why can HTTP not use the 418 status code?$0.0498$0.0393$0.03271.521.200 of 31 of 32 of 3

Select a model and a version of polite-crawler-mcp. With 0.2.3, the figure shows the two arms of that run and the WebFetch arm of the run of 0.2.1. The ▼ marks a claim on which the arm mcp costs less than WebFetch.

The count of part A gives the order: the claims go from the shortest page to the longest. With Sonnet, the cost of polite-crawler stays near its median on most pages. The cost of WebFetch grows with the page, because its small model reads the whole page.

With Sonnet, polite-crawler costs less on only 2 of 30 claims: RFC 9110 (“What does the 404 Not Found status code mean?”) and WCAG 2.1 (“What does WCAG 2.1 cover?”). They are two of the longest pages. With 0.2.3, the two arms of polite-crawler cost less on the same 2 claims. With Opus and one session in each arm, it costs less on RFC 9110 (“What does the 404 Not Found status code mean?”) and Wikipedia: Web crawler (“What is a web crawler?”).

The most expensive sessions of polite-crawler are on pages where the agent searched and read many times. Examples are the status code 418 of RFC 9110, and the Wikipedia articles about Python and Alan Turing.

A session with Opus costs approximately two times as much as a session with Sonnet, in each arm. The median session of polite-crawler costs 2.3 times as much with Opus, and the median session of WebFetch 2.0 times. The ratio between the arms stays almost the same: with 0.2.1, WebFetch costs approximately half.

With Opus, each claim has only one session in each arm. Thus with Opus, the cost of one claim can change more when the eval starts again. The eval did not start Opus with 0.2.3.

  1. The sessions. In CI, a job for each arm starts the sessions one after the other. Each session starts in a new empty folder, with no settings and no CLAUDE.md. The workflow pins the versions of Claude Code and polite-crawler-mcp.
  2. The prompt. The prompt gives the URL and the question. It asks for the exact words of the page between <quote> and </quote>.
  3. The usage. The record of a session takes the tokens and the cost from the result of Claude Code. The record counts each model, also the small model of WebFetch.
  4. The checks. The check of the claim compares the quote of the answer with the quote of the claim. For the check of the page, the summary fetches each page one time with the crawler. It looks for each quote of each answer on the page, word for word. It also accepts a quote with no inline Markdown.
  5. The repeats. With Sonnet, each claim got 3 sessions in each arm of each run. With Opus, it got 1 session in each arm.
  6. The stops. --max-turns stops a session after 12 turns, and --max-budget-usd stops a session at 1 USD.
  7. The second run. The run of 0.2.3 started only the arms mcp and mcp-quote, with the same claims, prompt, model and Claude Code. Pull request 38 made the tool text shorter. Part A counts these tokens with a proxy tokenizer. In that count, the text that the API gets on each turn went from 3,351 tokens to 2,372. With --tools quote, it went to 1,039.

The README of the eval gives each step. The code of commit aa97ae2 made the summaries of 0.2.1 again, in workflow 40155103977 and workflow 40155110580. The run of 0.2.3 made its own summary, with the code of commit f19d91a. The numbers of this page are in eval-b.json.

  • The eval started each arm one time. The runs started on October 25, 2026. The pages, the models and Claude Code change, so a different day can give different numbers.
  • The eval did not start the WebFetch arm again. For 0.2.3, the comparison with WebFetch uses the sessions of the run of 0.2.1. The two runs used the same model, Claude Code and claims, on the same day, approximately three hours apart.
  • Opus has only one session for each claim, and only with 0.2.1. Sonnet has 3 sessions for each claim in each arm.
  • The claims are short single facts. Each session proves one fact on one page. Thus each claim pays the fixed cost of the MCP server one time. Part A counts that cost one time for a session of 30 claims.
  • The prompt gives the URL. The agent does not search for the page.
  • The small model of WebFetch does the reading. The main model sees only the answer of that small model. The eval checks the answer against the page, but the agent cannot.
  • Claude Code is in each arm. Its own system prompt is in each session of each arm, so it adds to the cost of each arm. A different agent gives different costs.
  • The split by the kind of token is a count, not a test of a cause. The eval did not start sessions with a different read window or with smaller search results.

The shorter tool text is done: 0.2.3 has it, and --tools quote gives only four tools. The data point at the tool results. A smaller result of crawl_find and crawl_read writes fewer tokens to the cache, if the session needs no more turns. Part B can measure such a change with the same workflow.