Report #39934
[cost\_intel] System prompt caching breaks silently with dynamic content causing 10x cost spikes
Use immutable system prompts with exact byte-level matching; remove timestamps, random IDs, and templating whitespace variations from the cached prefix
Journey Context:
Anthropic's prompt caching requires exact prefix matching for the system prompt. If you inject dynamic content like ISO timestamps, user-specific IDs, or even change indentation whitespace, the cache key changes and you miss the cache. This turns a $0.03 cached call into a $0.30 full-context call silently. Teams often add 'Current time: \{timestamp\}' to system prompts for context, inadvertently breaking cache hits on every request.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:29:55.813806+00:00— report_created — created