Claude Code's TodoWrite tool silently rewrites millions of cached tokens per task update
A Reddit user traced Claude Code's rapid 5-hour usage window depletion to the TodoWrite tool, which invalidates and fully rewrites the entire prompt cache — up to 897k tokens at 1.25x cost — every time it updates a to-do item.
Score breakdown
The bug causes users running multi-step Claude Code sessions to be charged at the 1.25x cache-write rate for dozens of full-context rewrites of identical content, rapidly exhausting the 5-hour usage window in minutes rather than hours.
- 01The TodoWrite tool injects a `todo_reminder` block into the cached prefix; every status update re-stamps it, invalidating the entire prompt cache after the system prompt.
- 02Each cache invalidation triggers a full context rewrite of ~800k–900k tokens at the 1.25x cache-write rate, for essentially zero output.
- 03In one 14-minute session, 20 full rewrites consumed 16.7 million tokens, with rewrites ~43 seconds apart.
u/Adventurous_Two9033 on r/ClaudeAI documented a caching bug in Claude Code where the `TodoWrite` tool causes repeated, full-context prompt cache invalidations. When Claude Code uses `TodoWrite` to manage tasks, it injects a `todo_reminder` block near the front of the conversation. Each time the tool updates the list — checking off an item, adding one, or changing a status — it re-stamps the entire block. Because this block sits in the cached prefix, the re-stamp changes the cache fingerprint and invalidates everything after the system prompt, forcing the next message to rewrite the full context (typically 800k–900k tokens) at the 1.25x cache-write rate while producing almost no output. In a session where Claude works through a multi-item to-do list, this fires once per update, meaning dozens of full-context rewrites can occur within minutes.
The largest, a 14-minute window on May 30, involved 20 full rewrites totaling 16.7 million tokens, with rewrites occurring roughly every 43 seconds.
The post includes log data from five major spike events. The largest, a 14-minute window on May 30, involved 20 full rewrites totaling 16.7 million tokens, with rewrites occurring roughly every 43 seconds. Across all five events, token totals ranged from 9.2M to 16.7M, with 11–20 rewrites each. Critically, the `cache_read` value remained pinned at ~23k tokens (just the system prompt) while ~870k tokens of identical context were rewritten each time — the same hash `d75171` appearing across all 19 updates in one session, which the author argues confirms the content itself was not changing, pointing to a bug rather than user error. The issue affects both Opus 4.7 and 4.8 and is not IDE-specific.
The post offers an immediate workaround: setting `"todoFeatureEnabled": false` in `~/.claude/settings.json` and adding a `PreToolUse` hook that hard-blocks any `TodoWrite` calls. As an alternative task-tracking method, editing a plain markdown file is suggested, since file edits do not inject a cache-busting block. A GitHub issue has been filed at `anthropics/claude-code` #68140.
Key facts
- 01The TodoWrite tool injects a `todo_reminder` block into the cached prefix; every status update re-stamps it, invalidating the entire prompt cache after the system prompt.
- 02Each cache invalidation triggers a full context rewrite of ~800k–900k tokens at the 1.25x cache-write rate, for essentially zero output.
- 03In one 14-minute session, 20 full rewrites consumed 16.7 million tokens, with rewrites ~43 seconds apart.
- 04Across five logged spike events, total tokens ranged from 9.2M to 16.7M, with 11–20 full rewrites each.
- 05`cache_read` stayed pinned at ~23k tokens (system prompt only) while ~870k tokens of identical content were rewritten each time.
- 06The bug is version-independent, observed on both Opus 4.7 and 4.8, and not IDE-specific.
- 07A workaround exists: set `"todoFeatureEnabled": false` in `~/.claude/settings.json` and block `TodoWrite` via a `PreToolUse` hook; GitHub issue #68140 has been filed.
Topics
Summary and scoring are generated automatically from the original article. We always link back to the publisher and never republish images or paywalled content. Last processed Jun 13, 2026 · 08:58 UTC. How this works →