Analytics Dashboard
Relevant source files
The following files were used as context for generating this wiki page:
The Analytics Dashboard is a comprehensive visualization and monitoring system designed to provide real-time insights into conversation states, running processes, and performance metrics. It has been refactored from a monolithic structure into a modern, scalable modular architecture to support high performance and reliability.
The dashboard serves as the central hub for observing system health, monitoring real-time WebSocket communication, and analyzing conversation data processed by the backend core modules.
Sources: cli-tool/docs_to_claude/ARCHITECTURE.md:5-15, cli-tool/components/agents/ui-analysis/screenshot-synthesizer.md:46-52
System Architecture
The Analytics Dashboard utilizes a decoupled frontend-backend architecture. The frontend is built on a component-based design, while the backend is divided into core logic, data layers, and notification systems.
Modular Components
| Category | Component/Module | Description |
|---|---|---|
| Frontend | Dashboard.js | Main orchestration component managing the UI lifecycle and service integration. |
| Frontend | ConversationTable.js | Interactive table for conversation data with real-time status updates and filtering. |
| Frontend | Charts.js | Data visualization component using Chart.js for real-time updates. |
| Backend Core | StateCalculator.js | Detects real-time conversation states (active, idle, completed). |
| Backend Core | ProcessDetector.js | Monitors running Claude Code processes across platforms (macOS, Linux, Windows). |
| Backend Core | FileWatcher.js | Chokidar-based real-time file system monitoring with intelligent throttling. |
Sources: cli-tool/docs_to_claude/ARCHITECTURE.md:21-65, cli-tool/docs_to_claude/ARCHITECTURE.md:120-145
High-Level Data Flow
The following diagram illustrates the flow of information from the file system and processes through the backend modules to the frontend dashboard.
This diagram shows how raw data from the file system and active processes is analyzed, cached, and then broadcasted via WebSockets to the frontend StateService and Dashboard UI.
Sources: cli-tool/docs_to_claude/ARCHITECTURE.md:45-100, cli-tool/docs_to_claude/ARCHITECTURE.md:155-175
Frontend Architecture
The frontend is organized into a modular component system and a robust service layer that handles state management and communications.
Component Layer
The Dashboard.js component acts as the primary controller. It initializes the DataService, StateService, and WebSocketService while coordinating real-time data refreshes and error recovery.
Sources: cli-tool/docs_to_claude/ARCHITECTURE.md:123-132
Service Layer
- StateService.js: Implements the observer pattern for reactive state management. It tracks state history and updates the UI when conversation statuses change.
- DataService.js: Manages HTTP requests with intelligent caching (TTL-based) and automatic retry logic.
- WebSocketService.js: Handles persistent connections to the backend, including automatic reconnection, heartbeats, and message queuing.
Sources: cli-tool/docs_to_claude/ARCHITECTURE.md:155-190
Real-time Interaction Sequence
The sequence below details the interaction between the User Interface and the communication services during a data refresh request.
Data Layer and Performance
To ensure high performance, the dashboard utilizes a multi-level caching strategy and specific monitoring tools.
Caching Strategy
The system implements four levels of caching:
- Browser Cache: For static assets.
- Service Cache: For frontend API responses.
- Backend Cache: For raw file content and parsed conversation data.
- Computation Cache: For expensive backend calculations (e.g., token counting).
Sources: cli-tool/docs_to_claude/ARCHITECTURE.md:231-245
Performance Monitoring
The PerformanceMonitor.js utility tracks system health metrics, including:
- Memory usage patterns.
- Request/response durations (via Express middleware).
- Cache hit/miss ratios.
- WebSocket message throughput.
Sources: cli-tool/docs_to_claude/ARCHITECTURE.md:103-118, cli-tool/docs_to_claude/ARCHITECTURE.md:265-275
Implementation Notes
Directory Structure
src/
├── analytics.js # Main orchestration
├── analytics/
│ ├── core/ # Logic: StateCalculator, ProcessDetector
│ ├── data/ # DataCache
│ └── notifications/ # WebSocketServer
└── analytics-web/ # Frontend
├── components/ # UI: Dashboard, Charts
└── services/ # Services: Data, State, WebSocket
Sources: cli-tool/docs_to_claude/ARCHITECTURE.md:20-42
Fallback Mechanisms
If the WebSocket connection fails, the WebSocketService and DataService are designed to fall back to standard polling to ensure data continuity until the real-time link is restored.
Sources: cli-tool/docs_to_claude/ARCHITECTURE.md:222-227
Summary
The Analytics Dashboard provides a sophisticated, modular environment for real-time system observation. By leveraging a multi-level cache, event-driven WebSocket communication, and reactive frontend services, the dashboard maintains high performance while delivering critical insights into conversation and process management.