# agricidaniel/claude-avatar architecture

> Architecture diagram of the GitHub repository agricidaniel/claude-avatar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/agricidaniel/claude-avatar
- Repository: https://github.com/agricidaniel/claude-avatar

## Overview

Claude Avatar is a browser-based voice and text conversation app backed by a Node.js WebSocket bridge, Claude Code CLI, GPU transcription, and speech synthesis. The main flow is browser input → bridge → optional transcription → Claude response → speech synthesis → avatar/chat display. The README documents the UI and integrations; sampled server code confirms the bridge’s orchestration, but some helper implementations and UI internals were not shown.

Main entry points: [`claude/server.cjs`](https://github.com/agricidaniel/claude-avatar/blob/main/claude/server.cjs) (WebSocket bridge), [`claude/index.html`](https://github.com/agricidaniel/claude-avatar/blob/main/claude/index.html) (Avatar and chat UI), [`claude/tts.py`](https://github.com/agricidaniel/claude-avatar/blob/main/claude/tts.py) (TTS generation), [`claude/transcribe_server.py`](https://github.com/agricidaniel/claude-avatar/blob/main/claude/transcribe_server.py) (Persistent Whisper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Avatar client"]
  node_ui["Avatar and chat UI<br/>[index.html]"]
  node_talkinghead["TalkingHead"]
end

subgraph group_bridge["Conversation bridge"]
  node_bridge["WebSocket bridge<br/>[server.cjs]"]
  node_audio_pipeline["Audio preparation<br/>[server.cjs]"]
end

subgraph group_speech["Speech processing"]
  node_whisper_persistent["Persistent Whisper"]
  node_whisper_fallback["One-shot Whisper<br/>[transcribe.py]"]
  node_ffmpeg["ffmpeg"]
  node_tts_runner["TTS generation<br/>[tts.py]"]
  node_edge_tts["edge-tts"]
end

subgraph group_assistant["Claude session"]
  node_claude_session["Claude CLI session<br/>[server.cjs]"]
end

node_user(("User"))

node_user -->|"speaks or types"| node_ui
node_ui -->|"sends requests"| node_bridge
node_bridge -->|"prepares audio"| node_audio_pipeline
node_audio_pipeline -->|"converts WAV"| node_ffmpeg
node_audio_pipeline -->|"transcribes"| node_whisper_persistent
node_audio_pipeline -.->|"fallback transcription"| node_whisper_fallback
node_bridge -->|"sends prompt"| node_claude_session
node_bridge -->|"synthesizes response"| node_tts_runner
node_tts_runner -->|"generates speech"| node_edge_tts
node_bridge -->|"sends transcript and result"| node_ui
node_ui -->|"lip-syncs speech"| node_talkinghead

click node_ui "https://github.com/agricidaniel/claude-avatar/blob/main/claude/index.html"
click node_bridge "https://github.com/agricidaniel/claude-avatar/blob/main/claude/server.cjs"
click node_audio_pipeline "https://github.com/agricidaniel/claude-avatar/blob/main/claude/server.cjs"
click node_whisper_persistent "https://github.com/agricidaniel/claude-avatar/blob/main/claude/transcribe_server.py"
click node_whisper_fallback "https://github.com/agricidaniel/claude-avatar/blob/main/claude/transcribe.py"
click node_claude_session "https://github.com/agricidaniel/claude-avatar/blob/main/claude/server.cjs"
click node_tts_runner "https://github.com/agricidaniel/claude-avatar/blob/main/claude/tts.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_talkinghead,node_user toneBlue
class node_bridge,node_audio_pipeline toneAmber
class node_whisper_persistent,node_whisper_fallback,node_ffmpeg,node_tts_runner,node_edge_tts toneMint
class node_claude_session toneRose
```

## Components

### Avatar client

- [Avatar and chat UI](https://github.com/agricidaniel/claude-avatar/blob/main/claude/index.html): `claude/index.html`
- **TalkingHead**

### Conversation bridge

- [WebSocket bridge](https://github.com/agricidaniel/claude-avatar/blob/main/claude/server.cjs): `claude/server.cjs`
- [Audio preparation](https://github.com/agricidaniel/claude-avatar/blob/main/claude/server.cjs): `claude/server.cjs`

### Speech processing

- [Persistent Whisper](https://github.com/agricidaniel/claude-avatar/blob/main/claude/transcribe_server.py): `claude/transcribe_server.py`
- [One-shot Whisper](https://github.com/agricidaniel/claude-avatar/blob/main/claude/transcribe.py): `claude/transcribe.py`
- **ffmpeg**
- [TTS generation](https://github.com/agricidaniel/claude-avatar/blob/main/claude/tts.py): `claude/tts.py`
- **edge-tts**

### Claude session

- [Claude CLI session](https://github.com/agricidaniel/claude-avatar/blob/main/claude/server.cjs): `claude/server.cjs`

### Other components

- **User**

## Connections

- User → Avatar and chat UI: speaks or types (evidence: `README.md`)
- Avatar and chat UI → WebSocket bridge: sends requests (evidence: `README.md`)
- WebSocket bridge → Audio preparation: prepares audio (evidence: `README.md`)
- Audio preparation → ffmpeg: converts WAV (evidence: `README.md`)
- Audio preparation → Persistent Whisper: transcribes (evidence: `claude/server.cjs`)
- Audio preparation → One-shot Whisper: fallback transcription
- WebSocket bridge → Claude CLI session: sends prompt (evidence: `claude/server.cjs`)
- WebSocket bridge → TTS generation: synthesizes response (evidence: `README.md`)
- TTS generation → edge-tts: generates speech (evidence: `claude/tts.py`)
- WebSocket bridge → Avatar and chat UI: sends transcript and result (evidence: `claude/server.cjs`)
- Avatar and chat UI → TalkingHead: lip-syncs speech (evidence: `README.md`)
