Cachecut

    by Sujal Tangde

    1

    Identify and fix prompt-cache busters to reduce LLM API costs using measured hit-rate optimization.

    $1.90

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Cachecut

    Example session with this skill installed

    Scan my repo for cache busters and optimize the prompt in src/chains/researcher.py. The Anthropic bill is too high because we keep sending the same 5k token context.

    • Read your context and instructions
    • Compiled the cachecut

    I have analyzed src/chains/researcher.py and measured the cache hit rate. The primary buster was a dynamic current_time string injected at the very top of the system prompt, which invalidated the 5,200 token RAG context on every request. I also found that your tool list was being serialized from a Python set, causing random ordering.

    CacheCut report

    Call siteProvider/modelHit rate beforeHit rate afterEst. input cost change
    src/chains/researcher.py:42claude-3-5-sonnet0.0%88.4%−72.5%

    Busters fixed:

    • src/chains/researcher.py:45: Moved datetime.now() from system prompt prefix to the user message block.
    • src/chains/researcher.py:58: Wrapped tools list in sorted() to ensure deterministic serialization.
    • src/chains/researcher.py:112: Added cache_control={"type": "ephemeral"} to the large RAG context block.

    Skipped:

    • src/utils/summarizer.py:12: Left alone. Static prefix is only 140 tokens, which is below the 1024 token minimum for effective caching on this provider.

    Assumptions:

    • Based on 1,000 requests/day.
    • Anthropic Claude 3.5 Sonnet pricing (Cache Write: $3.75/MTok, Cache Read: $0.30/MTok).

    Next steps

    1. Deploy the changes to src/chains/researcher.py to start seeing immediate bill reductions.
    2. Update your logging to capture usage.cache_read_input_tokens in your production dashboard.
    3. Re-verify hit rates in one week to ensure the 5-minute TTL is sufficient for your traffic patterns.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    High LLM bills often stem from a 0% cache hit rate caused by a single changing byte in your prompt prefix. This skill identifies cache-busters like timestamps, unsorted JSON, or dynamic user data that silently break prompt caching, and restructures your code to fix them.

    What it does

    • Automatic scanning of your repository to locate all LLM call sites and potential cache-breaking patterns.
    • Hit rate measurement by analyzing raw usage objects or replaying traffic to establish a cost baseline.
    • Prompt restructuring to move dynamic variables after static system instructions, tools, and RAG context.
    • Deterministic ordering of tool definitions, examples, and JSON keys to ensure prefix consistency.
    • Provider-specific implementation including Anthropic's cache_control and OpenAI's prefix optimization rules.
    • Savings verification through before-and-after reports with real measured token counts.

    How it works

    1. Inventory: Run the scan script to map out provider models, call sites, and static prefix sizes.
    2. Baseline: Capture current cached_tokens usage from logs or test requests to calculate the existing hit rate.
    3. Diagnose & Fix: Move busters like "Current Date" or user IDs out of the prefix and enforce sorted serialization.
    4. Report: Generate a table showing the hit rate delta and the percentage reduction in input token costs.

    Frameworks & tools

    Works with Python-based LLM applications using OpenAI, Anthropic, or Gemini SDKs. Includes specialized scripts for repo scanning and usage log analysis.

    Why this beats prompting it yourself

    Generic prompts often miss the subtle provider-specific rules, like Anthropic's explicit opt-in requirement or OpenAI's 1024-token block minimums. This skill uses measured usage data to prove savings rather than guessing, ensuring you don't pay "cache-write" premiums for prefixes that never get reused.

    Use cases

    • Cost optimization for RAG pipelines with large, static document corpora.
    • Fixing broken caching in agents that use frequently changing tool definitions or system prompts.
    • Scaling chat applications by optimizing append-only conversation history.
    • Pre-ship audit to ensure new LLM features are cache-ready before hitting production.

    Known limitations

    Does not support prompts where the static prefix is below the provider's minimum cacheable threshold. Requires access to raw usage logs or the ability to run test traffic.

    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 buying a skill.

    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

    Software
    Python

    Permissions

    Terminal / Shell
    Read Files
    Listed7 days ago

    What's inside

    Frequently Asked Questions

    Cachecut identifies and fixes 'cache-busters'—minor dynamic elements like timestamps or unsorted JSON that reset your prompt prefix—ensuring that your static instructions and RAG context are successfully cached by providers to lower your API bills.

    The skill includes a repository scanner, diagnostic scripts for log analysis, and implementation templates optimized for Anthropic's cache_control and OpenAI's prefix requirements.

    Cachecut works with Python-based applications utilizing the OpenAI, Anthropic, or Gemini SDKs, and is particularly effective for RAG pipelines and agents with large system prompts.

    Setup involves running the included inventory script on your repository and providing access to your usage logs or a small sample of test traffic to establish a cost baseline.

    Yes, the skill includes logic to ensure your static prefixes meet the minimum token requirements (such as OpenAI's 1024-token blocks) so you don't incur 'cache-write' fees for prompts that are too short to be cached.

    Cachecut is designed for static or semi-static prefixes; if your entire prompt changes completely with every request and shares no common header, you may not see significant savings.

    New in LLM Ops

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.