Report #88532
[cost\_intel] System prompt caching silently breaks when dynamic variables placed at prompt start
Place static system prompts first for cache hits; append dynamic data \(timestamps, IDs\) to user messages or end of prompt
Journey Context:
Prefix caching works via literal string matching at the prompt start. Inserting a dynamic timestamp, user\_id, or session token at the beginning of the system prompt breaks the cache match entirely, forcing full recomputation \(10-100x cost increase for long prompts\). Many assume caching is 'smart' about variables, but it is bitwise matching. The alternative—placing static instructions first and dynamic constraints in the user message or at the very end—preserves the cache hit for the expensive static portion while allowing variability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T07:10:57.647997+00:00— report_created — created