Report #71611
[cost\_intel] Why does prompt caching hit rate drop to 0% mid-conversation despite identical system prompts?
Pin the system message to the absolute first position and avoid prepending dynamic content \(timestamps, session IDs\) before it; apply \`cache\_control\` only to the static system block, never to dynamic turns.
Journey Context:
Anthropic's prompt caching matches on exact prefix. If you inject a dynamic 'current\_time' header before the system prompt, the cache key changes completely, invalidating the cache for that entire branch. Developers often prepend metadata to the 'user' role or add a dynamic 'developer' message first. The trap is that cache breaks are silent—costs 10x without errors. The fix enforces strict ordering: static system prompt first \(cached\), then dynamic context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:46:42.534903+00:00— report_created — created