home/productivity/prompt-caching-and-cost

Prompt Caching And Cost

GPTClaudeDeepSeek··174 copies·updated 2026-07-14
prompt-caching-and-cost.prompt
# Prompt Caching and Cost Control

## Purpose

Prompt caching reduces repeated prefill work when multiple model calls share the same prefix. In long-running agents, this can materially reduce input-token cost and time-to-first-token latency.

Treat prompt caching as part of harness architecture, not as a provider afterthought. The context builder, tool registry, instruction manager, compactor, and telemetry layer all affect cache hit rate.

## Core rule: stable prefix, dynamic suffix

Most prompt-cache systems reward exact or near-exact prefix reuse. Design requests so stable content appears first and volatile content appears late.

Recommended ordering:

when to use it

Community prompt sourced from the open-source GitHub repo DenisSergeevitch/agents-best-practices (MIT). A "Prompt Caching And Cost" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

productivitycommunitydeveloper

source

DenisSergeevitch/agents-best-practices · MIT