Cc optimizer analyze
Skill Korck-lab/claude-code-optimizer/skills/cc-optimizer-analyze
Low-level analyzer: aggregate THIS project's Claude Code transcripts into token/model/cache statistics (zero model tokens, pure arithmetic). Read-only and project-scoped.From its SKILL.md
npx -y skills add Korck-lab/claude-code-optimizer --skill cc-optimizer-analyzeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.3 KB, as published. Nobody here has run it
/cc-optimizer:analyze
Aggregate this project's session transcripts into statistics, without spending any model tokens. Read-only — it never writes config anywhere.
Scope
Only the current project's transcripts (its root plus its git worktrees) are opened. The machine-wide aggregate is an explicit opt-in and should only be run when the user asks for it.
How to run it
python3 "${CLAUDE_PLUGIN_ROOT}/optimizer/analyze.py" \
"$HOME/.claude/projects" "$PWD/.claude/cc-optimizer/raw-stats.json" \
--project-root "$PWD"
Machine-wide (only on explicit request — drop --project-root):
python3 "${CLAUDE_PLUGIN_ROOT}/optimizer/analyze.py" \
"$HOME/.claude/projects" "$PWD/.claude/cc-optimizer/raw-stats-all.json"
Most of the time /cc-optimizer:run is what you want — it runs this step plus costing, recommendations and the report.
Output: raw-stats.json
{
"scope": {
"mode": "project",
"project_root": "/Users/me/Documents/sources/my-app",
"slugs": ["-Users-me-Documents-sources-my-app"]
},
"projects": {
"-Users-me-Documents-sources-my-app": {
"sessions": 150,
"total_tokens": 8048909762,
"input_tokens": 156819318,
"output_tokens": 257451667,
"cache_creation_input_tokens": 2150345336,
"cache_read_input_tokens": 30117123696,
"cache_hit_ratio": 0.9288,
"by_model": { "claude-opus-4-8": { "msgs": 5000, "input_tokens": 1801208 } }
}
}
}
scope states exactly which transcript directories were read — quote it if the user asks what the analysis looked at.
What's measured (from the transcripts)
- Total tokens by model
- Cache creation vs. read (1h vs 5m ephemeral)
- Cache hit ratio
- Output-size histogram (identifies expensive models doing trivial work)
- Subagent vs. main-thread spending
- Base context per session (the fixed per-turn overhead: system prompt, tool schemas, CLAUDE.md, MCP)
What's NOT spent
- Zero model API calls — pure Python arithmetic over the
message.usagefields already recorded in each transcript