Analytics and insights for vibe-based learning sessions
This repository contains the Learn and Vibe project, starting with Claude Code Chat Analytics.
learn_and_vibe/ β You are here (repository root)
βββ chat-analytics/ β The Next.js application
β βββ app/ β Next.js pages and API routes
β βββ lib/ β Core business logic
β βββ components/ β React components
β βββ docs/ β Technical documentation
βββ PRD.md β Product requirements
βββ sdk_docs.md β Claude SDK reference
βββ README.md β This file
chat-analytics/ directory. Unless otherwise noted, all commands in this documentation assume you're working from chat-analytics/.
Transform your Claude Code chat histories into actionable insights
A Next.js 15 progressive web application that automatically discovers, analyzes, and extracts value from your Claude Code conversations. Built with TypeScript and modern React patterns.
Claude Code Chat Analytics automatically:
- Discovers all your Claude Code projects from
~/.claude/projects/ - Analyzes conversation patterns using Claude's own AI via Agent SDK
- Extracts reusable code snippets and identifies time sinks
- Provides actionable recommendations to improve your workflow
- Stores everything locally in SQLite for instant access
Think of it as retrospective analytics for your AI-assisted development.
- Scans
~/.claude/projects/to find all chat histories - Extracts actual project paths from session metadata
- Organizes sessions chronologically with modification dates
- Uses Claude Agent SDK to analyze conversations
- Detects repetitive patterns and time sinks
- Identifies "quick wins" - solutions that worked efficiently
- Extracts code snippets with language detection and tagging
- Time spent estimates per project
- Turn counts and session durations
- Tool usage statistics (Read, Write, Edit, Bash, etc.)
- Session timelines with date range filtering
- SQLite database with WAL mode for concurrency
- Persistent analysis cache to avoid re-analysis
- Project starring/bookmarking
- Full-text storage of original sessions
- shadcn/ui components with Radix primitives
- Tailwind CSS for responsive design
- Server and Client Components architecture
- Date range picker for targeted analysis
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Next.js 15 App β
β (App Router + RSC) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββΌβββββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β File Scanner β β JSONL Parser β β Claude Agent β
β (scanner.ts) β β (jsonl-parser) β β (analyzer.ts) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
ββββββββββββββββββββββΌβββββββββββββββββββββ
βΌ
βββββββββββββββββββ
β SQLite DB β
β (better-sqlite3)β
βββββββββββββββββββ
β
ββββββββββββββββββββββΌβββββββββββββββββββββ
β β β
βΌ βΌ βΌ
[projects] [sessions] [analyses]
[patterns] [code_snippets] [settings]
Required:
- Node.js 18+ (tested with Node 24.4.0)
- Claude Code CLI (must be installed and authenticated)
Install Claude Code:
npm install -g @anthropic-ai/claude-codeAuthenticate (opens Claude Console):
claudeYou'll need:
- Active billing at console.anthropic.com
- macOS 10.15+, Ubuntu 20.04+, or Windows 10+ (with WSL)
π Full Claude Code installation guide
π Starting location: Repository root (learn_and_vibe/)
-
Navigate to the application directory:
cd chat-analytics -
Install dependencies:
# From: learn_and_vibe/chat-analytics/ npm install -
Configure environment (optional):
# From: learn_and_vibe/chat-analytics/ cp .env.example .env.localAvailable options in
.env.local:# Claude model to use for analysis (default: claude-sonnet-4-5-20250929) CLAUDE_MODEL=claude-sonnet-4-5-20250929
-
Run the development server:
# From: learn_and_vibe/chat-analytics/ npm run dev -
Open your browser: Navigate to http://localhost:3000
π‘ Tip: All subsequent commands in this guide assume you're in the chat-analytics/ directory unless explicitly stated otherwise.
For instant access from anywhere, create a global cca command that launches the app.
chat-analytics/ directory:
# 1. Navigate to the app directory (if not already there)
cd learn_and_vibe/chat-analytics
# 2. Verify you're in the right place
pwd
# β
Should end with: /learn_and_vibe/chat-analytics
# 3. Create the alias
# For Zsh (macOS default):
echo "alias cca=\"$(pwd)/launch-cca.sh\"" >> ~/.zshrc
source ~/.zshrc
# For Bash (Linux/older macOS):
echo "alias cca=\"$(pwd)/launch-cca.sh\"" >> ~/.bashrc
source ~/.bashrc
# 4. Verify it worked
type cca
# Should show: cca is an alias for /full/path/to/learn_and_vibe/chat-analytics/launch-cca.shWhat this does:
- Cleans up old processes on port 3000
- Starts the server in the background
- Monitors output for "Ready in" message
- Opens browser only when server is actually ready (no more waiting!)
- Shows server logs in foreground (Ctrl+C to stop)
Now launch from anywhere:
cca # Cleans up old processes, opens browser, starts serverTo stop the server:
# Press Ctrl+C in the terminal, or:
lsof -ti:3000 | xargs kill -9π See chat-analytics/CCA_SETUP.md for detailed setup instructions and troubleshooting.
You can install this as a Progressive Web App on your laptop for a native app-like experience!
-
Start the server:
cd chat-analytics npm run dev -
Open in Chrome/Edge/Brave: Navigate to http://localhost:3000
-
Install:
- Look for the install icon (β) in the address bar
- Or click Menu β "Install Claude Code Chat Analytics..."
- Click "Install" in the confirmation dialog
-
Done! The app will:
- Open in its own window (no browser UI)
- Be added to your Applications folder
- Appear in Spotlight search (macOS) or Start Menu (Windows)
- Launch like a native app
npm run dev each time before using the app (e.g., after restarting your computer). The installed app connects to your local server.
π‘ Solutions:
- Auto-start: See Auto-Start Solutions for LaunchAgent (macOS), Task Scheduler (Windows), or systemd (Linux) setup to automatically start the server on boot
~/.claude/projects/ and your local Claude CLI. It must run on your machine.
See PWA Installation Guide for detailed instructions, troubleshooting, and platform-specific steps.
When you first open the app:
- Click "Scan Projects" on the dashboard
- Wait for the scan to complete (usually 2-10 seconds)
- All discovered projects will appear as cards
- Select a project by clicking its card
- Choose a date range using the date picker (defaults to last 7 days)
- Click "Analyze Sessions"
- Wait for analysis to complete (30s - 2min depending on session count)
- View results in tabs:
- Overview: Summary and metrics
- Patterns: Repetitive prompts, time sinks, quick wins
- Code Snippets: Extracted code with language/tags
- Recommendations: Actionable suggestions
Click the star icon β on any project card to bookmark it. Starred projects appear at the top of your dashboard.
Navigate to /settings to:
- Check Claude CLI status
- View CLI installation path
- See authentication status
- Configure analysis preferences (future)
The app uses SQLite with the following tables:
| Table | Purpose |
|---|---|
projects |
Discovered Claude Code projects |
sessions |
Individual chat sessions (JSONL files) |
analyses |
Analysis results with summaries |
patterns |
Detected patterns (repetitive, time_sink, quick_win) |
code_snippets |
Extracted code with metadata |
settings |
User preferences and configuration |
See DATABASE.md for full schema details.
- Next.js 15 - App Router, Server Components, Server Actions
- React 19 - Latest React features
- TypeScript 5 - Full type safety
- SQLite - Local database via
better-sqlite3
- Claude Agent SDK v0.1.5 - AI-powered analysis
- Claude Code CLI - Local authentication
- shadcn/ui - Pre-built component library
- Radix UI - Accessible primitives
- Tailwind CSS 4 - Utility-first styling
- Lucide React - Icon library
- date-fns - Date manipulation
- react-hook-form - Form state management
- zod - Schema validation
Understanding the Two-Level Structure:
This repository (learn_and_vibe/) is organized as a container for multiple learning analytics projects. Currently, it contains the Claude Code Chat Analytics application.
learn_and_vibe/ β Repository root
βββ README.md β This file (overview of all projects)
βββ PRD.md β Product Requirements Document
βββ sdk_docs.md β Claude SDK reference documentation
βββ CLAUDE.md β Project-wide Claude Code instructions
β
βββ chat-analytics/ β π¦ Application root (Next.js app)
β
βββ README.md β App-specific installation guide
βββ package.json β Dependencies and scripts
βββ tsconfig.json β TypeScript config (defines @/* alias)
βββ next.config.ts β Next.js configuration
βββ tailwind.config.ts β Tailwind CSS config
β
βββ app/ β Next.js App Router (pages & APIs)
β βββ page.tsx # Dashboard (project list)
β βββ layout.tsx # Root layout with CLI status banner
β βββ projects/[projectId]/ # Dynamic project detail pages
β βββ settings/ # Settings page
β βββ api/ # API route handlers
β βββ scan/route.ts # POST: Discover Claude projects
β βββ analyze/route.ts # POST: Run AI analysis
β βββ projects/route.ts # GET: Fetch projects
β βββ claude-status/route.ts # GET: Check CLI installation
β
βββ lib/ β Core business logic
β βββ db.ts # SQLite database helpers
β βββ scanner.ts # Filesystem scanner
β βββ jsonl-parser.ts # Parse Claude session files
β βββ analyzer.ts # Claude Agent SDK integration
β βββ cache-builder.ts # Analysis caching
β βββ date-utils.ts # Date utilities
β βββ utils.ts # General utilities
β
βββ components/ β React components
β βββ project-card.tsx # Project cards on dashboard
β βββ session-timeline.tsx # Session visualization
β βββ nav-bar.tsx # Navigation
β βββ ui/ # shadcn/ui components
β
βββ docs/ β Technical documentation
β βββ ARCHITECTURE.md # System design deep-dive
β βββ DATABASE.md # Schema documentation
β βββ API.md # API reference
β βββ DEVELOPMENT.md # Developer guide
β
βββ public/ β Static assets
βββ analysis-cache/ β Cached results (gitignored)
βββ chat-analytics.db β SQLite database (gitignored)
Path Alias Explanation:
The TypeScript compiler is configured in chat-analytics/tsconfig.json with:
{
"compilerOptions": {
"paths": {
"@/*": ["./*"]
}
}
}This means @/ resolves to chat-analytics/ (the app root), so:
@/lib/dbβchat-analytics/lib/db.ts@/components/ui/buttonβchat-analytics/components/ui/button.tsx
Where to Run Commands:
Unless explicitly stated, all npm commands and scripts should be run from chat-analytics/:
cd chat-analytics/ # Navigate to app root
npm install # Install dependencies
npm run dev # Start dev serverScans ~/.claude/projects/ and saves to database.
Response:
{
"success": true,
"projectsFound": 12,
"totalSessions": 247
}Runs Claude Agent analysis on project sessions.
Request:
{
"projectId": 1,
"dateFrom": "2025-01-01",
"dateTo": "2025-01-31",
"customPrompts": ["What authentication patterns were used?"]
}Response:
{
"success": true,
"analysisId": 42,
"analysis": {
"projectSummary": "...",
"timeSpentMinutes": 180,
"patterns": [...],
"codeSnippets": [...],
"recommendations": [...]
}
}Fetches all projects with session counts.
Response:
[
{
"id": 1,
"name": "my-awesome-app",
"path": "/Users/you/projects/my-awesome-app",
"total_sessions": 23,
"last_analyzed": "2025-01-15T10:30:00.000Z",
"is_starred": 1
}
]Toggles project star status.
Request:
{
"projectId": 1
}Checks if Claude CLI is installed and working.
Response (success):
{
"available": true,
"path": "/Users/you/.claude/local/claude",
"message": "Claude CLI is ready to use"
}Response (not found):
{
"available": false,
"error": "CLAUDE_CLI_NOT_FOUND",
"message": "Claude CLI not found. Install: npm install -g @anthropic-ai/claude-code"
}See API.md for detailed endpoint documentation.
The app includes comprehensive testing documentation:
- Manual Testing: Step-by-step scenarios in TESTING_STRATEGY.md
- Unit Tests: (Coming soon) Test database helpers and parsers
- Integration Tests: (Coming soon) Test API routes
- E2E Tests: (Coming soon) Playwright tests for critical flows
# Check Claude CLI status
curl http://localhost:3000/api/claude-status | jq
# Scan projects
curl -X POST http://localhost:3000/api/scan | jq
# Verify Claude CLI works
claude --versionSymptoms: Red banner appears, analysis fails
Solutions:
- Install Claude Code:
npm install -g @anthropic-ai/claude-code - Authenticate:
claude(opens browser) - Verify installation:
which claude - Restart the app:
npm run dev
Common causes:
- Claude Code not in PATH
- Installed with
--prefixflag to non-standard location - Using NVM and Claude installed in different Node version
See the Settings page for detailed installation instructions.
Symptoms: Analysis running for 5+ minutes
Solutions:
- Reduce date range to analyze fewer sessions
- Check Claude CLI works:
claude --version - Check network connection (Claude needs internet)
- View console logs:
npm run devshows analysis progress
Symptoms: SQLITE_BUSY errors in console
Solutions:
- Stop any duplicate dev servers
- Delete
chat-analytics.db-walandchat-analytics.db-shm - Restart:
npm run dev
The database uses WAL mode which should prevent this, but multiple processes accessing the DB can cause conflicts.
Symptoms: Scan completes but shows 0 sessions
Solutions:
- Verify Claude Code projects exist:
ls ~/.claude/projects/ - Check JSONL files exist:
ls ~/.claude/projects/*/ - Check file permissions: ensure files are readable
- Try manual path in Settings (future feature)
- Project discovery from
~/.claude/projects/ - JSONL parsing
- Claude Agent SDK analysis
- Pattern detection
- Code snippet extraction
- SQLite storage
- Project starring
- Date range filtering
- Custom analysis prompts UI
- Export analysis to Markdown/PDF
- Search across all sessions
- Session-level analysis (not just project-wide)
- Better caching with TTL
- Comparison view (compare two date ranges)
- Tag-based organization
- Multi-project analysis
- Trend charts (time spent over time)
- Code snippet favorites/collections
- Manual session upload (for non-Claude Code histories)
- Dark mode
- Desktop app (Electron/Tauri)
Contributions welcome! See DEVELOPMENT.md for:
- Development setup
- Code style guidelines
- Testing requirements
- PR process
MIT License - see LICENSE for details
- Anthropic for Claude Code and the Agent SDK
- Vercel for Next.js 15
- shadcn for the beautiful UI component library
- The open source community for all the amazing tools
- Product Requirements Document - Original design spec
- Architecture Guide - System design deep-dive
- Database Schema - Full schema documentation
- API Documentation - Complete API reference
- Testing Strategy - How to test the app
- Claude Code Docs - Official Claude Code documentation
- Claude Agent SDK - SDK reference documentation
Last updated: 2025-10-05