Skip to content
theodo-groupPublic
forked from Arindam200/cc-lens

About

A real-time monitoring dashboard for Claude Code, with a proxy to intercept Anthropic API payloads

Resources

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

207 Commits

Folders and files

Repository files navigation

cc-tap CLI

Claude Code Lens (cc-tap)

This is a Theodo Group fork of Arindam200/cc-lens. The fork adds Live Capture, agent/workflow timelines, context analysis, and searchable session replays to help explain Claude Code's behavior.

Local-first analytics and debugging for Claude Code. Explore your ~/.claude/ history without an account or telemetry. Sharing team metrics is optional; see Privacy for capture, export, and network behavior.

Quick Start

Requires Node.js 24+ and npm. For your own sessions, Claude Code must have written local history to ~/.claude/ (or a custom profile).

npx cc-tap

Published to npm as cc-tap (the cc-lens name was taken). The CLI runs a prebuilt standalone bundle, so no source build is needed after npm downloads the package.

The CLI finds a free local port, starts the dashboard, and opens it in your browser.

To explore fictional data before you have local history:

npx cc-tap --demo

The demo generates sample history in ~/.cc-lens/demo/.claude/ instead of reading your real Claude Code history.

Start With a Question

Question Where to look
Why did a session behave unexpectedly? Open Sessions, select the session, and search its Replay for text, thinking, tool inputs, and results.
Which agent failed or used the context? Use Agents for the workflow timeline and Context for token usage; click a chart to open the conversation at that moment.
Why is this session expensive? Compare the session cost and model breakdown with Costs, checking whether the figure is reported or estimated.
What request did Claude Code send? Start Live Capture before launching Claude Code with the provided command, then inspect Live or the session's Raw API tab. See the capture caveat.

Versions and Releases

This README describes the current source branch. The npm package and GitHub releases may contain different sets of changes. Check npx cc-tap --version when reporting a problem, and consult the changelog to see what each version contains. To try changes newer than your version, run from source.

What You Can See

Overview

Dashboard overview
  • Sessions, messages, token usage, estimated cost, and local storage.
  • Trend cards with sparklines.
  • Date presets for 7, 30, and 90 days, plus a custom date range picker.
  • Usage over time, model distribution, peak hours, project activity, token breakdown, and recent sessions.

Projects

Projects

  • Searchable, sortable project grid.
  • Per-project cards with sessions, duration, estimated cost, languages, git branches, MCP/agent badges, and top tools.
  • Project detail pages with sessions, cost over time, language distribution, branch activity, and tool usage.

Sessions

Session replay and chat

  • Searchable session table with badges for compaction, agents, MCP, web search/fetch, and extended thinking.
  • Full session replay reconstructed from JSONL.
  • Assistant responses rendered as GitHub-flavored Markdown.
  • Tool calls and tool results shown inline.
  • File read/write/update tool results parsed into readable cards.
  • Per-turn model, duration, token breakdown, and estimated cost.
  • Compaction events shown alongside the context-size chart.
  • Search across the whole conversation, including thinking and tool inputs/results, in the Replay and agent drawers.
  • Virtualised turn lists and a parsed replay cache for long sessions.

Agents, Workflows & Context

  • Agents: a flame-style timeline of the orchestrator, nested sub-agents, and Workflow runs, with status, failures, tokens, and cost.
  • Open agent conversations and workflow details, or jump to the turn that launched an agent.
  • Select a time window and filter tool calls to investigate a particular part of a run.
  • Context: compare the orchestrator and selected agents in tokens or percentage of the model's context limit, by turn or wall-clock time.
  • Click a timeline or context chart to open the conversation at that moment.

Live Capture

Live Capture page

  • Click Live Capture in the top bar → Start, then run ENABLE_TOOL_SEARCH=true ANTHROPIC_BASE_URL=http://localhost:<port> claude in a new terminal — the snippet (with the right port) is copyable from the popover.
  • The Live page shows requests routed through the proxy with a side-by-side anatomy view: system prompt with cache breakpoints, tool schemas, message history, raw SSE response and an assembled response view.
  • Captures are correlated to JSONL sessions automatically and also surface under a Raw API tab on each session page; data is gzipped to ~/.cc-lens/payloads/ with a SQLite index.

