kevinzai/commander/cache-monitor

Claude Code and agent skill by kevinzai/commander

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Analyze Claude Code and OpenClaw session costs and cache efficiency. Parses JSONL session files to report cache hit rates, token waste, cost by project/agent. Use to optimize the $100/month budget.

Install

npx vskill@latest install kevinzai/commander/cache-monitor

SKILL.md

Cache Monitor

When to Use

  • Weekly cost review
  • After noticing expensive sessions
  • After changing CLAUDE.md or settings.json (check for cache busting)
  • When Kevin asks "how much did that cost?"

Analysis Commands

Per-Session Cost (Claude Code)
bash
# Find today's sessions
find ~/.claude/projects/ -name "*.jsonl" -mtime -1 2>/dev/null | head -20
Per-Agent Cost (OpenClaw)
bash
# Cost by agent (last 24h)
for dir in ~/.openclaw/agents/*/; do
agent=$(basename "$dir")
cost=$(find "$dir/sessions/" -name "*.jsonl" -mtime -1 -exec grep -h '"totalCost"' {} \; 2>/dev/null | \
jq -s '[.[].totalCost // 0] | add' 2>/dev/null || echo "0")
if [ "$cost" != "0" ] && [ "$cost" != "null" ]; then
echo "$agent: \$$cost"
fi
done | sort -t'$' -k2 -rn
Cache Hit Rate
bash
# Check cache_read_input_tokens vs input_tokens ratio
# Higher ratio = better caching = lower cost
find ~/.openclaw/agents/*/sessions/ -name "*.jsonl" -mtime -1 -exec \
grep -h '"cache_read_input_tokens"' {} \; 2>/dev/null | \
jq -s 'if length > 0 then
{ total_input: ([.[].input_tokens // 0] | add),
cache_read: ([.[].cache_read_input_tokens // 0] | add) } |
.cache_rate = (if .total_input > 0 then (.cache_read / .total_input * 100 | round) else 0 end)
else { note: "no data" } end'

Output Report

markdown
# Cost & Cache Report — YYYY-MM-DD
## Summary
-Period: Last 24h / 7d / 30d
-Total cost: $X.XX
-Budget remaining: $XX.XX of \$100/month
-Cache hit rate: XX%
## By Agent (top 10)
| Agent | Sessions | Cost | Cache Rate |
|-------|----------|------|-----------|
## By Project (top 10)
| Project | Sessions | Cost | Notes |
|---------|----------|------|-------|
## Alerts
-🔴 Agents with <30% cache rate (settings misconfigured?)
-🟡 Agents with cost >\$5/day
-✅ Well-optimized agents (>70% cache rate)
## Recommendations
-Specific actions to reduce cost

Gotchas

  • JSONL format varies by OpenClaw version — some fields may be nested differently
  • Cache rate of 0% for first session is normal (cold start)
  • Opus sessions will always cost more — that's by design for complex work
  • Agent-HQ at localhost:3001 has aggregated data too

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
6
Repository forks
1
7-day trend score
10

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kevinzai/commander/cache-monitor/badge)](https://verified-skill.com/skills/kevinzai/commander/cache-monitor)

Something wrong with this skill or its page? Tell us.