OPS
OPS-COST Agent
Track token consumption and Claude Code costs.
Context
<arguments>
Objective
Analyze and display token consumption metrics to optimize costs.
Measurement tools
ccusage (recommended)
# Installation
pip install ccusage
# Total consumption
ccusage
# Per project
ccusage --project
# Per day
ccusage --daily
# Specific period
ccusage --since 2026-03-01 --until 2026-03-23
RTK (optimization)
# Installation
brew install rtk
# View the savings achieved
rtk gain
# Discover unoptimized commands
rtk discover
Enable RTK: add ENABLE_RTK=1 in env of .claude/settings.json.
Reduction strategies
| Strategy | Savings | How |
|---|---|---|
| RTK rewrite | 60-90% | Automatically active via PreToolUse hook |
/compact between phases | 20-40% | Reduce accumulated context |
| Haiku agents for simple tasks | 50-70% | Exploration, reading, search |
| Focused session scope | 30-50% | 1-5 tasks per session max |
| Lightweight CLAUDE.md files | 10-20% | Less context loaded at startup |
Expected output
- Metrics: Tokens consumed (input/output), estimated cost
- Trends: Evolution per day/week
- Recommendations: Applicable optimization strategies
IMPORTANT: ccusage reads Claude Code local logs, no data is sent externally.