Skip to main content
agentsSource-backed

Prompt Cache Optimization Agent

Source-backed agent that reduces token cost and latency in Claude Code by improving prompt-cache hit rates, advising on stable context ordering, lean CLAUDE.md, on-demand skills, and MCP tool-search, grounded in the official docs.

by JPette1783·added 2026-06-05·
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://code.claude.com/docs/en/skills, https://github.com/JSONbored/awesome-claude/blob/main/content/agents/prompt-cache-optimization-agent.mdx
Safety notes
This agent optimizes context and cost; it does not change permissions or perform destructive actions., Do not move secrets into always-loaded context for caching reasons; keep credentials out of CLAUDE.md and prompts., Optimizations should not remove safety-relevant instructions just to shrink context; preserve guardrails.
Privacy notes
CLAUDE.md and always-on context are sent every request; avoid placing sensitive data there for cache reasons., Measuring cost via telemetry sends usage metrics to your configured exporter; confirm where that data goes., Skill descriptions load each session; keep sensitive workflow details out of descriptions.
Author
JPette1783
Submitted by
JPette1783
Claim status
unclaimed
Last verified
2026-06-05

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

63

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Needs review

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    No reviewed flag detected in metadata.

    Pending

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

Copy & paste

Copy-ready — paste the snippet to get started.

Adoption plan

Balanced adoption plan

Current risk score 24/100. Use staged verification before broader rollout.

Risk 24

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    No review metadata found; increase manual validation.

    Pending
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Missing required evidence: Metadata review. Risk score 31.

Risk 31

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Missing

Review metadata is missing.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required gaps: Metadata review

Decision timeline

Decision timeline · balanced

Blocking gaps: Check metadata review status. Risk 28.

Risk 28

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is missing.

Pending

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

Blockers: Check metadata review status

Prerequisite readiness

Prerequisite readiness

3 prerequisites to line up before setup. Have accounts and credentials ready first.

0/3 ready
Account & credentials2Configuration1

Safety & privacy surface

Safety & privacy surface

3 safety and 3 privacy notes across 5 risk areas. Review closely: credentials & tokens, permissions & scopes, network access.

5 areas
  • SafetyPermissions & scopesThis agent optimizes context and cost; it does not change permissions or perform destructive actions.
  • SafetyCredentials & tokensDo not move secrets into always-loaded context for caching reasons; keep credentials out of CLAUDE.md and prompts.
  • SafetyGeneralOptimizations should not remove safety-relevant instructions just to shrink context; preserve guardrails.
  • PrivacyNetwork accessCLAUDE.md and always-on context are sent every request; avoid placing sensitive data there for cache reasons.
  • PrivacyTelemetryMeasuring cost via telemetry sends usage metrics to your configured exporter; confirm where that data goes.
  • PrivacyCredentials & tokensSkill descriptions load each session; keep sensitive workflow details out of descriptions.

Safety notes

  • This agent optimizes context and cost; it does not change permissions or perform destructive actions.
  • Do not move secrets into always-loaded context for caching reasons; keep credentials out of CLAUDE.md and prompts.
  • Optimizations should not remove safety-relevant instructions just to shrink context; preserve guardrails.

Privacy notes

  • CLAUDE.md and always-on context are sent every request; avoid placing sensitive data there for cache reasons.
  • Measuring cost via telemetry sends usage metrics to your configured exporter; confirm where that data goes.
  • Skill descriptions load each session; keep sensitive workflow details out of descriptions.

Prerequisites

  • A Claude Code project where token cost or latency is a concern, with visibility into CLAUDE.md, skills, and connected MCP servers.
  • Ability to edit CLAUDE.md, skill frontmatter, and settings.
  • Optional telemetry to measure token usage before and after changes.

Schema details

Install type
copy
Troubleshooting
No
Full copyable content
## Content

Prompt Cache Optimization Agent is a reusable agent prompt for lowering token cost
and latency in Claude Code by improving how well the prompt cache is reused. It
focuses on keeping early, stable context constant, trimming always-on content,
deferring skills until needed, and leaning on MCP tool-search so idle tools do not
bloat every request.

Use it when a project's Claude Code usage is expensive or slow and you want
concrete, documentation-grounded context hygiene.

## Agent Prompt

You are a prompt-cache and context-cost optimizer for Claude Code. Reduce cost and
latency by improving cache reuse and trimming unnecessary always-on context,
without removing safety-relevant instructions. Use the official Claude Code
documentation as your reference for how features load.

Optimization workflow:

1. Stabilize early context. The most cache-friendly setup keeps the earliest,
   largest context (system prompt, CLAUDE.md) stable across requests. Flag churn
   in always-on context that invalidates the cache.
2. Trim CLAUDE.md. Keep it focused on always-needed rules. Move reference material
   to skills that load on demand. Aim for a lean always-on footprint.
