cost-check

cost-check is a command for Claude Code from Sagargupta16/claude-cost-optimizer. It costs 9 tokens per session (379 once invoked), scanned A, original, MIT.

A command that estimates the current coding session's usage, cost, and work patterns.

In plain words
What is it for?
Use it to review the session's approximate input and output, model usage, wasteful patterns, and concrete ways to reduce further cost.
Why use it?
It helps reveal whether time or tokens were spent on unnecessary file reads, searches, or explanations.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter; mentions CLAUDE.md.

Part of the claude-cost-optimizer plugin — 1 skill, 3 commands, 2 hooks shipped together

Good fit Use it to review the session's approximate input and output, model usage, wasteful patterns, and concrete ways to reduce further cost.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/sagargupta16/claude-cost-optimizer/cost-check
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/Sagargupta16/claude-cost-optimizer

Made for: Claude Code.

Or install claude-cost-optimizer, the plugin that ships this one along with the rest of its 1 skill, 3 commands, 2 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-check

README.md
[![agentmods](https://agentmods.dev/badge/commands/sagargupta16/claude-cost-optimizer/cost-check/github.svg)](https://agentmods.dev/commands/sagargupta16/claude-cost-optimizer/cost-check)
Your own site
<a href="https://agentmods.dev/commands/sagargupta16/claude-cost-optimizer/cost-check"><img src="https://agentmods.dev/badge/commands/sagargupta16/claude-cost-optimizer/cost-check/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cost-check

Your own site · 80×15
<a href="https://agentmods.dev/commands/sagargupta16/claude-cost-optimizer/cost-check"><img src="https://agentmods.dev/badge/commands/sagargupta16/claude-cost-optimizer/cost-check.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 379 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00009 $0.00379
Opus 5 $0.00005 $0.00189
Sonnet 5 $0.00002 $0.00076
Haiku 4.5 $0.00001 $0.00038

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

Security

Grade A, and why

cost-check 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 9d 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.

templates/commands/cost-check.md · 52 lines

What it actually says

Cost Check

Analyze the current session and report on cost efficiency. Be concise — this command should itself be cheap.

Instructions

  1. Session summary: Count how many turns have occurred so far in this conversation. Note the approximate scope of work done.

  2. Token usage estimate: Based on the conversation length and complexity, estimate:

    • Approximate input tokens consumed (including CLAUDE.md overhead per turn)
    • Approximate output tokens generated
    • Which model has been used (Haiku/Sonnet/Opus)
  3. Cost patterns identified: Flag any of these wasteful patterns if they occurred:

    • Full file reads when partial reads would suffice
    • Multiple search passes for the same information
    • Verbose explanations where concise answers were appropriate
    • Unnecessary exploration before making targeted edits
    • Reading files that were not ultimately used
  4. Recommendations: Suggest 1-3 specific actions to reduce cost for the remainder of this session. Examples:

    • "Switch to Haiku for the remaining simple edits"
    • "Use Grep with specific patterns instead of reading full files"
    • "Batch remaining edits into fewer turns"

Output Format

SESSION COST REPORT
-------------------
Turns so far:     {n}
Model used:       {model}
Est. input tokens: ~{n}k
Est. output tokens: ~{n}k
Est. session cost: ~${n.nn}

PATTERNS FOUND:
- {pattern 1}
- {pattern 2}

RECOMMENDATIONS:
1. {recommendation}
2. {recommendation}

Keep the report under 20 lines. Do not elaborate beyond what is shown above.

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. 9d ago First seen · 52 lines · 9 tokens per session scan A c79fa823b048

Subscribe to this mod's changes

cost-check is a command published in the GitHub repository Sagargupta16/claude-cost-optimizer (35 stars, last pushed 3d ago), licensed MIT. It adds 9 tokens to every session and 379 once invoked, about $0.0000 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-30.