npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

claude-otel

v0.1.1

Published

Local viewer for Claude Code OpenTelemetry raw API bodies

Downloads

141

Readme

claude-otel

Local viewer for Claude Code's OpenTelemetry raw API bodies.

Browse what your claude CLI actually sends and receives — full system prompts, tool calls, message history, token usage — in a calm, paginated UI.

[!NOTE] alpha · macOS / Linux · single Node.js CLI, zero npm dependencies.

Why

Claude Code v2.x ships as a native binary, which broke older interceptors like claude-trace. Anthropic's own answer is to dump full request/response JSONs via OpenTelemetry:

export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_LOG_RAW_API_BODIES=file:/path/to/dump-dir
claude

claude-otel automates that capture (defaults to ~/.claude/claude-otel/<encoded-cwd>/<timestamp>/, so sessions are grouped by project) and renders the resulting JSONs as a real conversation — markdown, tool calls, prior context, raw inspection — served locally with live updates over SSE.

Install

# from source
git clone https://github.com/huanghuiquan/claude-otel ~/dev/claude-otel
cd ~/dev/claude-otel
./install.sh

The installer symlinks bin/claude-otel.mjs to $BIN_DIR/claude-otel (default ~/.local/bin). Make sure that directory is on your $PATH.

Requirements: Node.js ≥ 18 + a modern browser. Zero npm dependencies.

Usage

claude-otel record                  # wrap `claude`, dump raw bodies (grouped by cwd)
claude-otel record -p "hello"       # one-shot capture
claude-otel record --events         # also stream OTel events to stderr
claude-otel record --cmd ccr code   # use a wrapper (e.g. ccr) instead of `claude`

claude-otel                         # serve ~/.claude/claude-otel on http://127.0.0.1:47821
claude-otel ~/logs                  # serve a custom root
claude-otel --port 8000             # custom port
claude-otel --no-open               # don't open browser (useful over ssh)

claude-otel --help                  # full help

A browser tab opens to a session list, grouped by project (the cwd at record time). Click into one to see the full transcript. New turns from a running claude-otel record show up live (SSE polls the directory once per second). The header has a theme toggle (Auto / Light / Dark) — Auto follows macOS appearance.

Commands

| | what it does | |---|---| | claude-otel (or claude-otel view) | starts the local web viewer | | claude-otel record [-- args] | execs claude (or --cmd <bin>) with OTel raw-body logging enabled; all positional args are passed through |

Data layout

claude-otel record writes under ~/.claude/claude-otel/ (override with --root or $CLAUDE_OTEL_ROOT):

<root>/
  <encoded-cwd>/                 ← e.g. -Users-iris-dev-foo
    .project                     ← original cwd, used for display
    <timestamp>/                 ← session
      <uuid>.request.json        ← full Messages API request body
      <uuid>.response.json       ← full response body

The viewer detects this layout and shows sessions grouped by project. A flat layout (sessions directly under root, no project layer) still works — those land under a (legacy) group.

Use with proxies (ccr, mise, etc.)

record spawns claude directly. To capture a session launched via a wrapper, pass --cmd:

claude-otel record --cmd ccr code           # use ccr (claude-code-router)
claude-otel record --cmd "mise exec claude" # for things mise resolves

The OTel hooks live inside the claude binary, so as long as claude is what eventually runs and inherits CLAUDE_CODE_ENABLE_TELEMETRY=1 + OTEL_LOG_RAW_API_BODIES=file:<dir>, raw bodies still drop into <dir> regardless of where the actual API requests are routed.

Features

  • Project-grouped picker — sessions cluster by cwd, with original path shown
  • Auto / Light / Dark theme — follows macOS appearance, with a manual override
  • Markdown rendering of assistant turns (code fences, headings, lists, links)
  • XML tag parsing for system reminders / <EXTREMELY_IMPORTANT> / <example> / etc., grouped and color-coded; common HTML tags inside code stay literal
  • Prior-context block on each turn — see exactly which messages were sent in the request
  • Token & cost counters per turn (Opus / Sonnet / Haiku 4.x pricing approximations)
  • Live updates via Server-Sent Events while a session is running
  • Path-traversal-safe static file API
  • Zero deps — Node stdlib only, single-file CLI; viewer is one HTML file using only Mac system fonts

Architecture

┌────────────────────────┐  writes   ┌─────────────────────────────────┐
│ claude-otel record     │──────────▶│ ~/.claude/claude-otel/          │
│ (spawns claude/--cmd   │           │   <encoded-cwd>/.project        │
│  with OTEL_LOG_RAW_…)  │           │   <encoded-cwd>/<ts>/*.json     │
└────────────────────────┘           └─────────────────────────────────┘
                                              │ reads
                                              ▼
                                  ┌──────────────────────┐
                                  │ claude-otel (Node)   │
                                  │  /                   │
                                  │  /api/sessions       │
                                  │  /api/.../files      │
                                  │  /api/.../file/{n}   │
                                  │  /api/.../events SSE │
                                  └──────────────────────┘
                                              │
                                              ▼
                                  ┌──────────────────────┐
                                  │ viewer.html          │
                                  │ (single-file SPA)    │
                                  └──────────────────────┘

Tests

npm test

Covers the path-traversal & slug-resolution boundary (safeJoin, parseSlug, resolveSessionDir) plus session-listing layout detection. Run before any change to those helpers.

Roadmap

  • [ ] Search across turns
  • [ ] Diff view between adjacent prior-context snapshots
  • [ ] Export turn as standalone markdown / replayable API request
  • [ ] Windows support
  • [ ] Auto-launch viewer from record

License

MIT — see LICENSE.