# abirgarg/claudethermal architecture

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

- Interactive diagram: https://gitdiagram.com/abirgarg/claudethermal
- Repository: https://github.com/abirgarg/claudethermal

## Overview

ClaudeThermal is a native macOS menu-bar monitor for Claude Code usage. At launch and as Claude Code data changes, it combines status-line usage percentages with locally parsed transcript data, optionally corrects rounded percentages by running Claude Code’s local `/usage` command, and computes session and weekly summaries. The app presents those results in a thermal pill and hover panel, with login and overheat-notification controls. The README documents the bridge and capabilities; some implementation links rely on the SOURCE INDEX because excerpts are partial.

Main entry points: [`Sources/ClaudeThermal/UsageStore.swift`](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/UsageStore.swift) (Usage Store), [`Sources/ClaudeThermal/StatusItemController.swift`](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/StatusItemController.swift) (Status Item Controller), [`Sources/ClaudeThermal/main.swift`](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/main.swift) (App Lifecycle), [`Sources/ClaudeThermal/SystemServices.swift`](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/SystemServices.swift) (Login and Alerts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Menu Bar App"]
  node_app["App Lifecycle<br/>[main.swift]"]
  node_store["Usage Store<br/>[UsageStore.swift]"]
  node_models["Usage Models<br/>[Models.swift]"]
  node_services["Login and Alerts"]
end

subgraph group_ingest["Usage Inputs"]
  node_bridge["Status Line Bridge"]
  node_live["Live Usage Reader<br/>[LiveUsage.swift]"]
  node_cli["Usage CLI Fetch"]
  node_watcher["File Watcher<br/>[LogWatcher.swift]"]
  node_parser["Incremental Log Parser<br/>[LogParser.swift]"]
end

subgraph group_compute["Usage Processing"]
  node_engine["Usage Engine<br/>[UsageEngine.swift]"]
end

subgraph group_present["Presentation and Controls"]
  node_status["Status Item Controller"]
  node_pill["Thermal Pill Renderer<br/>[PillRenderer.swift]"]
  node_hover["Hover Panel<br/>[HoverPanel.swift]"]
  node_panel["Usage Panel<br/>[PanelView.swift]"]
end

node_user(("Mac User"))
node_claude(("Claude Code"))
node_logs[("Claude Logs")]
node_macos(("macOS Services"))

node_user -->|"launches"| node_app
node_app -->|"starts"| node_store
node_app -->|"creates"| node_status
node_app -->|"configures"| node_services
node_claude -->|"pipes status"| node_bridge
node_bridge -->|"writes usage file"| node_live
node_store -->|"loads"| node_live
node_store -->|"fetches exact usage"| node_cli
node_cli -->|"runs local command"| node_claude
node_claude -->|"writes transcripts"| node_logs
node_store -->|"starts watching"| node_watcher
node_watcher -->|"reports changes"| node_store
node_store -->|"ingests log changes"| node_parser
node_parser -->|"reads JSONL"| node_logs
node_store -->|"computes snapshot"| node_engine
node_store -->|"publishes snapshot"| node_status
node_status -->|"renders usage"| node_pill
node_status -->|"opens panel"| node_hover
node_status -->|"hosts view"| node_panel
node_app -->|"evaluates alerts"| node_services
node_services -->|"uses login and notifications"| node_macos
node_user -->|"hovers or clicks"| node_status

click node_app "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/main.swift"
click node_store "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/UsageStore.swift"
click node_models "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/Models.swift"
click node_bridge "https://github.com/abirgarg/claudethermal/blob/main/scripts/statusline-bridge.sh"
click node_live "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/LiveUsage.swift"
click node_cli "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/ClaudeCLIUsage.swift"
click node_watcher "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/LogWatcher.swift"
click node_parser "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/LogParser.swift"
click node_engine "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/UsageEngine.swift"
click node_status "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/StatusItemController.swift"
click node_pill "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/PillRenderer.swift"
click node_hover "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/HoverPanel.swift"
click node_panel "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/PanelView.swift"
click node_services "https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/SystemServices.swift"

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_app,node_store,node_models,node_services,node_user toneBlue
class node_bridge,node_live,node_cli,node_watcher,node_parser,node_logs toneAmber
class node_engine toneMint
class node_status,node_pill,node_hover,node_panel toneRose
class node_claude,node_macos toneIndigo
```

## Components

### Menu Bar App

- [App Lifecycle](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/main.swift): `Sources/ClaudeThermal/main.swift`
- [Usage Store](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/UsageStore.swift): `Sources/ClaudeThermal/UsageStore.swift`
- [Usage Models](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/Models.swift): `Sources/ClaudeThermal/Models.swift`
- [Login and Alerts](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/SystemServices.swift): `Sources/ClaudeThermal/SystemServices.swift`

### Usage Inputs

- [Status Line Bridge](https://github.com/abirgarg/claudethermal/blob/main/scripts/statusline-bridge.sh): `scripts/statusline-bridge.sh`
- [Live Usage Reader](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/LiveUsage.swift): `Sources/ClaudeThermal/LiveUsage.swift`
- [Usage CLI Fetch](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/ClaudeCLIUsage.swift): `Sources/ClaudeThermal/ClaudeCLIUsage.swift`
- [File Watcher](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/LogWatcher.swift): `Sources/ClaudeThermal/LogWatcher.swift`
- [Incremental Log Parser](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/LogParser.swift): `Sources/ClaudeThermal/LogParser.swift`

### Usage Processing

- [Usage Engine](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/UsageEngine.swift): `Sources/ClaudeThermal/UsageEngine.swift`

### Presentation and Controls

- [Status Item Controller](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/StatusItemController.swift): `Sources/ClaudeThermal/StatusItemController.swift`
- [Thermal Pill Renderer](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/PillRenderer.swift): `Sources/ClaudeThermal/PillRenderer.swift`
- [Hover Panel](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/HoverPanel.swift): `Sources/ClaudeThermal/HoverPanel.swift`
- [Usage Panel](https://github.com/abirgarg/claudethermal/blob/main/Sources/ClaudeThermal/PanelView.swift): `Sources/ClaudeThermal/PanelView.swift`

### Other components

- **Mac User**
- **Claude Code**
- **Claude Logs**
- **macOS Services**

## Connections

- Mac User → App Lifecycle: launches (evidence: `README.md`)
- App Lifecycle → Usage Store: starts (evidence: `Sources/ClaudeThermal/main.swift`)
- App Lifecycle → Status Item Controller: creates (evidence: `Sources/ClaudeThermal/main.swift`)
- App Lifecycle → Login and Alerts: configures (evidence: `Sources/ClaudeThermal/main.swift`)
- Claude Code → Status Line Bridge: pipes status (evidence: `README.md`)
- Status Line Bridge → Live Usage Reader: writes usage file (evidence: `README.md`)
- Usage Store → Live Usage Reader: loads (evidence: `Sources/ClaudeThermal/UsageStore.swift`)
- Usage Store → Usage CLI Fetch: fetches exact usage (evidence: `Sources/ClaudeThermal/UsageStore.swift`)
- Usage CLI Fetch → Claude Code: runs local command (evidence: `Sources/ClaudeThermal/ClaudeCLIUsage.swift`)
- Claude Code → Claude Logs: writes transcripts (evidence: `README.md`)
- Usage Store → File Watcher: starts watching (evidence: `Sources/ClaudeThermal/UsageStore.swift`)
- File Watcher → Usage Store: reports changes (evidence: `Sources/ClaudeThermal/UsageStore.swift`)
- Usage Store → Incremental Log Parser: ingests log changes (evidence: `Sources/ClaudeThermal/UsageStore.swift`)
- Incremental Log Parser → Claude Logs: reads JSONL (evidence: `README.md`)
- Usage Store → Usage Engine: computes snapshot (evidence: `Sources/ClaudeThermal/UsageStore.swift`)
- Usage Store → Status Item Controller: publishes snapshot (evidence: `Sources/ClaudeThermal/StatusItemController.swift`)
- Status Item Controller → Thermal Pill Renderer: renders usage (evidence: `Sources/ClaudeThermal/StatusItemController.swift`)
- Status Item Controller → Hover Panel: opens panel (evidence: `Sources/ClaudeThermal/StatusItemController.swift`)
- Status Item Controller → Usage Panel: hosts view (evidence: `Sources/ClaudeThermal/StatusItemController.swift`)
- App Lifecycle → Login and Alerts: evaluates alerts (evidence: `Sources/ClaudeThermal/main.swift`)
- Login and Alerts → macOS Services: uses login and notifications (evidence: `README.md`)
- Mac User → Status Item Controller: hovers or clicks (evidence: `README.md`)
