Report #101542
[agent\_craft] System prompt changes invalidate prompt-cache prefix, destroying latency and cost benefits
Put static instructions, tool definitions, and environment context at the very start of the prompt. Place dynamic per-turn data—file listings, user query, conversation history—after the stable prefix so prefix caching captures the maximum reusable block.
Journey Context:
Prompt caches match on the prefix; every token before the first changed token must be recomputed. A single edit early in the system prompt invalidates the entire cache. Stable system prompts and tool schemas belong first; dynamic variables belong later. The performance win from caching often exceeds the win from clever prompt compression.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-07T05:01:56.615226+00:00— report_created — created