# seemseam/claude_codex_bridge architecture

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

- Interactive diagram: https://gitdiagram.com/seemseam/claude_codex_bridge
- Repository: https://github.com/seemseam/claude_codex_bridge

## Overview

CCB is a multi-agent terminal workspace and cross-provider collaboration layer. The main workflow starts with a user launching the CLI, configuring a project and agents, creating visible terminal layouts, and coordinating provider sessions through shared messaging and queued delivery. A background daemon maintains project state, while the mobile gateway adds remote control, file transfer, and terminal access. The graph combines documented product capabilities with source-index-supported module relationships; several runtime paths are not excerpted, so those links are documented at the product level rather than inferred from folder names.

Main entry points: [`bin/ccb.js`](https://github.com/seemseam/claude_codex_bridge/blob/main/bin/ccb.js) (CCB CLI), [`lib/mobile_gateway/service.py`](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/mobile_gateway/service.py) (Mobile gateway), [`lib/ccbd/services/dispatcher.py`](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/ccbd/services/dispatcher.py) (Job dispatcher), [`lib/provider_execution/service.py`](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/provider_execution/service.py) (Provider sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace setup"]
  node_cli["CCB CLI<br/>[ccb.js]"]
  node_config["Agent config<br/>[config_loader.py]"]
  node_project["Project context<br/>[context.py]"]
  node_layout["Terminal layout<br/>[nodes.py]"]
  node_namespace["Project namespace<br/>[backend.py]"]
end

subgraph group_runtime["Agent runtime"]
  node_provider["Provider sessions<br/>[service.py]"]
  node_terminal["Native terminals<br/>[services.py]"]
end

subgraph group_collaboration["Collaboration"]
  node_dispatcher["Job dispatcher<br/>[dispatcher.py]"]
  node_mailbox["Message queues<br/>[service.py]"]
  node_completion["Completion<br/>[orchestration.py]"]
  node_heartbeat["Heartbeat<br/>[engine.py]"]
end

subgraph group_daemon["Daemon control"]
  node_daemon["CCB daemon<br/>[main.py]"]
  node_socket["Control socket<br/>[socket_server.py]"]
  node_project_view["Project view<br/>[service.py]"]
end

subgraph group_mobile["Mobile access"]
  node_mobile["Mobile gateway<br/>[service.py]"]
  node_mobile_app["Mobile app"]
  node_relay["Mobile relay<br/>[relay_service.py]"]
end

node_user(("User"))
node_agents["CLI agents"]
node_remote_user(("Remote user"))

node_user -->|"launches"| node_cli
node_cli -->|"selects project"| node_project
node_cli -->|"configures agents"| node_config
node_project -.->|"sets up workspace"| node_layout
node_layout -.->|"materializes layout"| node_namespace
node_namespace -.->|"hosts sessions"| node_terminal
node_provider -->|"runs providers"| node_agents
node_provider -->|"uses native terminals"| node_terminal
node_cli -.->|"starts sessions"| node_provider
node_cli -.->|"submits work"| node_dispatcher
node_dispatcher -.->|"coordinates messages"| node_mailbox
node_dispatcher -.->|"finalizes work"| node_completion
node_heartbeat -.->|"tracks progress"| node_dispatcher
node_daemon -.->|"serves control"| node_socket
node_socket -.->|"provides project state"| node_project_view
node_daemon -.->|"preserves project state"| node_namespace
node_remote_user -->|"controls remotely"| node_mobile_app
node_mobile_app -.->|"connects to"| node_mobile
node_mobile -->|"controls projects"| node_socket
node_mobile -.->|"bridges live output"| node_relay
node_mobile -.->|"transfers files"| node_agents

click node_cli "https://github.com/seemseam/claude_codex_bridge/blob/main/bin/ccb.js"
click node_config "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/agents/config_loader.py"
click node_project "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/cli/context.py"
click node_layout "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/agents/models_runtime/layout_runtime/nodes.py"
click node_namespace "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/ccbd/services/project_namespace_runtime/backend.py"
click node_provider "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/provider_execution/service.py"
click node_terminal "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/terminal_runtime/tmux_backend_runtime/services.py"
click node_dispatcher "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/ccbd/services/dispatcher.py"
click node_mailbox "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/mailbox_kernel/service.py"
click node_completion "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/completion/orchestration.py"
click node_heartbeat "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/heartbeat/engine.py"
click node_daemon "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/ccbd/main.py"
click node_socket "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/ccbd/socket_server.py"
click node_project_view "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/ccbd/project_view/service.py"
click node_mobile "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/mobile_gateway/service.py"
click node_mobile_app "https://github.com/seemseam/claude_codex_bridge/blob/main/mobile/app/android/app/src/main/kotlin/io/ccb/mobile/ccb_mobile/BackgroundConnectionService.kt"
click node_relay "https://github.com/seemseam/claude_codex_bridge/blob/main/lib/mobile_gateway/relay_service.py"

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_cli,node_config,node_project,node_layout,node_namespace,node_user,node_remote_user toneBlue
class node_provider,node_terminal toneAmber
class node_dispatcher,node_mailbox,node_completion,node_heartbeat toneMint
class node_daemon,node_socket,node_project_view toneRose
class node_mobile,node_mobile_app,node_relay,node_agents toneIndigo
```

## Components

### Workspace setup

- [CCB CLI](https://github.com/seemseam/claude_codex_bridge/blob/main/bin/ccb.js): `bin/ccb.js`
- [Agent config](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/agents/config_loader.py): `lib/agents/config_loader.py`
- [Project context](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/cli/context.py): `lib/cli/context.py`
- [Terminal layout](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/agents/models_runtime/layout_runtime/nodes.py): `lib/agents/models_runtime/layout_runtime/nodes.py`
- [Project namespace](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/ccbd/services/project_namespace_runtime/backend.py): `lib/ccbd/services/project_namespace_runtime/backend.py`

### Agent runtime

- [Provider sessions](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/provider_execution/service.py): `lib/provider_execution/service.py`
- [Native terminals](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/terminal_runtime/tmux_backend_runtime/services.py): `lib/terminal_runtime/tmux_backend_runtime/services.py`

### Collaboration

- [Job dispatcher](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/ccbd/services/dispatcher.py): `lib/ccbd/services/dispatcher.py`
- [Message queues](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/mailbox_kernel/service.py): `lib/mailbox_kernel/service.py`
- [Completion](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/completion/orchestration.py): `lib/completion/orchestration.py`
- [Heartbeat](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/heartbeat/engine.py): `lib/heartbeat/engine.py`

### Daemon control

- [CCB daemon](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/ccbd/main.py): `lib/ccbd/main.py`
- [Control socket](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/ccbd/socket_server.py): `lib/ccbd/socket_server.py`
- [Project view](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/ccbd/project_view/service.py): `lib/ccbd/project_view/service.py`

### Mobile access

- [Mobile gateway](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/mobile_gateway/service.py): `lib/mobile_gateway/service.py`
- [Mobile app](https://github.com/seemseam/claude_codex_bridge/blob/main/mobile/app/android/app/src/main/kotlin/io/ccb/mobile/ccb_mobile/BackgroundConnectionService.kt): `mobile/app/android/app/src/main/kotlin/io/ccb/mobile/ccb_mobile/BackgroundConnectionService.kt`
- [Mobile relay](https://github.com/seemseam/claude_codex_bridge/blob/main/lib/mobile_gateway/relay_service.py): `lib/mobile_gateway/relay_service.py`

### Other components

- **User**
- **CLI agents**
- **Remote user**

## Connections

- User → CCB CLI: launches (evidence: `README.md`)
- CCB CLI → Project context: selects project (evidence: `lib/cli/context.py`)
- CCB CLI → Agent config: configures agents (evidence: `README.md`)
- Project context → Terminal layout: sets up workspace (evidence: `README.md`)
- Terminal layout → Project namespace: materializes layout (evidence: `README.md`)
- Project namespace → Native terminals: hosts sessions (evidence: `lib/ccbd/services/project_namespace_runtime/backend.py`)
- Provider sessions → CLI agents: runs providers (evidence: `README.md`)
- Provider sessions → Native terminals: uses native terminals (evidence: `README.md`)
- CCB CLI → Provider sessions: starts sessions (evidence: `README.md`)
- CCB CLI → Job dispatcher: submits work (evidence: `README.md`)
- Job dispatcher → Message queues: coordinates messages (evidence: `README.md`)
- Job dispatcher → Completion: finalizes work (evidence: `README.md`)
- Heartbeat → Job dispatcher: tracks progress
- CCB daemon → Control socket: serves control (evidence: `README.md`)
- Control socket → Project view: provides project state (evidence: `README.md`)
- CCB daemon → Project namespace: preserves project state (evidence: `README.md`)
- Remote user → Mobile app: controls remotely (evidence: `README.md`)
- Mobile app → Mobile gateway: connects to (evidence: `README.md`)
- Mobile gateway → Control socket: controls projects (evidence: `lib/mobile_gateway/service.py`)
- Mobile gateway → Mobile relay: bridges live output (evidence: `README.md`)
- Mobile gateway → CLI agents: transfers files (evidence: `README.md`)
