💾
Prompt Caching — Token Cost Optimization
Cache static prompt sections to cut costs by 90%
P1Infrastructure
Summary
Prompt Caching allows marking sections of system prompts as cacheable using cache_control breakpoints. Cached content is stored server-side and reused across requests, reducing input token costs by up to 90%. The Static/Dynamic Prompt Boundary pattern enables this: static rules are cached, only dynamic context changes per request.
Technical Details
Two caching strategies:
• Ephemeral cache: automatic, lasts ~5 minutes, reused within session
• Explicit breakpoints: cache_control markers in message content
Cost impact: cached input tokens cost 10% of fresh tokens. For a 10K-token system prompt repeated 100 times, caching saves ~900K tokens.
Design principle: structure prompts with static sections first (identity, rules, tools) and dynamic sections last (user context, recent history). The SYSTEM_PROMPT_DYNAMIC_BOUNDARY marker from Claude Code implements this pattern.
Architecture Insight
The Static/Dynamic split is a universal optimization pattern — the same principle behind CDN caching, database query plan caching, and compiled template engines.
Official / Public Basis
Prompt Caching officially documented at docs.anthropic.com/en/docs/build-with-claude/prompt-caching. Available for all Claude models.
Governance Concerns
Cache invalidation on prompt changes must be tested. Stale cached prompts may cause behavior drift. Monitor cache hit rates to ensure cost savings.
LightHope Ecosystem Mapping
m495 skill invocations — cache skill definitions across calls, m590 compilation — cache compile policies, m8100 search — cache search specifications