# mohit-pjcts/hacku architecture

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

## Overview

Backstage is a local, voice- and text-driven desktop assistant with separate macOS and Windows engines. Its main workflow routes an utterance to either an app-changing job or a read-only screen question; jobs are planned into per-app agents that observe, decide, act and verify, while questions produce spoken answers and screen annotations. The graph preserves both platform implementations and documented capabilities. Several links reflect the README rather than sampled implementation details; those are cited there.

Main entry points: [`windows/src/server.ts`](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/server.ts) (Windows server), [`mac/src/loop.ts`](https://github.com/mohit-pjcts/hacku/blob/main/mac/src/loop.ts) (Mac agent loop), [`windows/src/agent.ts`](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/agent.ts) (Windows agent), [`mac/src/server.ts`](https://github.com/mohit-pjcts/hacku/blob/main/mac/src/server.ts) (Mac server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Job orchestration"]
  node_mac_router["Mac router<br/>[router.ts]"]
  node_win_router["Windows router<br/>[router.ts]"]
  node_mac_manager["Mac planner and dispatcher<br/>[manager.ts]"]
  node_win_planner["Windows planner<br/>[planner.ts]"]
  node_mac_loop["Mac agent loop<br/>[loop.ts]"]
  node_win_agent["Windows agent<br/>[agent.ts]"]
  node_mac_perceive["Mac perception<br/>[perceive.ts]"]
  node_win_lanes["Windows lanes<br/>[lanes.ts]"]
  node_results["Task results<br/>[results.ts]"]
  node_files["File skills and operations<br/>[files.ts]"]
end

subgraph group_acting["App interaction"]
  node_mac_driver["Mac Cua driver<br/>[driver.ts]"]
  node_win_driver["Windows Cua driver<br/>[win.ts]"]
  node_mac_fastlane["Mac fast lane<br/>[FastLane.swift]"]
  node_win_fastlane["Windows fast lane<br/>[fastlane.ts]"]
end

subgraph group_screen["Screen answers"]
  node_mac_explain["Mac explain mode<br/>[explain.ts]"]
  node_win_explain["Windows explain mode<br/>[explain.ts]"]
  node_mac_overlay["Mac overlay<br/>[Overlay.swift]"]
  node_win_overlay["Windows overlay<br/>[overlay.ts]"]
end

subgraph group_platform["Platform runtime"]
  node_panel["Local panel"]
  node_mac_server["Mac server<br/>[server.ts]"]
  node_win_server["Windows server<br/>[server.ts]"]
  node_mac_voice["Mac voice<br/>[voice.ts]"]
  node_win_intake["Windows voice intake<br/>[index.ts]"]
  node_win_speak["Windows speech output<br/>[speak.ts]"]
end

node_user(("User"))
node_jev{{"TypeSafe jev"}}
node_claude{{"Claude"}}
node_apps["User apps"]

node_user -->|"speaks or types"| node_mac_overlay
node_user -->|"speaks or types"| node_win_overlay
node_mac_overlay -->|"sends input"| node_mac_server
node_win_overlay -->|"sends input"| node_win_server
node_panel -->|"sends commands"| node_mac_server
node_panel -->|"sends commands"| node_win_server
node_mac_server -->|"routes utterance"| node_mac_router
node_win_server -->|"routes utterance"| node_win_router
node_mac_router -->|"dispatches jobs"| node_mac_manager
node_win_router -->|"routes jobs"| node_win_server
node_win_server -->|"requests plans"| node_win_planner
node_mac_manager -->|"runs agents"| node_mac_loop
node_win_server -->|"runs tasks"| node_win_agent
node_mac_loop -.->|"perceives controls"| node_mac_perceive
node_win_agent -.->|"uses action lanes"| node_win_lanes
node_mac_loop -.->|"requests decisions"| node_jev
node_win_agent -.->|"requests decisions"| node_jev
node_mac_manager -->|"plans open tasks"| node_claude
node_mac_loop -.->|"checks borderline steps"| node_claude
node_win_agent -.->|"plans or checks"| node_claude
node_mac_loop -.->|"acts through"| node_mac_driver
node_win_agent -.->|"acts through"| node_win_driver
node_mac_driver -.->|"uses fast lane"| node_mac_fastlane
node_win_driver -->|"uses fast lane"| node_win_fastlane
node_mac_driver -.->|"controls windows"| node_apps
node_win_driver -->|"controls windows"| node_apps
node_mac_router -->|"routes questions"| node_mac_explain
node_win_router -->|"routes questions"| node_win_explain
node_mac_explain -.->|"asks about screen"| node_claude
node_win_explain -.->|"asks about screen"| node_claude
node_mac_explain -.->|"draws annotations"| node_mac_overlay
node_win_explain -.->|"draws annotations"| node_win_overlay
node_mac_explain -.->|"speaks answers"| node_mac_voice
node_win_explain -.->|"speaks answers"| node_win_speak
node_mac_overlay -.->|"sends voice text"| node_mac_server
node_win_intake -->|"sends voice events"| node_win_server
node_mac_server -.->|"reports outcomes"| node_results
node_mac_manager -.->|"compiles file skills"| node_files

click node_mac_server "https://github.com/mohit-pjcts/hacku/blob/main/mac/src/server.ts"
click node_win_server "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/server.ts"
click node_mac_router "https://github.com/mohit-pjcts/hacku/blob/main/mac/src/router.ts"
click node_win_router "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/router.ts"
click node_mac_manager "https://github.com/mohit-pjcts/hacku/blob/main/mac/src/manager.ts"
click node_win_planner "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/planner.ts"
click node_mac_loop "https://github.com/mohit-pjcts/hacku/blob/main/mac/src/loop.ts"
click node_win_agent "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/agent.ts"
click node_mac_perceive "https://github.com/mohit-pjcts/hacku/blob/main/mac/src/perceive.ts"
click node_win_lanes "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/lanes.ts"
click node_mac_driver "https://github.com/mohit-pjcts/hacku/blob/main/mac/src/driver.ts"
click node_win_driver "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/driver/win.ts"
click node_mac_fastlane "https://github.com/mohit-pjcts/hacku/blob/main/mac/native/FastLane.swift"
click node_win_fastlane "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/fastlane.ts"
click node_mac_explain "https://github.com/mohit-pjcts/hacku/blob/main/mac/src/explain.ts"
click node_win_explain "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/explain.ts"
click node_mac_overlay "https://github.com/mohit-pjcts/hacku/blob/main/mac/overlay/Overlay.swift"
click node_win_overlay "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/overlay.ts"
click node_mac_voice "https://github.com/mohit-pjcts/hacku/blob/main/mac/src/voice.ts"
click node_win_intake "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/intake/index.ts"
click node_win_speak "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/speak.ts"
click node_results "https://github.com/mohit-pjcts/hacku/blob/main/mac/src/results.ts"
click node_files "https://github.com/mohit-pjcts/hacku/blob/main/windows/src/files.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_mac_router,node_win_router,node_mac_manager,node_win_planner,node_mac_loop,node_win_agent,node_mac_perceive,node_win_lanes,node_results,node_files,node_user,node_apps toneBlue
class node_mac_driver,node_win_driver,node_mac_fastlane,node_win_fastlane toneAmber
class node_mac_explain,node_win_explain,node_mac_overlay,node_win_overlay toneMint
class node_panel,node_mac_server,node_win_server,node_mac_voice,node_win_intake,node_win_speak toneRose
class node_jev,node_claude toneIndigo
```

## Components

### Job orchestration

- [Mac router](https://github.com/mohit-pjcts/hacku/blob/main/mac/src/router.ts): `mac/src/router.ts`
- [Windows router](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/router.ts): `windows/src/router.ts`
- [Mac planner and dispatcher](https://github.com/mohit-pjcts/hacku/blob/main/mac/src/manager.ts): `mac/src/manager.ts`
- [Windows planner](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/planner.ts): `windows/src/planner.ts`
- [Mac agent loop](https://github.com/mohit-pjcts/hacku/blob/main/mac/src/loop.ts): `mac/src/loop.ts`
- [Windows agent](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/agent.ts): `windows/src/agent.ts`
- [Mac perception](https://github.com/mohit-pjcts/hacku/blob/main/mac/src/perceive.ts): `mac/src/perceive.ts`
- [Windows lanes](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/lanes.ts): `windows/src/lanes.ts`
- [Task results](https://github.com/mohit-pjcts/hacku/blob/main/mac/src/results.ts): `mac/src/results.ts`
- [File skills and operations](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/files.ts): `windows/src/files.ts`

### App interaction

- [Mac Cua driver](https://github.com/mohit-pjcts/hacku/blob/main/mac/src/driver.ts): `mac/src/driver.ts`
- [Windows Cua driver](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/driver/win.ts): `windows/src/driver/win.ts`
- [Mac fast lane](https://github.com/mohit-pjcts/hacku/blob/main/mac/native/FastLane.swift): `mac/native/FastLane.swift`
- [Windows fast lane](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/fastlane.ts): `windows/src/fastlane.ts`

### Screen answers

- [Mac explain mode](https://github.com/mohit-pjcts/hacku/blob/main/mac/src/explain.ts): `mac/src/explain.ts`
- [Windows explain mode](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/explain.ts): `windows/src/explain.ts`
- [Mac overlay](https://github.com/mohit-pjcts/hacku/blob/main/mac/overlay/Overlay.swift): `mac/overlay/Overlay.swift`
- [Windows overlay](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/overlay.ts): `windows/src/overlay.ts`

### Platform runtime

- **Local panel**
- [Mac server](https://github.com/mohit-pjcts/hacku/blob/main/mac/src/server.ts): `mac/src/server.ts`
- [Windows server](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/server.ts): `windows/src/server.ts`
- [Mac voice](https://github.com/mohit-pjcts/hacku/blob/main/mac/src/voice.ts): `mac/src/voice.ts`
- [Windows voice intake](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/intake/index.ts): `windows/src/intake/index.ts`
- [Windows speech output](https://github.com/mohit-pjcts/hacku/blob/main/windows/src/speak.ts): `windows/src/speak.ts`

### Other components

- **User**
- **TypeSafe jev**
- **Claude**
- **User apps**

## Connections

- User → Mac overlay: speaks or types
- User → Windows overlay: speaks or types
- Mac overlay → Mac server: sends input
- Windows overlay → Windows server: sends input (evidence: `windows/src/server.ts`)
- Local panel → Mac server: sends commands
- Local panel → Windows server: sends commands
- Mac server → Mac router: routes utterance (evidence: `mac/src/server.ts`)
- Windows server → Windows router: routes utterance (evidence: `windows/src/server.ts`)
- Mac router → Mac planner and dispatcher: dispatches jobs (evidence: `mac/src/server.ts`)
- Windows router → Windows server: routes jobs (evidence: `windows/src/server.ts`)
- Windows server → Windows planner: requests plans (evidence: `windows/src/server.ts`)
- Mac planner and dispatcher → Mac agent loop: runs agents (evidence: `mac/src/manager.ts`)
- Windows server → Windows agent: runs tasks (evidence: `windows/src/server.ts`)
- Mac agent loop → Mac perception: perceives controls
- Windows agent → Windows lanes: uses action lanes
- Mac agent loop → TypeSafe jev: requests decisions
- Windows agent → TypeSafe jev: requests decisions
- Mac planner and dispatcher → Claude: plans open tasks (evidence: `mac/src/manager.ts`)
- Mac agent loop → Claude: checks borderline steps
- Windows agent → Claude: plans or checks
- Mac agent loop → Mac Cua driver: acts through
- Windows agent → Windows Cua driver: acts through
- Mac Cua driver → Mac fast lane: uses fast lane
- Windows Cua driver → Windows fast lane: uses fast lane (evidence: `windows/src/driver/win.ts`)
- Mac Cua driver → User apps: controls windows
- Windows Cua driver → User apps: controls windows (evidence: `windows/src/driver/win.ts`)
- Mac router → Mac explain mode: routes questions (evidence: `mac/src/server.ts`)
- Windows router → Windows explain mode: routes questions (evidence: `windows/src/router.ts`)
- Mac explain mode → Claude: asks about screen
- Windows explain mode → Claude: asks about screen
- Mac explain mode → Mac overlay: draws annotations
- Windows explain mode → Windows overlay: draws annotations
- Mac explain mode → Mac voice: speaks answers
- Windows explain mode → Windows speech output: speaks answers
- Mac overlay → Mac server: sends voice text
- Windows voice intake → Windows server: sends voice events (evidence: `windows/src/main.ts`)
- Mac server → Task results: reports outcomes (evidence: `mac/src/server.ts`)
- Mac planner and dispatcher → File skills and operations: compiles file skills
