# leepokai/codync architecture

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

- Interactive diagram: https://gitdiagram.com/leepokai/codync
- Repository: https://github.com/leepokai/codync

## Overview

Codync is a cross-platform way to message persistent coding-agent bots running on a user’s computers. The principal workflow is: a user sends a message from a desktop, iPhone, or terminal client; the Rust host routes it to a selected agent, maintains the conversation, and returns updates to clients. Pairing and encrypted relay make remote computers reachable, while the product also includes group chats and threads, remote screen control, voice calls, routines, marketplace integrations, memory, and private push notifications. Relationships beyond the sampled excerpts are based on the README’s documented workflow and capabilities.

Main entry points: [`host/src/api/http.rs`](https://github.com/leepokai/codync/blob/main/host/src/api/http.rs) (Host API), [`host/src/chat/mod.rs`](https://github.com/leepokai/codync/blob/main/host/src/chat/mod.rs) (Bot conversations), [`apps/ios/Views/RootView.swift`](https://github.com/leepokai/codync/blob/main/apps/ios/Views/RootView.swift) (iPhone app), [`apps/desktop/src/renderer/views/thread/Composer.tsx`](https://github.com/leepokai/codync/blob/main/apps/desktop/src/renderer/views/thread/Composer.tsx) (Desktop app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client apps"]
  node_desktop["Desktop app<br/>[Composer.tsx]"]
  node_ios["iPhone app<br/>[RootView.swift]"]
  node_terminal["Terminal UI<br/>[ui.rs]"]
end

subgraph group_host["Host and agents"]
  node_host_runtime["Host runtime<br/>[main.rs]"]
  node_host_api["Host API<br/>[http.rs]"]
  node_hub["Connection hub<br/>[hub.rs]"]
  node_agent["Agent backends<br/>[backends.rs]"]
  node_host_store[("Host data store<br/>[schema.rs]")]
end

subgraph group_remote["Remote access"]
  node_pairing["Pairing and transport"]
end

subgraph group_features["Bot capabilities"]
  node_bot_chat["Bot conversations<br/>[mod.rs]"]
  node_group_threads["Groups and threads<br/>[group.rs]"]
  node_memory["Bot memory<br/>[mod.rs]"]
  node_marketplace["Marketplace<br/>[mod.rs]"]
  node_routines["Routines<br/>[mod.rs]"]
  node_screen["Remote screen<br/>[mod.rs]"]
  node_voice["Voice calls<br/>[call-operator.ts]"]
end

subgraph group_services["Cloud services"]
  node_cloud["Cloud relay<br/>[relay.ts]"]
  node_push["Push relay<br/>[index.ts]"]
end

node_user(("User"))
node_agents{{"ACP agents"}}

node_user -->|"messages"| node_desktop
node_user -->|"messages"| node_ios
node_user -->|"messages"| node_terminal
node_desktop -->|"sends requests"| node_host_api
node_ios -->|"connects through"| node_pairing
node_pairing -->|"reaches"| node_host_runtime
node_terminal -->|"calls locally"| node_host_api
node_host_runtime -->|"serves"| node_host_api
node_host_api -.->|"routes requests"| node_hub
node_hub -.->|"dispatches turns"| node_bot_chat
node_bot_chat -->|"drives agent"| node_agent
node_agent -->|"runs via ACP"| node_agents
node_bot_chat -->|"persists transcripts"| node_host_store
node_host_api -.->|"returns updates"| node_desktop
node_host_api -->|"returns updates"| node_ios
node_bot_chat -->|"supports"| node_group_threads
node_bot_chat -.->|"uses memory"| node_memory
node_host_api -.->|"serves requests"| node_marketplace
node_host_api -.->|"serves requests"| node_routines
node_host_api -.->|"serves control"| node_screen
node_desktop -.->|"starts calls"| node_voice
node_ios -->|"starts calls"| node_voice
node_pairing -->|"relays ciphertext"| node_cloud
node_host_runtime -->|"sends notifications"| node_push
node_push -->|"delivers alerts"| node_ios

click node_desktop "https://github.com/leepokai/codync/blob/main/apps/desktop/src/renderer/views/thread/Composer.tsx"
click node_ios "https://github.com/leepokai/codync/blob/main/apps/ios/Views/RootView.swift"
click node_terminal "https://github.com/leepokai/codync/blob/main/host/src/tui/app/ui.rs"
click node_host_runtime "https://github.com/leepokai/codync/blob/main/host/src/main.rs"
click node_host_api "https://github.com/leepokai/codync/blob/main/host/src/api/http.rs"
click node_hub "https://github.com/leepokai/codync/blob/main/host/src/hub.rs"
click node_bot_chat "https://github.com/leepokai/codync/blob/main/host/src/chat/mod.rs"
click node_agent "https://github.com/leepokai/codync/blob/main/host/src/agent/backends.rs"
click node_host_store "https://github.com/leepokai/codync/blob/main/host/src/store/schema.rs"
click node_group_threads "https://github.com/leepokai/codync/blob/main/host/src/chat/group.rs"
click node_memory "https://github.com/leepokai/codync/blob/main/host/src/chat/memory/mod.rs"
click node_marketplace "https://github.com/leepokai/codync/blob/main/host/src/market/mod.rs"
click node_routines "https://github.com/leepokai/codync/blob/main/host/src/routines/mod.rs"
click node_screen "https://github.com/leepokai/codync/blob/main/host/src/screen/mod.rs"
click node_voice "https://github.com/leepokai/codync/blob/main/apps/desktop/src/renderer/views/call/call-operator.ts"
click node_pairing "https://github.com/leepokai/codync/blob/main/apps/ios/Kit/Sources/CodyncKit/Client/ChannelTransport.swift"
click node_cloud "https://github.com/leepokai/codync/blob/main/cloud/src/relay.ts"
click node_push "https://github.com/leepokai/codync/blob/main/relay/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_desktop,node_ios,node_terminal,node_user toneBlue
class node_host_runtime,node_host_api,node_hub,node_agent,node_host_store toneAmber
class node_pairing toneMint
class node_bot_chat,node_group_threads,node_memory,node_marketplace,node_routines,node_screen,node_voice toneRose
class node_cloud,node_push,node_agents toneIndigo
```

## Components

### Client apps

- [Desktop app](https://github.com/leepokai/codync/blob/main/apps/desktop/src/renderer/views/thread/Composer.tsx): `apps/desktop/src/renderer/views/thread/Composer.tsx`
- [iPhone app](https://github.com/leepokai/codync/blob/main/apps/ios/Views/RootView.swift): `apps/ios/Views/RootView.swift`
- [Terminal UI](https://github.com/leepokai/codync/blob/main/host/src/tui/app/ui.rs): `host/src/tui/app/ui.rs`

### Host and agents

- [Host runtime](https://github.com/leepokai/codync/blob/main/host/src/main.rs): `host/src/main.rs`
- [Host API](https://github.com/leepokai/codync/blob/main/host/src/api/http.rs): `host/src/api/http.rs`
- [Connection hub](https://github.com/leepokai/codync/blob/main/host/src/hub.rs): `host/src/hub.rs`
- [Agent backends](https://github.com/leepokai/codync/blob/main/host/src/agent/backends.rs): `host/src/agent/backends.rs`
- [Host data store](https://github.com/leepokai/codync/blob/main/host/src/store/schema.rs): `host/src/store/schema.rs`

### Remote access

- [Pairing and transport](https://github.com/leepokai/codync/blob/main/apps/ios/Kit/Sources/CodyncKit/Client/ChannelTransport.swift): `apps/ios/Kit/Sources/CodyncKit/Client/ChannelTransport.swift`

### Bot capabilities

- [Bot conversations](https://github.com/leepokai/codync/blob/main/host/src/chat/mod.rs): `host/src/chat/mod.rs`
- [Groups and threads](https://github.com/leepokai/codync/blob/main/host/src/chat/group.rs): `host/src/chat/group.rs`
- [Bot memory](https://github.com/leepokai/codync/blob/main/host/src/chat/memory/mod.rs): `host/src/chat/memory/mod.rs`
- [Marketplace](https://github.com/leepokai/codync/blob/main/host/src/market/mod.rs): `host/src/market/mod.rs`
- [Routines](https://github.com/leepokai/codync/blob/main/host/src/routines/mod.rs): `host/src/routines/mod.rs`
- [Remote screen](https://github.com/leepokai/codync/blob/main/host/src/screen/mod.rs): `host/src/screen/mod.rs`
- [Voice calls](https://github.com/leepokai/codync/blob/main/apps/desktop/src/renderer/views/call/call-operator.ts): `apps/desktop/src/renderer/views/call/call-operator.ts`

### Cloud services

- [Cloud relay](https://github.com/leepokai/codync/blob/main/cloud/src/relay.ts): `cloud/src/relay.ts`
- [Push relay](https://github.com/leepokai/codync/blob/main/relay/src/index.ts): `relay/src/index.ts`

### Other components

- **User**
- **ACP agents**

## Connections

- User → Desktop app: messages (evidence: `README.md`)
- User → iPhone app: messages (evidence: `README.md`)
- User → Terminal UI: messages (evidence: `README.md`)
- Desktop app → Host API: sends requests (evidence: `README.md`)
- iPhone app → Pairing and transport: connects through (evidence: `README.md`)
- Pairing and transport → Host runtime: reaches (evidence: `README.md`)
- Terminal UI → Host API: calls locally (evidence: `README.md`)
- Host runtime → Host API: serves (evidence: `host/src/main.rs`)
- Host API → Connection hub: routes requests
- Connection hub → Bot conversations: dispatches turns
- Bot conversations → Agent backends: drives agent (evidence: `README.md`)
- Agent backends → ACP agents: runs via ACP (evidence: `README.md`)
- Bot conversations → Host data store: persists transcripts (evidence: `README.md`)
- Host API → Desktop app: returns updates
- Host API → iPhone app: returns updates (evidence: `README.md`)
- Bot conversations → Groups and threads: supports (evidence: `README.md`)
- Bot conversations → Bot memory: uses memory
- Host API → Marketplace: serves requests
- Host API → Routines: serves requests
- Host API → Remote screen: serves control
- Desktop app → Voice calls: starts calls
- iPhone app → Voice calls: starts calls (evidence: `README.md`)
- Pairing and transport → Cloud relay: relays ciphertext (evidence: `README.md`)
- Host runtime → Push relay: sends notifications (evidence: `README.md`)
- Push relay → iPhone app: delivers alerts (evidence: `README.md`)
