Show HN: Which prompts ate your Claude Code limit? A local, read-only doctor A tool called TokenOps, published as a Claude Code plugin and a PyPI CLI, analyzes local Claude Code session logs to show which prompts consumed the most usage; in a sample 7-day report covering 12 sessions and 304 prompts, it attributed 37% of usage to the first message after a break and 41% to re-reading context on every call. The doctor estimates that running /compact before stepping away would have saved about 31%, and its optional saver mode, off by default, holds a post-break message once when context exceeds 50k tokens to warn that resending re-reads the conversation at the cache-write price. TokenOps requires Python 3.9+ or uv, installs via /plugin marketplace add theagentplane/tokenops, and offers a --redact flag that hides prompts and project names for screenshots. Why am I hitting my limit? One command names the prompts that cost you the most, says why, and what to change. Read from your own session logs, on your machine. /tokenops:doctor Why am I hitting my limit? last 7 days, 12 sessions, 304 prompts, $235 at API list prices 37% of your Claude usage went to the first message after a break. 39 times the cache had expired, so Claude reloaded the whole conversation. /compact before you step away would have saved ~31%. Your 3 most expensive prompts 9% of usage 2 Wed 21:56 project B prompt hidden █████████░░░░░░░░░░░ 44% of that 5-hour window | 24x your typical prompt CACHE EXPIRED away 4h 45m, past the 1h cache: one call re-wrote your whole 965k-token conversation to the cache at 2x the input price 1 model call, paid $7.41 - /compact before leaving ~$0.52 14x less | /clear + note ~$0.27 ... Where your usage goes 41% Re-reading context every call 37% First message after a break cache reloaded 12% Claude's output 11% Caching new context What to change 1. Re-reading is 41%: every call reads the whole conversation again ... Use /clear when you switch to an unrelated task. 2. Output is 12% of your usage, so a terse-output tool like caveman can save at most that ... In Claude Code: /plugin marketplace add theagentplane/tokenops /plugin install tokenops@tokenops Then run /tokenops:doctor last 7 days; /tokenops:doctor 30 for 30 . Needs Python 3.9+ on your PATH; nothing to pip install . Or, without installing anything, from any terminal with uv https://docs.astral.sh/uv/ : uvx tokenops doctor The tokenops package on PyPI is this CLI; the agent governance library is agent-tokenops . - Prompts. One prompt you type can make many model calls tool use, subagents . They are all counted under the prompt that started them. The doctor shows the 3 most expensive prompts, with the project they were typed in. - Tokens are the size of the whole conversation that one call sent, not a sum over calls. Models with a 1M-token context can carry a conversation that long. - CACHE EXPIRED means the call came more than the cache lifetime 1 hour on a Claude plan, 5 minutes with an API key after the previous one, and wrote most of the conversation to the cache again at the cache-write price. The headline and the "First message after a break" row are the same number: the cache writes of those calls. - 5-hour windows are estimated from your first prompt in each, not read from Anthropic's meter. The cheaper costs are estimates: only the calls a break made expensive are re-priced. - Share yours. The report ends with one line you can paste as is: your headline share and the command, with no prompts, project names or dollars. - Sharing a screenshot? From a terminal, uvx tokenops doctor --redact hides your prompts and project names "project A", "project B" . /tokenops:saver on lets TokenOps act on what the doctor finds. Off by default; every hook fails open. - Resume guard. After a break longer than the cache lifetime, your next message re-reads the whole conversation at the cache-write price. The guard holds that message once: TokenOps: this session's cache expired 1.5 h since the last reply . Sending now re-reads 433k tokens at the cache-write price: about $3.47 API-equivalent, against $0.09 while the cache was warm. - Send the same message again to continue anyway. - Or run /compact first: it keeps the gist in far fewer tokens. - Or /clear and paste a 3-line summary of where you were cheapest . It only acts when the context is at least 50k tokens TOKENOPS GUARD MIN TOKENS . - Smart RTK. With RTK https://github.com/rtk-ai/rtk installed, shell commands Claude runs are rewritten to their compact RTK form git status - rtk git status , using RTK's own rtk rewrite . File reads cat , head , sed -n , git diff / git show , and the next test run after a failing one stay verbatim, because Claude needs that output exactly. If RTK's own hook is installed, smart RTK stays off so nothing is rewritten twice: remove RTK's hook from your Claude Code settings to let TokenOps decide. - Measured, not guessed. Smart RTK and caveman https://github.com/JuliusBrussee/caveman are each switched on in a random half of your sessions. After 10 sessions on and 10 off, the doctor shows what each one did to your usage per prompt, and the saver mode keeps it only if it saves: Measured on your sessions saver mode A/B, usage per prompt Smart RTK -6% usage per prompt 95% range -9% to -2% - kept on caveman +1% usage per prompt 95% range -3% to +5% - turned off Usage only: hooks cannot see whether the work went as well. For caveman, set its own default to off "defaultMode": "off" in caveman's config file, or CAVEMAN DEFAULT MODE=off so TokenOps decides per session. /tokenops:saver status shows what is on; /tokenops:saver off turns it all off. Claude Code writes every model response to ~/.claude/projects/ / .jsonl , often on several lines with the same message id. The doctor keeps the last line per response, includes subagent transcripts, counts a response once even when a forked session copies it, and prices each response at Anthropic's list rates: input, output, cache reads, and cache writes 1.25x input for the 5-minute cache, 2x for the 1-hour cache . Prices come from TokenOps' price book src/tokenops/framework/pricing.py . - First message after a break: a cache write of 20,000+ tokens, at least half the conversation, more than the cache lifetime after the previous call. The cache had expired, so the whole conversation was written again. - Re-reading context: cache reads. Every call reads the conversation again. - Caveman and RTK advice is a ceiling from your own usage mix what share is output, what share of tool output came from shell commands RTK compacts , not a measured A/B. On a Claude plan the dollar figures are API-equivalent: they show your share of usage, not a bill. Nothing leaves your machine. - Runs: python3 or python with the scripts in this folder, standard library only. With Saver mode on and RTK https://github.com/rtk-ai/rtk installed, it also runs rtk rewrite