Tokens to prove a claim
An agent that cites a page must check the quote. How many tokens does it read to do that? Part A of the eval counts them for 30 claims on 28 pages, in CI, with no model. Each claim has a question and an exact quote from a page. The pages are RFCs, Wikipedia articles, MDN, the documentation of Node.js and Python, government pages and one W3C recommendation.
The polite-crawler path is four calls of its MCP server. crawl_fetch stores the page, and crawl_find searches the store with the question. crawl_read reads 2,000 characters at the quote, and crawl_verify checks the quote. The other path reads the whole page as Markdown, the way WebFetch converts a page.
- 30 of 30 claims are verified.
crawl_verifyfound each quote. - In total, the pages as Markdown have 8.91 times the tokens of the polite-crawler path: 988,312 against 110,874.
- For one claim, the median ratio is 2.22. A typical page is not long, so the difference for one claim is smaller than the difference in total.
- On 4 very short pages, polite-crawler costs more. Its search results and its read window are longer than the page.
Each claim
Section titled “Each claim”- polite-crawler: fetch, find, read and verify
- WebFetch proxy: the page as Markdown
- The visible text of the page
- polite-crawler costs more (4 claims)
RFC 9110: Why can HTTP not use the 418 status code?
polite-crawler reads 2,848 tokens to prove the claim. The page as Markdown has 161,837 tokens, and its visible text 106,510. polite-crawler reads 57 times fewer.
crawl_fetch265crawl_find2,270crawl_read0crawl_verify313
crawl_find gives the page at place 4 of its results. The quote is past the cut of the reader (50,000 characters), so the path has no read. The excerpt of crawl_verify shows the text around the quote.
The axis is a log axis. The pages go from 701 to 161,837 tokens, and a linear axis puts the short pages at 0. On a log axis, the same distance is the same ratio. The panel below the figure shows the four steps of the polite-crawler path on a linear bar. A stack of parts on a log axis gives the wrong lengths.
The cost of polite-crawler stays between 2,010 and 4,318 tokens for each claim. It reads search results and a window of the page, not the page. The cost of the page grows with the page. RFC 9110 as Markdown has approximately 56 times the tokens of the path. The Wikipedia article about the mathematician has approximately 49 times the tokens.
A session
Section titled “A session”- polite-crawler, with the tool definitions (5,993 tokens) one time at the start
- WebFetch proxy: each page as Markdown
In this order, polite-crawler stays below the proxy from claim 2 on. Before that, the one-time tool definitions weigh more than the pages. After 30 claims: 116,867 against 988,312 tokens.
Show the running totals as a table
| Claims | The last page | polite-crawler | WebFetch proxy |
|---|---|---|---|
| 1 | RFC 9309 | 9,608 | 7,935 |
| 2 | RFC 9309 | 13,157 | 15,870 |
| 3 | RFC 2119 | 16,806 | 16,931 |
| 4 | RFC 9110 | 19,696 | 178,768 |
| 5 | RFC 9110 | 22,544 | 340,605 |
| 6 | RFC 1149 | 26,151 | 341,306 |
| 7 | RFC 2324 | 29,858 | 346,670 |
| 8 | RFC 8259 | 33,573 | 355,325 |
| 9 | RFC 6585 | 37,133 | 360,145 |
| 10 | RFC 4180 | 40,820 | 364,074 |
| 11 | RFC 8446 | 44,415 | 454,824 |
| 12 | Wikipedia: Web crawler | 48,479 | 482,091 |
| 13 | Wikipedia: Robots.txt | 52,506 | 502,180 |
| 14 | Wikipedia: Alan Turing | 54,516 | 601,352 |
| 15 | Wikipedia: Python (programming language) | 57,994 | 670,578 |
| 16 | MDN: Array.map | 61,831 | 678,739 |
| 17 | MDN: JSON.parse | 65,512 | 684,256 |
| 18 | MDN: Promise.all | 69,227 | 691,699 |
| 19 | Node.js: fs | 72,723 | 812,935 |
| 20 | Node.js: path | 76,673 | 820,950 |
| 21 | Node.js: events | 80,135 | 847,687 |
| 22 | Python: json | 84,345 | 857,521 |
| 23 | Python: functions | 88,510 | 885,167 |
| 24 | Python: collections | 92,545 | 901,260 |
| 25 | PEP 20 | 96,342 | 901,995 |
| 26 | Declaration of Independence | 100,510 | 905,732 |
| 27 | US Constitution | 104,586 | 914,263 |
| 28 | Data Protection Act 2018 | 108,297 | 920,101 |
| 29 | Human Rights Act 1998 | 112,549 | 925,201 |
| 30 | WCAG 2.1 | 116,867 | 988,312 |
The MCP server costs 5,993 tokens one time in each session: the definitions of its tools. Thus a session that proves one short claim costs more with polite-crawler. The order of the claims changes when polite-crawler goes below the proxy and stays there:
- In the order of the eval, from claim 2 on.
- With the short pages first, from claim 12 on.
- With the long pages first, from claim 1 on.
After all 30 claims, the order does not matter: 116,867 tokens against 988,312. The figure counts no tool definition for WebFetch.
Each number
Section titled “Each number”| RFC 9309What is the smallest robots.txt parsing limit that a crawler can use? | 7,935 | 5,679 | 3,615 | 2.20 | 1 |
|---|---|---|---|---|---|
| RFC 9309How long can a crawler use a cached robots.txt file? | 7,935 | 5,679 | 3,549 | 2.24 | 1 |
| RFC 2119What does the key word MUST mean in an RFC? | 1,061 | 903 | 3,649 | 0.29 (polite-crawler costs more) | 6 |
| RFC 9110What does the 404 Not Found status code mean? | 161,837 | 106,510 | 2,890 | 56.00 | 2past the cut: no read |
| RFC 9110Why can HTTP not use the 418 status code? | 161,837 | 106,510 | 2,848 | 56.82 | 4past the cut: no read |
| RFC 1149What kind of service do avian carriers provide for IP datagrams? | 701 | 623 | 3,607 | 0.19 (polite-crawler costs more) | 1 |
| RFC 2324What happens when someone tries to brew coffee with a teapot? | 5,364 | 4,309 | 3,707 | 1.45 | 1 |
| RFC 8259Which character encoding must JSON text use between systems? | 8,655 | 6,295 | 3,715 | 2.33 | 1 |
| RFC 6585What does the HTTP status code 429 mean? | 4,820 | 3,557 | 3,560 | 1.35 | 1 |
| RFC 4180How are the records of a CSV file separated? | 3,929 | 2,785 | 3,687 | 1.07 | 1 |
| RFC 8446What is the primary goal of TLS 1.3? | 90,750 | 68,147 | 3,595 | 25.24 | 2 |
| Wikipedia: Web crawlerWhat is a web crawler? | 27,267 | 11,386 | 4,064 | 6.71 | 1 |
| Wikipedia: Robots.txtWhat is the file robots.txt for? | 20,089 | 7,101 | 4,027 | 4.99 | 1 |
| Wikipedia: Alan TuringWhen was Alan Turing born? | 99,172 | 32,667 | 2,010 | 49.34 | 1 |
| Wikipedia: Python (programming language)Which language did Python succeed? | 69,226 | 22,653 | 3,478 | 19.90 | 2 |
| MDN: Array.mapWhat does the map method of an array return? | 8,161 | 3,134 | 3,837 | 2.13 | 4 |
| MDN: JSON.parseWhat does JSON.parse do? | 5,517 | 2,482 | 3,681 | 1.50 | 1 |
| MDN: Promise.allWhat does Promise.all take as input? | 7,443 | 3,312 | 3,715 | 2.00 | 1 |
| Node.js: fsWhat is the Node.js fs module modeled on? | 121,236 | 66,129 | 3,496 | 34.68 | 1 |
| Node.js: pathWhat does the Node.js path module do? | 8,015 | 4,702 | 3,950 | 2.03 | 2 |
| Node.js: eventsWhich architecture is the Node.js core API built around? | 26,737 | 16,804 | 3,462 | 7.72 | 1 |
| Python: jsonWhat kind of format is JSON, according to the Python documentation? | 9,834 | 6,384 | 4,210 | 2.34 | 1 |
| Python: functionsAre the built-in functions of Python always available? | 27,646 | 18,806 | 4,165 | 6.64 | 1 |
| Python: collectionsWhat does the Python collections module implement? | 16,093 | 10,875 | 4,035 | 3.99 | 4 |
| PEP 20What is the first aphorism of the Zen of Python? | 735 | 434 | 3,797 | 0.19 (polite-crawler costs more) | 2 |
| Declaration of IndependenceWhich truths does the Declaration of Independence hold to be self-evident? | 3,737 | 2,576 | 4,168 | 0.90 (polite-crawler costs more) | 1 |
| US ConstitutionWhy did the people of the United States ordain the Constitution? | 8,531 | 6,370 | 4,076 | 2.09 | 1 |
| Data Protection Act 2018What does the UK Data Protection Act 2018 make provision about? | 5,838 | 2,802 | 3,711 | 1.57 | 1 |
| Human Rights Act 1998Does the UK Human Rights Act protect the right to life? | 5,100 | 3,788 | 4,252 | 1.20 | 2 |
| WCAG 2.1What does WCAG 2.1 cover? | 63,111 | 28,894 | 4,318 | 14.62 | 1 |
The ratio is the tokens of the page as Markdown divided by the tokens of the polite-crawler path. A ratio below 1 is a claim on which polite-crawler costs more. The place in crawl_find is the place of the page of the claim in the results of the search for the question.
The method
Section titled “The method”- The fetch. The eval fetched each URL one time into a new store, with the default identity of the crawler. The crawler obeyed robots.txt and the pace of each site, and it opened no browser.
- The archive. The run exported the store as a WACZ file. Its SHA-256 starts with
28f5d5cd32ea038f. - The replay. The measurement read the WACZ file into a new store and sent no request. A second replay gave the same numbers.
- The count. For each claim, the count is all the text of the four tool results. The proxy is the HTML of the page as Markdown (
turndown), with no script, style, noscript or template elements.
The README of the eval gives each step, the units and the checks. The numbers of this page are in eval-a.json.
The limits
Section titled “The limits”- The tokenizer is a proxy. The count uses the encoding
{evalA.tokenizer}of the packagegpt-tokenizer. It is not the tokenizer of Claude, and Claude gives different counts. The two paths use the same tokenizer, so a ratio depends less on the tokenizer than a count. - The real WebFetch is different. The WebFetch tool of Claude Code converts the page to Markdown and gives it to a small model with the prompt. The main model gets the answer of that model, not the page. That answer is not an exact quote that the main model can check. To check a quote, a model reads the text of the page. The proxy counts that text, with no limit of WebFetch.
- The read window starts at the quote.
crawl_verifygives the place of the quote, so the agent knows where to read. An agent that reads from the start of each page in ranges of 4,000 characters reads 202,067 tokens in total, not 110,874. - Some quotes are past the cut. The reader of polite-crawler cuts the text of a page at 50,000 characters. For 2 claims (RFC 9110), the quote is past the cut. Then the path has no read, and the excerpt of
crawl_verifyshows the text around the quote. - The count leaves out the text that the agent writes (the arguments of each call) and the system prompt.
- Part B measured the real cost. In real sessions of Claude Code, WebFetch costs less than polite-crawler, because a small model reads the page. With polite-crawler-mcp 0.2.1, a session with WebFetch cost approximately half as much. With the shorter tool text of 0.2.3, it costs approximately 60%.