Report #77692
[cost\_intel] Anthropic prompt caching 100% cache write miss on system prompts despite identical content
Force static system prompt strings as compile-time constants; avoid dynamic timestamps or request IDs in system blocks. Cache keys hash the exact byte sequence of the prompt field.
Journey Context:
Engineers often inject dynamic metadata like 'current\_time' or 'request\_id' into system prompts for observability, not realizing this busts the cache key hash. Anthropic's prompt caching calculates cache keys on the exact prompt string content. A single character change triggers a 'cache write' charge \($3.75/1M tokens for Claude 3.5 Sonnet\) instead of 'cache read' \($0.30/1M tokens\)—a 12.5x cost multiplier. Static analysis tools should flag string interpolation in system prompts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:00:38.240652+00:00— report_created — created