ποΈ Architecture
How the TUI, daemon, and Claude Code hooks talk to each other over two Unix sockets.
claude-dash is split into three cooperating parts: the TUI you interact with, a background daemon that holds session state, and lightweight hook processes that Claude Code fires on every tool use.
π³ File tree
claude-dash-cli/
βββ Cargo.toml
βββ src/
βββ main.rs # CLI dispatch (clap), TUI event loop, daemon spawn
βββ app.rs # TUI app state, key handling, usage cache
βββ types.rs # Shared domain types
βββ daemon.rs # Unix socket client (TUI β daemon)
βββ usage.rs # ccusage + Anthropic API rate limits
βββ utils.rs # Formatting helpers
βββ cmd/
β βββ daemon.rs # Daemon process β two Unix socket servers, state machine
β βββ hook.rs # Claude Code hook handler β reads stdin, fires events
β βββ install.rs # Hook installer β writes ~/.claude/settings.json
βββ ui/
βββ mod.rs # Layout
βββ header.rs # Top bar
βββ footer.rs # Key hints bar
βββ session_list.rs # Agent list with status groups
βββ usage_panel.rs # Cost/token/chart panel
βββ overlays.rs # Permission modal, new session, renameπ The two sockets
Two Unix sockets connect the pieces:
/tmp/claude-dash.sockβ hook processes send events here (fire-and-forget, or await a decision for aPermissionRequest)./tmp/claude-dash-tui.sockβ the TUI connects here to receive state snapshots/deltas and to send permission decisions.
βοΈ Event flow
Claude Code hooks trigger claude-dash hook on every tool use. The hook reads
the event from stdin and forwards it to the daemon over
/tmp/claude-dash.sock. The daemon tracks session state and pushes updates to
all connected TUI clients over /tmp/claude-dash-tui.sock as newline-delimited
JSON.
For a PermissionRequest, the hook process blocks awaiting the daemon's
decision: the TUI surfaces a permission modal, your keypress (a / s / d)
travels back to the daemon, and the daemon replies to the waiting hook β which
allows or denies the tool call in Claude Code.