Skip to content
Agent Orchestration
Skill

/prompt-caching

Cache the parts of the prompt that don't change so a long-running loop stops paying full price on every turn. Use when the system prompt, tool defs, or reference docs are stable across many turns.

From plugin
loopkit
75953 skills1 agent4 commands2 MCP

Claude Code

$ npx -y skills add Archive228/loopkit --skill prompt-caching --agent claude-code

SKILL.md

prompt-caching.SKILL.md
name: prompt-caching
description: Cache the parts of the prompt that don't change so a long-running loop stops paying full price on every turn. Use when the system prompt, tool defs, or reference docs are stable across many turns.
when_to_use: long session, repeated large context, cost climbing, system prompt >1024 tokens, unchanged tool definitions across turns

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.

Pick 5m unless you know turns are minutes apart.

Staleness rules — cache invalidation is silent

  • **Any byte change** above the breakpoint invalidates the cache from that point.
  • **Reordering** tools or messages counts as change.
  • **Trailing whitespace** counts as change.
  • **A different model version** counts as change.

If cost isn't dropping, log the cache-hit metric. Do not assume.

When NOT to cache

  • Prompt <1024 tokens — below the minimum block size, no savings.
  • One-shot calls — no reuse, cache write is wasted.
  • Highly dynamic system prompt (per-user templating) — cache misses will exceed hits.

Red flags

  • **Cost graph flat after adding breakpoints** — you're invalidating on every turn. Diff two consecutive requests byte-for-byte above the breakpoint.
  • **Breakpoint after user message** — pointless; the user message changes every turn.
  • **Four+ breakpoints** — max is four; extras are ignored silently.
  • **Caching a prompt that gets edited mid-session** — one edit above the cut wipes all downstream savings.

The math

Cache write ≈ 1.25× normal input. Cache read ≈ 0.1× normal input. So a stable 20K-token prefix hit N times: N=1 costs more than no-cache; N=2 breaks even; N=10 costs ~15% of no-cache. Long loops win big; short chats lose.

Cache is the single biggest cost lever on a long-running agent. Set it once at the start of the loop, verify hits, forget it.

Read more
@archive228
Ships withloopkit

33 battle-tested skills + minimal .claude harness for any coding agent (Claude Code, Cursor, Codex, Gemini CLI).

75953 skills1 agent2 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
759
Star history of Archive228/loopkit on GitHub, a chart by star-history.com

Other skills on loopkit.

a11y-pass

a11y-pass

Catch the accessibility failures that ship in almost every AI-built UI. Use after building any interactive component.

@archive228@archive228Install Skill
active-memory-reminder

active-memory-reminder

Before compaction Loopkit extracts decisions into claude-decisions.json (machine-readable). Read it alongside claude-progress.txt…

@archive228@archive228Install Skill
authz-check

authz-check

Verify that an endpoint checks ownership, not just authentication. Use on any handler that reads or mutates user data.

@archive228@archive228Install Skill
bisect-regression

bisect-regression

Find the exact commit that introduced a bug. Use when something worked before and broke, and you don't know which change did it.

@archive228@archive228Install Skill
broken-window-check

broken-window-check

Before picking new work, smoke-test the last "completed" feature. If it's broken, revert and re-open it before touching anything…

@archive228@archive228Install Skill

More skills from other plugins.

1password

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

openclaw4d395k
@steipete@steipeteInstall Skill
jira-tickets

jira-tickets

Read and update Jira tickets through Orca's saved Jira connections. Use when a task comes from Jira or the user asks for Jira…

orca2d128k
@stablyai@stablyaiInstall Skill
agentmail

agentmail

Use your assigned AgentMail inbox to read email tasks, explicitly send or reply, and check delivery. Provided automatically by…

paperclip3d114k
@paperclipai@paperclipaiInstall Skill
adr-create

adr-create

Create a new Architecture Decision Record with sequential numbering and AgentDB registration

@ruvnet@ruvnetInstall Skill

Questions about prompt-caching.

Which coding agents can use prompt-caching?
prompt-caching installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.