Skip to content

yahav10/claude-code-dashboard

πŸ“Š Claude Code Dashboard

Local-first analytics dashboard for Claude Code usage.

Understand your AI coding patterns, costs, and performance β€” all without leaving your machine.

npm version License: MIT Node TypeScript 100% Local Zero Telemetry

Zero telemetry. Zero outbound connections. Your data never leaves localhost.


⚑ Quick Start

npx claude-code-insights

Opens a dashboard at http://localhost:3838 analyzing your Claude Code sessions from ~/.claude/.

Global install: npm install -g claude-code-insights


✨ Features

Feature What it does
πŸ“ˆ Overview Dashboard KPIs, daily activity charts, cost trends, model distribution, weekly heatmap
πŸ“‹ Sessions Browser Virtual-scrolled table with sorting, filters (date, model, project, cost), column toggles
πŸ” Session Detail Message-by-message timeline, tool breakdown, cost waterfall
🎯 Advanced Timeline Gantt-style visualization with swim lanes, zoom, minimap, click-to-inspect
πŸ“‘ Live Monitor Real-time per-session tracking via SSE with session switching and message feed
πŸ€– Interactive Agent Run Claude Code sessions from the dashboard (requires ANTHROPIC_API_KEY)
πŸ’° Cost Analytics Per-model and per-day breakdowns with 30-day linear forecast
⚑ Cache Efficiency Hit rates, savings breakdown, token flow visualization, caching recommendations
πŸ› οΈ Tool & Skill Usage Invocation counts, error rates, frequency tables, time-range filtering
🧠 AI Insights 10 automated detection rules (cost spikes, tool loops, context bloat, error cascades)
ℹ️ Info Tooltips Every metric includes an explanatory tooltip
🎨 Themes Dark, light, and high-contrast with system preference detection
πŸ”’ Privacy First Network guard, PII detection, privacy mode, localhost-only

πŸ–₯️ CLI Options

Option Default Description
--dir <path> ~/.claude Directory to scan for Claude sessions
--port <number> 3838 Server port
--no-open β€” Don't auto-open browser
--privacy-mode true Enable PII redaction on API responses

πŸ”’ Security & Privacy

Claude Code Dashboard is built with a zero-trust architecture. Security is enforced at every layer.

πŸ›‘οΈ Network Isolation

A network guard monkey-patches net.Socket.prototype.connect at startup to block all non-localhost outbound connections at the socket level. Runs before any other code. If any dependency tries to phone home β€” blocked and logged.

Allowed hosts: 127.0.0.1, localhost, ::1, 0.0.0.0

πŸ” PII Detection & Redaction

A regex-based scanner detects sensitive data before it reaches the browser:

Category Patterns
πŸ”‘ API keys Anthropic (sk-ant-*), OpenAI (sk-*), generic (pk-*, rk-*, ak-*)
☁️ Cloud credentials AWS access keys (AKIA*, ABIA*, ACCA*, ASIA*)
🎟️ Tokens GitHub (ghp_*, gho_*, ghu_*, ghs_*, ghr_*), JWTs
πŸ” Secrets Private key headers (RSA, EC, DSA)
πŸ‘€ Personal data Email addresses, IPv4 addresses

PII redaction runs at three pipeline points:

  1. Indexing β€” Content previews redacted before SQLite storage
  2. WebSocket β€” Agent tool inputs redacted before reaching browser
  3. SSE β€” Live monitor messages redacted before broadcast

βœ… Additional Guarantees

  • Read-only β€” Never writes to or modifies ~/.claude/
  • No telemetry β€” Zero analytics, tracking, or phone-home
  • Localhost-only β€” Server binds exclusively to 127.0.0.1
  • CSP headers β€” default-src 'self', X-Frame-Options: DENY, X-Content-Type-Options: nosniff
  • Prepared statements β€” All SQLite queries are parameterized (no string interpolation)

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  CLI (packages/cli)                      β”‚
β”‚  Commander.js β†’ starts server            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Server (apps/server)                    β”‚
β”‚  Fastify 5 + better-sqlite3 + SSE + WS  β”‚
β”‚                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Indexer  β”‚ β”‚  Live   β”‚ β”‚   Agent   β”‚  β”‚
│  │ (JSONL→  │ │ (SSE    │ │ (WS +     │  │
β”‚  β”‚  SQLite) β”‚ β”‚  poll)  β”‚ β”‚  SDK)     β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Web (apps/web)                          β”‚
β”‚  Vue 3 + Pinia + ECharts + TanStack     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Shared packages:
  shared-types/     Zod schemas, TypeScript types
  cost-engine/      Token pricing tables, cost calculator
  session-parser/   JSONL reader, session & timeline builders
  insights-engine/  10 detection rules for session analysis

βš™οΈ Tech Stack

