Prompt caching that actually pays back: 4 patterns | Claude Code Toolkit
Deep dives

Prompt caching that actually pays back: 4 patterns

Enabling prompt caching is easy. Getting meaningful savings from it is where most teams stall. Four specific patterns we've validated in production — with the token math and honest limitations.

MK
Mateo K. September 2, 2026 · 12 min read

Prompt caching is one of those features that's easy to enable and hard to see savings from. You flip the switch, the bill doesn't obviously drop, and it's tempting to conclude "caching doesn't work for us." Usually the actual issue is that the workflow shape doesn't match how caching charges. This post is the four patterns we've validated actually pay back — and why the ones you'd expect to save you money often don't.

For background: with prompt caching, the first request in a cached-context flow pays for cache write; subsequent requests within the cache TTL pay a heavy discount on the cached portion. The math works when you re-use the same prefix many times before the TTL expires. The math doesn't work when you use each context once, or when your "cache-worthy" prefix is small enough that the write premium eats the savings.

Pattern 1: Long multi-turn coding sessions

The clearest win. Long interactive Claude Code sessions where you load CLAUDE.md, look at 10-15 files, and then have a back-and-forth for an hour. The cache prefix (CLAUDE.md + tool definitions + system prompt + initial file reads) is large; the follow-up turns re-use all of it.

A typical session for us: 40K tokens loaded upfront, then 12-15 turns. Without caching: full input cost every turn. With caching: cache-write on turn 1, cache-hit rate around 85% on subsequent turns. Savings: 40-50% on session cost.

The teams seeing biggest caching savings are the ones with long interactive sessions. The teams seeing least savings are the ones with lots of short one-off invocations. Both are fine ways to work; the caching math treats them very differently.

Pattern 2: Subagent invocations with shared context

When a subagent gets invoked repeatedly within a workflow — say, an incident-investigator running 4 times during a session, each time pulling the same runbook context and Sentry MCP tools — caching helps a lot. The shared prefix (subagent system prompt, tool definitions, standard reference material) hits cache every time after the first.

This is where MCPs particularly benefit. Loading tool definitions for GitHub, Sentry, Datadog, and internal-docs MCPs is not free — a decent-sized MCP setup can be 8-15K tokens of tool schema alone. Caching that means subsequent subagent runs skip almost all of it.

For our incident-investigator: about 12K tokens of MCP schema plus 8K of subagent prompt. Without caching, that's paid on every invocation. With caching, paid once per TTL window. Given the subagent runs 10-50 times a day, this is the difference between the subagent costing $8 a day and $1.50.

Pattern 3: CI workflows that run repeatedly against the same repo

A slightly non-obvious win. If you have a nightly workflow that reviews PRs, generates docs, or sweeps for issues — and it runs against the same codebase each night — the initial codebase context is cache-able across runs.

The trick: the cache needs to survive between runs. This means either (a) using a longer TTL if your setup supports it, or (b) chaining workflows so they share a session. Our docs-sweep workflow runs at 3am and finishes around 3:20am. Reindex workflow runs at 3:30am. Both share cached context (the CLAUDE.md, the repo structure, the current architecture doc). Second workflow pays much less.

Practical note

Batch API + caching stack nicely. The 50% Batch API discount applies to the paid portion; caching further reduces what's paid. For long-running batch workflows over a large codebase, both together can cut costs 60-70% vs interactive pricing without caching.

Pattern 4: Cross-session context via prompt prefix

This one requires more design work but pays back for very-large-context workflows. If your team runs multiple daily sessions against a large codebase, you can standardize on a prefix that's known to be cached — a specific loading order for CLAUDE.md files, a standard set of "seed" files always loaded first, consistent MCP configuration.

When multiple engineers all start with this prefix, the cache warms up early in the day and stays warm. Later sessions hit cache more often. This is the "team-shared warm cache" pattern.

Trade-off: it constrains how sessions start (you can't just load whatever you want first) in exchange for savings. For small teams, not worth the constraint. For 20+ engineer teams all using the same codebase, the aggregate savings become significant.

The patterns that don't pay back (and why)

Short one-off sessions

The classic false-hope scenario. Engineer opens a Claude Code session, asks one question, closes it. The session has zero re-use, so the cache-write premium is pure loss. If your team's usage is dominated by short sessions, caching either does nothing or costs slightly more.

This isn't a caching problem — it's a usage-pattern mismatch. The fix is either changing usage patterns (encourage longer sessions when they're warranted) or accepting that caching won't help.

Small CLAUDE.md files

The cacheable-prefix minimum matters. If your CLAUDE.md is 500 tokens and you have no other consistent prefix, there's not enough context to cache meaningfully. Caching wants prefixes that are at least ~2K+ tokens; the smaller your setup, the less caching helps.

Rapidly-changing tool definitions

If your MCP set changes frequently (you're adding tools, tweaking tool descriptions), each change invalidates the cache. Cache hits only accumulate when the prefix stays stable. Teams in heavy customization phases see less caching benefit than teams with a stable setup.

The token math, briefly

You don't need to redo Anthropic's pricing here, but the shape of the calculation is worth understanding. Caching charges: writing the cache is roughly 25% more expensive than a normal input token. Reading from cache is roughly 90% cheaper than a normal input token.

So caching pays back when: cache_reads > cache_write_premium / cache_read_discount. Roughly: after 3-4 reads of the same cached prefix, you've broken even. Every read after that is savings.

Which means: if a workflow only uses each prefix once, caching costs slightly more. If it uses each prefix 5+ times, caching starts saving substantially. Everything about "does caching help us?" reduces to "how often do we re-use the same prefix?"

What the token math misses

Caching also reduces latency, sometimes substantially. For very-long-context sessions, the difference between processing 50K new tokens and hitting a warm cache is noticeable. Cost savings get measured; latency wins often don't. The latency wins are real even when the cost savings are marginal.

How to measure whether caching is working for you

The metric that matters: cache hit rate on cache-eligible tokens. Anthropic's billing shows this. What "healthy" looks like:

  • >70%: you're getting most of the possible savings. Doing well.
  • 40-70%: getting some savings, but there's room. Look at which workflows are single-invocation vs repeated.
  • <40%: caching is probably not paying back. Either usage patterns are dominated by short sessions, or something is invalidating the cache more often than expected.

When we started measuring, we were at ~30%. The problem: our subagent tool definitions were slightly different per invocation (using dynamic values), which invalidated cache. Fix was to move dynamic values to arguments rather than tool schema. Cache hit rate jumped to ~65% overnight, and monthly bill dropped noticeably.

The meta-lesson

Caching is a feature that rewards the specific patterns it was designed for. It's not a magic switch that reduces costs universally. The teams getting real value are the ones who understood the pattern-match (long sessions with re-used prefixes) and structured their workflows accordingly.

The teams getting no value usually have workflows that don't match the pattern — short one-off invocations, rapidly changing configurations, or infrastructure that invalidates cache frequently. That's not a caching bug; it's a mismatch. Fix the workflow, or accept the caching won't help.

For our team specifically: a year in, caching saves us ~15% of what our bill would otherwise be. Not the "50% savings!" you see in marketing, but real money on a real bill, achieved through boring pattern-matching between our workflows and the feature. That's about right.

MK

Written by

Mateo K.

Mateo focuses on platform engineering, agentic workflows, and turning experimental patterns into infrastructure that scales.

Get cctk running in one command

85 slash commands, 12 subagents, 12 MCP integrations, 12 hooks. All the patterns from this post are shipped in cctk.

npx cctk@latest init Get cctk v1.5.2 →