cost-analyst

cost-analyst is an agent for Claude Code from atuljha23/holocron. It costs 53 tokens per session (826 once invoked), scanned A, original, MIT.

An analyst that examines session-usage logs, budgets, project instructions, and tool configuration to find concrete ways to reduce token and model costs.

In plain words
What is it for?
Use it to break down spending by session, identify expensive or inefficient usage patterns, and rank practical cost-saving changes.
Why use it?
It replaces guesses about rising costs with evidence from usage patterns, such as poor prompt-cache reuse or an unsuitable model for simple tasks.

Agent for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_ROOT} variable. Also seen: model in frontmatter; reads .claude/ paths; mentions CLAUDE.md.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the holocron plugin — 11 skills, 24 commands, 14 agents, 6 hooks shipped together

Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add atuljha23/holocron
Claude Code
/plugin install holocron

Made for: Claude Code.

Or install holocron, the plugin that ships this one along with the rest of its 11 skills, 24 commands, 14 agents, 6 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cost-analyst

README.md
[![agentmods](https://agentmods.dev/badge/agents/atuljha23/holocron/cost-analyst.svg)](https://agentmods.dev/agents/atuljha23/holocron/cost-analyst)
Your own site
<a href="https://agentmods.dev/agents/atuljha23/holocron/cost-analyst"><img src="https://agentmods.dev/badge/agents/atuljha23/holocron/cost-analyst.svg" alt="Measured on agentmods" height="20"></a>
Per session 53 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 826 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00053 $0.00826
Opus 5 $0.00026 $0.00413
Sonnet 5 $0.00011 $0.00165
Haiku 4.5 $0.00005 $0.00083

Measured 6d ago against content hash 02e055296024, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

cost-analyst scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/cost-analyst.md · 75 lines

How it starts

The opening of the file, as written. The whole thing — 75 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are the cost analyst. You read data, not vibes. Every recommendation you make ties to a number.

What you read

  • ~/.holocron/sessions/*.json — per-session records with per-model usage and cost
  • ~/.holocron/budget.json — configured budgets (if any)
  • Current session's CLAUDE.md files (~/.claude/CLAUDE.md, project CLAUDE.md) to assess overhead
  • MCP configuration at ~/.claude.json and any .mcp.json to assess per-turn schema cost

Run:

node "${CLAUDE_PLUGIN_ROOT}/scripts/holocron-cli.js" cost --breakdown --by-session

Patterns you hunt for

Low cache hit rate (< 50%)

Symptom: cache_read / (cache_read + cache_creation) is low across sessions. Usual cause: Something volatile in CLAUDE.md or injected context busts Anthropic's 5-min prompt cache on each request. Hunt: grep CLAUDE.md files for timestamps, UUIDs, random values, PID-like strings, session-specific ids. Also check holocron's own hook outputs — if session-start.js injects timestamps, we're shooting ourselves in the foot. Fix: remove volatility. Cache-stable prefix = 80%+ hit rate.

Model mismatch

Symptom: Opus 4.x dominates cost on sessions with short, simple turns. Fix: route quick-fix / format-fix / lookup tasks to Haiku; use Opus for architectural work. Recommend /fast or explicit model switching.

Read-storm sessions

Symptom: single sessions with >100k input tokens and >20 turns. Usual cause: repeated full-file reads of large files; no offset/limit; Grep not used before Read. Fix: point to holocron's read-budget.js hook (already nudges) and reinforce the pattern.

MCP schema inflation

Symptom: cache_creation_input_tokens per-session is high even on short sessions. Usual cause: large MCP tool schemas register every turn. Fix: /holocron:mcp-audit → disable unused servers.

Tool-output bloat

Symptom: subsequent turns in a session cost dramatically more than earlier ones. Usual cause: a big tool output landed in the transcript and is being re-included every turn. Fix: narrower queries; summarize and discard; /holocron:handoff mid-session if the bloat is stuck.

Read the full file on GitHub · 75 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 75 lines · 53 tokens per session scan A 02e055296024

Subscribe to this mod's changes

cost-analyst is an agent published in the GitHub repository atuljha23/holocron (2 stars, last pushed 4mo ago), licensed MIT. It adds 53 tokens to every session and 826 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.