Works with the AI Agents you already use
LLM Prompt-Cache Auditor: Fix Zero Cache Hits
Audit and fix LLM API implementations to stop prompt cache misses and reduce token costs.
$9
LLM Prompt-Cache Auditor: Fix Zero Cache Hits
Example session with this skill installed
Audit my Claude API implementation. I am sending a 50k token system prompt with tools, but my Anthropic logs show 0 cached tokens on every request. I'm using Python and the Anthropic SDK.
- Read your context and instructions
- Compiled the llm prompt-cache auditor
I have audited the provided implementation and identified two critical issues preventing prompt cache hits. The primary cause is a dynamic timestamp injected into the system prompt, which invalidates the prefix match for every request.
Prompt Cache Audit Report
| Issue | Location | Impact | Fix |
|---|---|---|---|
| Dynamic Prefix | llm_client.py:42 | 100% Cache Miss | The datetime.now() call inside the system f-string changes the prefix every second. Move this to a user message after the static prefix. |
| Marker Position | chat_manager.py:88 | No Cache Write | The cache_control block is placed in a plain string system prompt. Move it to the final block of a content array. |
| Tool Ordering | tools/registry.py:12 | Intermittent Miss | Tools are gathered from a set(), causing inconsistent ordering. Change to a list() or sort alphabetically. |
# Fixed implementation for llm_client.py
system_prompt = [
{
"type": "text",
"text": STATIC_INSTRUCTIONS,
"cache_control": {"type": "ephemeral"} # Correct marker placement
}
]
# Move dynamic data out of the system prefix
messages = [
{
"role": "user",
"content": f"Current time is {datetime.now().isoformat()}. {user_query}"
}
]
Next steps
- Deploy the change to move
datetime.now()to the first user message. - Update the system prompt to use the content block array format instead of a raw string.
- Monitor the
usage.cache_read_input_tokensfield in your next 5 requests to confirm hits.
Connects securely to your tools. The creator never sees your data.
About this skill
Stop paying full price for LLM requests that reuse the same instructions and tools. When your logs show zero prompt cache hits or unexpected latency, this skill identifies the exact byte-level changes in your request payload that are breaking the prefix match. It performs a systematic audit of your code, API calls, and history management to stop cache misses across Anthropic Claude, OpenAI, and Google Gemini.
What it does
- Pinpoint cache-breakers by detecting dynamic timestamps, session IDs, or unordered dictionaries in the prefix.
- Audit tool definitions to ensure consistent list ordering and schema stability across turns.
- Optimize marker placement by correctly positioning
cache_controltags for multi-turn conversations and tool loops. - Analyze history management to prevent sliding windows or message pruning from invalidating the entire cache.
- Validate provider limits by checking prefixes against minimum length requirements and TTL lifetimes.
How it works
- Model Identification to load provider-specific constraints for token limits and cache markers.
- Measurement Phase where it analyzes token usage fields (cached, write, input) to distinguish between short prefixes and unstable ones.
- Prefix Mapping to build a visual representation of the request order including tools, instructions, and messages.
- Vulnerability Scan of the codebase for f-strings, randomized sets, or per-user feature flags in the static header.
- Report Generation providing specific file and line numbers for each identified cause along with the required fix.
Frameworks & tools
Works with any application calling hosted LLM APIs via SDKs or HTTP including Anthropic, OpenAI, and Google.
Why this beats prompting it yourself
Prompt caching is sensitive to single-byte differences and provider-specific quirks that are easy to overlook. This skill uses a specialized debugging process to find hidden sources of entropy like unordered JSON serialization or improper history trimming that generic prompts miss.
Use cases
- Debugging why
cache_read_input_tokensis consistently 0 in Anthropic logs. - Optimizing high-traffic agents that share a massive 100k+ token system prompt.
- Fixing cache misses in RAG systems where tool definitions change per user.
- Reducing latency for multi-turn chat interfaces by fixing marker placement.
Requires access to LLM API response logs or application source code. Does not fix latency for local models or non-caching providers.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 7 days ago
Permissions
No special permissions declared or detected