Claude Code Analytics:將 AI 對話轉化為可操作的洞察

Claude Code Analytics:將 AI 對話轉化為可操作的洞察

Hacker News·

Claude Code Analytics 是一個託管在 GitHub 上的工具,旨在捕捉、搜尋和分析 AI 開發對話,透過互動式儀表板和全文字搜尋等功能,將其轉化為可操作的洞察。

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

To see all available qualifiers, see our documentation.

Analysis tool for Claude Code - automatically capture, search, and analyze your AI development conversations

License

Uh oh!

There was an error while loading. Please reload this page.

sujankapadia/claude-code-analytics

Folders and files

Latest commit

History

Repository files navigation

Claude Code Analytics

Image

Image

Image

Image

A analysis tool for Claude Code that automatically captures, archives, and analyzes your AI development conversations. Features an interactive dashboard, full-text search, and AI-powered insights across all your sessions.

What It Does

Claude Code Analytics transforms your AI development workflow into actionable insights:

Prerequisites

Before installing, you need:

Compatibility

Testing Status: This is an alpha release (v0.1.0) that has been tested on:

Platform Support:

If you encounter platform-specific issues, please report them on GitHub.

Quick Start

1. Install

The installer automatically:

2. Import Existing Conversations

This creates the database, imports all existing conversations, and builds the search index.

3. Launch Dashboard

The dashboard opens at http://localhost:8501. Start exploring your conversations!

4. (Optional) Configure AI Analysis

To enable AI-powered analysis features, add an API key to your config file:

Get API keys from OpenRouter or Google AI Studio.

That's it! New conversations will be automatically captured when you exit Claude Code sessions.

Key Features

📊 Interactive Dashboard

The Streamlit-based dashboard is your primary interface for exploring conversations:

🔍 Search & Discovery

💾 Automatic Archiving

🤖 AI-Powered Analysis

📈 Comprehensive Analytics

Quick Start

1. Install

The installer sets up hooks, creates directories, and configures Claude Code to automatically export conversations.

2. Create Database

3. Launch Dashboard

The dashboard opens at http://localhost:8501. Start exploring your conversations!

4. (Optional) Configure AI Analysis

To use AI-powered analysis features:

Get API keys from OpenRouter or Google AI Studio.

Configuration

Claude Code Analytics uses a centralized configuration system with smart defaults. All settings are stored in ~/.config/claude-code-analytics/.env.

Configuration File Location

The configuration file is automatically created during installation at:

This location follows the XDG Base Directory specification.

Configuration Variables

The .env file supports all standard environment variable syntax, including variable interpolation using ${VAR} syntax.

Required vs Optional Settings

Required for basic features (browse, search, analytics):

Required for AI analysis features:

Required for GitHub Gist publishing:

Optional customization:

Customizing Configuration

Edit the configuration file to customize settings:

Example customizations:

Variable Interpolation

The configuration system supports referencing other variables using ${VAR} syntax:

Environment Variables

You can override configuration file settings using environment variables:

Configuration Reference

For a complete list of all configuration variables with documentation, see .env.example in the repository.

Using the Dashboard

Browse Sessions

The Browse Sessions page shows all your conversations:

Search Conversations

The Search page provides powerful full-text search:

View Analytics

The Analytics Dashboard provides visual insights:

Run AI Analysis

The AI Analysis page lets you analyze sessions with LLMs:

Publish to GitHub Gists

After running an analysis, you can publish your results as a GitHub Gist with automatic security scanning:

Security Scanning:

The gist includes:

Advanced Usage

CLI Tools

The installation provides several CLI commands for working with your conversations:

Popular models:

Run the import command anytime to update the database with new conversations:

The command automatically:

Using Python Scripts Directly

If you prefer to use the Python scripts directly instead of CLI commands:

Manual Export

Convert JSONL transcripts to readable text format:

Custom Analysis Prompts

Create custom analysis templates in prompts/:

See prompts/README.md for detailed instructions.

How It Works

Architecture

Hook System

The export-conversation.sh hook runs automatically when you exit Claude Code:

Database Schema

The SQLite database uses a normalized schema:

See the technical documentation in docs/technical/ for more details.

Project Identification

Important: Claude Code uses the working directory path as the project identifier, not a separate project name or git repository name.

When you run claude-code in a directory like /Users/username/dev/my-project, Claude Code:

Encodes the path by replacing / with -:

Stores sessions in ~/.claude/projects/{encoded-path}/:

Analytics tool decodes the path back to display in the dashboard:

This means:

The analytics dashboard groups all conversations by these directory paths, so you'll see all your work for a specific codebase location together.

File Organization

Exported conversations are organized by project:

Readable Text Format

The generated .txt files provide a clean, readable format:

Manual Installation

If you need to install manually or want to understand what the installer does:

Add to ~/.claude/settings.json:

If you have existing hooks, merge the SessionEnd entry into your existing hooks object.

Troubleshooting

Check the debug log:

Common issues:

Ensure directories are writable:

If database import fails:

Project Structure

Documentation

Development

Setting Up Development Environment

If you're contributing to Claude Code Analytics or modifying the code, we use pre-commit hooks to ensure code quality:

The hooks will now run automatically before each commit.

Code Quality Tools

The pre-commit configuration includes:

Manual Code Quality Checks

If you need to run checks manually without committing:

Configuration

All tool configurations are in pyproject.toml:

Logging Standards

Production scripts use Python's logging module for consistent output. See claude_code_analytics/scripts/LOGGING.md for conventions:

Future Roadmap

Contributing

Contributions are welcome! Feel free to:

License

MIT License - Use and modify freely.

Resources

About

Analysis tool for Claude Code - automatically capture, search, and analyze your AI development conversations

Resources

License

Security policy

Uh oh!

There was an error while loading. Please reload this page.

Stars

Watchers

Forks

Releases

  1

Packages

  0

Contributors

  2

Image

Image

Languages

Footer

Footer navigation

Hacker News

相關文章

  1. Claude 技能、資源與工具列表,用於客製化 Claude AI 工作流程

    3 個月前

  2. 使用 Claude Code 進行 AI 輔助編碼的最佳實踐與建構 Claude.md

    3 個月前

  3. 利用 Claude Code Hooks 自動化您的 AI 工作流程

    3 個月前

  4. CatSyphon:分析您的AI程式碼助手對話

    3 個月前

  5. Claude Code Orchestrator:透過多個Claude會話實現並行AI開發

    3 個月前