cost-optimizer

cost-optimizer is a skill for Claude Code from mergisi/awesome-openclaw-agents. It costs 69 tokens per session (1,151 once invoked), scanned A, original, MIT.

A project checker for finding common ways Claude Code uses more tokens than needed. It inspects configuration and memory files without looking up prices or estimating past spending.

In plain words
What is it for?
Use it to audit CLAUDE.md files, Claude Code memory, hooks, and related project settings for token waste. It also helps investigate unexpectedly high Claude bills or oversized session context.
Why use it?
It helps explain why an AI coding session or project may consume many tokens. You get an ordered list of fixes instead of searching through setup files manually.

Skill for Claude Code

Written for Claude Code: SessionStart hook event. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions subagents.

Good fit Use it to audit CLAUDE.md files, Claude Code memory, hooks, and related project settings for token waste. It also helps investigate unexpectedly high Claude bills or oversized session context.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mergisi/awesome-openclaw-agents/cost-optimizer
About the project

awesome-openclaw-agents is a curated collection of ready-to-use SOUL.md configurations that define AI agents for tasks across areas such as development, marketing, finance, support, and automation. It is for OpenClaw users who want predefined agent roles and workflows to adapt or deploy. The catalogue entries are agent-related skills drawn from this collection.

mergisi/awesome-openclaw-agents · 3,955 stars · on GitHub · crewclaw.com

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.

Any agent
npx skills add mergisi/awesome-openclaw-agents --skill cost-optimizer
Clone the repo
git clone --depth 1 https://github.com/mergisi/awesome-openclaw-agents

Made for: Claude Code.

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-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/mergisi/awesome-openclaw-agents/cost-optimizer/github.svg)](https://agentmods.dev/skills/mergisi/awesome-openclaw-agents/cost-optimizer)
Your own site
<a href="https://agentmods.dev/skills/mergisi/awesome-openclaw-agents/cost-optimizer"><img src="https://agentmods.dev/badge/skills/mergisi/awesome-openclaw-agents/cost-optimizer/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-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/skills/mergisi/awesome-openclaw-agents/cost-optimizer"><img src="https://agentmods.dev/badge/skills/mergisi/awesome-openclaw-agents/cost-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 69 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,151 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 2 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 3 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Agent Snooping · line 36
    Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
    Fix: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variabl
  • high Agent Snooping · line 37
    Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
    Fix: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variabl
  • medium Agent Snooping · line 48
    Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
    Fix: Remove all code or instructions that list or read other skills' files or directories. Skills should operate independently; cross-skill access is a privilege escalation.
How audits are shown
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.00069 $0.01151
Opus 5 $0.00034 $0.00575
Sonnet 5 $0.00014 $0.00230
Haiku 4.5 $0.00007 $0.00115

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

Security

Grade A, and why

cost-optimizer scanned grade A with 2 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 11d 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.

Reads agent configuration directorieslowAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

find ~/.claude/projects -name 'MEMORY.md' -exec wc -l {} \;

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Enumerates other installed skillslowAgent snooping

Other skills' SKILL.md files reveal prompts, capabilities and secrets that should be invisible to peers.

ls ~/.claude/skills/ .claude/skills/ 2>/dev/null

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

skills/claude/cost-optimizer/SKILL.md · 120 lines

How it starts

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

Cost Optimizer

Audit a project's Claude Code setup for the handful of well-known cost leaks and output a prioritized remediation list. This is a static inspection — no pricing API calls, no guesswork about past spend.

When to use

  • "My Claude Code bill doubled this month — what's going on?"
  • "Audit this project for token waste"
  • "Why is my session context always huge?"
  • Post-mortem after a runaway agent run

What to check

Run each check and record PASS / WARN / FAIL with a short note.

1. CLAUDE.md size

wc -l CLAUDE.md .claude/CLAUDE.md 2>/dev/null
  • PASS: under 100 lines
  • WARN: 100-300 lines
  • FAIL: >300 lines — this is prepended to every message, so every line costs tokens forever.

Fix: move reference material (API keys, runbooks, verbose examples) into skill files or docs/, and leave CLAUDE.md as a thin pointer.

2. Memory file bloat

find ~/.claude/projects -name 'MEMORY.md' -exec wc -l {} \;
find .claude/memory -type f -exec wc -l {} \; 2>/dev/null
  • WARN if any memory file is >500 lines.
  • FAIL if >1500 lines — memory should be a curated index with links to detail files, not a dump.

Fix: extract old sections into memory/<topic>.md detail files and link from the index.

3. Unused or shadowed skills

ls ~/.claude/skills/ .claude/skills/ 2>/dev/null
  • Cross-reference with the skill invocations in the last 30 days of shell history or session logs if available.
  • Skills that have never been invoked but have huge SKILL.md bodies (>300 lines) are loaded into the skill index every turn — prune them.

4. Subagent fan-out patterns

Grep the project for Task/agent launch patterns:

grep -rn 'TaskCreate\|subagent\|parallel.*agent' --include='*.md' --include='*.js' --include='*.ts' .
  • WARN if the repo spawns >5 parallel subagents per run without aggregation — each spins up its own context window.
  • FAIL if subagents re-read the whole repo instead of receiving a scoped prompt.

Read the full file on GitHub · 120 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. 11d ago First seen · 120 lines · 69 tokens per session scan A 06bd4abeb951

Subscribe to this mod's changes

cost-optimizer is a skill published in the GitHub repository mergisi/awesome-openclaw-agents (3,955 stars, last pushed 3mo ago), licensed MIT. It adds 69 tokens to every session and 1,151 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 2 findings (reads agent configuration directories, enumerates other installed skills). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

hive.chart-creation-foundations

Required reading whenever any chart tool is available. Teaches the one-tool embedding contract (call chartrender → live chart appears in chat AND a downloadable PNG lands in the queen session dir), the ECharts (data viz) vs Mermaid (structural diagrams) decision, the BI/financial-grade aesthetic baseline (no…

aden-hive/hive · 133 tokens

browser-edge-cases

SOP for debugging browser automation failures on complex websites. Use when browser tools fail on specific sites like LinkedIn, Twitter/X, SPAs, or sites with Shadow DOM.

aden-hive/hive · 40 tokens

shogun-screenshot

A screenshot tool for getting images from a computer or web page and then cropping, resizing, or masking sensitive information. Playwright is a browser-automation tool used here to capture web pages.

yohey-w/multi-agent-shogun · 149 tokens

agent-qa-testing

Agent davranis testi ve protokol uyumluluk dogrulamasi. Agent'larin tanimli rollerine uygun davranip davranmadigini assertion-based test'lerle olcer. Personality drift, role violation ve output kalite regresyonu tespit eder.

vibeeval/vibecosystem · 58 tokens

accessibility-patterns

WCAG 2.2 AA compliance, ARIA patterns, keyboard navigation, screen reader optimization.

vibeeval/vibecosystem · 24 tokens

review

Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes — Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/PRD asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use…

stevesolun/ctx · 95 tokens