# devsohm/axi architecture

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

- Interactive diagram: https://gitdiagram.com/devsohm/axi
- Repository: https://github.com/devsohm/axi

## Overview

Axi is a monorepo of typed libraries for agent applications. Its packages cover model access, object runtimes, durable conversations and tasks, isolated code execution, MCP clients, environments, telemetry, and terminal interfaces. The documented agent workflow runs through Durable’s Harness, which connects models and extensions to queued input, generation, tools, and persisted state; applications can then observe committed state. The README establishes the package-level relationships below, but sampled source is limited, so internal call edges are omitted where they are not evidenced.

Main entry points: [`packages/objects/src/host/host.ts`](https://github.com/devsohm/axi/blob/main/packages/objects/src/host/host.ts) (Host runtime), [`packages/durable/src/harness/harness.ts`](https://github.com/devsohm/axi/blob/main/packages/durable/src/harness/harness.ts) (Agent Harness), [`packages/durable/src/session/session.ts`](https://github.com/devsohm/axi/blob/main/packages/durable/src/session/session.ts) (Conversations), [`packages/ai/src/types.ts`](https://github.com/devsohm/axi/blob/main/packages/ai/src/types.ts) (AI runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ai["Model Runtime"]
  node_ai_runtime["AI runtime<br/>[types.ts]"]
  node_ai_models["Model catalog<br/>[models.ts]"]
  node_ai_providers["Provider factories<br/>[openrouter.ts]"]
  node_ai_protocols["Provider protocols"]
  node_ai_auth["OAuth flows<br/>[openrouter.ts]"]
  node_ai_identity["Client identity<br/>[identity.ts]"]
end

subgraph group_objects["Object Runtime"]
  node_objects_contracts["Object contracts<br/>[index.ts]"]
  node_objects_host["Host runtime<br/>[host.ts]"]
  node_objects_route["Host routing<br/>[route.ts]"]
  node_objects_data["Principal and errors<br/>[principal.ts]"]
  node_objects_state["State and deltas<br/>[tracker.ts]"]
  node_objects_json["JSON validation<br/>[json.ts]"]
  node_objects_app["App host<br/>[app.ts]"]
  node_objects_store[("Object store<br/>[engine.ts]")]
end

subgraph group_durable["Durable Agents"]
  node_durable_harness["Agent Harness<br/>[harness.ts]"]
  node_durable_session["Conversations<br/>[session.ts]"]
  node_durable_tasks["Tasks and tools<br/>[tasks.ts]"]
  node_durable_views["Views and events<br/>[view.ts]"]
  node_durable_memory[("Memory storage<br/>[memory.ts]")]
  node_durable_jsonl[("JSONL storage<br/>[storage.ts]")]
  node_durable_sqlite[("SQLite storage<br/>[storage.ts]")]
end

subgraph group_integration["Integrations"]
  node_codemode["Code Mode<br/>[execution.ts]"]
  node_mcp["MCP client<br/>[client.ts]"]
  node_env["Environment access<br/>[connection.ts]"]
  node_daemon["Native daemon<br/>[main.rs]"]
  node_telemetry["Telemetry<br/>[index.ts]"]
end

subgraph group_interfaces["Interfaces"]
  node_tui["Terminal UI<br/>[tui.ts]"]
end

node_developer(("Application developer"))

node_developer -->|"uses"| node_ai_runtime
node_ai_runtime -->|"uses catalog"| node_ai_models
node_ai_runtime -->|"calls providers"| node_ai_providers
node_ai_providers -->|"uses protocols"| node_ai_protocols
node_ai_providers -->|"supports OAuth"| node_ai_auth
node_developer -->|"hosts app"| node_objects_app
node_objects_app -->|"hosts objects"| node_objects_host
node_objects_host -->|"uses contracts"| node_objects_contracts
node_objects_host -->|"routes hosts"| node_objects_route
node_objects_host -->|"uses principals"| node_objects_data
node_objects_host -->|"persists state"| node_objects_store
node_objects_store -->|"tracks changes"| node_objects_state
node_objects_store -->|"validates data"| node_objects_json
node_developer -->|"runs agents"| node_durable_harness
node_durable_harness -->|"uses models"| node_ai_runtime
node_durable_harness -->|"manages conversations"| node_durable_session
node_durable_harness -->|"runs tasks"| node_durable_tasks
node_durable_harness -->|"publishes state"| node_durable_views
node_durable_session -->|"stores data"| node_durable_memory
node_durable_session -->|"stores data"| node_durable_jsonl
node_durable_session -->|"stores data"| node_durable_sqlite
node_developer -->|"runs isolated code"| node_codemode
node_developer -->|"connects MCP"| node_mcp
node_developer -->|"uses environments"| node_env
node_env -->|"connects daemon"| node_daemon
node_developer -->|"records spans"| node_telemetry
node_developer -->|"builds terminal UI"| node_tui

click node_ai_runtime "https://github.com/devsohm/axi/blob/main/packages/ai/src/types.ts"
click node_ai_models "https://github.com/devsohm/axi/blob/main/packages/ai/src/models.ts"
click node_ai_providers "https://github.com/devsohm/axi/blob/main/packages/ai/src/providers/openrouter.ts"
click node_ai_protocols "https://github.com/devsohm/axi/blob/main/packages/ai/src/api/anthropic-client.ts"
click node_ai_auth "https://github.com/devsohm/axi/blob/main/packages/ai/src/auth/oauth/openrouter.ts"
click node_ai_identity "https://github.com/devsohm/axi/blob/main/packages/ai/src/utils/identity.ts"
click node_objects_contracts "https://github.com/devsohm/axi/blob/main/packages/objects/src/contracts/index.ts"
click node_objects_host "https://github.com/devsohm/axi/blob/main/packages/objects/src/host/host.ts"
click node_objects_route "https://github.com/devsohm/axi/blob/main/packages/objects/src/host/route.ts"
click node_objects_data "https://github.com/devsohm/axi/blob/main/packages/objects/src/data/principal.ts"
click node_objects_state "https://github.com/devsohm/axi/blob/main/packages/objects/src/delta/tracker.ts"
click node_objects_json "https://github.com/devsohm/axi/blob/main/packages/objects/src/json.ts"
click node_objects_app "https://github.com/devsohm/axi/blob/main/packages/objects/src/node/app/app.ts"
click node_objects_store "https://github.com/devsohm/axi/blob/main/packages/objects/src/store/engine.ts"
click node_durable_harness "https://github.com/devsohm/axi/blob/main/packages/durable/src/harness/harness.ts"
click node_durable_session "https://github.com/devsohm/axi/blob/main/packages/durable/src/session/session.ts"
click node_durable_tasks "https://github.com/devsohm/axi/blob/main/packages/durable/src/tasks.ts"
click node_durable_views "https://github.com/devsohm/axi/blob/main/packages/durable/src/harness/view.ts"
click node_durable_memory "https://github.com/devsohm/axi/blob/main/packages/durable/src/storage/memory.ts"
click node_durable_jsonl "https://github.com/devsohm/axi/blob/main/packages/durable/src/storage/jsonl/storage.ts"
click node_durable_sqlite "https://github.com/devsohm/axi/blob/main/packages/durable/src/storage/sqlite/storage.ts"
click node_codemode "https://github.com/devsohm/axi/blob/main/packages/codemode/src/runtime/execution.ts"
click node_mcp "https://github.com/devsohm/axi/blob/main/packages/mcp/src/client.ts"
click node_env "https://github.com/devsohm/axi/blob/main/packages/env/src/connection.ts"
click node_daemon "https://github.com/devsohm/axi/blob/main/packages/env/daemon/src/main.rs"
click node_telemetry "https://github.com/devsohm/axi/blob/main/packages/telemetry/src/index.ts"
click node_tui "https://github.com/devsohm/axi/blob/main/packages/tui/src/tui.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_ai_runtime,node_ai_models,node_ai_providers,node_ai_protocols,node_ai_auth,node_ai_identity toneBlue
class node_objects_contracts,node_objects_host,node_objects_route,node_objects_data,node_objects_state,node_objects_json,node_objects_app,node_objects_store toneAmber
class node_durable_harness,node_durable_session,node_durable_tasks,node_durable_views,node_durable_memory,node_durable_jsonl,node_durable_sqlite toneMint
class node_codemode,node_mcp,node_env,node_daemon,node_telemetry toneRose
class node_tui,node_developer toneIndigo
```

## Components

### Model Runtime

- [AI runtime](https://github.com/devsohm/axi/blob/main/packages/ai/src/types.ts): `packages/ai/src/types.ts`
- [Model catalog](https://github.com/devsohm/axi/blob/main/packages/ai/src/models.ts): `packages/ai/src/models.ts`
- [Provider factories](https://github.com/devsohm/axi/blob/main/packages/ai/src/providers/openrouter.ts): `packages/ai/src/providers/openrouter.ts`
- [Provider protocols](https://github.com/devsohm/axi/blob/main/packages/ai/src/api/anthropic-client.ts): `packages/ai/src/api/anthropic-client.ts`
- [OAuth flows](https://github.com/devsohm/axi/blob/main/packages/ai/src/auth/oauth/openrouter.ts): `packages/ai/src/auth/oauth/openrouter.ts`
- [Client identity](https://github.com/devsohm/axi/blob/main/packages/ai/src/utils/identity.ts): `packages/ai/src/utils/identity.ts`

### Object Runtime

- [Object contracts](https://github.com/devsohm/axi/blob/main/packages/objects/src/contracts/index.ts): `packages/objects/src/contracts/index.ts`
- [Host runtime](https://github.com/devsohm/axi/blob/main/packages/objects/src/host/host.ts): `packages/objects/src/host/host.ts`
- [Host routing](https://github.com/devsohm/axi/blob/main/packages/objects/src/host/route.ts): `packages/objects/src/host/route.ts`
- [Principal and errors](https://github.com/devsohm/axi/blob/main/packages/objects/src/data/principal.ts): `packages/objects/src/data/principal.ts`
- [State and deltas](https://github.com/devsohm/axi/blob/main/packages/objects/src/delta/tracker.ts): `packages/objects/src/delta/tracker.ts`
- [JSON validation](https://github.com/devsohm/axi/blob/main/packages/objects/src/json.ts): `packages/objects/src/json.ts`
- [App host](https://github.com/devsohm/axi/blob/main/packages/objects/src/node/app/app.ts): `packages/objects/src/node/app/app.ts`
- [Object store](https://github.com/devsohm/axi/blob/main/packages/objects/src/store/engine.ts): `packages/objects/src/store/engine.ts`

### Durable Agents

- [Agent Harness](https://github.com/devsohm/axi/blob/main/packages/durable/src/harness/harness.ts): `packages/durable/src/harness/harness.ts`
- [Conversations](https://github.com/devsohm/axi/blob/main/packages/durable/src/session/session.ts): `packages/durable/src/session/session.ts`
- [Tasks and tools](https://github.com/devsohm/axi/blob/main/packages/durable/src/tasks.ts): `packages/durable/src/tasks.ts`
- [Views and events](https://github.com/devsohm/axi/blob/main/packages/durable/src/harness/view.ts): `packages/durable/src/harness/view.ts`
- [Memory storage](https://github.com/devsohm/axi/blob/main/packages/durable/src/storage/memory.ts): `packages/durable/src/storage/memory.ts`
- [JSONL storage](https://github.com/devsohm/axi/blob/main/packages/durable/src/storage/jsonl/storage.ts): `packages/durable/src/storage/jsonl/storage.ts`
- [SQLite storage](https://github.com/devsohm/axi/blob/main/packages/durable/src/storage/sqlite/storage.ts): `packages/durable/src/storage/sqlite/storage.ts`

### Integrations

- [Code Mode](https://github.com/devsohm/axi/blob/main/packages/codemode/src/runtime/execution.ts): `packages/codemode/src/runtime/execution.ts`
- [MCP client](https://github.com/devsohm/axi/blob/main/packages/mcp/src/client.ts): `packages/mcp/src/client.ts`
- [Environment access](https://github.com/devsohm/axi/blob/main/packages/env/src/connection.ts): `packages/env/src/connection.ts`
- [Native daemon](https://github.com/devsohm/axi/blob/main/packages/env/daemon/src/main.rs): `packages/env/daemon/src/main.rs`
- [Telemetry](https://github.com/devsohm/axi/blob/main/packages/telemetry/src/index.ts): `packages/telemetry/src/index.ts`

### Interfaces

- [Terminal UI](https://github.com/devsohm/axi/blob/main/packages/tui/src/tui.ts): `packages/tui/src/tui.ts`

### Other components

- **Application developer**

## Connections

- Application developer → AI runtime: uses
- AI runtime → Model catalog: uses catalog
- AI runtime → Provider factories: calls providers (evidence: `packages/ai/src/providers/openrouter.ts`)
- Provider factories → Provider protocols: uses protocols
- Provider factories → OAuth flows: supports OAuth
- Application developer → App host: hosts app
- App host → Host runtime: hosts objects
- Host runtime → Object contracts: uses contracts
- Host runtime → Host routing: routes hosts (evidence: `packages/objects/src/host/route.ts`)
- Host runtime → Principal and errors: uses principals
- Host runtime → Object store: persists state
- Object store → State and deltas: tracks changes
- Object store → JSON validation: validates data (evidence: `packages/objects/src/store/engine.ts`)
- Application developer → Agent Harness: runs agents
- Agent Harness → AI runtime: uses models
- Agent Harness → Conversations: manages conversations
- Agent Harness → Tasks and tools: runs tasks
- Agent Harness → Views and events: publishes state
- Conversations → Memory storage: stores data
- Conversations → JSONL storage: stores data
- Conversations → SQLite storage: stores data
- Application developer → Code Mode: runs isolated code
- Application developer → MCP client: connects MCP
- Application developer → Environment access: uses environments
- Environment access → Native daemon: connects daemon
- Application developer → Telemetry: records spans
- Application developer → Terminal UI: builds terminal UI
