# dioneldaf/claude-panel architecture

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

- Interactive diagram: https://gitdiagram.com/dioneldaf/claude-panel
- Repository: https://github.com/dioneldaf/claude-panel

## Overview

Claude Panel is a Windows desktop widget that turns Claude Code session activity into per-session status lights, notifications, and panel presence behavior. The main flow combines registry scans with optional hook events, reduces them to session states, publishes snapshots to the interface, and reacts to session-count changes. Separate branches cover hook installation and repair, saved preferences and sign-in launch, plus the panel’s mini mode, dragging, and mascot animations. Some runtime wiring is documented rather than shown in the excerpts; those links are marked unverified.

Main entry points: [`src-tauri/src/engine.rs`](https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/engine.rs) (Runtime engine), [`src/main.ts`](https://github.com/dioneldaf/claude-panel/blob/main/src/main.ts) (Panel interface), [`src-tauri/src/hooks.rs`](https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/hooks.rs) (Hook management), [`crates/cpanel-core/src/registry.rs`](https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/registry.rs) (Session registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_session["Session monitoring"]
  node_registry[("Session registry<br/>[registry.rs]")]
  node_hookforwarder["Hook forwarder<br/>[main.rs]"]
  node_hookevents["Hook events<br/>[hook_event.rs]"]
end

subgraph group_core["State and alerts"]
  node_reducer["Session reducer<br/>[reducer.rs]"]
  node_model["Session model<br/>[model.rs]"]
  node_notifier["Notification policy<br/>[notify.rs]"]
  node_soundpolicy["Sound policy<br/>[sound.rs]"]
end

subgraph group_desktop["Desktop runtime"]
  node_engine["Runtime engine<br/>[engine.rs]"]
  node_probe["OS probe<br/>[probe.rs]"]
  node_policy["Presence policy<br/>[policy.rs]"]
end

subgraph group_frontend["Panel interface"]
  node_ui["Panel interface<br/>[main.ts]"]
  node_viewmodel["View helpers<br/>[model.ts]"]
  node_presence["Presence animation<br/>[presence.ts]"]
  node_mascot["Pixel mascot<br/>[mascot.ts]"]
  node_dragui["Drag effects<br/>[drag.ts]"]
  node_physics["Spring physics<br/>[physics.ts]"]
end

subgraph group_management["Hooks and preferences"]
  node_hookmanager["Hook management<br/>[hooks.rs]"]
  node_settings["Hook settings<br/>[settings.rs]"]
  node_hookstate[("Hook repair state<br/>[hookstate.rs]")]
  node_cli["CLI actions<br/>[cli.rs]"]
  node_preferences[("UI preferences<br/>[persist.rs]")]
  node_autostart["Sign-in launch<br/>[autostart.rs]"]
end

node_claude(("Claude Code"))
node_native(("Windows desktop"))
node_user(("Panel user"))

node_claude -->|"writes sessions"| node_registry
node_claude -->|"runs hooks"| node_hookforwarder
node_hookforwarder -->|"sends datagrams"| node_hookevents
node_registry -->|"scans sessions"| node_engine
node_hookevents -->|"receives events"| node_engine
node_engine -->|"reduces activity"| node_reducer
node_reducer -->|"builds views"| node_model
node_engine -->|"checks transitions"| node_notifier
node_engine -->|"selects cue"| node_soundpolicy
node_engine -->|"uses OS probe"| node_probe
node_engine -.->|"observes presence"| node_policy
node_engine -.->|"publishes snapshots"| node_ui
node_ui -->|"renders states"| node_viewmodel
node_ui -.->|"plays phases"| node_presence
node_ui -->|"sets mood"| node_mascot
node_ui -.->|"handles dragging"| node_dragui
node_dragui -->|"uses springs"| node_physics
node_user -->|"views and controls"| node_ui
node_user -->|"manages hooks"| node_hookmanager
node_cli -->|"runs actions"| node_hookmanager
node_hookmanager -->|"installs entries"| node_settings
node_hookmanager -->|"tracks installs"| node_hookstate
node_engine -.->|"repairs hooks"| node_hookmanager
node_user -->|"changes settings"| node_preferences
node_preferences -.->|"stores launch choice"| node_autostart
node_autostart -->|"registers sign-in"| node_native
node_engine -->|"shows notifications"| node_native

click node_registry "https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/registry.rs"
click node_hookforwarder "https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-hook/src/main.rs"
click node_hookevents "https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/hook_event.rs"
click node_reducer "https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/reducer.rs"
click node_model "https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/model.rs"
click node_notifier "https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/notify.rs"
click node_soundpolicy "https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/sound.rs"
click node_engine "https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/engine.rs"
click node_probe "https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/probe.rs"
click node_policy "https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/policy.rs"
click node_ui "https://github.com/dioneldaf/claude-panel/blob/main/src/main.ts"
click node_viewmodel "https://github.com/dioneldaf/claude-panel/blob/main/src/model.ts"
click node_presence "https://github.com/dioneldaf/claude-panel/blob/main/src/presence.ts"
click node_mascot "https://github.com/dioneldaf/claude-panel/blob/main/src/mascot.ts"
click node_dragui "https://github.com/dioneldaf/claude-panel/blob/main/src/drag.ts"
click node_physics "https://github.com/dioneldaf/claude-panel/blob/main/src/physics.ts"
click node_hookmanager "https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/hooks.rs"
click node_settings "https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/settings.rs"
click node_hookstate "https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/hookstate.rs"
click node_cli "https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/cli.rs"
click node_preferences "https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/persist.rs"
click node_autostart "https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/autostart.rs"

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_registry,node_hookforwarder,node_hookevents,node_user toneBlue
class node_reducer,node_model,node_notifier,node_soundpolicy toneAmber
class node_engine,node_probe,node_policy toneMint
class node_ui,node_viewmodel,node_presence,node_mascot,node_dragui,node_physics toneRose
class node_hookmanager,node_settings,node_hookstate,node_cli,node_preferences,node_autostart,node_claude,node_native toneIndigo
```

## Components

### Session monitoring

- [Session registry](https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/registry.rs): `crates/cpanel-core/src/registry.rs`
- [Hook forwarder](https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-hook/src/main.rs): `crates/cpanel-hook/src/main.rs`
- [Hook events](https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/hook_event.rs): `crates/cpanel-core/src/hook_event.rs`

### State and alerts

- [Session reducer](https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/reducer.rs): `crates/cpanel-core/src/reducer.rs`
- [Session model](https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/model.rs): `crates/cpanel-core/src/model.rs`
- [Notification policy](https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/notify.rs): `crates/cpanel-core/src/notify.rs`
- [Sound policy](https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/sound.rs): `crates/cpanel-core/src/sound.rs`

### Desktop runtime

- [Runtime engine](https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/engine.rs): `src-tauri/src/engine.rs`
- [OS probe](https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/probe.rs): `src-tauri/src/probe.rs`
- [Presence policy](https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/policy.rs): `src-tauri/src/policy.rs`

### Panel interface

- [Panel interface](https://github.com/dioneldaf/claude-panel/blob/main/src/main.ts): `src/main.ts`
- [View helpers](https://github.com/dioneldaf/claude-panel/blob/main/src/model.ts): `src/model.ts`
- [Presence animation](https://github.com/dioneldaf/claude-panel/blob/main/src/presence.ts): `src/presence.ts`
- [Pixel mascot](https://github.com/dioneldaf/claude-panel/blob/main/src/mascot.ts): `src/mascot.ts`
- [Drag effects](https://github.com/dioneldaf/claude-panel/blob/main/src/drag.ts): `src/drag.ts`
- [Spring physics](https://github.com/dioneldaf/claude-panel/blob/main/src/physics.ts): `src/physics.ts`

### Hooks and preferences

- [Hook management](https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/hooks.rs): `src-tauri/src/hooks.rs`
- [Hook settings](https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/settings.rs): `crates/cpanel-core/src/settings.rs`
- [Hook repair state](https://github.com/dioneldaf/claude-panel/blob/main/crates/cpanel-core/src/hookstate.rs): `crates/cpanel-core/src/hookstate.rs`
- [CLI actions](https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/cli.rs): `src-tauri/src/cli.rs`
- [UI preferences](https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/persist.rs): `src-tauri/src/persist.rs`
- [Sign-in launch](https://github.com/dioneldaf/claude-panel/blob/main/src-tauri/src/autostart.rs): `src-tauri/src/autostart.rs`

### Other components

- **Claude Code**
- **Windows desktop**
- **Panel user**

## Connections

- Claude Code → Session registry: writes sessions (evidence: `README.md`)
- Claude Code → Hook forwarder: runs hooks (evidence: `README.md`)
- Hook forwarder → Hook events: sends datagrams (evidence: `README.md`)
- Session registry → Runtime engine: scans sessions (evidence: `src-tauri/src/engine.rs`)
- Hook events → Runtime engine: receives events (evidence: `src-tauri/src/engine.rs`)
- Runtime engine → Session reducer: reduces activity (evidence: `src-tauri/src/engine.rs`)
- Session reducer → Session model: builds views (evidence: `crates/cpanel-core/src/reducer.rs`)
- Runtime engine → Notification policy: checks transitions (evidence: `src-tauri/src/engine.rs`)
- Runtime engine → Sound policy: selects cue (evidence: `src-tauri/src/engine.rs`)
- Runtime engine → OS probe: uses OS probe (evidence: `src-tauri/src/engine.rs`)
- Runtime engine → Presence policy: observes presence (evidence: `src-tauri/src/engine.rs`)
- Runtime engine → Panel interface: publishes snapshots
- Panel interface → View helpers: renders states (evidence: `src/main.ts`)
- Panel interface → Presence animation: plays phases (evidence: `src/presence.ts`)
- Panel interface → Pixel mascot: sets mood (evidence: `src/main.ts`)
- Panel interface → Drag effects: handles dragging (evidence: `src/main.ts`)
- Drag effects → Spring physics: uses springs (evidence: `src/drag.ts`)
- Panel user → Panel interface: views and controls (evidence: `README.md`)
- Panel user → Hook management: manages hooks (evidence: `README.md`)
- CLI actions → Hook management: runs actions (evidence: `src-tauri/src/cli.rs`)
- Hook management → Hook settings: installs entries (evidence: `src-tauri/src/hooks.rs`)
- Hook management → Hook repair state: tracks installs (evidence: `src-tauri/src/hooks.rs`)
- Runtime engine → Hook management: repairs hooks (evidence: `src-tauri/src/engine.rs`)
- Panel user → UI preferences: changes settings (evidence: `README.md`)
- UI preferences → Sign-in launch: stores launch choice
- Sign-in launch → Windows desktop: registers sign-in (evidence: `README.md`)
- Runtime engine → Windows desktop: shows notifications (evidence: `README.md`)