3. Defer skills. Skill descriptions load each session, but full content loads only
   when used. For user-only skills, set the frontmatter so nothing loads until
   invoked.
4. Use MCP tool-search. Tool names load at session start with schemas deferred;
   confirm tool-search is on so idle MCP tools cost little.
5. Avoid mid-context insertions that invalidate the cache for the rest of the
   session when they can be deferred.
6. Measure. If telemetry is available, compare token usage before and after.

Output contract:

- Context inventory: always-on content, skills, MCP tools and their costs.
- Findings: churn that breaks caching, oversized CLAUDE.md, eager skills.
- Recommended changes: stabilize, trim, defer, and rely on tool-search.
- Optional measurement plan using telemetry.

## Features

- Identifies context churn that invalidates the prompt cache.
- Trims always-on CLAUDE.md and defers reference material to skills.
- Uses skill invocation control and MCP tool-search to cut idle cost.
- Provides a before/after measurement approach via telemetry.

## Use Cases

- Reduce token spend on a frequently used Claude Code project.
- Cut latency caused by bloated always-on context.
- Right-size CLAUDE.md and skill loading.
- Confirm MCP tool-search is keeping idle tool cost low.

## Source Notes

- Claude Code loads CLAUDE.md fully every request, loads skill descriptions at
  session start with full content on use, and defers MCP tool schemas with tool-
  search on by default.
- Keeping the large, early context stable maximizes reuse, and moving reference
  content into on-demand skills lowers per-request cost.

## Duplicate Check

The content tree and open PRs were checked for prompt cache, token cost, and
context optimization agents. No prompt cache optimization agent exists. This entry
is distinct: it is an `agents` prompt focused on improving Claude Code prompt-cache
reuse and context cost.

## Editorial Disclosure

Submitted as an independent community agent entry by `JPette1783`, based on
public Claude Code documentation. No paid placement, referral, or affiliate
relationship.

## Sources

- Claude Code skills documentation: https://code.claude.com/docs/en/skills
- Claude Code features overview: https://code.claude.com/docs/en/features-overview
- Claude Code MCP documentation: https://code.claude.com/docs/en/mcp

About this resource

Content

Prompt Cache Optimization Agent is a reusable agent prompt for lowering token cost and latency in Claude Code by improving how well the prompt cache is reused. It focuses on keeping early, stable context constant, trimming always-on content, deferring skills until needed, and leaning on MCP tool-search so idle tools do not bloat every request.

Use it when a project's Claude Code usage is expensive or slow and you want concrete, documentation-grounded context hygiene.

Agent Prompt

You are a prompt-cache and context-cost optimizer for Claude Code. Reduce cost and latency by improving cache reuse and trimming unnecessary always-on context, without removing safety-relevant instructions. Use the official Claude Code documentation as your reference for how features load.

Optimization workflow:

  1. Stabilize early context. The most cache-friendly setup keeps the earliest, largest context (system prompt, CLAUDE.md) stable across requests. Flag churn in always-on context that invalidates the cache.
  2. Trim CLAUDE.md. Keep it focused on always-needed rules. Move reference material to skills that load on demand. Aim for a lean always-on footprint.
  3. Defer skills. Skill descriptions load each session, but full content loads only when used. For user-only skills, set the frontmatter so nothing loads until invoked.
  4. Use MCP tool-search. Tool names load at session start with schemas deferred; confirm tool-search is on so idle MCP tools cost little.
  5. Avoid mid-context insertions that invalidate the cache for the rest of the session when they can be deferred.
  6. Measure. If telemetry is available, compare token usage before and after.

Output contract:

  • Context inventory: always-on content, skills, MCP tools and their costs.
  • Findings: churn that breaks caching, oversized CLAUDE.md, eager skills.
  • Recommended changes: stabilize, trim, defer, and rely on tool-search.
  • Optional measurement plan using telemetry.

Features

  • Identifies context churn that invalidates the prompt cache.
  • Trims always-on CLAUDE.md and defers reference material to skills.
  • Uses skill invocation control and MCP tool-search to cut idle cost.
  • Provides a before/after measurement approach via telemetry.

Use Cases

  • Reduce token spend on a frequently used Claude Code project.
  • Cut latency caused by bloated always-on context.
  • Right-size CLAUDE.md and skill loading.
  • Confirm MCP tool-search is keeping idle tool cost low.

Source Notes

  • Claude Code loads CLAUDE.md fully every request, loads skill descriptions at session start with full content on use, and defers MCP tool schemas with tool- search on by default.
  • Keeping the large, early context stable maximizes reuse, and moving reference content into on-demand skills lowers per-request cost.

Duplicate Check

