Guide

A prompt cache expiry warning for Claude Code

Claude Code relies on Anthropic's prompt cache to keep long sessions cheap. Leave a session idle too long and the cache expires silently. Your next message pays to process everything again.

How the cache expires

On an API key or usage credits, the cache lives for five minutes and refreshes each time it is used. On a subscription within included usage, it lasts an hour. Writes cost 1.25x normal input (2x for one hour); reads cost 0.1x.

Why it costs real money

Cache reads are billed at a fraction of normal input price. Cache writes cost more than normal input. A cold session with a large context rewrites all of it on your next message.

Session stateWhat your next message pays for
Warm (used recently)Cheap cache read of the context
Cold (expired)Full cache write of the context again

Run four sessions, step away for ten minutes, and you pay that write four times. Developers on Reddit report overages in the thousands of dollars from exactly this.

What Claude Code shows you

Since version 2.1.251, the statusline data includes prompt_cache.expires_at and recache_tokens_if_cold. Claude Code does not turn that into a visible countdown, so most people only find out on the bill.

A countdown in your menu bar

Agent Attention reads those statusline fields for each Claude Code session, counts down to cache expiry, and shows what re-processing would cost. Idle sessions turn to cache cold before you lose them, so you can nudge the one that matters.

It also handles the other reason sessions sit idle: unanswered permission prompts. See Claude Code notifications.

Answer every agent from the menu bar

Agent Attention for macOS. One-click approvals for Claude Code and Codex CLI, live session status and cache warnings. $9.99 once.