Capture caveat: pointing Claude Code at a custom ANTHROPIC_BASE_URL can change its behavior. ENABLE_TOOL_SEARCH=true preserves tool search, but does not guarantee that the captured request is identical to a normal session. See Known limitations.

Raw captures can contain private prompts, source code, tool results, and thinking. They are compressed, not anonymized or encrypted. See Privacy for storage and retention defaults.

Costs

Costs

  • Total estimated cost, cache savings, and estimated cost without cache.
  • Cost over time and cost by project.
  • Per-model token and cost breakdown.
  • Cache efficiency panel.
  • Pricing reference from lib/pricing.ts.
  • Session costs use Claude Code's reported total when it covers the session; otherwise they are estimated and marked accordingly. See Costs and pricing.

Insights & Usage

  • Insights: cache-efficiency and model-choice suggestions, budget pacing, and spend-spike detection.
  • Usage headroom for the 5-hour and 7-day windows.
  • Wrapped: a yearly aggregate stats card with PNG download.

Tools & Features

Tools & features

  • Tool ranking across all sessions.
  • Tool categories for file I/O, shell, agents, web, planning, todos, skills, MCP, and other calls.
  • MCP server usage details.
  • Feature adoption across sessions.
  • Tool error analysis.
  • Claude Code version history.
  • Git branch analytics.

Activity

Activity calendar

  • GitHub-style activity calendar.
  • Current streak, longest streak, active days, and most active day.
  • Usage over time, peak hours, and day-of-week patterns.
  • Activity can be derived from session JSONL when the stats cache is incomplete.

Local Claude Code Files

  • History: Search and page through ~/.claude/history.jsonl.
  • Todos: Browse todos from ~/.claude/todos/ with search and status filters.
  • Plans: Read saved plans from ~/.claude/plans/ with inline Markdown rendering.
  • Memory: Browse and edit memory files across projects, with type filters and stale detection.
  • Settings: Inspect ~/.claude/settings.json, installed skills, plugins, MCP servers, and storage usage.

Export & Import

Export

  • Export a portable .cclens.json file containing stats, session metadata, facets, and recent command history.
  • Preview export counts before downloading.
  • Optionally filter exports by session start date.
  • Drop an export file to preview an additive merge from another machine.

Import is intentionally preview-only right now. It shows which sessions are new or already present, but it does not write merged data back into ~/.claude/, to avoid corrupting live Claude Code files.

The separate Team export produces a redacted metrics file for aggregation across people and machines. It excludes prompts by default; the opt-in titles level includes first prompts. General .cclens.json exports are private and are not covered by that redaction. See Team mode.

Navigation

Global search (Command K)

  • Global search: Cmd+K, Ctrl+K, or /.
  • Session list keyboard navigation: j / k to move, Enter to open, Esc to clear.
  • Page shortcuts: g plus a page key, for example g s for sessions, g p for projects, g c for costs.
  • Responsive layout with desktop sidebar, collapsible navigation, mobile bottom nav, and mobile menu.
  • Light and dark themes.

Multiple Claude Profiles

By default, cc-tap reads ~/.claude/. To point it at another Claude Code config directory, set CLAUDE_CONFIG_DIR:

# Default profile
npx cc-tap

# Work profile
CLAUDE_CONFIG_DIR=~/.claude-work npx cc-tap

On Windows PowerShell:

$env:CLAUDE_CONFIG_DIR="C:\Users\you\.claude-work"; npx cc-tap

The active config directory is shown in the CLI banner on launch.

CLI Options

npx cc-tap [options]
Option Default Description
--demo Off Generate fictional session history and use it instead of your real Claude Code history.
--open <path> / Open a particular app page, for example /sessions/<session-id>.
--host <host> 127.0.0.1 Address to bind. Loopback only by default. Set 0.0.0.0 to expose the dashboard on your LAN. Also settable with the CC_LENS_HOST env var.
--port <port> 3000 Port to listen on. Auto-increments if the port is taken. Also settable with the PORT env var.
--help, -h Print usage and exit.
--version, -v Print the version and exit.

