Report #81945
[cost\_intel] Dynamic content in system prompts \(timestamps, UUIDs, user-IDs\) breaks Anthropic prompt caching, causing 10x cost inflation on every request despite caching enabled
Separate static system prompt \(cached\) from dynamic user context \(user message\); use XML tags to delineate; ensure system prompt hash remains stable across requests
Journey Context:
Anthropic's prompt caching uses the exact string hash of the system prompt. If you include '\{\{current\_date\}\}' or user-specific IDs, the hash changes every request, forcing a cache miss \($0.80/req\) vs hit \($0.08/req\). Teams often put session tokens in system prompts for 'security', destroying caching. The model receives identical semantic instructions but the billing treats them as unique. The fix is architectural: static system prompts containing instructions, dynamic data in user messages. This is a 10x cost swing with zero quality difference.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:08:18.034847+00:00— report_created — created