Token-spend analytics for Claude Code — per-tool, per-task, per-project. CLI + web dashboard + MCP server.
tokscope demonstrates solid tool design with clear, action-oriented names (get_*, find_*, investigate) and comprehensive descriptions (avg 180 chars, well above 34-char baseline). All 10 tools have explicit input schemas with proper JSON Schema structure. Filters are well-documented and reused across tools. However, output schemas are NOT documented, LLMs cannot predict response structure for downstream chaining. Error handling is minimal (only get_session_detail shows basic validation). No tool annotations (readOnlyHint, destructiveHint) despite all being read-only analytics. Parameter descriptions are present but some lack format/range guidance (e.g., 'since'/'until' accept 'ISO date YYYY-MM-DD or epoch ms' but no validation shown). Composition is strong, tools chain naturally (get_top_costs → get_session_detail → investigate). Security is appropriate for read-only analytics.
Retry loops: same bash_command repeated within window_s seconds in a session, ≥1 of which errored. Surfaces wasted bash spend.
For each compaction event, return the largest-output message in the 10 minutes before it — likely the bloating turn that triggered compaction. Pass session_id to scope to one session.
Sessions where the same file was Read repeatedly with no intervening Edit/Write — wasted tokens. Returns rows of session_id+file_path+dup_reads.
Tool bigrams (prev_tool → next_tool) where next_tool errors at rate ≥ min_rate over ≥ min_n samples. Reveals causal patterns.
Composite bottleneck report. Returns 7 keys: duplicate_reads, bash_retries, error_chains, cost_outliers, compaction_root, reasoning_cache_by_model, reasoning_cache_inefficient_sessions. Use this when the user asks 'where am I burning tokens' or 'what's wasteful'.
Top-level analytics: spend (today/yesterday/7d/30d/all-time) with period-over-period delta percentages, cache hit ratio, top projects and tools, daily sparkline. Use this first to orient.
Output schemas not documented. LLMs cannot predict response structure (e.g., what fields does get_overview return? Is it paginated?). Breaks downstream tool chaining and forces agents to guess field names.
No tool annotations despite all tools being read-only analytics. Missing readOnlyHint would help agents understand these are safe to call without side effects.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 60 | 2026-07-28+ | v2 |
Reasoning + cache aggregations. group_by ∈ {model, session, project, day}. Returns per-key cost, hit_ratio, cache_creation_pct, thinking_pct_of_output. Use this for 'cache efficiency' or 'thinking token' questions.
Deep dive on a single session: timeline (per-message tokens/cost), tool breakdown, bash breakdown by program+subcommand, file activity, reasoning+cache summary.
Ranked cost breakdown along one dimension. `by` ∈ {tool, project, session, task, file, bash_program, bash_subcommand, model}. limit clamped to 100.
Deep root-cause investigation. Gathers session facts, runs every internal detector scoped to the target, and synthesizes: {summary, facts, evidence, root_causes (with confidence), actions (ranked by impact × effort), top_expensive_turns}. Pass session_id for a specific session, or target='auto' to pick the highest-cost outlier in the filter window. Use when the user asks 'why is X expensive' or 'what's wrong with this session'.
Date/time parameters ('since', 'until') accept multiple formats ('ISO date YYYY-MM-DD or epoch ms') but no validation shown. LLMs may pass invalid formats. Should enforce one canonical format or validate with clear error messages.
Minimal error handling. Only get_session_detail shows validation ('session_id required'). Other tools lack recovery guidance. If filters are invalid or session_id doesn't exist, LLMs receive no actionable error.
investigate() tool has complex output (summary, facts, evidence, root_causes, actions, top_expensive_turns) but no schema documented. LLMs cannot parse or chain on this composite response.