# hesamsheikh/octogent architecture

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

- Interactive diagram: https://gitdiagram.com/hesamsheikh/octogent
- Repository: https://github.com/hesamsheikh/octogent

## Overview

Octogent is a local multi-agent coding environment: a developer coordinates scoped tentacles and todo work through a web UI, while the API manages terminal sessions and agent collaboration. The graph highlights this orchestration path alongside documented worktree isolation and the monitor, conversation, usage, GitHub, and code-intelligence views. Several route and runtime implementations are unsampled, so only visible or README-documented relationships are connected; the other UI capabilities are shown without guessed backend wiring.

Main entry points: [`apps/web/src/App.tsx`](https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/App.tsx) (Console application), [`apps/api/src/terminalRuntime.ts`](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime.ts) (Terminal runtime), [`apps/api/src/createApiServer/deckRoutes.ts`](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/createApiServer/deckRoutes.ts) (Deck orchestration), [`apps/web/src/components/PrimaryViewRouter.tsx`](https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/components/PrimaryViewRouter.tsx) (Primary views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web console"]
  node_app["Console application<br/>[App.tsx]"]
  node_views["Primary views"]
  node_canvas["Agent canvas"]
  node_canvasdata["Canvas data"]
  node_endpoints["API endpoints"]
  node_ui_state["Persisted UI state"]
end

subgraph group_api["API and orchestration"]
  node_server["Local API server<br/>[server.ts]"]
  node_api_factory["API construction<br/>[createApiServer.ts]"]
  node_terminal_routes["Terminal routes<br/>[terminalRoutes.ts]"]
  node_deck_routes["Deck orchestration<br/>[deckRoutes.ts]"]
  node_deck_files["Tentacle files"]
  node_prompts["Prompt library<br/>[promptResolver.ts]"]
end

subgraph group_runtime["Terminal execution"]
  node_runtime["Terminal runtime<br/>[terminalRuntime.ts]"]
  node_sessions["PTY sessions<br/>[sessionRuntime.ts]"]
  node_messaging["Agent messaging"]
  node_worktrees["Worktree isolation<br/>[worktreeManager.ts]"]
  node_git_clients["Git integrations<br/>[systemClients.ts]"]
end

subgraph group_insights["Project insights"]
  node_monitor["Monitor service<br/>[service.ts]"]
  node_monitor_store[("Monitor cache<br/>[repository.ts]")]
  node_conversations["Conversation history<br/>[conversations.ts]"]
  node_usage["Usage reporting<br/>[claudeUsage.ts]"]
end

subgraph group_shared["Shared domain"]
  node_core["Domain contracts<br/>[terminal.ts]"]
  node_terminal_list["Terminal list model"]
  node_snapshot_reader["Snapshot reader port"]
end

node_developer(("Developer"))

node_developer -->|"coordinates"| node_app
node_app -->|"selects views"| node_views
node_views -->|"routes canvas"| node_canvas
node_canvas -->|"loads graph data"| node_canvasdata
node_canvasdata -->|"builds requests"| node_endpoints
node_app -->|"builds terminal list"| node_terminal_list
node_terminal_list -->|"reads snapshots"| node_snapshot_reader
node_app -->|"persists preferences"| node_ui_state
node_ui_state -->|"builds state requests"| node_endpoints
node_app -.->|"uses local API"| node_server
node_server -->|"creates server"| node_api_factory
node_terminal_routes -->|"lists terminals"| node_runtime
node_deck_routes -->|"checks terminals"| node_runtime
node_deck_routes -->|"reads tentacles"| node_deck_files
node_deck_routes -->|"resolves worker prompts"| node_prompts
node_runtime -->|"manages sessions"| node_sessions
node_runtime -->|"delegates messaging"| node_messaging
node_runtime -->|"manages worktrees"| node_worktrees
node_worktrees -->|"runs git operations"| node_git_clients
node_monitor -->|"reads and writes cache"| node_monitor_store
node_developer -.->|"works from shared model"| node_core

click node_app "https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/App.tsx"
click node_views "https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/components/PrimaryViewRouter.tsx"
click node_canvas "https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/components/CanvasPrimaryView.tsx"
click node_canvasdata "https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/app/hooks/useCanvasGraphData.ts"
click node_endpoints "https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/runtime/runtimeEndpoints.ts"
click node_ui_state "https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/app/hooks/usePersistedUiState.ts"
click node_server "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/server.ts"
click node_api_factory "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/createApiServer.ts"
click node_terminal_routes "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/createApiServer/terminalRoutes.ts"
click node_deck_routes "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/createApiServer/deckRoutes.ts"
click node_deck_files "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/deck/readDeckTentacles.ts"
click node_prompts "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/prompts/promptResolver.ts"
click node_runtime "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime.ts"
click node_sessions "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime/sessionRuntime.ts"
click node_messaging "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime/channelMessaging.ts"
click node_worktrees "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime/worktreeManager.ts"
click node_git_clients "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime/systemClients.ts"
click node_monitor "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/monitor/service.ts"
click node_monitor_store "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/monitor/repository.ts"
click node_conversations "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime/conversations.ts"
click node_usage "https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/claudeUsage.ts"
click node_core "https://github.com/hesamsheikh/octogent/blob/main/packages/core/src/domain/terminal.ts"
click node_terminal_list "https://github.com/hesamsheikh/octogent/blob/main/packages/core/src/application/buildTerminalList.ts"
click node_snapshot_reader "https://github.com/hesamsheikh/octogent/blob/main/packages/core/src/ports/TerminalSnapshotReader.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_app,node_views,node_canvas,node_canvasdata,node_endpoints,node_ui_state toneBlue
class node_server,node_api_factory,node_terminal_routes,node_deck_routes,node_deck_files,node_prompts toneAmber
class node_runtime,node_sessions,node_messaging,node_worktrees,node_git_clients toneMint
class node_monitor,node_monitor_store,node_conversations,node_usage toneRose
class node_core,node_terminal_list,node_snapshot_reader,node_developer toneIndigo
```

## Components

### Web console

- [Console application](https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Primary views](https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/components/PrimaryViewRouter.tsx): `apps/web/src/components/PrimaryViewRouter.tsx`
- [Agent canvas](https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/components/CanvasPrimaryView.tsx): `apps/web/src/components/CanvasPrimaryView.tsx`
- [Canvas data](https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/app/hooks/useCanvasGraphData.ts): `apps/web/src/app/hooks/useCanvasGraphData.ts`
- [API endpoints](https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/runtime/runtimeEndpoints.ts): `apps/web/src/runtime/runtimeEndpoints.ts`
- [Persisted UI state](https://github.com/hesamsheikh/octogent/blob/main/apps/web/src/app/hooks/usePersistedUiState.ts): `apps/web/src/app/hooks/usePersistedUiState.ts`

### API and orchestration

- [Local API server](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/server.ts): `apps/api/src/server.ts`
- [API construction](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/createApiServer.ts): `apps/api/src/createApiServer.ts`
- [Terminal routes](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/createApiServer/terminalRoutes.ts): `apps/api/src/createApiServer/terminalRoutes.ts`
- [Deck orchestration](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/createApiServer/deckRoutes.ts): `apps/api/src/createApiServer/deckRoutes.ts`
- [Tentacle files](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/deck/readDeckTentacles.ts): `apps/api/src/deck/readDeckTentacles.ts`
- [Prompt library](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/prompts/promptResolver.ts): `apps/api/src/prompts/promptResolver.ts`

### Terminal execution

- [Terminal runtime](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime.ts): `apps/api/src/terminalRuntime.ts`
- [PTY sessions](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime/sessionRuntime.ts): `apps/api/src/terminalRuntime/sessionRuntime.ts`
- [Agent messaging](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime/channelMessaging.ts): `apps/api/src/terminalRuntime/channelMessaging.ts`
- [Worktree isolation](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime/worktreeManager.ts): `apps/api/src/terminalRuntime/worktreeManager.ts`
- [Git integrations](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime/systemClients.ts): `apps/api/src/terminalRuntime/systemClients.ts`

### Project insights

- [Monitor service](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/monitor/service.ts): `apps/api/src/monitor/service.ts`
- [Monitor cache](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/monitor/repository.ts): `apps/api/src/monitor/repository.ts`
- [Conversation history](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/terminalRuntime/conversations.ts): `apps/api/src/terminalRuntime/conversations.ts`
- [Usage reporting](https://github.com/hesamsheikh/octogent/blob/main/apps/api/src/claudeUsage.ts): `apps/api/src/claudeUsage.ts`

### Shared domain

- [Domain contracts](https://github.com/hesamsheikh/octogent/blob/main/packages/core/src/domain/terminal.ts): `packages/core/src/domain/terminal.ts`
- [Terminal list model](https://github.com/hesamsheikh/octogent/blob/main/packages/core/src/application/buildTerminalList.ts): `packages/core/src/application/buildTerminalList.ts`
- [Snapshot reader port](https://github.com/hesamsheikh/octogent/blob/main/packages/core/src/ports/TerminalSnapshotReader.ts): `packages/core/src/ports/TerminalSnapshotReader.ts`

### Other components

- **Developer**

## Connections

- Developer → Console application: coordinates (evidence: `README.md`)
- Console application → Primary views: selects views (evidence: `apps/web/src/components/PrimaryViewRouter.tsx`)
- Primary views → Agent canvas: routes canvas (evidence: `apps/web/src/components/PrimaryViewRouter.tsx`)
- Agent canvas → Canvas data: loads graph data (evidence: `apps/web/src/components/CanvasPrimaryView.tsx`)
- Canvas data → API endpoints: builds requests (evidence: `apps/web/src/app/hooks/useCanvasGraphData.ts`)
- Console application → Terminal list model: builds terminal list (evidence: `apps/web/src/App.tsx`)
- Terminal list model → Snapshot reader port: reads snapshots (evidence: `packages/core/src/application/buildTerminalList.ts`)
- Console application → Persisted UI state: persists preferences (evidence: `apps/web/src/App.tsx`)
- Persisted UI state → API endpoints: builds state requests (evidence: `apps/web/src/app/hooks/usePersistedUiState.ts`)
- Console application → Local API server: uses local API (evidence: `README.md`)
- Local API server → API construction: creates server (evidence: `apps/api/src/server.ts`)
- Terminal routes → Terminal runtime: lists terminals (evidence: `apps/api/src/createApiServer/terminalRoutes.ts`)
- Deck orchestration → Terminal runtime: checks terminals (evidence: `apps/api/src/createApiServer/deckRoutes.ts`)
- Deck orchestration → Tentacle files: reads tentacles (evidence: `apps/api/src/createApiServer/deckRoutes.ts`)
- Deck orchestration → Prompt library: resolves worker prompts (evidence: `apps/api/src/createApiServer/deckRoutes.ts`)
- Terminal runtime → PTY sessions: manages sessions (evidence: `apps/api/src/terminalRuntime.ts`)
- Terminal runtime → Agent messaging: delegates messaging (evidence: `apps/api/src/terminalRuntime.ts`)
- Terminal runtime → Worktree isolation: manages worktrees (evidence: `apps/api/src/terminalRuntime.ts`)
- Worktree isolation → Git integrations: runs git operations (evidence: `apps/api/src/terminalRuntime/worktreeManager.ts`)
- Monitor service → Monitor cache: reads and writes cache (evidence: `apps/api/src/monitor/service.ts`)
- Developer → Domain contracts: works from shared model (evidence: `README.md`)