The content tree and open PRs were checked for prompt cache, token cost, and context optimization agents. No prompt cache optimization agent exists. This entry is distinct: it is an agents prompt focused on improving Claude Code prompt-cache reuse and context cost.

Editorial Disclosure

Submitted as an independent community agent entry by JPette1783, based on public Claude Code documentation. No paid placement, referral, or affiliate relationship.

Sources

Source citations

Add this badge to your README

Show that Prompt Cache Optimization Agent is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/agents/prompt-cache-optimization-agent.svg)](https://heyclau.de/entry/agents/prompt-cache-optimization-agent)

How it compares

Prompt Cache Optimization Agent side by side with 2 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

1 trust signal differ across this comparison (Submitter).

Field

Source-backed agent that reduces token cost and latency in Claude Code by improving prompt-cache hit rates, advising on stable context ordering, lean CLAUDE.md, on-demand skills, and MCP tool-search, grounded in the official docs.

Open dossier

Source-backed Claude Code subagent prompt for reviewing Agent Skills before adoption or publication, checking SKILL.md scope, descriptions, invocation control, supporting files, tool permissions, helpfulness, safety, and privacy risks against official Claude Code skills guidance.

Open dossier

An agent prompt for curating an organization's Agent Skills: reviewing each SKILL.md name and description, scope (personal, project, or plugin) and precedence, per-skill allowed-tools, and whether Claude or the user invokes it.

Open dossier
Next steps
Trust
Review statusNot reviewedNot reviewedNot reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verified
Source provenanceSource-backedSource-backedSource-backed
SubmitterDiffersJPette1783Desel72JPette1783
Install riskReview firstReview firstReview first
Notes Safety ✓ Privacy ✓ Safety ✓ Privacy ✓ Safety ✓ Privacy ✓
Brand
Categoryagentsagentsagents
SourceSource-backedSource-backedSource-backed
AuthorJPette1783Desel72JPette1783
Added2026-06-052026-06-082026-06-05
Platforms
Harness
Source repo
Safety notesThis agent optimizes context and cost; it does not change permissions or perform destructive actions. Do not move secrets into always-loaded context for caching reasons; keep credentials out of CLAUDE.md and prompts. Optimizations should not remove safety-relevant instructions just to shrink context; preserve guardrails.This agent reviews skill quality and adoption readiness; it does not execute the skill, install plugins, run scripts, or approve production rollout by itself. Flag skills that can perform writes, deployments, destructive actions, account changes, network calls, credential handling, or background automation without explicit user control. Recommend `disable-model-invocation: true`, least-privilege `allowed-tools`, or additional human review when a skill has side effects or could trigger too broadly. Treat supporting files, shell injection blocks, and bundled scripts as executable or instruction-bearing review surfaces, not harmless documentation.This agent curates and reviews skills; it does not execute them. Recommend tool restrictions (allowed-tools) for skills that touch sensitive actions, and invocation control for skills with side effects. Flag skills whose descriptions could cause the model to auto-invoke them in inappropriate contexts.
Privacy notesCLAUDE.md and always-on context are sent every request; avoid placing sensitive data there for cache reasons. Measuring cost via telemetry sends usage metrics to your configured exporter; confirm where that data goes. Skill descriptions load each session; keep sensitive workflow details out of descriptions.Reads local skill instructions and supporting files, which may expose internal workflow names, repository paths, policies, examples, customer data, or credentials accidentally written into prompts. Review output can mention sensitive skill names, tool permissions, file paths, dynamic commands, and risk findings; keep it out of public PR comments unless sanitized. Skills loaded by Claude can place their descriptions or full instructions into model context, so the review should flag secrets and unnecessary confidential details before adoption.Skill descriptions load each session; keep sensitive workflow detail and secrets out of them. Skills sourced from outside the org should be reviewed before adoption, since their instructions run in your sessions. Use settings-level overrides to hide or disable model-invocation of skills you did not author without editing their files.
Prerequisites
  • A Claude Code project where token cost or latency is a concern, with visibility into CLAUDE.md, skills, and connected MCP servers.
  • Ability to edit CLAUDE.md, skill frontmatter, and settings.
  • Optional telemetry to measure token usage before and after changes.
  • One or more Agent Skill directories with a `SKILL.md` file and any referenced supporting files.
  • Access to the skill's intended user, task boundary, invocation path, and expected output.
  • A clear policy for whether the skill may be model-invoked automatically or must be user-invoked.
  • Permission to inspect tool restrictions, dynamic context commands, scripts, examples, templates, and bundled plugin metadata if present.
  • A set of Agent Skills (personal, project, or plugin) with their SKILL.md files.
  • Knowledge of which skills should be org-wide versus project-specific.
  • Ability to edit skill frontmatter and settings such as skill overrides.
Install
Config
Citations
ClaimUnclaimedUnclaimedUnclaimed
Open 3 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.