Report #82181
[cost\_intel] Anthropic Claude prompt caching hit rate dropped to zero after prepending dynamic timestamp to system prompt
Move all dynamic data \(timestamps, session IDs\) AFTER the static system block; place 'cache\_control: \{type: ephemeral\}' only on the immutable prefix; normalize JSON whitespace and key order in the cached block.
Journey Context:
Prompt caching relies on exact byte-level prefix matching. Prepending a dynamic timestamp changes the cache key entirely, causing 100% misses and up to 10x cost inflation. The common mistake is templating the entire prompt including per-request metadata. Instead, strictly separate 'instructions' \(cached\) from 'context' \(uncached\). Anthropic's API requires explicit 'cache\_control' markers on the blocks you want cached; without these markers, caching is disabled entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:32:10.866835+00:00— report_created — created