A local, infra-free, raw-fidelity inspector for a single Claude Code session — a DevTools Network tab for Claude Code.
Project description
cc-tracer (For Claude Code)
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.
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_URLat 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:
- Merges 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.bakonce). Use--settings PATHto target a different file, e.g.~/.claude/settings.jsonto trace globally. - 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. - 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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cc_tracer-0.1.3.tar.gz.
File metadata
- Download URL: cc_tracer-0.1.3.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
229e299de34ff867d95e873bc54930080ceb6fffdcd559d888714f22cc0cf0b0
|
|
| MD5 |
3af2bf17cd2afbb37a87342d8d1ed5e8
|
|
| BLAKE2b-256 |
991eea44b283dcaf6f0e3344eadedc48207db41efac6c97d9ee7a33be1f6e961
|
File details
Details for the file cc_tracer-0.1.3-py3-none-any.whl.
File metadata
- Download URL: cc_tracer-0.1.3-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a17b6855f4c6dd298b30fb051f31e4e50161d58c110bdf9411736b9a8ebff832
|
|
| MD5 |
6bd00fe39d589d8a6ec31ced418396e8
|
|
| BLAKE2b-256 |
fcccc930e50b2518d825cdb4d9426c84073f4dca4fee9d2df9b7e9ed7a59ea4b
|