# kaiwalyakoparkar/open-paw architecture

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

- Interactive diagram: https://gitdiagram.com/kaiwalyakoparkar/open-paw
- Repository: https://github.com/kaiwalyakoparkar/open-paw

## Overview

Open Paw is a macOS menu-bar voice companion whose primary flow is hotkey or buddy activation, speech capture and transcription, agent-harness streaming, then on-screen text and spoken replies. A separate explain-this flow captures and marks a screenshot before sending it with a voice prompt to the selected harness. The map includes the documented Hermes, Claude, and Codex options, session handling, and speech/screen subsystems. Some wiring is documented in the README or SOURCE INDEX rather than shown in full source excerpts; those evidence limits are reflected in the cited edges.

Main entry points: [`OpenPaw/CompanionManager.swift`](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/CompanionManager.swift) (Companion orchestration), [`OpenPawCore/AgentHarness.swift`](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/AgentHarness.swift) (Harness selection), [`OpenPaw/Voice/GradiumSTTClient.swift`](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Voice/GradiumSTTClient.swift) (Gradium transcription), [`OpenPawCore/HermesAPIClient.swift`](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/HermesAPIClient.swift) (Hermes client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Buddy interaction"]
  node_app["App lifecycle<br/>[OpenPawApp.swift]"]
  node_manager["Companion orchestration"]
  node_window["Floating buddy<br/>[BuddyWindow.swift]"]
  node_buddy["Buddy display<br/>[BuddyView.swift]"]
  node_voicepill["Voice status UI"]
  node_onboarding["Harness setup"]
  node_hotkeys["Wake hotkey<br/>[GlobalHotkey.swift]"]
  node_holdtalk["Push-to-talk"]
end

subgraph group_voice["Voice pipeline"]
  node_audio["Audio capture<br/>[AudioCapture.swift]"]
  node_stt["Gradium transcription"]
  node_vad["Voice activity logic<br/>[VADLogic.swift]"]
  node_tts["Gradium speech playback"]
  node_ttsynth["TTS synthesis"]
end

subgraph group_agents["Agent harnesses"]
  node_messages["Chat messages<br/>[ChatMessage.swift]"]
  node_harness["Harness selection<br/>[AgentHarness.swift]"]
  node_hermes["Hermes client"]
  node_hermesparser["Hermes stream parser"]
  node_claude["Claude CLI client"]
  node_codex["Codex CLI client"]
  node_sessions[("Pinned sessions")]
end

subgraph group_vision["Screen annotation"]
  node_annotation["Annotation overlay"]
  node_capture["Screen capture"]
  node_composer["Image composition"]
  node_encoder["Screenshot encoding"]
end

node_user(("Mac user"))
node_gradium{{"Gradium service"}}
node_hermesgw{{"Hermes gateway"}}
node_claudebin{{"Claude CLI"}}
node_codexbin{{"Codex CLI"}}

node_user -->|"launches"| node_app
node_app -->|"starts"| node_manager
node_user -->|"presses wake"| node_hotkeys
node_user -->|"holds talk"| node_holdtalk
node_hotkeys -.->|"signals"| node_manager
node_holdtalk -->|"signals"| node_manager
node_manager -->|"captures audio"| node_audio
node_audio -->|"streams audio"| node_stt
node_stt -->|"transcribes via"| node_gradium
node_stt -->|"uses"| node_vad
node_manager -->|"requests response"| node_harness
node_harness -->|"streams messages"| node_messages
node_harness -->|"selects"| node_hermes
node_harness -->|"selects"| node_claude
node_harness -->|"selects"| node_codex
node_hermes -->|"calls"| node_hermesgw
node_hermes -->|"parses stream"| node_hermesparser
node_claude -->|"runs"| node_claudebin
node_codex -->|"runs"| node_codexbin
node_claude -->|"persists session"| node_sessions
node_codex -->|"persists session"| node_sessions
node_manager -->|"updates buddy"| node_window
node_window -->|"hosts"| node_buddy
node_buddy -->|"renders"| node_voicepill
node_manager -->|"speaks reply"| node_tts
node_tts -->|"fetches audio"| node_ttsynth
node_ttsynth -->|"synthesizes via"| node_gradium
node_user -->|"configures harness"| node_onboarding
node_user -->|"requests explain"| node_annotation
node_annotation -.->|"submits selection"| node_manager
node_manager -->|"captures screen"| node_capture
node_manager -->|"composes marked image"| node_composer
node_manager -->|"encodes screenshot"| node_encoder
node_manager -->|"sends annotated prompt"| node_harness

click node_app "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/OpenPawApp.swift"
click node_manager "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/CompanionManager.swift"
click node_window "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/UI/BuddyWindow.swift"
click node_buddy "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/UI/BuddyView.swift"
click node_voicepill "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/UI/VoicePillView.swift"
click node_onboarding "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/UI/OnboardingPanel.swift"
click node_hotkeys "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Hotkey/GlobalHotkey.swift"
click node_holdtalk "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Hotkey/HoldToTalkMonitor.swift"
click node_audio "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Voice/AudioCapture.swift"
click node_stt "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Voice/GradiumSTTClient.swift"
click node_vad "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/VADLogic.swift"
click node_tts "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Voice/GradiumTTSClient.swift"
click node_ttsynth "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/GradiumTTSSynthesize.swift"
click node_messages "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/ChatMessage.swift"
click node_harness "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/AgentHarness.swift"
click node_hermes "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/HermesAPIClient.swift"
click node_hermesparser "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/HermesSSEParser.swift"
click node_claude "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/ClaudeCLIClient.swift"
click node_codex "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/CodexCLIClient.swift"
click node_sessions "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/PinnedSessionStore.swift"
click node_annotation "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/UI/AnnotationOverlay.swift"
click node_capture "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Vision/ScreenCapture.swift"
click node_composer "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Vision/AnnotatedImageComposer.swift"
click node_encoder "https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Vision/ScreenshotEncoder.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_manager,node_window,node_buddy,node_voicepill,node_onboarding,node_hotkeys,node_holdtalk,node_user toneBlue
class node_audio,node_stt,node_vad,node_tts,node_ttsynth toneAmber
class node_messages,node_harness,node_hermes,node_hermesparser,node_claude,node_codex,node_sessions toneMint
class node_annotation,node_capture,node_composer,node_encoder toneRose
class node_gradium,node_hermesgw,node_claudebin,node_codexbin toneIndigo
```

## Components

### Buddy interaction

- [App lifecycle](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/OpenPawApp.swift): `OpenPaw/OpenPawApp.swift`
- [Companion orchestration](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/CompanionManager.swift): `OpenPaw/CompanionManager.swift`
- [Floating buddy](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/UI/BuddyWindow.swift): `OpenPaw/UI/BuddyWindow.swift`
- [Buddy display](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/UI/BuddyView.swift): `OpenPaw/UI/BuddyView.swift`
- [Voice status UI](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/UI/VoicePillView.swift): `OpenPaw/UI/VoicePillView.swift`
- [Harness setup](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/UI/OnboardingPanel.swift): `OpenPaw/UI/OnboardingPanel.swift`
- [Wake hotkey](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Hotkey/GlobalHotkey.swift): `OpenPaw/Hotkey/GlobalHotkey.swift`
- [Push-to-talk](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Hotkey/HoldToTalkMonitor.swift): `OpenPaw/Hotkey/HoldToTalkMonitor.swift`

### Voice pipeline

- [Audio capture](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Voice/AudioCapture.swift): `OpenPaw/Voice/AudioCapture.swift`
- [Gradium transcription](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Voice/GradiumSTTClient.swift): `OpenPaw/Voice/GradiumSTTClient.swift`
- [Voice activity logic](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/VADLogic.swift): `OpenPawCore/VADLogic.swift`
- [Gradium speech playback](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Voice/GradiumTTSClient.swift): `OpenPaw/Voice/GradiumTTSClient.swift`
- [TTS synthesis](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/GradiumTTSSynthesize.swift): `OpenPawCore/GradiumTTSSynthesize.swift`

### Agent harnesses

- [Chat messages](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/ChatMessage.swift): `OpenPawCore/ChatMessage.swift`
- [Harness selection](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/AgentHarness.swift): `OpenPawCore/AgentHarness.swift`
- [Hermes client](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/HermesAPIClient.swift): `OpenPawCore/HermesAPIClient.swift`
- [Hermes stream parser](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/HermesSSEParser.swift): `OpenPawCore/HermesSSEParser.swift`
- [Claude CLI client](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/ClaudeCLIClient.swift): `OpenPawCore/ClaudeCLIClient.swift`
- [Codex CLI client](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/CodexCLIClient.swift): `OpenPawCore/CodexCLIClient.swift`
- [Pinned sessions](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPawCore/PinnedSessionStore.swift): `OpenPawCore/PinnedSessionStore.swift`

### Screen annotation

- [Annotation overlay](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/UI/AnnotationOverlay.swift): `OpenPaw/UI/AnnotationOverlay.swift`
- [Screen capture](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Vision/ScreenCapture.swift): `OpenPaw/Vision/ScreenCapture.swift`
- [Image composition](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Vision/AnnotatedImageComposer.swift): `OpenPaw/Vision/AnnotatedImageComposer.swift`
- [Screenshot encoding](https://github.com/kaiwalyakoparkar/open-paw/blob/main/OpenPaw/Vision/ScreenshotEncoder.swift): `OpenPaw/Vision/ScreenshotEncoder.swift`

### Other components

- **Mac user**
- **Gradium service**
- **Hermes gateway**
- **Claude CLI**
- **Codex CLI**

## Connections

- Mac user → App lifecycle: launches (evidence: `README.md`)
- App lifecycle → Companion orchestration: starts (evidence: `OpenPaw/OpenPawApp.swift`)
- Mac user → Wake hotkey: presses wake (evidence: `README.md`)
- Mac user → Push-to-talk: holds talk (evidence: `README.md`)
- Wake hotkey → Companion orchestration: signals
- Push-to-talk → Companion orchestration: signals (evidence: `OpenPaw/CompanionManager.swift`)
- Companion orchestration → Audio capture: captures audio (evidence: `OpenPaw/CompanionManager.swift`)
- Audio capture → Gradium transcription: streams audio (evidence: `README.md`)
- Gradium transcription → Gradium service: transcribes via (evidence: `OpenPaw/Voice/GradiumSTTClient.swift`)
- Gradium transcription → Voice activity logic: uses (evidence: `OpenPaw/Voice/GradiumSTTClient.swift`)
- Companion orchestration → Harness selection: requests response (evidence: `OpenPaw/CompanionManager.swift`)
- Harness selection → Chat messages: streams messages (evidence: `OpenPawCore/AgentHarness.swift`)
- Harness selection → Hermes client: selects (evidence: `OpenPawCore/AgentHarness.swift`)
- Harness selection → Claude CLI client: selects (evidence: `OpenPawCore/AgentHarness.swift`)
- Harness selection → Codex CLI client: selects (evidence: `OpenPawCore/AgentHarness.swift`)
- Hermes client → Hermes gateway: calls (evidence: `OpenPawCore/HermesAPIClient.swift`)
- Hermes client → Hermes stream parser: parses stream (evidence: `OpenPawCore/HermesAPIClient.swift`)
- Claude CLI client → Claude CLI: runs (evidence: `OpenPawCore/ClaudeCLIClient.swift`)
- Codex CLI client → Codex CLI: runs (evidence: `OpenPawCore/CodexCLIClient.swift`)
- Claude CLI client → Pinned sessions: persists session (evidence: `OpenPawCore/ClaudeCLIClient.swift`)
- Codex CLI client → Pinned sessions: persists session (evidence: `OpenPawCore/CodexCLIClient.swift`)
- Companion orchestration → Floating buddy: updates buddy (evidence: `OpenPaw/CompanionManager.swift`)
- Floating buddy → Buddy display: hosts (evidence: `OpenPaw/UI/BuddyWindow.swift`)
- Buddy display → Voice status UI: renders (evidence: `OpenPaw/UI/BuddyView.swift`)
- Companion orchestration → Gradium speech playback: speaks reply (evidence: `OpenPaw/CompanionManager.swift`)
- Gradium speech playback → TTS synthesis: fetches audio (evidence: `OpenPaw/Voice/GradiumTTSClient.swift`)
- TTS synthesis → Gradium service: synthesizes via (evidence: `README.md`)
- Mac user → Harness setup: configures harness (evidence: `README.md`)
- Mac user → Annotation overlay: requests explain (evidence: `README.md`)
- Annotation overlay → Companion orchestration: submits selection
- Companion orchestration → Screen capture: captures screen (evidence: `OpenPaw/CompanionManager.swift`)
- Companion orchestration → Image composition: composes marked image (evidence: `OpenPaw/CompanionManager.swift`)
- Companion orchestration → Screenshot encoding: encodes screenshot (evidence: `OpenPaw/CompanionManager.swift`)
- Companion orchestration → Harness selection: sends annotated prompt (evidence: `README.md`)
