Skip to main content

A local, infra-free, raw-fidelity inspector for a single Claude Code session — a DevTools Network tab for Claude Code.

Project description

cc-tracer (Local Tracer for Claude Code)

PyPI Python License: MIT

A local, infra-free, raw-fidelity inspector for a single Claude Code session — a DevTools Network tab for Claude Code. Install it, point Claude Code at it, and watch one session's hook events and raw API turns on a live timeline like CC Tracer WebUI Example

How it captures

A local FastAPI server (127.0.0.1:7355) with two capture tiers:

  • Hook tier — Claude Code hooks POST to the tracer server. Captures what Claude did: prompts, Pre/PostToolUse, results, stop reasons.
  • API-proxy tier — point ANTHROPIC_BASE_URL at the tracer; it streams /v1/* to the real API (plain HTTP in, real HTTPS out — no cert trust needed) and reassembles the streaming response into full API turns: system prompt, message context, reasoning text, token usage — what Claude saw and thought.

Getting started

Prerequisites: python3 (3.9+), pip, and the claude CLI on your PATH.

Install the package, then let one command do everything — configure the Claude Code hooks, start the tracer server, and launch Claude Code routed through it:

pip install cc-tracer          # or: pip install -e .   (from a clone)
cc-tracer start

Then open the tracer UI at http://127.0.0.1:7355 and use Claude Code as usual. The tracer keeps running after you quit Claude Code so you can keep browsing the capture — run cc-tracer stop when you're done.

What cc-tracer start does:

  1. Adds the tracer hooks into the project-local .claude/settings.json (in the current directory, so they apply only to this project — not every Claude session; idempotent, backs the original up to .bak once). Use --settings PATH to target a different file, e.g. ~/.claude/settings.json to trace globally.
  2. Starts a detached tracer server on :7355 (hook sink + UI + API proxy), or reuses one already running there. The server is left running when Claude exits.
  3. Exports ANTHROPIC_BASE_URL=http://127.0.0.1:7355 and runs claude (you can pass claude args after --).

Session JSONL is written to ~/.cc-tracer/logs/ (override with TRACER_LOG_DIR or --log-dir).

For instance:

cc-tracer start \
  --log-dir ./logs/ \
  -- -c # -c to continue recent claude session

To run just the server without launching Claude — e.g. to browse past captures in the UI — use

cc-tracer start --server-only # it will config hooks and start the server.

# To start tracing, you can run 
ANTHROPIC_BASE_URL=http://127.0.0.1:7355 claude 

Stopping

cc-tracer stop    # stop the server AND remove the tracer's hooks

Hooks follow the server's lifecycle: start adds them and stop removes only the tracer's own entries (your other hooks are left alone). With the server running, you can also point a Claude session you launch yourself at it with export ANTHROPIC_BASE_URL=http://127.0.0.1:7355.

When to use this vs. OpenTelemetry

Claude Code emits OpenTelemetry natively, and tools like SigNoz, Grafana, and LangSmith build on it. They are aggregate observability — dashboards, cost/latency trends, alerting, cross-session correlation across a fleet. If that's your goal, use them; this tracer doesn't try to.

This tracer targets the thing those tools explicitly aren't: a local, infra-free, raw-fidelity inspector for a single session — think "DevTools Network tab for Claude Code."

This tracer Native OTel (SigNoz / Grafana / LangSmith)
Raw API request/response body ❌ (spans/metrics; content redacted by default)
Reasoning / thinking text
Tool layer (Pre/Post, Edit diffs)
Backend infra required none (JSONL + one HTML file) collector + storage + UI
Data stays fully local configurable / often SaaS
Cross-session stats & alerting

The closest off-the-shelf analog is a manual mitmproxy setup; the base-URL forwarder avoids that approach's CA forging and NODE_EXTRA_CA_CERTS fuss.

Caveats

  • Proxy ≠ full coverage. The API proxy only sees HTTP traffic. Transport that isn't plain HTTP (e.g. the Agent SDK's IPC/WebSocket) is captured only at the hook tier. Native OTel emits regardless of transport.
  • SSE reassembly is schema-coupled. Rebuilding turns depends on the current Anthropic event shape, so it needs upkeep when the API evolves — a maintenance cost the OTel-based tools don't carry.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cc_tracer-0.1.4.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cc_tracer-0.1.4-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file cc_tracer-0.1.4.tar.gz.

File metadata

  • Download URL: cc_tracer-0.1.4.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for cc_tracer-0.1.4.tar.gz
Algorithm Hash digest
SHA256 0b5f1b92cd514e06409aa465c8f09a8ce94a5f6b57d25992f23cfa3e1c92078b
MD5 0cb13643654624ec24e6a3827f38d55c
BLAKE2b-256 8f428d8e6eacafd1dc62b315ff3c98dab4f0f70c68bfe40bfb06f873111a102b

See more details on using hashes here.

File details

Details for the file cc_tracer-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: cc_tracer-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for cc_tracer-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 56e37d168bb19be99d83909692248b3eb7a89fc736ec558983efc46eca3ada5f
MD5 ebbf0fb5b3cf26f654d26c2fa83a4a44
BLAKE2b-256 bcf4583e869e4044f8426282db254a927d1cb7574e777d7560c011ffa6490374

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page