The dashboard serves your private Claude Code history, so it binds to loopback (127.0.0.1) by default. cc-tap does not read the shell's HOSTNAME variable, so it works the same on WSL, containers, and CI. Override the host only if you understand the exposure.

# Bind to a fixed port
npx cc-tap --port 4000

# Expose on the local network (opt-in)
npx cc-tap --host 0.0.0.0

There are also cc-tap push and cc-tap digest subcommands for team mode; see Team mode.

Open a Given Page

--open <path> makes the browser land on that page instead of the overview, for example one session:

CLAUDE_CONFIG_DIR=~/pulled-task/claude npx cc-tap --open /sessions/<session-id>

Only a plain app path is accepted (a leading /, letters, digits, / _ - . ~, and an optional query). Anything else is ignored with a warning, and the overview opens.

Run From Source

Prerequisites

  • Node.js 24+ (the dashboard uses the built-in node:sqlite module)
  • Claude Code with local data in ~/.claude/

Development

npm install
npm run dev

Open http://localhost:3000, or the port shown in your terminal.

Production Build

npm run build
npm start

For the packaged standalone bundle used by the CLI:

npm run build:dist

Serve Under a Path Prefix

To put cc-tap behind a proxy at a sub-path, build it for that prefix with CC_TAP_BASE_PATH:

CC_TAP_BASE_PATH=/relay/cc-tap npm run build:dist
node bin/cli.js   # serves and opens http://127.0.0.1:3000/relay/cc-tap

Pages, assets and API calls all live under the prefix, and outside it only / answers, with a redirect to the prefix, so the proxy forwards the path as-is rather than stripping it. The prefix is baked in at build time: the published npm package is built for the root, and a prefixed one is built from source.

Checks

npm run lint
npm test

Project Docs

  • Roadmap: planned improvements and non-goals.
  • Known limitations: accuracy, compatibility, and runtime caveats.
  • Compatibility: supported local files and reporting guidance.
  • Contributing: local setup, PR expectations, and manual test notes.
  • Team mode: shared-folder team analytics, push hub setup, and terminal team digests.
  • Privacy: what data is read, exported, or edited.
  • Security: private vulnerability reporting and review checklist.

Data Sources

cc-tap reads local Claude Code files directly:

  • ~/.claude/projects/<slug>/*.jsonl: session JSONL and replay data
  • ~/.claude/projects/<slug>/<session>/subagents/: sub-agent transcripts, including workflows/wf_*/ for Workflow runs
  • ~/.claude/projects/<slug>/<session>/workflows/: Workflow run records and persisted scripts
  • ~/.claude/stats-cache.json: aggregate stats when available
  • ~/.claude/usage-data/session-meta/: session metadata fallback
  • ~/.claude/history.jsonl: command history
  • ~/.claude/todos/: todo files
  • ~/.claude/plans/: saved plan files
  • ~/.claude/projects/*/memory/: project memory files
  • ~/.claude/settings.json: settings, skills, plugins, and MCP config

Dashboard data refreshes every 5 seconds while the app is open.

Costs and Pricing

When Claude Code writes a complete, usable cost-state record, cc-tap uses its reported session total, including sub-agents. Otherwise it estimates from recorded token usage and lib/pricing.ts. Estimated sessions show ~ in the sessions table and an estimate label on the session page. These figures are usage diagnostics, not invoice totals or subscription charges. See Known limitations.

To override or add rates without editing source, create ~/.cc-lens/pricing.json. Entries are merged over the defaults, so you can override a single model or add new ones. Values are in dollars per million tokens:

{
  "claude-opus-4-8": { "input": 5.0, "output": 25.0, "cacheWrite": 6.25, "cacheRead": 0.5 }
}

Optional fields include cacheWrite1h, fast, and longPrompt for request-level pricing. Overrides are loaded once per process; restart cc-tap after editing the file. Overrides affect table estimates, not a session's accepted reported total. Unknown models are flagged when they borrow another model's rates.

The CLI name is cc-tap. Existing ~/.cc-lens/ paths, CC_LENS_* environment variables, and .cclens.json formats retain their names for compatibility.

About

A real-time monitoring dashboard for Claude Code, with a proxy to intercept Anthropic API payloads

Resources

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages