Skip to main content

Replays Claude Code session transcripts and Claude.ai exports as context-token timelines, ledgers, and project breakdowns — a FastAPI service over cc-session-core.

Project description

cc-session-explorer

PyPI Python versions CI codecov Dependabot License: MIT

Replays Claude Code session transcripts and Claude.ai exports as context-token timelines, cost ledgers, and project breakdowns — a FastAPI dashboard, CLI tools, and an MCP server built on cc-session-core, which owns the transcript parsing boundary. This package maps each typed record to presentation-layer models and renders them.

Layout

src/cc_session_explorer/   The Python package
  api/                     /timeline lens: context-token replay routes
  usage/                   /api lens: cost + token usage rollups
  ingest/                  Live transcript ingest (watchfiles -> SQLite)
  history/                 Historical ledger store + refresh CLI
  viz/                     Self-contained HTML reports (Sankey, cost ledger)
  mcp/                     Stdio MCP server over the same capabilities
  static/                  Built single-file SPA (output of frontend/app)
frontend/
  ui/                      @cc-session/dashboard-ui — the design-system components
  app/                     @cc-session/dashboard-app — the dashboard SPA (bundles ui from source)
systemd/                   Linux user services for the dashboard and the live watcher
launchd/                   macOS LaunchAgents for the dashboard and the live watcher
tests/

Persistent stores live under ~/.cc-session-explorer (transcripts.db, ledger.db) — the legacy data home, kept so existing installs and the systemd watcher carry over (see src/cc_session_explorer/paths.py).

Install

uv tool install cc-session-explorer

From a checkout (the sibling cc-session-core repo must sit next to this one — [tool.uv.sources] wires it up editable for development):

uv sync --all-groups

Run

Command What it does
cc-session-explorer FastAPI dashboard: SPA at /, cost lens at /api/*, context lens at /timeline/*, on 127.0.0.1:9821
cc-session-watch Live transcript watcher; ingests ~/.claude/projects into SQLite
cc-session-history Refreshes the historical usage ledger
cc-session-sankey Per-session token-flow Sankey as a self-contained HTML page
cc-session-ledger Directory-wide cost ledger as a self-contained HTML page
cc-session-explorer-mcp Stdio MCP server exposing the explorer's capabilities as tools

Configuration comes from CC_SESSION_EXPLORER_* env vars (or a .env): CC_SESSION_EXPLORER_HOME_DIR (defaults to your home directory) and CC_SESSION_EXPLORER_EXPORT_PATH (a Claude.ai account export zip, only needed for the export timeline).

MCP server

Register cc-session-explorer-mcp in a Claude Code .mcp.json:

{
  "mcpServers": {
    "cc-session-explorer": {
      "command": "cc-session-explorer-mcp"
    }
  }
}

Frontend

The SPA is built from frontend/app, which bundles the frontend/ui design system directly from source (a Vite alias — no publish step). frontend/ is an npm workspace (app + ui) so both share one hoisted node_modules — install once at the workspace root. The build emits one self-contained index.html into src/cc_session_explorer/static/, where the FastAPI app serves it as package data.

cd frontend && npm install
cd app && npm run build      # regenerates src/cc_session_explorer/static/index.html
npm run typecheck            # tsc --noEmit across the app (and, from frontend/ui, the design system)
npm run dev                  # dev server proxying to a running dashboard on :9821

Background services (optional)

bin/cc-session-explorer-startup installs and starts the dashboard and the transcript watcher as background services, dispatching to the right one for your OS. It's idempotent (safe to run on every plugin load, and picks up unit changes automatically) and is what the plugin's dashboard-uptime monitor calls on your behalf — running it by hand is only needed outside the Claude Code plugin context.

Linux: systemd

User units live in systemd/. The dashboard is socket-activated (cc-session-explorer.socket holds the port; cc-session-explorer.service starts on demand and exits after an idle period); the watcher is a plain always-on service. Manual install, if not running via the startup script above:

cp systemd/*.service systemd/*.socket ~/.config/systemd/user/
# edit ExecStart in each unit if you run from a checkout rather than `uv tool install`
systemctl --user daemon-reload
systemctl --user enable --now cc-session-explorer.socket cc-session-watch.service

macOS: launchd

LaunchAgents live in launchd/. launchd has no environment-variable-based socket-activation protocol a plain Python process can read (systemd's LISTEN_FDS has no macOS equivalent without private-API C bindings), so both the dashboard and the watcher run always-on here — the app already supports this directly (SystemdActivation degrades to a plain uvicorn.run() when no systemd env vars are present). Manual install, if not running via the startup script above:

mkdir -p ~/Library/LaunchAgents ~/Library/Logs/cc-session-explorer
sed -e "s|@PLUGIN_ROOT@|$(pwd)|g" -e "s|@HOME@|$HOME|g" \
  launchd/com.cc-session-explorer.dashboard.plist > ~/Library/LaunchAgents/com.cc-session-explorer.dashboard.plist
sed -e "s|@PLUGIN_ROOT@|$(pwd)|g" -e "s|@HOME@|$HOME|g" \
  launchd/com.cc-session-explorer.watch.plist > ~/Library/LaunchAgents/com.cc-session-explorer.watch.plist
launchctl bootstrap "gui/$(id -u)" ~/Library/LaunchAgents/com.cc-session-explorer.dashboard.plist
launchctl bootstrap "gui/$(id -u)" ~/Library/LaunchAgents/com.cc-session-explorer.watch.plist

Logs: ~/Library/Logs/cc-session-explorer/{dashboard,watch}.log.

Development

uv run pytest
uv run ruff check
uv run pyright

Publishing order: cc-session-core goes to PyPI first; this package depends on cc-session-core>=0.1.0,<0.2.0.

License

MIT

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_session_explorer-0.1.0.tar.gz (396.5 kB view details)

Uploaded Source

Built Distribution

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

cc_session_explorer-0.1.0-py3-none-any.whl (217.9 kB view details)

Uploaded Python 3

File details

Details for the file cc_session_explorer-0.1.0.tar.gz.

File metadata

  • Download URL: cc_session_explorer-0.1.0.tar.gz
  • Upload date:
  • Size: 396.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cc_session_explorer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0bdbd51bfbbb7581766a5a99dc4b6469580e4c30bac56c2f2cfdf2dada9a70a1
MD5 a29f5343f2c7556a0370b51ebaab1b31
BLAKE2b-256 3637cab2496ee1dac3cd82cb555c4f396fce0e3629a2433470bc9a32236d661f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_session_explorer-0.1.0.tar.gz:

Publisher: publish.yml on Magic-Man-us/cc-session-explorer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cc_session_explorer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cc_session_explorer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ca6e9c7760b81c7d8759c2821cb76a146c3870fb3da8f793a3596e7099b1f76
MD5 f5628c28009014ed13e29b9fc418f53a
BLAKE2b-256 0aa9f71bf206dbccd28da8ba26b8990ca8c1810c5bc342f3b3fd201c38fa23ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_session_explorer-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Magic-Man-us/cc-session-explorer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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