prompt-caching
Installation
SKILL.md
Prompt Caching
Pain Signals — You Need This Pattern When:
- Repeated calls share a large stable prefix (system prompt, tool schemas, retrieved docs, prior turns) and you are paying full input-token cost on every turn
- TTFT (time to first token) is dominated by prefix processing, not generation
- An agent loop runs many turns within minutes; each turn re-sends the full transcript
- A subagent fork inherits parent context — without caching, the fork pays the parent's prefix cost again
- Cost-per-session is high and dominated by input tokens, not output
Caching is free latency and ~90% input-token cost reduction on hits. If your harness has stable prefixes and you are not measuring cache_read_input_tokens, you are leaving money on the table.
Core Principle
The Anthropic API hashes a prefix of your request and stores the model's internal KV state keyed by that prefix. A subsequent request whose first N bytes match a live cache entry skips re-processing those N bytes — the model resumes from saved state.