cost-optimizer
Skill4k starsChanged 9 months agoMITView on GitHub
Trigger when the user asks to audit Claude Code costs, reduce token spend, says "my Claude bill is too high", "optimize my CLAUDE.md", "why is this project burning tokens", or "/cost-optimizer". Scans a project for the common Claude Code cost leaks and returns a prioritized fix list.
3 other projects use a version of this.
Trending
Quiet since October.about the whole repository
Most recently taken up by
- ShawhinT/non-coding-skillstheir own version, first seen Jul 28, 2026
- scoobydont-666/shared-claude-skillstheir own version, first seen Jul 7, 2026
- RandomNest/aivideo-production-skillstheir own version, first seen Feb 20, 2026
Who's talking about mergisi/awesome-openclaw-agents
- openclaw/openclaw“docs(showcase): add CrewClaw deployment platform”GitHub · Mar 16, 2026 · 2 reactions
- @tom-doerr.bsky.social“https://github.com/mergisi/awesome-openclaw-agents”Bluesky · Jun 13, 2026 · 1 likes
- ashishpatel26/500-AI-Agents-Projects“Add OpenClaw agent templates (177 agents across 24 categories)”GitHub · Mar 21, 2026 · 1 reactions
- @tom-doerr.bsky.social“https://github.com/mergisi/awesome-openclaw-agents”Bluesky · Mar 15, 2026 · 1 likes
- openclaw/openclaw“docs: add awesome-openclaw-agents to Community section”GitHub · Feb 18, 2026 · 1 reactions
The biggest 5 of 18 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 18
Talked about on GitHub and Bluesky (18 times).
On GitHub · 16
- Mar 16, 2026docs(showcase): add CrewClaw deployment platform — openclaw/openclaw2 reactions · 3 comments
- Mar 21, 2026Add OpenClaw agent templates (177 agents across 24 categories) — ashishpatel26/500-AI-Agents-Projects1 reaction · 2 comments
- Feb 18, 2026docs: add awesome-openclaw-agents to Community section — openclaw/openclaw1 reaction · 4 comments
- Feb 11, 2026docs(showcase): add CrewClaw deployment platform — openclaw/openclaw1 reaction · 5 comments
- Oct 3, 2026agent-skills.github.mergisi.awesome-openclaw-agents: 2.0-unstable-2026-05-25 → 2.0 — sudosubin/agents.nix0 reactions
11 more on GitHub
- Sep 29, 2026agent-skills.github.mergisi.awesome-openclaw-agents: init at 2.0-unstable-2026-05-25 — sudosubin/agents.nix0 reactions
- Apr 27, 2026docs(showcase): add CrewClaw deployment platform — BingqingLyu/openclaw0 reactions
- Apr 24, 2026Add CrewClaw to Frameworks (no-code generator for OpenClaw) — kyrolabs/awesome-agents0 reactions
- Apr 13, 2026update pleaxe — ogerly/awesom-claw0 reactions
- Mar 21, 2026Add OpenClaw agent templates collection (177 agents) — Shubhamsaboo/awesome-llm-apps0 reactions
- Mar 17, 2026Integration: 177 ready-to-deploy agent templates from CrewClaw — NVIDIA/NemoClaw0 reactions
- Mar 9, 2026Add Awesome OpenClaw Agents to related resources — msitarzewski/agency-agents0 reactions
- Mar 9, 2026Add Awesome OpenClaw Agents — slavakurilyak/awesome-ai-agents0 reactions · 1 comment
- Mar 9, 2026Add Awesome OpenClaw Agents — e2b-dev/awesome-ai-agents0 reactions
- Mar 9, 2026Add Awesome OpenClaw Agents template collection — kyrolabs/awesome-agents0 reactions
- Feb 8, 2026Add CrewClaw — no-code AI agent generator (closed-source) — e2b-dev/awesome-ai-agents0 reactions
On Bluesky · 2
- Jun 13, 2026https://github.com/mergisi/awesome-openclaw-agents — @tom-doerr.bsky.social1 likes and repost
- Mar 15, 2026https://github.com/mergisi/awesome-openclaw-agents — @tom-doerr.bsky.social1 likes and repost
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- ShawhinT/non-coding-skills★ 40same name
- RandomNest/aivideo-production-skills★ 15same name
- scoobydont-666/shared-claude-skills★ 1same name
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 repository15 other files it gives its agents.
- excalidraw-architectureSkill
- git-commit-writerSkill
- model-cost-compareSkill
- openclaw-debuggerSkill
- code-explainerSkill
- commit-messageSkill
- cover-letterSkill
- growth-ideasSkill
- haiku-cardSkill
- meeting-notesSkill
- pricing-advisorSkill
- regex-builderSkill
- sql-explainerSkill
- standup-summarySkill
- tone-shifterSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
Run each check and record PASS / WARN / FAIL with a short note.
- Distinctive: line 40
WARN: if any memory file is >500 lines.
- Distinctive: line 41
FAIL: if >1500 lines — memory should be a curated index with links to detail files, not a dump.
- Distinctive: line 62
WARN: if the repo spawns >5 parallel subagents per run without aggregation — each spins up its own context window.
- Distinctive: line 63
FAIL: if subagents re-read the whole repo instead of receiving a scoped prompt.
- Very specific: line 69
Look for .claude/settings.json and check if the project sets an unusually short cache TTL, or if hooks invalidate the cache every message …
- Very specific: line 81
WARN: if Opus is pinned for routine tasks that Sonnet could handle.
- Distinctive: line 112
Do not invent dollar savings.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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.mdbodies (>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.
Fix: pass a short brief + a handful of file paths to each subagent, not the entire CLAUDE.md context.
5. Prompt cache hygiene
Look for .claude/settings.json and check if the project sets an unusually short cache TTL, or if hooks invalidate the cache every message (e.g. a hook that echoes a timestamp into the system prompt).
- FAIL any hook that injects
date/uuidgen/ random content into every turn — it kills the cache, 10x cost.
6. Model selection
Grep for explicit model pins:
grep -rn 'opus\|sonnet\|haiku\|claude-3\|claude-4' .claude/ CLAUDE.md 2>/dev/null- WARN if Opus is pinned for routine tasks that Sonnet could handle. Recommend the
/model-cost-compareskill for a per-task estimate.
7. Session file size
du -sh ~/.claude/projects/*/sessions 2>/dev/null | sort -h | tail -5Huge session dirs suggest you never /compact long-running threads. Suggest periodic compaction.
Output format
Print a ranked list. Top of the list = biggest win per effort.
Cost Optimizer — <project>
Priority 1 (FAIL)
[CLAUDE.md] 412 lines — prepended every turn. Extract sections into skills/.
[cache hygiene] .claude/settings.json hook injects `date +%s` on SessionStart. Remove it.
Priority 2 (WARN)
[memory] MEMORY.md is 820 lines. Index top, details linked.
[model pinning] Opus 4.6 pinned in 4 skill files — 2 could drop to Sonnet 4.6.
Priority 3 (nice-to-have)
[skills] 3 skills (haiku-card, foo, bar) never invoked in last 30 days.
Estimated impact: roughly halving per-turn overhead — validate with a before/after /cost check.Do not invent dollar savings. You can estimate relative impact ("~30% smaller context") but not absolute currency unless the user provides their current bill.
Example invocations
/cost-optimizer- "Audit this project for Claude Code cost waste"
- "My CLAUDE.md feels too big — what should I cut?"
- "Why is my prompt cache missing every turn?"
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
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.

