# chaitanyagiri/munder-difflin architecture

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

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

## Overview

Munder Difflin is an Electron desktop harness that turns terminal coding CLIs into a coordinated team of agents, represented on a shared office floor. The principal workflow is to configure an agent, launch its real CLI in a pseudo-terminal, and coordinate work through Michael and the hive while agents retain memory. The README also describes voice/realtime controls, integrations and webhooks, and workspace tools. The tree and excerpts establish the UI, IPC, runtime, and feature modules; some internal wiring is inferred only where the README explicitly documents the behavior.

Main entry points: [`src/main/index.ts`](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/index.ts) (Main process), [`src/renderer/src/App.tsx`](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/renderer/src/App.tsx) (App shell), [`src/preload/index.ts`](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/preload/index.ts) (IPC bridge), [`src/main/pty.ts`](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/pty.ts) (PTY sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_office["Office floor<br/>[OfficeFloor.tsx]"]
  node_agentui["Agent controls"]
  node_terminalui["Terminal view<br/>[TerminalView.tsx]"]
  node_preload["IPC bridge<br/>[index.ts]"]
end

subgraph group_runtime["Agent runtime"]
  node_main["Main process<br/>[index.ts]"]
  node_pty["PTY sessions<br/>[pty.ts]"]
  node_parser["PTY activity parser<br/>[usePtyParser.ts]"]
end

subgraph group_coordination["Coordination and memory"]
  node_hive["Hive coordinator<br/>[hive.ts]"]
  node_roster["Agent roster<br/>[roster.ts]"]
  node_memory["Agent memory<br/>[memory.ts]"]
  node_database[("Local database<br/>[db.ts]")]
end

subgraph group_features["Tools and integrations"]
  node_realtime["Realtime voice<br/>[realtime.ts]"]
  node_integrations["Integrations<br/>[integrations.ts]"]
  node_webhooks["Webhook triggers<br/>[webhook.ts]"]
  node_workspace["Workspace tools<br/>[git.ts]"]
end

node_user(("User"))
node_provider{{"Agent CLI"}}

node_user -->|"uses"| node_app
node_app -->|"renders"| node_office
node_app -->|"controls"| node_agentui
node_agentui -->|"invokes IPC"| node_preload
node_terminalui -->|"invokes IPC"| node_preload
node_preload -->|"forwards IPC"| node_main
node_main -->|"manages sessions"| node_pty
node_pty -->|"spawns CLI"| node_provider
node_provider -->|"streams output"| node_pty
node_terminalui -->|"passes stream"| node_parser
node_parser -->|"updates activity"| node_office
node_hive -->|"coordinates agents"| node_roster
node_hive -->|"uses memory"| node_memory
node_memory -->|"indexes recall"| node_database
node_main -->|"dispatches voice"| node_realtime
node_main -->|"handles integration IPC"| node_integrations
node_main -->|"starts server"| node_webhooks
node_main -->|"handles git requests"| node_workspace

click node_app "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/renderer/src/App.tsx"
click node_office "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/renderer/src/scene/office/OfficeFloor.tsx"
click node_agentui "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/renderer/src/components/AgentDetailPanel.tsx"
click node_terminalui "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/renderer/src/components/TerminalView.tsx"
click node_preload "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/preload/index.ts"
click node_main "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/index.ts"
click node_pty "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/pty.ts"
click node_parser "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/renderer/src/hooks/usePtyParser.ts"
click node_hive "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/hive.ts"
click node_roster "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/roster.ts"
click node_memory "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/memory.ts"
click node_database "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/db.ts"
click node_realtime "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/realtime.ts"
click node_integrations "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/integrations.ts"
click node_webhooks "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/webhook.ts"
click node_workspace "https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/git.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,node_office,node_agentui,node_terminalui,node_preload,node_user toneBlue
class node_main,node_pty,node_parser toneAmber
class node_hive,node_roster,node_memory,node_database toneMint
class node_realtime,node_integrations,node_webhooks,node_workspace toneRose
class node_provider toneIndigo
```

## Components

### Desktop experience

- [App shell](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/renderer/src/App.tsx): `src/renderer/src/App.tsx`
- [Office floor](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/renderer/src/scene/office/OfficeFloor.tsx): `src/renderer/src/scene/office/OfficeFloor.tsx`
- [Agent controls](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/renderer/src/components/AgentDetailPanel.tsx): `src/renderer/src/components/AgentDetailPanel.tsx`
- [Terminal view](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/renderer/src/components/TerminalView.tsx): `src/renderer/src/components/TerminalView.tsx`
- [IPC bridge](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/preload/index.ts): `src/preload/index.ts`

### Agent runtime

- [Main process](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/index.ts): `src/main/index.ts`
- [PTY sessions](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/pty.ts): `src/main/pty.ts`
- [PTY activity parser](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/renderer/src/hooks/usePtyParser.ts): `src/renderer/src/hooks/usePtyParser.ts`

### Coordination and memory

- [Hive coordinator](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/hive.ts): `src/main/hive.ts`
- [Agent roster](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/roster.ts): `src/main/roster.ts`
- [Agent memory](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/memory.ts): `src/main/memory.ts`
- [Local database](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/db.ts): `src/main/db.ts`

### Tools and integrations

- [Realtime voice](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/realtime.ts): `src/main/realtime.ts`
- [Integrations](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/integrations.ts): `src/main/integrations.ts`
- [Webhook triggers](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/webhook.ts): `src/main/webhook.ts`
- [Workspace tools](https://github.com/chaitanyagiri/munder-difflin/blob/main/src/main/git.ts): `src/main/git.ts`

### Other components

- **User**
- **Agent CLI**

## Connections

- User → App shell: uses
- App shell → Office floor: renders
- App shell → Agent controls: controls
- Agent controls → IPC bridge: invokes IPC
- Terminal view → IPC bridge: invokes IPC
- IPC bridge → Main process: forwards IPC
- Main process → PTY sessions: manages sessions
- PTY sessions → Agent CLI: spawns CLI
- Agent CLI → PTY sessions: streams output
- Terminal view → PTY activity parser: passes stream
- PTY activity parser → Office floor: updates activity
- Hive coordinator → Agent roster: coordinates agents
- Hive coordinator → Agent memory: uses memory
- Agent memory → Local database: indexes recall
- Main process → Realtime voice: dispatches voice
- Main process → Integrations: handles integration IPC
- Main process → Webhook triggers: starts server
- Main process → Workspace tools: handles git requests
