# harnessmd/munder-difflin architecture

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

- Interactive diagram: https://gitdiagram.com/harnessmd/munder-difflin
- Repository: https://github.com/harnessmd/munder-difflin

## Overview

Munder Difflin is a local-first Electron desktop harness that turns terminal coding CLIs into a coordinated agent team. The user configures providers and starts work through the desktop UI; Michael, the orchestrator, assigns and routes tasks to agents running in real pseudo-terminals. Agents exchange mailbox messages and use persistent memory, while the shared office floor visualizes their activity. The README also documents schedules, inbound webhooks, integrations, and realtime voice features. Internal edges are limited to relationships stated in the README; several implementation details are unsampled.

Main entry points: [`src/main/pty.ts`](https://github.com/harnessmd/munder-difflin/blob/main/src/main/pty.ts) (Agent processes), [`src/main/hive.ts`](https://github.com/harnessmd/munder-difflin/blob/main/src/main/hive.ts) (Hive orchestrator), [`src/renderer/src/App.tsx`](https://github.com/harnessmd/munder-difflin/blob/main/src/renderer/src/App.tsx) (Desktop app), [`src/main/memory.ts`](https://github.com/harnessmd/munder-difflin/blob/main/src/main/memory.ts) (Agent memory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_app["Desktop app<br/>[App.tsx]"]
  node_office["Office floor<br/>[OfficeFloor.tsx]"]
  node_terminal["Terminal UI<br/>[TerminalView.tsx]"]
  node_settings["Provider settings"]
  node_config[("App configuration<br/>[config.ts]")]
  node_updater["App updates<br/>[updater.ts]"]
  node_button["UI controls<br/>[PixelButton.tsx]"]
end

subgraph group_agents["Agent runtime"]
  node_providers["Provider catalog<br/>[agentProvider.ts]"]
  node_pty["Agent processes<br/>[pty.ts]"]
  node_cli["Coding CLIs"]
  node_tools["Tool catalog<br/>[toolCatalog.ts]"]
  node_filesystem["Workspace files<br/>[fs.ts]"]
end

subgraph group_coordination["Coordination"]
  node_hive["Hive orchestrator<br/>[hive.ts]"]
  node_roster["Agent roster<br/>[roster.ts]"]
  node_memory[("Agent memory<br/>[memory.ts]")]
  node_knowledge["Knowledge layer<br/>[knowledge.ts]"]
  node_mailbox["Agent mailboxes<br/>[hive.ts]"]
  node_hooks["Agent hooks<br/>[hooks.ts]"]
end

subgraph group_capabilities["Extended capabilities"]
  node_triggers["Trigger contracts<br/>[triggers.ts]"]
  node_webhooks["Webhook server<br/>[webhook.ts]"]
  node_integrations["Integrations<br/>[integrations.ts]"]
  node_realtime["Realtime voice<br/>[realtimeActions.ts]"]
  node_skills["Agent skills<br/>[skills.ts]"]
  node_analytics["Analytics<br/>[analytics.ts]"]
  node_telemetry["Telemetry<br/>[telemetry.ts]"]
  node_usage["Usage tracking<br/>[usage.ts]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_settings -->|"chooses provider"| node_providers
node_app -->|"requests work"| node_hive
node_hive -->|"assigns tasks"| node_pty
node_pty -->|"runs in PTY"| node_cli
node_cli -->|"returns terminal output"| node_pty
node_pty -->|"renders sessions"| node_terminal
node_app -->|"shows agents"| node_office
node_hive -->|"coordinates agents"| node_roster
node_hive -->|"routes messages"| node_mailbox
node_pty -->|"reads memory"| node_memory
node_pty -->|"drains inbox"| node_mailbox
node_memory -.->|"semantic recall"| node_knowledge
node_triggers -->|"defines endpoints"| node_webhooks
node_user -->|"dictates and transcribes"| node_realtime

click node_app "https://github.com/harnessmd/munder-difflin/blob/main/src/renderer/src/App.tsx"
click node_office "https://github.com/harnessmd/munder-difflin/blob/main/src/renderer/src/scene/office/OfficeFloor.tsx"
click node_terminal "https://github.com/harnessmd/munder-difflin/blob/main/src/renderer/src/components/TerminalView.tsx"
click node_settings "https://github.com/harnessmd/munder-difflin/blob/main/src/renderer/src/components/AiEnginesSettings.tsx"
click node_providers "https://github.com/harnessmd/munder-difflin/blob/main/src/shared/agentProvider.ts"
click node_pty "https://github.com/harnessmd/munder-difflin/blob/main/src/main/pty.ts"
click node_hive "https://github.com/harnessmd/munder-difflin/blob/main/src/main/hive.ts"
click node_roster "https://github.com/harnessmd/munder-difflin/blob/main/src/main/roster.ts"
click node_memory "https://github.com/harnessmd/munder-difflin/blob/main/src/main/memory.ts"
click node_knowledge "https://github.com/harnessmd/munder-difflin/blob/main/src/main/knowledge.ts"
click node_mailbox "https://github.com/harnessmd/munder-difflin/blob/main/src/main/hive.ts"
click node_triggers "https://github.com/harnessmd/munder-difflin/blob/main/src/shared/triggers.ts"
click node_webhooks "https://github.com/harnessmd/munder-difflin/blob/main/src/main/webhook.ts"
click node_integrations "https://github.com/harnessmd/munder-difflin/blob/main/src/shared/integrations.ts"
click node_realtime "https://github.com/harnessmd/munder-difflin/blob/main/src/main/realtimeActions.ts"
click node_skills "https://github.com/harnessmd/munder-difflin/blob/main/src/main/skills.ts"
click node_config "https://github.com/harnessmd/munder-difflin/blob/main/src/main/config.ts"
click node_tools "https://github.com/harnessmd/munder-difflin/blob/main/src/shared/toolCatalog.ts"
click node_analytics "https://github.com/harnessmd/munder-difflin/blob/main/src/main/analytics.ts"
click node_telemetry "https://github.com/harnessmd/munder-difflin/blob/main/src/main/telemetry.ts"
click node_usage "https://github.com/harnessmd/munder-difflin/blob/main/src/main/usage.ts"
click node_updater "https://github.com/harnessmd/munder-difflin/blob/main/src/main/updater.ts"
click node_hooks "https://github.com/harnessmd/munder-difflin/blob/main/src/main/hooks.ts"
click node_filesystem "https://github.com/harnessmd/munder-difflin/blob/main/src/main/fs.ts"
click node_button "https://github.com/harnessmd/munder-difflin/blob/main/src/renderer/src/components/PixelButton.tsx"

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_office,node_terminal,node_settings,node_config,node_updater,node_button,node_user toneBlue
class node_providers,node_pty,node_cli,node_tools,node_filesystem toneAmber
class node_hive,node_roster,node_memory,node_knowledge,node_mailbox,node_hooks toneMint
class node_triggers,node_webhooks,node_integrations,node_realtime,node_skills,node_analytics,node_telemetry,node_usage toneRose
```

## Components

### Desktop experience

- [Desktop app](https://github.com/harnessmd/munder-difflin/blob/main/src/renderer/src/App.tsx): `src/renderer/src/App.tsx`
- [Office floor](https://github.com/harnessmd/munder-difflin/blob/main/src/renderer/src/scene/office/OfficeFloor.tsx): `src/renderer/src/scene/office/OfficeFloor.tsx`
- [Terminal UI](https://github.com/harnessmd/munder-difflin/blob/main/src/renderer/src/components/TerminalView.tsx): `src/renderer/src/components/TerminalView.tsx`
- [Provider settings](https://github.com/harnessmd/munder-difflin/blob/main/src/renderer/src/components/AiEnginesSettings.tsx): `src/renderer/src/components/AiEnginesSettings.tsx`
- [App configuration](https://github.com/harnessmd/munder-difflin/blob/main/src/main/config.ts): `src/main/config.ts`
- [App updates](https://github.com/harnessmd/munder-difflin/blob/main/src/main/updater.ts): `src/main/updater.ts`
- [UI controls](https://github.com/harnessmd/munder-difflin/blob/main/src/renderer/src/components/PixelButton.tsx): `src/renderer/src/components/PixelButton.tsx`

### Agent runtime

- [Provider catalog](https://github.com/harnessmd/munder-difflin/blob/main/src/shared/agentProvider.ts): `src/shared/agentProvider.ts`
- [Agent processes](https://github.com/harnessmd/munder-difflin/blob/main/src/main/pty.ts): `src/main/pty.ts`
- **Coding CLIs**
- [Tool catalog](https://github.com/harnessmd/munder-difflin/blob/main/src/shared/toolCatalog.ts): `src/shared/toolCatalog.ts`
- [Workspace files](https://github.com/harnessmd/munder-difflin/blob/main/src/main/fs.ts): `src/main/fs.ts`

### Coordination

- [Hive orchestrator](https://github.com/harnessmd/munder-difflin/blob/main/src/main/hive.ts): `src/main/hive.ts`
- [Agent roster](https://github.com/harnessmd/munder-difflin/blob/main/src/main/roster.ts): `src/main/roster.ts`
- [Agent memory](https://github.com/harnessmd/munder-difflin/blob/main/src/main/memory.ts): `src/main/memory.ts`
- [Knowledge layer](https://github.com/harnessmd/munder-difflin/blob/main/src/main/knowledge.ts): `src/main/knowledge.ts`
- [Agent mailboxes](https://github.com/harnessmd/munder-difflin/blob/main/src/main/hive.ts): `src/main/hive.ts`
- [Agent hooks](https://github.com/harnessmd/munder-difflin/blob/main/src/main/hooks.ts): `src/main/hooks.ts`

### Extended capabilities

- [Trigger contracts](https://github.com/harnessmd/munder-difflin/blob/main/src/shared/triggers.ts): `src/shared/triggers.ts`
- [Webhook server](https://github.com/harnessmd/munder-difflin/blob/main/src/main/webhook.ts): `src/main/webhook.ts`
- [Integrations](https://github.com/harnessmd/munder-difflin/blob/main/src/shared/integrations.ts): `src/shared/integrations.ts`
- [Realtime voice](https://github.com/harnessmd/munder-difflin/blob/main/src/main/realtimeActions.ts): `src/main/realtimeActions.ts`
- [Agent skills](https://github.com/harnessmd/munder-difflin/blob/main/src/main/skills.ts): `src/main/skills.ts`
- [Analytics](https://github.com/harnessmd/munder-difflin/blob/main/src/main/analytics.ts): `src/main/analytics.ts`
- [Telemetry](https://github.com/harnessmd/munder-difflin/blob/main/src/main/telemetry.ts): `src/main/telemetry.ts`
- [Usage tracking](https://github.com/harnessmd/munder-difflin/blob/main/src/main/usage.ts): `src/main/usage.ts`

### Other components

- **User**

## Connections

- User → Desktop app: uses (evidence: `README.md`)
- Provider settings → Provider catalog: chooses provider (evidence: `README.md`)
- Desktop app → Hive orchestrator: requests work (evidence: `README.md`)
- Hive orchestrator → Agent processes: assigns tasks (evidence: `README.md`)
- Agent processes → Coding CLIs: runs in PTY (evidence: `README.md`)
- Coding CLIs → Agent processes: returns terminal output (evidence: `README.md`)
- Agent processes → Terminal UI: renders sessions (evidence: `README.md`)
- Desktop app → Office floor: shows agents (evidence: `README.md`)
- Hive orchestrator → Agent roster: coordinates agents (evidence: `README.md`)
- Hive orchestrator → Agent mailboxes: routes messages (evidence: `README.md`)
- Agent processes → Agent memory: reads memory (evidence: `README.md`)
- Agent processes → Agent mailboxes: drains inbox (evidence: `README.md`)
- Agent memory → Knowledge layer: semantic recall
- Trigger contracts → Webhook server: defines endpoints (evidence: `README.md`)
- User → Realtime voice: dictates and transcribes (evidence: `README.md`)
