home/productivity/prompt-caching-6

PROMPT CACHING

GPTClaudeDeepSeek··259 copies·updated 2026-07-14
prompt-caching-6.prompt
# Prompt Caching Protocol (R13-004 / F-304)

**Purpose.** Mark each agent's stable prompt prefix with Anthropic
`cache_control: {"type": "ephemeral", "ttl": "..."}` so subsequent calls
within the TTL pay ~10% of the prefix token cost and ~15% of the latency
(R2-C092). APEX makes 5-7 agent calls per task; without caching, the
stable prefix repeats every call and millions of tokens are wasted across
a project.

**Spec anchors.**
- "Cost-aware execution." — apex-spec.md principle-line
- Design-note: "Prompt caching: stable prefix first, volatile last → 90%
  input cost reduction (R7)"
- `framework/commands/apex/next.md` comment anchor: "Stable prefix FIRST
  (for cache hits), volatile LAST"
- `framework/CONTEXT_BUDGET.default.json` zone anchor:
  `stable_prefix.policy = "Always loaded. Never evicted."`

## Mechanics

Anthropic's prompt caching is opt-in via a `cache_control` directive
attached to a specific prompt segment. The harness reads each agent's
frontmatter `cache_breakpoints:` directive at invocation time and splits
the prompt at the matching XML tag. Everything BEFORE the tag is the
stable prefix; everything AFTER is volatile per-call input.

fill the variables

This prompt has 1 variable. Pro fills them into a ready-to-paste prompt for you — no manual find-and-replace.

{"type": "ephemeral", "ttl": "..."}
Unlock with Pro →

when to use it

Community prompt sourced from the open-source GitHub repo davidel8698-stack/apex (MIT). A "PROMPT CACHING" 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

davidel8698-stack/apex · MIT