# 1181110317/agenthub architecture

> Architecture diagram of the GitHub repository 1181110317/agenthub, 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/1181110317/agenthub
- Repository: https://github.com/1181110317/agenthub

## Overview

AgentHub is a local web workspace for running coding agents and built-in model chat, then reviewing their streamed work in a shared session UI. The main path is user → browser workspace → server → agent adapter/runtime → streamed results and persisted session state. Separate branches provide workspace operations, MCP tools, remote execution, scheduled tasks, and usage/search. README documents additional capabilities whose implementation was not sampled; those are represented only where the tree supports a source path, and uncertain call wiring is omitted.

Main entry points: [`server.js`](https://github.com/1181110317/agenthub/blob/master/server.js) (HTTP and WS server), [`lib/agents.js`](https://github.com/1181110317/agenthub/blob/master/lib/agents.js) (Agent adapters), [`public/app.js`](https://github.com/1181110317/agenthub/blob/master/public/app.js) (Web workspace), [`lib/api-agent.js`](https://github.com/1181110317/agenthub/blob/master/lib/api-agent.js) (Built-in agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Workspace UI"]
  node_webui["Web workspace<br/>[app.js]"]
end

subgraph group_runtime["Request runtime"]
  node_server["HTTP and WS server<br/>[server.js]"]
  node_assistants["Assistant roles<br/>[assistants.js]"]
  node_presets["Provider presets"]
end

subgraph group_agents["Agent execution"]
  node_adapter["Agent adapters<br/>[agents.js]"]
  node_apiagent["Built-in agent<br/>[api-agent.js]"]
  node_claude["Claude bridge<br/>[claude-bridge.js]"]
  node_codex["Codex bridge<br/>[codex-bridge.js]"]
  node_zcode["ZCode bridge<br/>[zcode-bridge.js]"]
  node_acp["ACP connector<br/>[acp-agent.js]"]
  node_mcp["MCP tools<br/>[mcp-tools.js]"]
  node_mcpservers["MCP servers<br/>[mcp-servers.js]"]
end

subgraph group_workspace["Workspace features"]
  node_ssh["SSH remote<br/>[ssh.js]"]
  node_workspacefs["Workspace operations<br/>[workspace.js]"]
  node_git["Git changes<br/>[git.js]"]
  node_scheduler["Scheduled tasks<br/>[cron.js]"]
  node_usage["Usage records<br/>[usage.js]"]
  node_search["Conversation search<br/>[db.js]"]
end

subgraph group_state["State and access"]
  node_store[("JSON persistence<br/>[store.js]")]
  node_messages[("Session messages<br/>[session-files.js]")]
  node_events[("Turn events<br/>[events.js]")]
  node_auth["Web account access<br/>[auth.js]"]
end

node_user(("User"))
node_provider(("Model provider"))
node_cli(("Agent CLI"))

node_user -->|"uses"| node_webui
node_webui -->|"sends requests"| node_server
node_server -->|"starts sessions"| node_adapter
node_adapter -->|"dispatches built-in"| node_apiagent
node_adapter -->|"starts bridge"| node_claude
node_adapter -->|"starts bridge"| node_codex
node_adapter -->|"starts bridge"| node_zcode
node_adapter -->|"dispatches ACP"| node_acp
node_apiagent -.->|"requests completions"| node_provider
node_claude -->|"runs CLI"| node_cli
node_codex -->|"runs CLI"| node_cli
node_zcode -->|"runs CLI"| node_cli
node_server -->|"exposes tools"| node_mcp
node_server -->|"manages servers"| node_mcpservers
node_server -->|"uses remote access"| node_ssh
node_server -->|"handles file operations"| node_workspacefs
node_server -->|"handles Git requests"| node_git
node_server -->|"runs scheduled tasks"| node_scheduler
node_server -->|"records usage"| node_usage
node_server -->|"queries conversation index"| node_search
node_server -->|"persists state"| node_store
node_server -->|"persists messages"| node_messages
node_server -->|"records turn events"| node_events
node_server -->|"checks access"| node_auth
node_server -->|"loads assistant roles"| node_assistants
node_server -->|"serves provider presets"| node_presets
node_server -->|"streams results"| node_webui

click node_webui "https://github.com/1181110317/agenthub/blob/master/public/app.js"
click node_server "https://github.com/1181110317/agenthub/blob/master/server.js"
click node_adapter "https://github.com/1181110317/agenthub/blob/master/lib/agents.js"
click node_apiagent "https://github.com/1181110317/agenthub/blob/master/lib/api-agent.js"
click node_claude "https://github.com/1181110317/agenthub/blob/master/lib/claude-bridge.js"
click node_codex "https://github.com/1181110317/agenthub/blob/master/lib/codex-bridge.js"
click node_zcode "https://github.com/1181110317/agenthub/blob/master/lib/zcode-bridge.js"
click node_acp "https://github.com/1181110317/agenthub/blob/master/lib/acp-agent.js"
click node_mcp "https://github.com/1181110317/agenthub/blob/master/lib/mcp-tools.js"
click node_mcpservers "https://github.com/1181110317/agenthub/blob/master/lib/mcp-servers.js"
click node_ssh "https://github.com/1181110317/agenthub/blob/master/lib/ssh.js"
click node_workspacefs "https://github.com/1181110317/agenthub/blob/master/lib/workspace.js"
click node_git "https://github.com/1181110317/agenthub/blob/master/lib/git.js"
click node_scheduler "https://github.com/1181110317/agenthub/blob/master/lib/cron.js"
click node_usage "https://github.com/1181110317/agenthub/blob/master/lib/usage.js"
click node_search "https://github.com/1181110317/agenthub/blob/master/lib/db.js"
click node_store "https://github.com/1181110317/agenthub/blob/master/lib/store.js"
click node_messages "https://github.com/1181110317/agenthub/blob/master/lib/session-files.js"
click node_events "https://github.com/1181110317/agenthub/blob/master/lib/events.js"
click node_auth "https://github.com/1181110317/agenthub/blob/master/lib/auth.js"
click node_assistants "https://github.com/1181110317/agenthub/blob/master/lib/assistants.js"
click node_presets "https://github.com/1181110317/agenthub/blob/master/lib/provider-presets.js"

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_webui,node_user toneBlue
class node_server,node_assistants,node_presets toneAmber
class node_adapter,node_apiagent,node_claude,node_codex,node_zcode,node_acp,node_mcp,node_mcpservers toneMint
class node_ssh,node_workspacefs,node_git,node_scheduler,node_usage,node_search toneRose
class node_store,node_messages,node_events,node_auth,node_provider,node_cli toneIndigo
```

## Components

### Workspace UI

- [Web workspace](https://github.com/1181110317/agenthub/blob/master/public/app.js): `public/app.js`

### Request runtime

- [HTTP and WS server](https://github.com/1181110317/agenthub/blob/master/server.js): `server.js`
- [Assistant roles](https://github.com/1181110317/agenthub/blob/master/lib/assistants.js): `lib/assistants.js`
- [Provider presets](https://github.com/1181110317/agenthub/blob/master/lib/provider-presets.js): `lib/provider-presets.js`

### Agent execution

- [Agent adapters](https://github.com/1181110317/agenthub/blob/master/lib/agents.js): `lib/agents.js`
- [Built-in agent](https://github.com/1181110317/agenthub/blob/master/lib/api-agent.js): `lib/api-agent.js`
- [Claude bridge](https://github.com/1181110317/agenthub/blob/master/lib/claude-bridge.js): `lib/claude-bridge.js`
- [Codex bridge](https://github.com/1181110317/agenthub/blob/master/lib/codex-bridge.js): `lib/codex-bridge.js`
- [ZCode bridge](https://github.com/1181110317/agenthub/blob/master/lib/zcode-bridge.js): `lib/zcode-bridge.js`
- [ACP connector](https://github.com/1181110317/agenthub/blob/master/lib/acp-agent.js): `lib/acp-agent.js`
- [MCP tools](https://github.com/1181110317/agenthub/blob/master/lib/mcp-tools.js): `lib/mcp-tools.js`
- [MCP servers](https://github.com/1181110317/agenthub/blob/master/lib/mcp-servers.js): `lib/mcp-servers.js`

### Workspace features

- [SSH remote](https://github.com/1181110317/agenthub/blob/master/lib/ssh.js): `lib/ssh.js`
- [Workspace operations](https://github.com/1181110317/agenthub/blob/master/lib/workspace.js): `lib/workspace.js`
- [Git changes](https://github.com/1181110317/agenthub/blob/master/lib/git.js): `lib/git.js`
- [Scheduled tasks](https://github.com/1181110317/agenthub/blob/master/lib/cron.js): `lib/cron.js`
- [Usage records](https://github.com/1181110317/agenthub/blob/master/lib/usage.js): `lib/usage.js`
- [Conversation search](https://github.com/1181110317/agenthub/blob/master/lib/db.js): `lib/db.js`

### State and access

- [JSON persistence](https://github.com/1181110317/agenthub/blob/master/lib/store.js): `lib/store.js`
- [Session messages](https://github.com/1181110317/agenthub/blob/master/lib/session-files.js): `lib/session-files.js`
- [Turn events](https://github.com/1181110317/agenthub/blob/master/lib/events.js): `lib/events.js`
- [Web account access](https://github.com/1181110317/agenthub/blob/master/lib/auth.js): `lib/auth.js`

### Other components

- **User**
- **Model provider**
- **Agent CLI**

## Connections

- User → Web workspace: uses
- Web workspace → HTTP and WS server: sends requests
- HTTP and WS server → Agent adapters: starts sessions
- Agent adapters → Built-in agent: dispatches built-in
- Agent adapters → Claude bridge: starts bridge
- Agent adapters → Codex bridge: starts bridge
- Agent adapters → ZCode bridge: starts bridge
- Agent adapters → ACP connector: dispatches ACP
- Built-in agent → Model provider: requests completions
- Claude bridge → Agent CLI: runs CLI
- Codex bridge → Agent CLI: runs CLI
- ZCode bridge → Agent CLI: runs CLI
- HTTP and WS server → MCP tools: exposes tools
- HTTP and WS server → MCP servers: manages servers
- HTTP and WS server → SSH remote: uses remote access
- HTTP and WS server → Workspace operations: handles file operations
- HTTP and WS server → Git changes: handles Git requests
- HTTP and WS server → Scheduled tasks: runs scheduled tasks
- HTTP and WS server → Usage records: records usage
- HTTP and WS server → Conversation search: queries conversation index
- HTTP and WS server → JSON persistence: persists state
- HTTP and WS server → Session messages: persists messages
- HTTP and WS server → Turn events: records turn events
- HTTP and WS server → Web account access: checks access
- HTTP and WS server → Assistant roles: loads assistant roles
- HTTP and WS server → Provider presets: serves provider presets
- HTTP and WS server → Web workspace: streams results
