← Reddit

I built a tool that watches your Claude Code sessions and tells you where your tokens are going

Reddit · Flimsy_Pumpkin6873 · June 2, 2026
I build my 1s open source tool - it detects token waste pattens from Claude Code OpenTelemetry data. Claude Code emits OpenTelemetry spans for every tool call and LLM request — token counts, durations, full commands, session IDs. Meridian collects those spans

Detailed Analysis

A developer has released Meridian, an open source tool designed to monitor Claude Code sessions and identify inefficient token usage patterns by tapping into the OpenTelemetry telemetry data that Claude Code natively emits. Claude Code, Anthropic's agentic coding assistant, produces OpenTelemetry spans for every tool call and LLM request, capturing token counts, durations, executed commands, and session identifiers. Meridian runs a local collector that ingests these spans, applies pattern detection logic across session histories, and automatically generates additions to the CLAUDE.md configuration file — the persistent instruction document Claude Code reads at session start — designed to preemptively correct the identified inefficiencies.

The tool targets three dominant waste patterns the developer identified through their own session analysis. The first is retry spirals, where Claude probes the environment repeatedly — often four to five times — because the correct command invocations or environment details are absent from CLAUDE.md, forcing the model to rediscover context through trial and error on each session. The second is context bloat, where cached tokens accumulate across a long session such that every subsequent turn carries an increasingly expensive token payload. The third is heavy baselines, where the combination of system prompt, MCP tool schemas, and CLAUDE.md content already consumes roughly 90,000 tokens before any actual task work begins, leaving comparatively little headroom and increasing per-turn cost significantly.

The architectural approach prioritizes local data sovereignty: the collector runs as a background process on the user's machine, all telemetry data remains local, and the tool integrates directly into Claude Code as a slash command via the `/meridian` interface, minimizing friction in the workflow. By writing fixes back into CLAUDE.md rather than requiring manual intervention, Meridian attempts to create a self-improving feedback loop where session inefficiencies are systematically eliminated over time rather than repeatedly incurred.

This tool reflects a broader emerging practice of instrumenting AI coding assistants to manage the economics of large context window usage. As models like Claude 3.5 and Claude 3.7 Sonnet operate with 200,000-token context windows, the cost profile of long agentic sessions has become a practical concern for developers using these tools intensively. The pattern of retry spirals in particular highlights a structural challenge in agentic AI systems: without sufficient upfront environmental grounding, models engage in expensive exploratory behavior that a well-maintained configuration file could eliminate entirely.

The release also illustrates how the developer ecosystem around Claude Code is maturing. Anthropic's decision to expose OpenTelemetry instrumentation as a first-class feature of Claude Code has created a surface for third-party tooling that operates at the observability layer — analogous to how APM tools like Datadog or Honeycomb attach to application infrastructure. Meridian represents an early example of what may become a category of meta-tools that sit above AI coding assistants and optimize their operational behavior, treating token efficiency as a measurable engineering concern rather than an opaque cost.

Read original article →