prompt-caching

Installation
SKILL.md

Prompt Caching

Every turn of a Plan→Act→Verify loop resends the same system prompt, the same tool definitions, and (usually) the same reference docs. Without cache breakpoints you pay full input price on all of it, every turn. With them, cached reads cost ~10% of the write.

Where to put breakpoints

Cache from the top of the prompt down. The cache is prefix-matched — a break in the middle invalidates everything after it.

  1. System prompt — mark the end of it as a breakpoint if it's >1024 tokens (Sonnet/Opus) or >2048 (Haiku).
  2. Tool definitions — cache immediately after, if the tool set is stable across the loop.
  3. Large stable docs — repo map, style guide, spec — before any turn-specific user text.
  4. User message stem — only if the same preamble repeats every turn.

Everything past the last breakpoint is billed fresh every turn. That's fine — that's where the changing content goes.

TTL choice

  • 5-minute cache (default) — for tight loops where turns are seconds apart. Free to write.
  • 1-hour cache — for slow loops (human in the loop, background jobs). Write cost is higher; break-even is ~2 hits.
Installs
18
GitHub Stars
757
First Seen
Jul 8, 2026
prompt-caching — archive228/loopkit