agentleFS
agentic-control-planeagentic-control-plane/codex-acp-plugin/skills/cost-xray/SKILL.md

cost-xray

Skill1 starsChanged 4 months agoMITView on GitHub

Generate a cost X-ray report for your agent from ACP's metering — cache economics, context composition, tool bloat, loop share — before you ship it (or whenever spend surprises you)

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. agentic-control-plane/claude-code-acp-plugin★ 1100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository2 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    ACP MCP tools: if connected: acp_optimize (composition), acp_trace (one run's steps), acp_recommendations (policy findings), acp_cost …

    line 13
  2. Very specific:

    Failure waste: only from runOutcome === "failed" runs.

    line 30

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Cost X-ray

Produce a ranked, evidence-backed report on where this agent's model spend goes and what to change. ACP sits in the request path, so it sees composition (cache blend, context breakdown, per-tool output bytes, loop share) — not just totals. Your job: pull the data, run the decompositions below, and deliver a report the user can act on before scaling to production.

Data sources (in order of preference)

  1. ACP MCP tools if connected: acp_optimize (composition), acp_trace (one run's steps), acp_recommendations (policy findings), acp_cost (spend by model).
  2. REST fallback with the key in ~/.acp/credentials (or ~/.acp/proxy-key):
    • GET https://api.agenticcontrolplane.com/api/v1/runs?window=7d — run rollups
    • GET https://api.agenticcontrolplane.com/api/v1/runs/{runKey} — one run with ordered steps
    • GET https://api.agenticcontrolplane.com/api/v1/introspect/cost-insights?window=7d — ranked recommendations Auth: Authorization: Bearer <key>.

Analysis steps

  1. Headline: total cost, run count, window. If byoAuth, label costs "@ API rates" (subscription traffic priced at what it would cost).
  2. Cache economics — decompose before concluding. A low headline hit rate has at least four distinct causes with different fixes. Compute from step data (model, tMs, promptTokens, cachedTokens):
    • per-model hit rate — Anthropic caches are per-model; if one model is cold, switching is the cause → route or batch by model;
    • hit rate by gap since the previous same-model call (<1min / 1–5min / 5–60min) — decay over gaps = TTL expiry → schedule work closer together or accept it;
    • full-price share immediately after a model switch — high = switching cost, low = rules it out;
    • uniform ~50% across models and gaps = structural: likely cache writes of new tool output being counted as misses (heavy tool-result appending), or genuine prefix instability. Say which is more consistent with the context composition, and say what you cannot distinguish from the data.
  3. Context composition: system vs history vs tool-results share. If tool results dominate, name the top tools by re-read bytes (toolResultBytesByTool) and the worst offender's MB.
  4. Loop share: report the number. Only recommend a subagent split for autonomous agents (background/api tier) — for interactive agents the growing loop IS the work.
  5. Failure waste: only from runOutcome === "failed" runs. Runs without a terminal outcome NEVER get a waste claim.
  6. Recommendations: merge /cost-insights items, ranked by impactUsd.

Report rules (honesty is the product)

  • Window-observed dollars only unless the fix is a deterministic config change (model routing, cap) — only levers project to monthly.
  • State the basis on every claim ("based on N runs / M steps over D days"). Step arrays cap at 250 — say so when a run is truncated.
  • Name capture gaps instead of showing zeros. Empty contextBreakdown/topTools = the proxy isn't in the model path → tell the user how to add it (point the model client's base URL at the ACP proxy). Empty costByModel on older runs = pre-capture data.
  • Never claim intent you can't observe — an errored step a run recovered from is not waste.

Report shape

# Cost X-ray — <agent> — last <window>
<headline: $X across N runs (@ API rates?)>

## What your money buys        ← composition + top tools
## Cache economics             ← decomposed, with the cause you ruled IN and OUT
## What to change before shipping   ← ranked, each with $ at stake + concrete action
## What we couldn't see        ← capture gaps + how to close them

Deliver as markdown. Offer to save it to a file if the user wants to share it.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.