What this read moved
1–3 of 3statusline Changed · +21 / -0 lines
from line 269
269269 "cache_write_tokens": 352000,
270270 "miss_recache_tokens": 310200,
271271 "last_miss_at": 1738425230,
272 "last_miss_cause": {
273 "causes": ["tools_changed"],
274 "tools_added": 2,
275 "tools_removed": 0
276 },
277 "miss_causes": {
278 "tools_changed": 2
279 },
272280 "recache_tokens_if_cold": 45000
273281 },
274282 "fast_mode": false,
from line 386
378386| `cache_write_tokens` | All tokens written to the cache this session, the first request's initial write included |
379387| `miss_recache_tokens` | Tokens written to the cache by the requests counted as misses |
380388| `last_miss_at` | When the last miss happened, in epoch seconds. `null` while the session has no misses |
389| `last_miss_cause` | What Claude Code identified as the likely cause of the last miss, described under [Last miss cause](#last-miss-cause). Requires Claude Code v2.1.260 or later |
390| `miss_causes` | How many of this session's diagnosed misses had each cause, keyed by the same cause names as `last_miss_cause`. Requires Claude Code v2.1.260 or later |
381391| `recache_tokens_if_cold` | Tokens the next request re-caches if the cache has gone cold by then. `null` right after a compaction or a clearing of old tool results, until the next request records the rewritten conversation's size |
382392
383393Claude Code shows the same statistics in the terminal, on the [`/usage` command's `Prompt cache (main)` line](/docs/en/costs#prompt-cache-statistics).
394
395<h4 id="last-miss-cause">
396 Last miss cause
397</h4>
398
399The `last_miss_cause` object reports what Claude Code identified as the likely cause of the most recent miss. Its `causes` array holds one or more cause names, such as `tools_changed`, `system_prompt_changed`, `ttl_expired_5m`, or `likely_server_side`. The object is `null` until the session's first miss, and again whenever Claude Code couldn't identify a cause for the most recent miss. Requires Claude Code v2.1.260 or later.
400
401Two causes add counts to the object:
402
403* `tools_added` and `tools_removed`: with `tools_changed`, how many tools were added to or removed from the request
404* `system_char_delta`: with `system_prompt_changed`, the change in the system prompt's length, in characters
384405
385406## Examples
386407
costs Changed · +1 / -1 lines
from line 41
4141
4242The misses, expected rebuilds, and warm or cold parts of the line mean the following:
4343
44* **Misses**: requests that re-processed content the cache already held, with the time of the last miss and how many tokens those requests wrote back to the cache. Claude Code counts a request as a miss when the request re-processed more than 5% and at least 2,000 tokens of what it could have read from cache. [Actions that invalidate the cache](/docs/en/prompt-caching#actions-that-invalidate-the-cache) lists the usual causes.
44* **Misses**: requests that re-processed content the cache already held, with the time of the last miss and how many tokens those requests wrote back to the cache. Claude Code counts a request as a miss when the request re-processed more than 5% and at least 2,000 tokens of what it could have read from cache. [Actions that invalidate the cache](/docs/en/prompt-caching#actions-that-invalidate-the-cache) lists the usual causes. When Claude Code can identify a likely cause for the last miss, the line names it too, for example `likely cause: tool definitions changed`. The likely-cause text requires Claude Code v2.1.260 or later.
4545* **Expected rebuilds**: when Claude Code has itself just rewritten the conversation, by [compaction](/docs/en/prompt-caching#compacting-the-conversation) or by clearing old tool results from context, it counts the same kind of miss as an expected rebuild instead. This part appears only after at least one expected rebuild has happened.
4646* **Warm or cold**: whether the cached prefix is still within its [cache lifetime](/docs/en/prompt-caching#cache-lifetime), with the TTL in effect. When the cache is cold, the line shows how long the session has been idle. When no response has reported cache tokens, the line ends with `no prompt caching reported by the API` instead.
4747
prompt-caching Changed · +2 / -0 lines
from line 292
292292
293293For a per-session summary, run `/usage`. After the main conversation's first response, Claude Code adds a [`Prompt cache (main)` line](/docs/en/costs#prompt-cache-statistics) to the Session block, showing the session's hit ratio, miss count, and whether the cache is warm right now. A status line script can read the same numbers from the [`prompt_cache` object](/docs/en/statusline#prompt-cache-fields). Both require Claude Code v2.1.251 or later.
294294
295The `Prompt cache (main)` line also names the likely cause of the last miss when Claude Code can identify one, for example `likely cause: tool definitions changed`. The likely-cause text requires Claude Code v2.1.260 or later.
296
295297For visibility across an organization, the OpenTelemetry exporter reports cache read and creation tokens per user and session. See [Monitor usage](/docs/en/monitoring-usage) for the metric and event attribute reference.
296298
297299## Subagents and the cache