You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Real-time monitoring platform for Claude Code agent activity
Track sessions, monitor agents in real-time, visualize tool usage, and observe subagent orchestration through a professional dark-themed web interface. Integrates directly with Claude Code via its native hook system.
graph LR
A["Claude Code<br/>Session"] -->|hooks fire on<br/>tool use / stop| B["Hook Handler<br/>(Node.js script)"]
B -->|HTTP POST| C["Dashboard Server<br/>(Express + SQLite)"]
C -->|WebSocket<br/>broadcast| D["Dashboard UI<br/>(React + Tailwind)"]
style A fill:#6366f1,stroke:#818cf8,color:#fff
style B fill:#1a1a28,stroke:#2a2a3d,color:#e4e4ed
style C fill:#1a1a28,stroke:#2a2a3d,color:#e4e4ed
style D fill:#10b981,stroke:#34d399,color:#fff
Loading
Features
Feature
Description
Dashboard
Overview stats, active agent cards, recent activity feed
Kanban Board
5-column agent status board (Idle / Connected / Working / Completed / Error)
Sessions
Searchable, filterable table of all Claude Code sessions
Session Detail
Per-session agent cards and full event timeline
Activity Feed
Real-time streaming event log with pause/resume
Live Updates
WebSocket push -- no polling, instant UI updates
Auto-Discovery
Sessions and agents are created automatically from hook events
git clone https://github.com/hoangsonww/Claude-Code-Agent-Monitor.git
cd Claude-Code-Agent-Monitor
npm run setup
2. Configure Claude Code Hooks
npm run install-hooks
This adds hook entries to ~/.claude/settings.json that forward events to the dashboard. Existing hooks are preserved.
3. Start
# Development (hot reload on both server and client)
npm run dev
# Production (single process, built client)
npm run build && npm start
4. Open
Mode
URL
Development
http://localhost:5173
Production
http://localhost:4820
Optional: Seed Demo Data
npm run seed
Creates 8 sample sessions, 23 agents, and 106 events so you can explore the UI immediately.
How It Works
sequenceDiagram
participant CC as Claude Code
participant HH as Hook Handler
participant API as Express Server
participant DB as SQLite
participant WS as WebSocket
participant UI as React Client
CC->>HH: stdin (JSON event)
HH->>API: POST /api/hooks/event
API->>DB: Insert/update records
API->>WS: Broadcast update
WS->>UI: Push message
UI->>UI: Re-render component
Note over CC,HH: Hooks fire on PreToolUse,<br/>PostToolUse, Stop,<br/>SubagentStop, Notification
Note over API,DB: Transactional writes<br/>with auto session/agent creation
Note over WS,UI: ~0ms latency,<br/>no polling
Loading
Hook Lifecycle
Claude Code fires a hook when a tool is used, a session ends, or a subagent completes
Hook Handler (scripts/hook-handler.js) reads the JSON event from stdin and POSTs it to the API. Fails silently with a 5s timeout so it never blocks Claude Code
Server processes the event inside a SQLite transaction:
Auto-creates sessions and main agents on first contact
Detects Agent tool calls to track subagent creation
Updates agent status/current_tool on each tool use
Marks everything completed on session stop
WebSocket broadcasts the change to all connected clients
UI receives the update and re-renders the affected components
Agent State Machine
stateDiagram-v2
[*] --> idle: Agent created
idle --> connected: Session established
connected --> working: Tool use started
working --> connected: Tool use completed
working --> working: Different tool started
connected --> completed: Session ended
working --> completed: Session ended
working --> error: Error occurred
idle --> completed: Session ended
completed --> [*]
error --> [*]
Loading
Session State Machine
stateDiagram-v2
[*] --> active: First hook event received
active --> completed: Stop hook (normal)
active --> error: Stop hook (error)
active --> abandoned: No activity timeout
completed --> [*]
error --> [*]
abandoned --> [*]
Loading
Configuration
Environment Variable
Default
Description
DASHBOARD_PORT
4820
Port for the Express server
CLAUDE_DASHBOARD_PORT
4820
Port used by hook handler to reach the server
NODE_ENV
development
Set to production to serve the built client
npm Scripts
Command
Description
npm run setup
Install server and client dependencies
npm run dev
Start server (watch mode) + client (Vite HMR) concurrently
npm run dev:server
Start only the Express server with --watch
npm run dev:client
Start only the Vite dev server
npm run build
TypeScript check + Vite production build
npm start
Start production server (serves built client)
npm run install-hooks
Configure Claude Code hooks in ~/.claude/settings.json
npm run seed
Populate database with sample data
API Reference
All endpoints return JSON. Error responses follow the shape { error: { code, message } }.
Health
Method
Path
Description
GET
/api/health
Returns { status: "ok", timestamp }
Sessions
Method
Path
Query Params
Description
GET
/api/sessions
status, limit, offset
List sessions with agent counts
GET
/api/sessions/:id
--
Session detail with agents and events
POST
/api/sessions
--
Create session (idempotent on id)
PATCH
/api/sessions/:id
--
Update session status/metadata
Agents
Method
Path
Query Params
Description
GET
/api/agents
status, session_id, limit, offset
List agents with filters
GET
/api/agents/:id
--
Single agent detail
POST
/api/agents
--
Create agent
PATCH
/api/agents/:id
--
Update agent status/task/tool
Events
Method
Path
Query Params
Description
GET
/api/events
session_id, limit, offset
List events (newest first)
Stats
Method
Path
Description
GET
/api/stats
Aggregate counts, status distributions, WS connections
The dashboard processes these Claude Code hook types:
Hook Type
Trigger
Dashboard Action
PreToolUse
Agent starts using a tool
Updates agent to working, sets current_tool. If tool is Agent, creates subagent record
PostToolUse
Tool execution completed
Updates agent to connected, clears current_tool
Stop
Session ended
Marks all agents completed, ends session
SubagentStop
Subagent finished
Marks most recent working subagent completed
Notification
Agent notification
Logs event
Data Storage
Engine: SQLite 3 via better-sqlite3
Location:data/dashboard.db
Journal mode: WAL (concurrent reads during writes)
Reset: Delete data/dashboard.db to clear all data
Statusline
A standalone CLI statusline utility for Claude Code that displays model name, user, working directory, git branch, context window usage bar, and token counts -- all color-coded with ANSI escape sequences.
A real-time monitoring dashboard for Claude Code agents, built with Node.js, Express, React, and WebSockets. It tracks sessions, agent activity, tool usage, and subagent orchestration through Claude Code hooks, providing live analytics, a Kanban status board, and an interactive web interface.