TokenSave Data · Dataset
How much does a big CLAUDE.md or AGENTS.md cost? Claude Code vs Codex
A 50 KB CLAUDE.md added 15,985 input tokens to every Claude Code request. Codex read only the first 32 KiB of a 50 KB AGENTS.md and silently ignored an instruction placed at the end. Claude Code’s prompt cache absorbs most of the cost after the first turn.
Measured 2026-10-18 · 6 file sizes · 2 tools · 2 runs · License CC BY 4.0 · Related: Claude Code vs Codex startup tokens
DOI 10.5281/zenodo.23453217 · Also on Hugging Face · Kaggle · GitHub
Key findings
- Every kilobyte of CLAUDE.md costs about 320 input tokens on every request. With no instruction file, a one-word reply cost Claude Code 35,795 input tokens; a 10 KB CLAUDE.md added 3,303, a 25 KB file 8,080 and a 50 KB file 15,985 (+45%).
- Codex stops reading AGENTS.md at 32 KiB. A 25 KB AGENTS.md added 5,339 tokens, but doubling it to 50 KB added only 1,495 more. We put the line “the release codename is BLUE-HERON-47” at the end of a 50 KB AGENTS.md: Codex answered “NONE” in 2 of 2 runs, while the same line at the start of the file was found 2 of 2 times. Codex documents this limit (
project_doc_max_bytes, 32 KiB by default) but its output in our runs gave no warning that the file was cut. - Claude Code read the whole file. It found the codename at the start and at the end of the 50 KB CLAUDE.md in all 4 runs. Claude Code shows a performance warning for CLAUDE.md files over 40,000 characters but still loads them.
- The cache makes the first turn the expensive one. At API list prices reported by Claude Code, the first request cost $0.162 with no file and $0.290 with the 50 KB file (+79%). On the second turn the file was read from the cache and the cost was $0.143 against $0.146 (+2%).
- The same text costs Claude more tokens. The 25 KB file added 8,080 tokens in Claude Code and 5,339 in Codex, 51% more, in line with Claude’s tokenizer needing more tokens for the same English text.
Input tokens and cost by instruction file size
Prompt: “Reply with the single word OK.”, then “Reply with the single word OK again.” in the same session. Both runs gave identical token counts. Cost is the API list-price figure Claude Code reports (the runs used a Max plan); Codex does not report cost.
| Instruction file | Claude Code input, turn 1 | Added by file | Claude cost, turn 1 | Claude cost, turn 2 | Codex input, turn 1 | Added by file |
|---|---|---|---|---|---|---|
| none | 35,795 | +0 | $0.162 | $0.143 | 14,690 | +0 |
| 975 bytes (1 KB) | 36,295 | +500 | $0.166 | $0.143 | 14,962 | +272 |
| 5,044 bytes (5 KB) | 37,532 | +1,737 | $0.176 | $0.143 | 15,791 | +1,101 |
| 10,163 bytes (10 KB) | 39,098 | +3,303 | $0.189 | $0.144 | 16,838 | +2,148 |
| 25,550 bytes (25 KB) | 43,875 | +8,080 | $0.227 | $0.145 | 20,029 | +5,339 |
| 51,181 bytes (50 KB) | 51,780 | +15,985 | $0.290 | $0.146 | 21,524 | +6,834 |
Is an instruction at the end of a big file followed?
A line “The release codename for this project is BLUE-HERON-47.” was added at the start or at the end of the 50 KB file, and each tool was asked for the codename without being allowed to open any files.
| Tool | Where the line was placed in a 50 KB file | Runs that knew the codename |
|---|---|---|
| Claude Code (CLAUDE.md) | Start of the file | 2 / 2 |
| Claude Code (CLAUDE.md) | End of the file | 2 / 2 |
| Codex (AGENTS.md) | Start of the file | 2 / 2 |
| Codex (AGENTS.md) | End of the file | 0 / 2 |
Method
- The instruction files are a realistic project guide for a TypeScript monorepo (commands, then conventions for 60 modules), generated by a script so that the 1, 5, 10, 25 and 50 KB files are prefixes of the same text. The generator script is included in the JSON download.
- The same file was saved as
CLAUDE.mdfor Claude Code andAGENTS.mdfor Codex in an otherwise empty folder. - Claude Code 2.1.295 (Opus 5.5, effort medium):
claude -pand thenclaude -c -pwith--output-format jsonand no MCP servers. Input tokens are uncached input plus cache writes plus cache reads. - Codex CLI 0.162 (gpt-6-luna, effort medium):
codex exec --jsonand thencodex exec resume --last. Codex reports session totals, so turn 2 is the difference from turn 1. - Each configuration was run twice on 2026-10-18 on the same Windows laptop. The baseline includes each tool’s global settings on that machine, so only the added tokens should be compared.
Limitations
- One kind of instruction text, English only; other languages need more tokens per kilobyte.
- Sizes between 25 and 50 KB were not measured, so the exact point where Codex stops reading is taken from its documentation.
- The cost figures are list-price estimates from Claude Code; subscription plans are not billed per token.
How to cite
Free to use, quote and republish with attribution under CC BY 4.0. Please link to this page.
TokenSave (2026). CLAUDE.md and AGENTS.md size: what instruction files cost in Claude Code and Codex [Data set]. Zenodo. https://doi.org/10.5281/zenodo.23453217
Embed the chart
Related
- Claude Code vs Codex: startup tokens and the same coding task
- Claude effort levels: tokens, time and cost
- Check your own Claude Code usage
Questions or corrections: contact@jonhisking.com