# jh3779/agent-handoff-bridge architecture

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

- Interactive diagram: https://gitdiagram.com/jh3779/agent-handoff-bridge
- Repository: https://github.com/jh3779/agent-handoff-bridge

## Overview

Agent Handoff Bridge coordinates task context across Claude Code, Codex, and Gemini: users select a workspace, create or continue a shared handoff packet, preview or execute a provider run, and retain run state for later handoffs. The product also offers terminal, desktop, and browser-based controllers, API-key provider access, workspace browsing and chat history, plus a separate remote task server. The README and sampled files establish the main CLI and Web UI dispatch paths; unsampled subsystem internals are represented without inferred connections.

Main entry points: [`handoff_bridge.py`](https://github.com/jh3779/agent-handoff-bridge/blob/main/handoff_bridge.py) (Bridge CLI), [`handoff_webui.py`](https://github.com/jh3779/agent-handoff-bridge/blob/main/handoff_webui.py) (Web UI Server), [`webui_bridge_run.py`](https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_bridge_run.py) (Provider Dispatch), [`webui_api_key_mode.py`](https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_api_key_mode.py) (API-Key Mode)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_controllers["User Controllers"]
  node_terminal["Task Controller<br/>[handoff_control.py]"]
  node_desktop["Desktop Controller<br/>[handoff_desktop.py]"]
  node_tauri["Tauri Shell<br/>[lib.rs]"]
end

subgraph group_handoff["Handoff Runtime"]
  node_bridge["Bridge CLI<br/>[handoff_bridge.py]"]
  node_task_packet["Task Packet<br/>[current.md]"]
  node_run_state[("Run State")]
end

subgraph group_webui["Web UI"]
  node_webserver["Web UI Server<br/>[handoff_webui.py]"]
  node_webclient["Web Client<br/>[app.js]"]
  node_workspace["Workspace Access<br/>[webui_workspace.py]"]
  node_chatstorage[("Chat History")]
  node_run_dispatch["Provider Dispatch"]
  node_api_mode["API-Key Mode"]
  node_credentials[("Provider Credentials")]
  node_common["Web UI Helpers<br/>[webui_common.py]"]
end

subgraph group_remote["Remote Access"]
  node_remote_server["Remote Task Server"]
  node_remote_submit["Remote Submit Client"]
end

subgraph group_integrations["Providers"]
  node_provider_cli["Provider CLIs"]
  node_provider_api["Provider APIs"]
end

node_user(("Operator"))

node_user -->|"issues task"| node_terminal
node_user -->|"selects workspace"| node_desktop
node_user -->|"sends task"| node_webclient
node_terminal -->|"runs CLI"| node_bridge
node_desktop -->|"runs CLI"| node_bridge
node_tauri -->|"wraps"| node_webserver
node_webclient -->|"uses API"| node_webserver
node_webserver -->|"validates paths"| node_workspace
node_webserver -->|"dispatches run"| node_run_dispatch
node_webserver -->|"records history"| node_chatstorage
node_webserver -->|"scaffolds workspace"| node_bridge
node_run_dispatch -->|"runs CLI"| node_bridge
node_run_dispatch -->|"falls back"| node_api_mode
node_api_mode -->|"reads keys"| node_credentials
node_api_mode -->|"calls API"| node_provider_api
node_bridge -->|"runs provider"| node_provider_cli
node_bridge -->|"reads context"| node_task_packet
node_bridge -->|"stores status"| node_run_state
node_user -.->|"submits task"| node_remote_submit
node_remote_submit -.->|"sends request"| node_remote_server

click node_terminal "https://github.com/jh3779/agent-handoff-bridge/blob/main/handoff_control.py"
click node_desktop "https://github.com/jh3779/agent-handoff-bridge/blob/main/handoff_desktop.py"
click node_tauri "https://github.com/jh3779/agent-handoff-bridge/blob/main/src-tauri/src/lib.rs"
click node_webserver "https://github.com/jh3779/agent-handoff-bridge/blob/main/handoff_webui.py"
click node_webclient "https://github.com/jh3779/agent-handoff-bridge/blob/main/webui/app.js"
click node_workspace "https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_workspace.py"
click node_chatstorage "https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_chat_storage.py"
click node_run_dispatch "https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_bridge_run.py"
click node_api_mode "https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_api_key_mode.py"
click node_credentials "https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_credentials.py"
click node_common "https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_common.py"
click node_bridge "https://github.com/jh3779/agent-handoff-bridge/blob/main/handoff_bridge.py"
click node_task_packet "https://github.com/jh3779/agent-handoff-bridge/blob/main/.handoff/current.md"
click node_remote_server "https://github.com/jh3779/agent-handoff-bridge/blob/main/remote_handoff_server.py"
click node_remote_submit "https://github.com/jh3779/agent-handoff-bridge/blob/main/remote_handoff_submit.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_terminal,node_desktop,node_tauri toneBlue
class node_bridge,node_task_packet,node_run_state toneAmber
class node_webserver,node_webclient,node_workspace,node_chatstorage,node_run_dispatch,node_api_mode,node_credentials,node_common toneMint
class node_remote_server,node_remote_submit toneRose
class node_provider_cli,node_provider_api,node_user toneIndigo
```

## Components

### User Controllers

- [Task Controller](https://github.com/jh3779/agent-handoff-bridge/blob/main/handoff_control.py): `handoff_control.py`
- [Desktop Controller](https://github.com/jh3779/agent-handoff-bridge/blob/main/handoff_desktop.py): `handoff_desktop.py`
- [Tauri Shell](https://github.com/jh3779/agent-handoff-bridge/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`

### Handoff Runtime

- [Bridge CLI](https://github.com/jh3779/agent-handoff-bridge/blob/main/handoff_bridge.py): `handoff_bridge.py`
- [Task Packet](https://github.com/jh3779/agent-handoff-bridge/blob/main/.handoff/current.md): `.handoff/current.md`
- **Run State**

### Web UI

- [Web UI Server](https://github.com/jh3779/agent-handoff-bridge/blob/main/handoff_webui.py): `handoff_webui.py`
- [Web Client](https://github.com/jh3779/agent-handoff-bridge/blob/main/webui/app.js): `webui/app.js`
- [Workspace Access](https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_workspace.py): `webui_workspace.py`
- [Chat History](https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_chat_storage.py): `webui_chat_storage.py`
- [Provider Dispatch](https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_bridge_run.py): `webui_bridge_run.py`
- [API-Key Mode](https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_api_key_mode.py): `webui_api_key_mode.py`
- [Provider Credentials](https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_credentials.py): `webui_credentials.py`
- [Web UI Helpers](https://github.com/jh3779/agent-handoff-bridge/blob/main/webui_common.py): `webui_common.py`

### Remote Access

- [Remote Task Server](https://github.com/jh3779/agent-handoff-bridge/blob/main/remote_handoff_server.py): `remote_handoff_server.py`
- [Remote Submit Client](https://github.com/jh3779/agent-handoff-bridge/blob/main/remote_handoff_submit.py): `remote_handoff_submit.py`

### Providers

- **Provider CLIs**
- **Provider APIs**

### Other components

- **Operator**

## Connections

- Operator → Task Controller: issues task (evidence: `README.md`)
- Operator → Desktop Controller: selects workspace (evidence: `README.md`)
- Operator → Web Client: sends task (evidence: `README.md`)
- Task Controller → Bridge CLI: runs CLI (evidence: `handoff_control.py`)
- Desktop Controller → Bridge CLI: runs CLI (evidence: `handoff_desktop.py`)
- Tauri Shell → Web UI Server: wraps
- Web Client → Web UI Server: uses API (evidence: `handoff_webui.py`)
- Web UI Server → Workspace Access: validates paths (evidence: `handoff_webui.py`)
- Web UI Server → Provider Dispatch: dispatches run (evidence: `handoff_webui.py`)
- Web UI Server → Chat History: records history (evidence: `webui_chat_storage.py`)
- Web UI Server → Bridge CLI: scaffolds workspace (evidence: `handoff_webui.py`)
- Provider Dispatch → Bridge CLI: runs CLI (evidence: `webui_bridge_run.py`)
- Provider Dispatch → API-Key Mode: falls back (evidence: `webui_bridge_run.py`)
- API-Key Mode → Provider Credentials: reads keys (evidence: `webui_api_key_mode.py`)
- API-Key Mode → Provider APIs: calls API (evidence: `webui_api_key_mode.py`)
- Bridge CLI → Provider CLIs: runs provider (evidence: `README.md`)
- Bridge CLI → Task Packet: reads context (evidence: `handoff_bridge.py`)
- Bridge CLI → Run State: stores status (evidence: `README.md`)
- Operator → Remote Submit Client: submits task
- Remote Submit Client → Remote Task Server: sends request
