Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    LLM Prompt-Cache Auditor: Fix Zero Cache Hits

    1

    Audit and fix LLM API implementations to stop prompt cache misses and reduce token costs.

    $9

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    LLM Prompt-Cache Auditor: Fix Zero Cache Hits

    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

    IssueLocationImpactFix
    Dynamic Prefixllm_client.py:42100% Cache MissThe datetime.now() call inside the system f-string changes the prefix every second. Move this to a user message after the static prefix.
    Marker Positionchat_manager.py:88No Cache WriteThe cache_control block is placed in a plain string system prompt. Move it to the final block of a content array.
    Tool Orderingtools/registry.py:12Intermittent MissTools 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

    1. Deploy the change to move datetime.now() to the first user message.
    2. Update the system prompt to use the content block array format instead of a raw string.
    3. Monitor the usage.cache_read_input_tokens field 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_control tags 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

    1. Model Identification to load provider-specific constraints for token limits and cache markers.
    2. Measurement Phase where it analyzes token usage fields (cached, write, input) to distinguish between short prefixes and unstable ones.
    3. Prefix Mapping to build a visual representation of the request order including tools, instructions, and messages.
    4. Vulnerability Scan of the codebase for f-strings, randomized sets, or per-user feature flags in the static header.
    5. 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_tokens is 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Listed7 days ago

    What's inside

    Frequently Asked Questions

    This skill identifies the exact 'cache-breakers' in your API payloads—such as dynamic timestamps, unordered tool lists, or improper marker placement—that prevent providers like Anthropic and OpenAI from recognizing reused tokens.

    Yes, it is designed to work across all major providers that support prompt caching, including Anthropic Claude, OpenAI, and Google Gemini, regardless of which SDK or framework you are using.

    You receive the full auditing toolset, including the prefix mapping engine, provider-specific constraint libraries, and the automated report generator that identifies specific lines of code causing cache misses.

    The auditor requires either access to your application's source code or samples of your raw API request logs to perform a byte-level analysis of the payload structure.

    While it is highly effective for RAG, this skill specifically focuses on the 'static' portions of your request, such as tool definitions and system instructions, rather than the dynamic retrieval content itself.

    New in LLM Ops