Backend

Cache-Aware Prompting

by tokencalculator

Structures prompts so provider prompt caching actually applies. Use in any repeated-prefix workload such as RAG, agents or chat.

Skill content

Prompt caching only helps when the prefix is byte-identical across requests. Most prompts break that accidentally.

Structure every prompt as:
1. Stable system instructions, in a fixed order.
2. Stable reference material: documentation, schemas, examples.
3. Cache breakpoint.
4. Variable content: conversation history, the current query, retrieved chunks.

Common cache breakers to remove from the prefix: timestamps, request ids, user names, randomised example ordering, and any dynamically generated preamble.

Measure the cached-token fraction. If it is below 60 percent on a repeated-prefix workload, something dynamic is sitting above stable content.