Scans Claude Code sessions for 6 statistical anomalies like cost inefficiency, low cache hits, excessive tool use, with severity scoring, triage, and automatic drill-down into top sessions for diagnostics.
npx claudepluginhub li195111/claude-token-analyzer --plugin claude-token-analyzerThis skill uses the workspace's default tool permissions.
Scan for anomalies, triage by severity, and drill into suspicious sessions for root cause diagnosis.
Routes Claude Code token usage and cost analysis requests to sub-skills for health checks, cost audits, anomaly detection, project reviews, trends, and usage patterns. Provides quick overviews for ambiguous intents.
Analyzes Claude Code conversation logs for token usage, costs, cache hit rates, workflow patterns (skills, agents, hooks), and cost optimizations. Generates interactive HTML dashboard.
Tracks tokens, analyzes caching behavior, identifies bottlenecks in tool usage, and estimates costs to optimize Claude Code session performance and efficiency.
Share bugs, ideas, or general feedback.
Scan for anomalies, triage by severity, and drill into suspicious sessions for root cause diagnosis.
Execute mcp__token-analyzer__sync_db. Skip if already called in this conversation.
Execute mcp__token-analyzer__anomaly_scan with:
stddev_threshold: 2.0 (default), user can adjust (1.5 sensitive / 3.0 conservative)min_tokens_for_cache_check: 10000 (default), adjustableproject_path: optionalIMPORTANT: anomaly_scan output can exceed 370K characters. Write raw output to ${TMPDIR:-/tmp}/cta-anomaly-report.json before parsing.
Sort and present anomalies in this priority order:
Anomalies with severity scores sort before those without.
For the highest-severity anomalies, execute mcp__token-analyzer__analyze_session with each session_id to obtain the 10-dimension analysis.
Limit automatic drill-down to 5 sessions maximum to avoid excessive token consumption.
For each analyzed session, output a diagnostic card:
### 🔴 Session a1b2c3d4 — CostInefficient (severity: 8.5)
- **成本**:$X.XX(超出平均 X.Xσ)
- **Cache 命中率**:X.X%(平均 XX.X%)
- **模型**:claude-opus-4-6
- **Tool 排名**:Read(35), Bash(12), Edit(8)
- **壓縮事件**:2 次(turn 8, turn 15)
- **可能原因**:上下文頻繁壓縮導致 cache 失效,大量重讀檔案
- **建議**:考慮分拆任務以減少壓縮頻率
Infer "possible cause" and "suggestion" from the 10-dimension analysis data:
${TMPDIR:-/tmp}/cta-anomaly-report.json first.stddev_threshold (1.5=sensitive, 2.0=balanced, 3.0=conservative).min_tokens_for_cache_check to filter short sessions from cache analysis.$X.XX USD.For MCP tool parameter details and anomaly type definitions: ${CLAUDE_PLUGIN_ROOT}/skills/cta/references/tool-reference.md