# exoharness/exo architecture

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

- Interactive diagram: https://gitdiagram.com/exoharness/exo
- Repository: https://github.com/exoharness/exo
- Video tour (about a minute): https://gitdiagram.com/exoharness/exo/video

## Overview

Exo is a long-running, self-improving AI agent harness. Users send requests through the CLI or configured chat channels; the host-side harness runs model turns, dispatches tool calls, and returns results while retaining canonical state outside the sandbox. Major branches include sandbox execution, scheduled work, adapters, and ExoChat. The README documents these capabilities; sampled source confirms the HTTP request dispatch and several adapter and storage behaviors, but not every runtime connection.

Main entry points: [`exo/harness.ts`](https://github.com/exoharness/exo/blob/main/exo/harness.ts) (Harness facade), [`exo/adapters/protocol.ts`](https://github.com/exoharness/exo/blob/main/exo/adapters/protocol.ts) (Adapter protocol), [`exo/adapters`](https://github.com/exoharness/exo/tree/main/exo/adapters) (Channel adapters), [`exoharness/typescript/model-runtime/turn-loop.ts`](https://github.com/exoharness/exo/blob/main/exoharness/typescript/model-runtime/turn-loop.ts) (Model turn loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User interaction"]
  node_cli["CLI<br/>[main.rs]"]
  node_chat_ui["ExoChat UI<br/>[chat.jsx]"]
  node_relay["Chat relay<br/>[worker.js]"]
end

subgraph group_agent["Agent runtime"]
  node_harness["Harness facade<br/>[harness.ts]"]
  node_turn_loop["Model turn loop<br/>[turn-loop.ts]"]
  node_tool_registry["Tool registry<br/>[tool-registry.ts]"]
  node_agent_tools["Agent tools"]
  node_profiles["Agent profiles"]
end

subgraph group_state["State and scheduling"]
  node_event_log[("Canonical state<br/>[storage.rs]")]
  node_scheduler["Task scheduler<br/>[main.rs]"]
  node_scheduler_tools["Scheduler tools<br/>[scheduler-tools.ts]"]
end

subgraph group_execution["Sandbox execution"]
  node_exoharness["Harness backend<br/>[harness.rs]"]
  node_http_server["HTTP server<br/>[server.rs]"]
  node_request_server["Request dispatcher<br/>[server.rs]"]
  node_sandbox["Sandbox providers<br/>[mod.rs]"]
end

subgraph group_channels["Chat channels"]
  node_adapter_workers["Channel adapters"]
  node_adapter_protocol["Adapter protocol<br/>[protocol.ts]"]
  node_discord["Discord adapter<br/>[worker.ts]"]
  node_slack["Slack adapter<br/>[worker.ts]"]
  node_whatsapp["WhatsApp adapter<br/>[worker.ts]"]
  node_signal["Signal adapter<br/>[worker.ts]"]
  node_irc["IRC adapter<br/>[worker.ts]"]
end

node_user(("User"))
node_model_api{{"Model providers"}}

node_user -->|"sends prompts"| node_cli
node_user -->|"sends prompts"| node_chat_ui
node_user -->|"messages"| node_adapter_workers
node_chat_ui -->|"opens session"| node_relay
node_relay -->|"relays chat"| node_adapter_workers
node_cli -->|"controls agent"| node_harness
node_adapter_workers -->|"delivers events"| node_harness
node_harness -->|"runs turns"| node_turn_loop
node_turn_loop -->|"requests completion"| node_model_api
node_turn_loop -->|"dispatches calls"| node_tool_registry
node_tool_registry -->|"resolves tools"| node_agent_tools
node_harness -.->|"loads profile"| node_profiles
node_harness -->|"persists state"| node_event_log
node_scheduler -->|"runs scheduler"| node_harness
node_scheduler_tools -->|"manages tasks"| node_scheduler
node_agent_tools -->|"executes commands"| node_sandbox
node_harness -->|"uses backend"| node_exoharness
node_http_server -->|"dispatches requests"| node_request_server
node_request_server -->|"calls operations"| node_exoharness
node_exoharness -->|"starts sandbox"| node_sandbox
node_adapter_workers -->|"uses messages"| node_adapter_protocol
node_discord -->|"reads and writes"| node_adapter_protocol
node_slack -->|"reads and writes"| node_adapter_protocol
node_whatsapp -->|"reads and writes"| node_adapter_protocol
node_signal -->|"reads and writes"| node_adapter_protocol
node_irc -->|"uses messages"| node_adapter_protocol

click node_cli "https://github.com/exoharness/exo/blob/main/crates/cli/src/main.rs"
click node_chat_ui "https://github.com/exoharness/exo/blob/main/website/src/chat.jsx"
click node_relay "https://github.com/exoharness/exo/blob/main/website/src/worker.js"
click node_harness "https://github.com/exoharness/exo/blob/main/exo/harness.ts"
click node_turn_loop "https://github.com/exoharness/exo/blob/main/exoharness/typescript/model-runtime/turn-loop.ts"
click node_tool_registry "https://github.com/exoharness/exo/blob/main/exoharness/typescript/harness/tool-registry.ts"
click node_agent_tools "https://github.com/exoharness/exo/tree/main/exo/tools"
click node_profiles "https://github.com/exoharness/exo/tree/main/exo/profiles"
click node_event_log "https://github.com/exoharness/exo/blob/main/crates/exoharness/src/storage.rs"
click node_scheduler "https://github.com/exoharness/exo/blob/main/exo/scheduler-runner/src/main.rs"
click node_scheduler_tools "https://github.com/exoharness/exo/blob/main/exo/tools/scheduler-tools.ts"
click node_exoharness "https://github.com/exoharness/exo/blob/main/crates/exoharness/src/harness.rs"
click node_http_server "https://github.com/exoharness/exo/blob/main/crates/exoharness/src/http/server.rs"
click node_request_server "https://github.com/exoharness/exo/blob/main/crates/exoharness/src/server.rs"
click node_sandbox "https://github.com/exoharness/exo/blob/main/crates/exoharness/src/sandbox_provider/mod.rs"
click node_adapter_workers "https://github.com/exoharness/exo/tree/main/exo/adapters"
click node_adapter_protocol "https://github.com/exoharness/exo/blob/main/exo/adapters/protocol.ts"
click node_discord "https://github.com/exoharness/exo/blob/main/exo/adapters/discord/worker.ts"
click node_slack "https://github.com/exoharness/exo/blob/main/exo/adapters/slack/worker.ts"
click node_whatsapp "https://github.com/exoharness/exo/blob/main/exo/adapters/whatsapp/worker.ts"
click node_signal "https://github.com/exoharness/exo/blob/main/exo/adapters/signal/worker.ts"
click node_irc "https://github.com/exoharness/exo/blob/main/exo/adapters/irc/worker.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_cli,node_chat_ui,node_relay,node_user toneBlue
class node_harness,node_turn_loop,node_tool_registry,node_agent_tools,node_profiles toneAmber
class node_event_log,node_scheduler,node_scheduler_tools toneMint
class node_exoharness,node_http_server,node_request_server,node_sandbox toneRose
class node_adapter_workers,node_adapter_protocol,node_discord,node_slack,node_whatsapp,node_signal,node_irc,node_model_api toneIndigo
```

## Components

### User interaction

- [CLI](https://github.com/exoharness/exo/blob/main/crates/cli/src/main.rs): `crates/cli/src/main.rs`
- [ExoChat UI](https://github.com/exoharness/exo/blob/main/website/src/chat.jsx): `website/src/chat.jsx`
- [Chat relay](https://github.com/exoharness/exo/blob/main/website/src/worker.js): `website/src/worker.js`

### Agent runtime

- [Harness facade](https://github.com/exoharness/exo/blob/main/exo/harness.ts): `exo/harness.ts`
- [Model turn loop](https://github.com/exoharness/exo/blob/main/exoharness/typescript/model-runtime/turn-loop.ts): `exoharness/typescript/model-runtime/turn-loop.ts`
- [Tool registry](https://github.com/exoharness/exo/blob/main/exoharness/typescript/harness/tool-registry.ts): `exoharness/typescript/harness/tool-registry.ts`
- [Agent tools](https://github.com/exoharness/exo/tree/main/exo/tools): `exo/tools`
- [Agent profiles](https://github.com/exoharness/exo/tree/main/exo/profiles): `exo/profiles`

### State and scheduling

- [Canonical state](https://github.com/exoharness/exo/blob/main/crates/exoharness/src/storage.rs): `crates/exoharness/src/storage.rs`
- [Task scheduler](https://github.com/exoharness/exo/blob/main/exo/scheduler-runner/src/main.rs): `exo/scheduler-runner/src/main.rs`
- [Scheduler tools](https://github.com/exoharness/exo/blob/main/exo/tools/scheduler-tools.ts): `exo/tools/scheduler-tools.ts`

### Sandbox execution

- [Harness backend](https://github.com/exoharness/exo/blob/main/crates/exoharness/src/harness.rs): `crates/exoharness/src/harness.rs`
- [HTTP server](https://github.com/exoharness/exo/blob/main/crates/exoharness/src/http/server.rs): `crates/exoharness/src/http/server.rs`
- [Request dispatcher](https://github.com/exoharness/exo/blob/main/crates/exoharness/src/server.rs): `crates/exoharness/src/server.rs`
- [Sandbox providers](https://github.com/exoharness/exo/blob/main/crates/exoharness/src/sandbox_provider/mod.rs): `crates/exoharness/src/sandbox_provider/mod.rs`

### Chat channels

- [Channel adapters](https://github.com/exoharness/exo/tree/main/exo/adapters): `exo/adapters`
- [Adapter protocol](https://github.com/exoharness/exo/blob/main/exo/adapters/protocol.ts): `exo/adapters/protocol.ts`
- [Discord adapter](https://github.com/exoharness/exo/blob/main/exo/adapters/discord/worker.ts): `exo/adapters/discord/worker.ts`
- [Slack adapter](https://github.com/exoharness/exo/blob/main/exo/adapters/slack/worker.ts): `exo/adapters/slack/worker.ts`
- [WhatsApp adapter](https://github.com/exoharness/exo/blob/main/exo/adapters/whatsapp/worker.ts): `exo/adapters/whatsapp/worker.ts`
- [Signal adapter](https://github.com/exoharness/exo/blob/main/exo/adapters/signal/worker.ts): `exo/adapters/signal/worker.ts`
- [IRC adapter](https://github.com/exoharness/exo/blob/main/exo/adapters/irc/worker.ts): `exo/adapters/irc/worker.ts`

### Other components

- **User**
- **Model providers**

## Connections

- User → CLI: sends prompts
- User → ExoChat UI: sends prompts
- User → Channel adapters: messages
- ExoChat UI → Chat relay: opens session
- Chat relay → Channel adapters: relays chat
- CLI → Harness facade: controls agent
- Channel adapters → Harness facade: delivers events
- Harness facade → Model turn loop: runs turns
- Model turn loop → Model providers: requests completion
- Model turn loop → Tool registry: dispatches calls
- Tool registry → Agent tools: resolves tools
- Harness facade → Agent profiles: loads profile
- Harness facade → Canonical state: persists state
- Task scheduler → Harness facade: runs scheduler
- Scheduler tools → Task scheduler: manages tasks
- Agent tools → Sandbox providers: executes commands
- Harness facade → Harness backend: uses backend
- HTTP server → Request dispatcher: dispatches requests
- Request dispatcher → Harness backend: calls operations
- Harness backend → Sandbox providers: starts sandbox
- Channel adapters → Adapter protocol: uses messages
- Discord adapter → Adapter protocol: reads and writes
- Slack adapter → Adapter protocol: reads and writes
- WhatsApp adapter → Adapter protocol: reads and writes
- Signal adapter → Adapter protocol: reads and writes
- IRC adapter → Adapter protocol: uses messages
