[Bug] Claude Code repeatedly generates prompt-cache misconfiguration causing 1.25x billing surcharge without warning
Bug Description
Claude Code repeatedly generated the SAME prompt-caching defect it had already diagnosed and fixed itself.
Pattern: agent pipelines where the per-stage system prompt (variable) is placed BEFORE the cache_control breakpoint on the case file (static). Prefix never matches → every call pays the 1.25x cache-write surcharge, zero cache reads. Measured: 1,360,936 cache-write tokens vs 8,024 reads across 14 opus-4-8 calls.
On 5 Aug 2026 Claude Code found this defect on its own in another module, described it precisely in the commit message ("~70% off the input cost"), fixed it, and verified the fix with usage data. It then wrote the identical defect into a new subsystem 23 days later, and never fixed the pre-existing instance in a third one — including while editing the very same codebase.
It also never once warned me that the configuration it chose carried a billing cost. I am a lawyer, not a software engineer; I rely on Claude Code for exactly these decisions.
Related generated-code omissions in the same pipeline: no balance pre-check, no partial-result salvage (119,584 tokens of finished output discarded when the last stage hit "credit balance is too low"), no concurrent-run guard, and a cost dashboard using the 1h cache multiplier (2.0x) for 5-minute calls (1.25x).
Request IDs: req_011Cez2Br2YGPW9y1zwUxYcX (2026-09-12 18:33:17 UTC), req_011Cdd2LFxshqWVgRaYmL9E1, req_011Cdd2i7LKnCuDYmszbSBpL (2026-08-02).
A full report with production usage data has been filed with Console Support as a billing matter.Timeline of the same defect across subsystems (private repo, commits available on request):
- 1 Aug 2026, 84c853e2 — defect introduced in subsystem A (CIVILIS). Never fixed until 12 Sep.
- 5 Aug 2026, f8d9ac87 — Claude Code diagnoses and fixes the identical defect in subsystem B, quantifying the saving at ~70%.
- 28 Aug 2026, ac98b5f5 — Claude Code writes the identical defect into subsystem C (POENALIS), 23 days after fixing it.
- 12 Sep 2026, 145368a6 — Claude Code amplifies the defect in subsystem A by adding 146,000 characters of documents into the same misconfigured block, with no cost warning.
- 12 Sep 2026, c6c532bd — fix, after I diagnosed it myself.
An earlier instance of the same structural gap (no guard against self-feeding billable calls) is documented on 6 Jul 2026 in commits 9e937581 and 57703936: a Telegram webhook returning 500 caused indefinite retries, and untracked update_id caused up to 8 sequential Claude calls per duplicate delivery, confirmed live with 6 duplicate runs.
What I would want from the product: when Claude Code writes or edits an API call that carries a billing consequence — cache breakpoint placement, model choice in a loop, a pipeline with no spend ceiling — it should say so, once, in plain language. It demonstrably has the knowledge; on 5 Aug it wrote the number itself.An independent product report has also been filed from within Claude Code (/feedback), Conversation ID 215476013643063.
Environment Info
- Platform: darwin
- Terminal: Apple_Terminal
- Version: 2.1.272
- Feedback ID: a6a06fb1-8c23-4ecd-abfb-4cb459a829de
Errors
[]