# dankel26/phonebox architecture

> Architecture diagram of the GitHub repository dankel26/phonebox, 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/dankel26/phonebox
- Repository: https://github.com/dankel26/phonebox

## Overview

PhoneBox turns an Android phone into a configurable desk panel backed by a cross-platform desktop agent. The main workflow is to pair the phone with the agent, load the panel over USB or Wi‑Fi, and display live computer data or send touch-control actions back to the computer. Distinct product areas include monitoring, AI-session and quota tracking, automation, media/control integrations, and phone-to-computer bridging. The README documents these capabilities; sampled source is partial, so links to unsampled subsystems are limited to documented relationships or visible references.

Main entry points: [`agent/PhoneBox.Agent/Program.cs`](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/Program.cs) (Desktop agent API), [`android/app/src/main/java/net/oxog/phonebox/deskpanel/MainActivity.kt`](https://github.com/dankel26/phonebox/blob/main/android/app/src/main/java/net/oxog/phonebox/deskpanel/MainActivity.kt) (Android panel app), [`agent/PhoneBox.Agent/Pairing.cs`](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/Pairing.cs) (Pairing), [`agent/PhoneBox.Agent/RuleEngine.cs`](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/RuleEngine.cs) (Automation rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_connection["Connection and panel"]
  node_panel["Panel UI"]
  node_agent["Desktop agent API<br/>[Program.cs]"]
  node_pairing["Pairing<br/>[Pairing.cs]"]
  node_usb["USB link<br/>[UsbLink.cs]"]
end

subgraph group_monitoring["Monitoring and AI"]
  node_system["System metrics<br/>[SystemMonitor.cs]"]
  node_sessions["Coding sessions<br/>[SessionMonitor.cs]"]
  node_quotas["AI quotas<br/>[QuotaMonitor.cs]"]
  node_github["GitHub status<br/>[GitHubMonitor.cs]"]
end

subgraph group_controls["Controls and automation"]
  node_rules["Automation rules<br/>[RuleEngine.cs]"]
  node_shortcuts["Shortcuts and macros<br/>[Shortcuts.cs]"]
  node_deck["Control Deck<br/>[ControlDeck.cs]"]
  node_media["Media controls<br/>[MediaMonitor.cs]"]
  node_push[("Push state<br/>[PushStore.cs]")]
end

subgraph group_phone["Phone bridge"]
  node_android["Android panel app<br/>[MainActivity.kt]"]
  node_stream["Agent stream<br/>[AgentStream.kt]"]
  node_clipboard["Clipboard bridge"]
  node_notifications["Phone notifications"]
  node_iosclient["iOS agent client<br/>[AgentClient.swift]"]
  node_iospair["iOS pairing"]
end

node_person(("Phone user"))

node_person -->|"configures"| node_panel
node_person -->|"pairs phone"| node_pairing
node_pairing -->|"claims access"| node_agent
node_android -->|"connects to"| node_agent
node_android -->|"opens stream"| node_stream
node_panel -->|"requests data"| node_agent
node_agent -->|"serves metrics"| node_system
node_agent -->|"serves sessions"| node_sessions
node_agent -->|"serves quotas"| node_quotas
node_agent -->|"serves status"| node_github
node_agent -->|"evaluates rules"| node_rules
node_rules -->|"runs shortcut"| node_shortcuts
node_panel -->|"sends controls"| node_deck
node_panel -->|"controls playback"| node_media
node_agent -->|"stores state"| node_push
node_android -->|"starts bridge"| node_clipboard
node_android -->|"receives notices"| node_notifications
node_iospair -->|"stores pairing"| node_iosclient
node_iosclient -.->|"proxies requests"| node_agent
node_usb -->|"connects phone"| node_agent

click node_agent "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/Program.cs"
click node_pairing "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/Pairing.cs"
click node_usb "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/UsbLink.cs"
click node_system "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/SystemMonitor.cs"
click node_sessions "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/SessionMonitor.cs"
click node_quotas "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/QuotaMonitor.cs"
click node_github "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/GitHubMonitor.cs"
click node_rules "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/RuleEngine.cs"
click node_shortcuts "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/Shortcuts.cs"
click node_deck "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/ControlDeck.cs"
click node_media "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/MediaMonitor.cs"
click node_push "https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/PushStore.cs"
click node_android "https://github.com/dankel26/phonebox/blob/main/android/app/src/main/java/net/oxog/phonebox/deskpanel/MainActivity.kt"
click node_stream "https://github.com/dankel26/phonebox/blob/main/android/app/src/main/java/net/oxog/phonebox/deskpanel/AgentStream.kt"
click node_clipboard "https://github.com/dankel26/phonebox/blob/main/android/app/src/main/java/net/oxog/phonebox/deskpanel/ClipboardService.kt"
click node_notifications "https://github.com/dankel26/phonebox/blob/main/android/app/src/main/java/net/oxog/phonebox/deskpanel/PhoneNotificationListener.kt"
click node_iosclient "https://github.com/dankel26/phonebox/blob/main/ios/PhoneBox/PhoneBox/Networking/AgentClient.swift"
click node_iospair "https://github.com/dankel26/phonebox/blob/main/ios/PhoneBox/PhoneBox/Pairing/PairingService.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_panel,node_agent,node_pairing,node_usb,node_person toneBlue
class node_system,node_sessions,node_quotas,node_github toneAmber
class node_rules,node_shortcuts,node_deck,node_media,node_push toneMint
class node_android,node_stream,node_clipboard,node_notifications,node_iosclient,node_iospair toneRose
```

## Components

### Connection and panel

- **Panel UI**
- [Desktop agent API](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/Program.cs): `agent/PhoneBox.Agent/Program.cs`
- [Pairing](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/Pairing.cs): `agent/PhoneBox.Agent/Pairing.cs`
- [USB link](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/UsbLink.cs): `agent/PhoneBox.Agent/UsbLink.cs`

### Monitoring and AI

- [System metrics](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/SystemMonitor.cs): `agent/PhoneBox.Agent/SystemMonitor.cs`
- [Coding sessions](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/SessionMonitor.cs): `agent/PhoneBox.Agent/SessionMonitor.cs`
- [AI quotas](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/QuotaMonitor.cs): `agent/PhoneBox.Agent/QuotaMonitor.cs`
- [GitHub status](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/GitHubMonitor.cs): `agent/PhoneBox.Agent/GitHubMonitor.cs`

### Controls and automation

- [Automation rules](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/RuleEngine.cs): `agent/PhoneBox.Agent/RuleEngine.cs`
- [Shortcuts and macros](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/Shortcuts.cs): `agent/PhoneBox.Agent/Shortcuts.cs`
- [Control Deck](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/ControlDeck.cs): `agent/PhoneBox.Agent/ControlDeck.cs`
- [Media controls](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/MediaMonitor.cs): `agent/PhoneBox.Agent/MediaMonitor.cs`
- [Push state](https://github.com/dankel26/phonebox/blob/main/agent/PhoneBox.Agent/PushStore.cs): `agent/PhoneBox.Agent/PushStore.cs`

### Phone bridge

- [Android panel app](https://github.com/dankel26/phonebox/blob/main/android/app/src/main/java/net/oxog/phonebox/deskpanel/MainActivity.kt): `android/app/src/main/java/net/oxog/phonebox/deskpanel/MainActivity.kt`
- [Agent stream](https://github.com/dankel26/phonebox/blob/main/android/app/src/main/java/net/oxog/phonebox/deskpanel/AgentStream.kt): `android/app/src/main/java/net/oxog/phonebox/deskpanel/AgentStream.kt`
- [Clipboard bridge](https://github.com/dankel26/phonebox/blob/main/android/app/src/main/java/net/oxog/phonebox/deskpanel/ClipboardService.kt): `android/app/src/main/java/net/oxog/phonebox/deskpanel/ClipboardService.kt`
- [Phone notifications](https://github.com/dankel26/phonebox/blob/main/android/app/src/main/java/net/oxog/phonebox/deskpanel/PhoneNotificationListener.kt): `android/app/src/main/java/net/oxog/phonebox/deskpanel/PhoneNotificationListener.kt`
- [iOS agent client](https://github.com/dankel26/phonebox/blob/main/ios/PhoneBox/PhoneBox/Networking/AgentClient.swift): `ios/PhoneBox/PhoneBox/Networking/AgentClient.swift`
- [iOS pairing](https://github.com/dankel26/phonebox/blob/main/ios/PhoneBox/PhoneBox/Pairing/PairingService.swift): `ios/PhoneBox/PhoneBox/Pairing/PairingService.swift`

### Other components

- **Phone user**

## Connections

- Phone user → Panel UI: configures (evidence: `README.md`)
- Phone user → Pairing: pairs phone (evidence: `README.md`)
- Pairing → Desktop agent API: claims access (evidence: `agent/PhoneBox.Agent/Program.cs`)
- Android panel app → Desktop agent API: connects to (evidence: `README.md`)
- Android panel app → Agent stream: opens stream (evidence: `android/app/src/main/java/net/oxog/phonebox/deskpanel/MainActivity.kt`)
- Panel UI → Desktop agent API: requests data (evidence: `README.md`)
- Desktop agent API → System metrics: serves metrics (evidence: `agent/PhoneBox.Agent/Program.cs`)
- Desktop agent API → Coding sessions: serves sessions (evidence: `agent/PhoneBox.Agent/Program.cs`)
- Desktop agent API → AI quotas: serves quotas (evidence: `agent/PhoneBox.Agent/Program.cs`)
- Desktop agent API → GitHub status: serves status (evidence: `agent/PhoneBox.Agent/Program.cs`)
- Desktop agent API → Automation rules: evaluates rules (evidence: `README.md`)
- Automation rules → Shortcuts and macros: runs shortcut (evidence: `agent/PhoneBox.Agent/RuleEngine.cs`)
- Panel UI → Control Deck: sends controls (evidence: `README.md`)
- Panel UI → Media controls: controls playback (evidence: `README.md`)
- Desktop agent API → Push state: stores state (evidence: `agent/PhoneBox.Agent/Program.cs`)
- Android panel app → Clipboard bridge: starts bridge (evidence: `android/app/src/main/java/net/oxog/phonebox/deskpanel/MainActivity.kt`)
- Android panel app → Phone notifications: receives notices (evidence: `README.md`)
- iOS pairing → iOS agent client: stores pairing (evidence: `ios/PhoneBox/PhoneBox/Pairing/PairingService.swift`)
- iOS agent client → Desktop agent API: proxies requests (evidence: `README.md`)
- USB link → Desktop agent API: connects phone (evidence: `agent/PhoneBox.Agent/Program.cs`)
