disler/claude-code-hooks-multi-agent-observability

Real-time monitoring for Claude Code agents through simple hook event tracking.

925 stars284 forksUpdated Oct 26, 2025
npx skills add disler/claude-code-hooks-multi-agent-observability

README

Multi-Agent Observability System

Real-time monitoring and visualization for Claude Code agents through comprehensive hook event tracking. You can watch the full breakdown here and watch the latest enhancement where we compare Haiku 4.5 and Sonnet 4.5 here.

šŸŽÆ Overview

This system provides complete observability into Claude Code agent behavior by capturing, storing, and visualizing Claude Code Hook events in real-time. It enables monitoring of multiple concurrent agents with session tracking, event filtering, and live updates.

Multi-Agent Observability Dashboard

šŸ—ļø Architecture

Claude Agents → Hook Scripts → HTTP POST → Bun Server → SQLite → WebSocket → Vue Client

Agent Data Flow Animation

šŸ“‹ Setup Requirements

Before getting started, ensure you have the following installed:

  • Claude Code - Anthropic's official CLI for Claude
  • Astral uv - Fast Python package manager (required for hook scripts)
  • Bun, npm, or yarn - For running the server and client
  • Anthropic API Key - Set as ANTHROPIC_API_KEY environment variable
  • OpenAI API Key (optional) - For multi-model support with just-prompt MCP tool
  • ElevenLabs API Key (optional) - For audio features

Configure .claude Directory

To setup observability in your repo,we need to copy the .claude directory to your project root.

To integrate the observability hooks into your projects:

  1. Copy the entire .claude directory to your project root:

    cp -R .claude /path/to/your/project/
    
  2. Update the settings.json configuration:

    Open .claude/settings.json in your project and modify the source-app parameter to identify your project:

    {
      "hooks": {
        "PreToolUse": [{
          "matcher": "",
          "hooks": [
            {
              "type": "command",
              "command": "uv run .claude/hooks/pre_tool_use.py"
            },
            {
              "type": "command",
              "command": "uv run .claude/hooks/send_event.py --source-app YOUR_PROJECT_NAME --event-type PreToolUse --summarize"
            }
          ]
        }],
        "PostToolUse": [{
          "matcher": "",
          "hooks": [
            {
              "type": "command",
              "command": "uv run .claude/hooks/post_tool_use.py"
            },
            {
              "type": "command",
              "command": "uv run .claude/hooks/send_event.py --source-app YOUR_PROJECT_NAME --event-type PostToolUse --summarize"
            }
          ]
        }],
        "UserPromptSubmit": [{
          "hooks": [
            {
              "type": "command",
              "command": "uv run .claude/hooks/user_prompt_submit.py --log-only"
            },
            {
              "type": "command",
              "command": "uv run .claude/hooks/send_event.py --source-app YOUR_PROJECT_NAME --event-type UserPromptSubmit --summarize"
            }
          ]
        }]
        // ... (similar patterns for Notification, Stop, SubagentStop, PreCompact, SessionStart, SessionEnd)
      }
    }
    

    Replace YOUR_PROJECT_NAME with a unique identifier for your project (e.g., my-api-server, react-app, etc.).

  3. Ensure the observability server is running:

    # From the observability project directory (this codebase)
    ./scripts/start-system.sh
    

Now your project will send events to the observability system whenever Claude Code performs actions.

šŸš€ Quick Start

You can quickly view how this works by running this repositories .claude setup.

# 1. Start both server and client
./scripts/start-system.sh

# 2. Open http://localhost:5173 in your browser

# 3. Open Claude Code and run the following command:
Run git ls-files to understand the codebase.

# 4. Watch events stream in the client

# 5. Copy the .claude folder to other projects you want to emit events from.
cp -R .claude <directory of your codebase you want to emit events from>

šŸ“ Project Structure

claude-code-hooks-multi-agent-observability/
│
ā”œā”€ā”€ apps/                    # Application components
│   ā”œā”€ā”€ server/             # Bun TypeScript server
│   │   ā”œā”€ā”€ src/
│   │   │   ā”œā”€ā”€ index.ts    # Main server with HTTP/WebSocket endpoints
│   │   │   ā”œā”€ā”€ db.ts       # SQLite database management & migrations
│   │   │   └── types.ts    # TypeScript interfaces
│   │   ā”œā”€ā”€ package.json
│   │   └── events.db       # SQLite database (gitignored)
│   │
│   └── client/             # Vue 3 TypeScript client
│       ā”œā”€ā”€ src/
│       │   ā”œā”€ā”€ App.vue     # Main app with theme & WebSocket management
│       │   ā”œā”€ā”€ components/
│       │   │   ā”œā”€ā”€ EventTimeline.vue      # Event list 

...
Read full README

Publisher

dislerdisler

Statistics

Stars925
Forks284
Open Issues15
CreatedJul 13, 2025