# joyguey/heyclicky architecture

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

- Interactive diagram: https://gitdiagram.com/joyguey/heyclicky
- Repository: https://github.com/joyguey/heyclicky

## Overview

Clicky is a macOS menu-bar AI tutor. The user opens its panel, starts push-to-talk, speaks while Clicky captures screen context, then receives a streaming Claude response that can include on-screen pointers; spoken replies use text-to-speech. The graph preserves transcription alternatives, screen/overlay interaction, and the Worker proxy as product capabilities. Several links are documented only in the README; unsampled implementation details are not inferred.

Main entry points: [`leanring-buddy/CompanionManager.swift`](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/CompanionManager.swift) (Companion State), [`leanring-buddy/BuddyTranscriptionProvider.swift`](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/BuddyTranscriptionProvider.swift) (Provider Selection), [`worker/src/index.ts`](https://github.com/joyguey/heyclicky/blob/main/worker/src/index.ts) (Cloudflare Proxy), [`leanring-buddy/CompanionPanelView.swift`](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/CompanionPanelView.swift) (Companion Panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Mac App"]
  node_app_entry["App Lifecycle"]
  node_menu_panel["Menu Bar Panel"]
  node_panel_ui["Companion Panel"]
  node_companion["Companion State"]
  node_analytics["Product Analytics"]
end

subgraph group_voice["Voice Input"]
  node_shortcut["Push-to-Talk Shortcut"]
  node_dictation["Audio Capture"]
  node_provider_factory["Provider Selection"]
  node_assembly_transcription["AssemblyAI Streaming"]
  node_openai_transcription["OpenAI Transcription"]
  node_apple_transcription["Apple Speech"]
end

subgraph group_assistant["AI Response"]
  node_claude["Vision Chat<br/>[ClaudeAPI.swift]"]
  node_openai_api["OpenAI API<br/>[OpenAIAPI.swift]"]
  node_tts["Speech Playback"]
end

subgraph group_experience["Screen Experience"]
  node_screen_capture["Screen Capture"]
  node_response_overlay["Response Overlay"]
  node_cursor_overlay["Cursor Overlay"]
  node_element_detector["Element Detection"]
  node_position["Window Positioning"]
end

subgraph group_proxy["API Proxy"]
  node_worker["Cloudflare Proxy<br/>[index.ts]"]
end

node_user(("User"))
node_external_apis{{"AI and Speech APIs"}}

node_user -->|"opens"| node_menu_panel
node_app_entry -->|"creates"| node_menu_panel
node_menu_panel -->|"hosts"| node_panel_ui
node_panel_ui -->|"controls"| node_companion
node_companion -->|"manages"| node_dictation
node_companion -->|"starts"| node_shortcut
node_dictation -.->|"selects provider"| node_provider_factory
node_provider_factory -->|"selects"| node_assembly_transcription
node_provider_factory -->|"selects"| node_openai_transcription
node_provider_factory -->|"selects"| node_apple_transcription
node_assembly_transcription -->|"fetches token"| node_worker
node_dictation -->|"delivers transcript"| node_companion
node_companion -->|"captures context"| node_screen_capture
node_companion -->|"sends prompt"| node_claude
node_claude -->|"proxies chat"| node_worker
node_worker -->|"forwards requests"| node_external_apis
node_companion -->|"speaks reply"| node_tts
node_tts -->|"requests audio"| node_worker
node_companion -->|"shows overlay"| node_cursor_overlay
node_claude -->|"directs cursor"| node_cursor_overlay
node_companion -->|"tracks events"| node_analytics
node_panel_ui -->|"checks permissions"| node_position
node_companion -.->|"displays response"| node_response_overlay
node_cursor_overlay -.->|"locates targets"| node_element_detector

click node_app_entry "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/leanring_buddyApp.swift"
click node_menu_panel "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/MenuBarPanelManager.swift"
click node_panel_ui "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/CompanionPanelView.swift"
click node_companion "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/CompanionManager.swift"
click node_shortcut "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/GlobalPushToTalkShortcutMonitor.swift"
click node_dictation "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/BuddyDictationManager.swift"
click node_provider_factory "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/BuddyTranscriptionProvider.swift"
click node_assembly_transcription "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/AssemblyAIStreamingTranscriptionProvider.swift"
click node_openai_transcription "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/OpenAIAudioTranscriptionProvider.swift"
click node_apple_transcription "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/AppleSpeechTranscriptionProvider.swift"
click node_screen_capture "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/CompanionScreenCaptureUtility.swift"
click node_claude "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/ClaudeAPI.swift"
click node_openai_api "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/OpenAIAPI.swift"
click node_tts "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/ElevenLabsTTSClient.swift"
click node_response_overlay "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/CompanionResponseOverlay.swift"
click node_cursor_overlay "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/OverlayWindow.swift"
click node_element_detector "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/ElementLocationDetector.swift"
click node_position "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/WindowPositionManager.swift"
click node_analytics "https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/ClickyAnalytics.swift"
click node_worker "https://github.com/joyguey/heyclicky/blob/main/worker/src/index.ts"

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_entry,node_menu_panel,node_panel_ui,node_companion,node_analytics,node_user toneBlue
class node_shortcut,node_dictation,node_provider_factory,node_assembly_transcription,node_openai_transcription,node_apple_transcription toneAmber
class node_claude,node_openai_api,node_tts,node_external_apis toneMint
class node_screen_capture,node_response_overlay,node_cursor_overlay,node_element_detector,node_position toneRose
class node_worker toneIndigo
```

## Components

### Mac App

- [App Lifecycle](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/leanring_buddyApp.swift): `leanring-buddy/leanring_buddyApp.swift`
- [Menu Bar Panel](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/MenuBarPanelManager.swift): `leanring-buddy/MenuBarPanelManager.swift`
- [Companion Panel](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/CompanionPanelView.swift): `leanring-buddy/CompanionPanelView.swift`
- [Companion State](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/CompanionManager.swift): `leanring-buddy/CompanionManager.swift`
- [Product Analytics](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/ClickyAnalytics.swift): `leanring-buddy/ClickyAnalytics.swift`

### Voice Input

- [Push-to-Talk Shortcut](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/GlobalPushToTalkShortcutMonitor.swift): `leanring-buddy/GlobalPushToTalkShortcutMonitor.swift`
- [Audio Capture](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/BuddyDictationManager.swift): `leanring-buddy/BuddyDictationManager.swift`
- [Provider Selection](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/BuddyTranscriptionProvider.swift): `leanring-buddy/BuddyTranscriptionProvider.swift`
- [AssemblyAI Streaming](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/AssemblyAIStreamingTranscriptionProvider.swift): `leanring-buddy/AssemblyAIStreamingTranscriptionProvider.swift`
- [OpenAI Transcription](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/OpenAIAudioTranscriptionProvider.swift): `leanring-buddy/OpenAIAudioTranscriptionProvider.swift`
- [Apple Speech](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/AppleSpeechTranscriptionProvider.swift): `leanring-buddy/AppleSpeechTranscriptionProvider.swift`

### AI Response

- [Vision Chat](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/ClaudeAPI.swift): `leanring-buddy/ClaudeAPI.swift`
- [OpenAI API](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/OpenAIAPI.swift): `leanring-buddy/OpenAIAPI.swift`
- [Speech Playback](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/ElevenLabsTTSClient.swift): `leanring-buddy/ElevenLabsTTSClient.swift`

### Screen Experience

- [Screen Capture](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/CompanionScreenCaptureUtility.swift): `leanring-buddy/CompanionScreenCaptureUtility.swift`
- [Response Overlay](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/CompanionResponseOverlay.swift): `leanring-buddy/CompanionResponseOverlay.swift`
- [Cursor Overlay](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/OverlayWindow.swift): `leanring-buddy/OverlayWindow.swift`
- [Element Detection](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/ElementLocationDetector.swift): `leanring-buddy/ElementLocationDetector.swift`
- [Window Positioning](https://github.com/joyguey/heyclicky/blob/main/leanring-buddy/WindowPositionManager.swift): `leanring-buddy/WindowPositionManager.swift`

### API Proxy

- [Cloudflare Proxy](https://github.com/joyguey/heyclicky/blob/main/worker/src/index.ts): `worker/src/index.ts`

### Other components

- **User**
- **AI and Speech APIs**

## Connections

- User → Menu Bar Panel: opens (evidence: `README.md`)
- App Lifecycle → Menu Bar Panel: creates (evidence: `leanring-buddy/leanring_buddyApp.swift`)
- Menu Bar Panel → Companion Panel: hosts (evidence: `leanring-buddy/MenuBarPanelManager.swift`)
- Companion Panel → Companion State: controls (evidence: `leanring-buddy/CompanionPanelView.swift`)
- Companion State → Audio Capture: manages (evidence: `leanring-buddy/CompanionManager.swift`)
- Companion State → Push-to-Talk Shortcut: starts (evidence: `leanring-buddy/CompanionManager.swift`)
- Audio Capture → Provider Selection: selects provider (evidence: `leanring-buddy/BuddyDictationManager.swift`)
- Provider Selection → AssemblyAI Streaming: selects (evidence: `leanring-buddy/BuddyTranscriptionProvider.swift`)
- Provider Selection → OpenAI Transcription: selects (evidence: `leanring-buddy/BuddyTranscriptionProvider.swift`)
- Provider Selection → Apple Speech: selects (evidence: `leanring-buddy/BuddyTranscriptionProvider.swift`)
- AssemblyAI Streaming → Cloudflare Proxy: fetches token (evidence: `README.md`)
- Audio Capture → Companion State: delivers transcript (evidence: `leanring-buddy/CompanionManager.swift`)
- Companion State → Screen Capture: captures context (evidence: `leanring-buddy/CompanionManager.swift`)
- Companion State → Vision Chat: sends prompt (evidence: `leanring-buddy/CompanionManager.swift`)
- Vision Chat → Cloudflare Proxy: proxies chat (evidence: `README.md`)
- Cloudflare Proxy → AI and Speech APIs: forwards requests (evidence: `README.md`)
- Companion State → Speech Playback: speaks reply (evidence: `leanring-buddy/CompanionManager.swift`)
- Speech Playback → Cloudflare Proxy: requests audio (evidence: `README.md`)
- Companion State → Cursor Overlay: shows overlay (evidence: `leanring-buddy/CompanionManager.swift`)
- Vision Chat → Cursor Overlay: directs cursor (evidence: `README.md`)
- Companion State → Product Analytics: tracks events (evidence: `leanring-buddy/CompanionManager.swift`)
- Companion Panel → Window Positioning: checks permissions (evidence: `leanring-buddy/CompanionPanelView.swift`)
- Companion State → Response Overlay: displays response
- Cursor Overlay → Element Detection: locates targets