Layer Technology
πŸ–ΌοΈ Frontend Vue 3, TypeScript, Vite, Pinia, SCSS (BEM)
πŸ“Š Charts ECharts (tree-shaken)
πŸ“‹ Tables TanStack Vue Table + Vue Virtual
πŸ”§ Backend Fastify 5, better-sqlite3 (WAL mode)
πŸ“‘ Real-time Server-Sent Events (live), WebSocket (agent)
πŸ€– Agent Claude Agent SDK (@anthropic-ai/claude-agent-sdk)
βœ… Validation Zod schemas as single source of truth
πŸ’» CLI Commander.js
πŸ§ͺ Testing Vitest

πŸ“ Project Structure

claude-code-insights/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ server/           # Fastify API server
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ db/       # SQLite schema, queries, connection
β”‚   β”‚   β”‚   β”œβ”€β”€ middleware/# Network guard, privacy, PII detector
β”‚   β”‚   β”‚   β”œβ”€β”€ routes/   # REST API, SSE, WebSocket endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ services/ # Indexer, scanner
β”‚   β”‚   β”‚   └── workers/  # Session parse worker
β”‚   β”‚   └── package.json
β”‚   └── web/              # Vue 3 SPA
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ components/# 60+ Vue components
β”‚       β”‚   β”œβ”€β”€ composables/# Vue composables (API, charts, etc.)
β”‚       β”‚   β”œβ”€β”€ pages/    # Route-level page components
β”‚       β”‚   β”œβ”€β”€ stores/   # Pinia state management
β”‚       β”‚   └── styles/   # SCSS design tokens, mixins, themes
β”‚       └── package.json
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ shared-types/     # Zod schemas + TypeScript types
β”‚   β”œβ”€β”€ cost-engine/      # Token pricing & cost calculation
β”‚   β”œβ”€β”€ session-parser/   # JSONL parsing & session building
β”‚   β”œβ”€β”€ insights-engine/  # Automated analysis rules
β”‚   └── cli/              # CLI entry point (npx target)
β”œβ”€β”€ scripts/              # Build scripts
└── docs/                 # Design & implementation plans

πŸ€– Agent Feature

The interactive Agent page lets you run Claude Code sessions directly from the dashboard. Optional β€” requires an ANTHROPIC_API_KEY.

export ANTHROPIC_API_KEY=sk-ant-...
npx claude-code-insights

Security: The API key is read by the Claude Agent SDK only β€” never read, stored, or logged by CSI. Agent communication uses WebSocket over localhost. Tool inputs are PII-redacted.


πŸ”§ Configuration

Environment Variable Default Description
CSI_SCAN_DIR ~/.claude Directory to scan for sessions
CSI_PORT 3838 Server port
CSI_PRIVACY_MODE true Enable PII redaction
ANTHROPIC_API_KEY β€” Optional. Required only for Agent

πŸ› οΈ Development

Prerequisites

  • Node.js >= 20
  • pnpm >= 9

Setup

git clone https://github.com/yahav10/claude-code-insights.git
cd claude-code-insights
pnpm install

Commands

pnpm dev              # Dev servers (API :3838, web :5173)
pnpm test             # Run all tests
pnpm typecheck        # Type check
bash scripts/build.sh # Production build

❓ FAQ

Where is my data stored?

Session data is indexed into a local SQLite database at ~/.cache/claude-code-insights/index.db. No data is transmitted anywhere.

Does this modify my Claude Code sessions?

No. CSI is strictly read-only β€” it never writes to ~/.claude/.

How do I reset the index?

Delete the database file: rm ~/.cache/claude-code-insights/index.db. It will be rebuilt on next start.

Does the Agent feature cost money?

Yes β€” it calls the Anthropic API using your key. Costs depend on the model and tokens consumed. Same as using Claude Code directly.

Can I run this on a remote server?

No. The server binds to 127.0.0.1 only and the network guard blocks all non-localhost connections. Designed exclusively for local use.


πŸ”§ Troubleshooting

Issue Solution
No sessions found Make sure you've used Claude Code at least once. Sessions are in ~/.claude/projects/. Use --dir for custom location
Port already in use Use --port <number>: npx claude-code-insights --port 4000
Agent not working Ensure ANTHROPIC_API_KEY is set in your environment
pnpm install fails Add "pnpm": { "onlyBuiltDependencies": ["better-sqlite3"] } to package.json, then re-run. Or use npx which handles native builds

🀝 Contributing

See CONTRIBUTING.md.

πŸ”’ Security

See SECURITY.md for our security policy and how to report vulnerabilities.

πŸ“œ Code of Conduct

See CODE_OF_CONDUCT.md.

πŸ“„ License

MIT β€” see LICENSE.


Built with ❀️ for the Claude Code community

See what your AI coding sessions actually look like.

About

Local-first analytics dashboard for Claude Code usage. Zero telemetry. Zero outbound connections.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors