# razzant/ouroboros architecture

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

- Interactive diagram: https://gitdiagram.com/razzant/ouroboros
- Repository: https://github.com/razzant/ouroboros

## Overview

Ouroboros is a persistent, local-first AI coding agent with desktop and headless entry points. The main workflow accepts a task through the gateway, admits and supervises worker execution, invokes model/tool capabilities, and records results and durable artifacts. Projects, memory, history, review, and self-evolution are major product capabilities described in the README; their branches are represented at subsystem level where source excerpts do not establish internal wiring. Edges use SOURCE INDEX references or README statements, so unsampled internals are not presented as inspected.

Main entry points: [`ouroboros/agent_task_pipeline.py`](https://github.com/razzant/ouroboros/blob/main/ouroboros/agent_task_pipeline.py) (Agent pipeline), [`supervisor/workers.py`](https://github.com/razzant/ouroboros/blob/main/supervisor/workers.py) (Worker supervisor), [`server.py`](https://github.com/razzant/ouroboros/blob/main/server.py) (Server runtime), [`ouroboros/gateway/tasks.py`](https://github.com/razzant/ouroboros/blob/main/ouroboros/gateway/tasks.py) (Task gateway)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Runtime entry"]
  node_server["Server runtime<br/>[server.py]"]
  node_headless["Headless CLI<br/>[headless.py]"]
  node_gateway["Task gateway<br/>[tasks.py]"]
end

subgraph group_execution["Task execution"]
  node_supervisor["Worker supervisor<br/>[workers.py]"]
  node_agent["Agent pipeline"]
  node_llm["Model routing<br/>[llm_routing.py]"]
end

subgraph group_continuity["Continuity and records"]
  node_projects[("Project registry")]
  node_memory[("Durable memory<br/>[memory.py]")]
  node_history[("Task history<br/>[chronicle_store.py]")]
  node_results[("Task results<br/>[task_results.py]")]
  node_artifacts[("Task artifacts<br/>[artifacts.py]")]
  node_state[("Supervisor state<br/>[state.py]")]
  node_cancel[("Cancel intents<br/>[cancel_intents.py]")]
end

subgraph group_capabilities["Agent capabilities"]
  node_tools["Agent tools<br/>[core.py]"]
  node_delegate["Delegated execution"]
  node_review["Review<br/>[review.py]"]
  node_evolution["Self evolution"]
end

subgraph group_interfaces["User interfaces"]
  node_web["Web interface<br/>[app.js]"]
  node_android["Android host<br/>[CoreService.java]"]
end

node_owner(("User"))
node_models{{"Model provider"}}
node_claudexor{{"Claudexor runtime"}}

node_owner -->|"uses"| node_server
node_owner -->|"uses"| node_headless
node_server -->|"routes tasks"| node_gateway
node_gateway -->|"starts tasks"| node_headless
node_headless -->|"dispatches work"| node_supervisor
node_supervisor -->|"runs agent"| node_agent
node_agent -->|"requests inference"| node_llm
node_llm -->|"calls provider"| node_models
node_agent -.->|"uses tools"| node_tools
node_agent -->|"delegates coding"| node_delegate
node_delegate -->|"runs harness"| node_claudexor
node_agent -->|"owns review"| node_review
node_agent -->|"uses projects"| node_projects
node_agent -->|"uses memory"| node_memory
node_agent -->|"records history"| node_history
node_agent -->|"writes results"| node_results
node_agent -->|"writes artifacts"| node_artifacts
node_supervisor -->|"reads state"| node_state
node_supervisor -->|"promotes workers"| node_evolution
node_gateway -.->|"accepts cancellation"| node_cancel
node_web -.->|"connects to runtime"| node_server
node_android -.->|"connects to runtime"| node_server

click node_server "https://github.com/razzant/ouroboros/blob/main/server.py"
click node_headless "https://github.com/razzant/ouroboros/blob/main/ouroboros/headless.py"
click node_gateway "https://github.com/razzant/ouroboros/blob/main/ouroboros/gateway/tasks.py"
click node_supervisor "https://github.com/razzant/ouroboros/blob/main/supervisor/workers.py"
click node_agent "https://github.com/razzant/ouroboros/blob/main/ouroboros/agent_task_pipeline.py"
click node_llm "https://github.com/razzant/ouroboros/blob/main/ouroboros/llm_routing.py"
click node_tools "https://github.com/razzant/ouroboros/blob/main/ouroboros/tools/core.py"
click node_delegate "https://github.com/razzant/ouroboros/blob/main/ouroboros/claudexor_runtime.py"
click node_review "https://github.com/razzant/ouroboros/blob/main/ouroboros/review.py"
click node_evolution "https://github.com/razzant/ouroboros/blob/main/supervisor/worker_promotion.py"
click node_projects "https://github.com/razzant/ouroboros/blob/main/ouroboros/projects_registry.py"
click node_memory "https://github.com/razzant/ouroboros/blob/main/ouroboros/memory.py"
click node_history "https://github.com/razzant/ouroboros/blob/main/ouroboros/chronicle_store.py"
click node_results "https://github.com/razzant/ouroboros/blob/main/ouroboros/task_results.py"
click node_artifacts "https://github.com/razzant/ouroboros/blob/main/ouroboros/artifacts.py"
click node_state "https://github.com/razzant/ouroboros/blob/main/supervisor/state.py"
click node_cancel "https://github.com/razzant/ouroboros/blob/main/ouroboros/cancel_intents.py"
click node_web "https://github.com/razzant/ouroboros/blob/main/web/app.js"
click node_android "https://github.com/razzant/ouroboros/blob/main/android/host/src/ai/ouroboros/android/CoreService.java"

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_server,node_headless,node_gateway,node_owner toneBlue
class node_supervisor,node_agent,node_llm toneAmber
class node_projects,node_memory,node_history,node_results,node_artifacts,node_state,node_cancel toneMint
class node_tools,node_delegate,node_review,node_evolution toneRose
class node_web,node_android,node_models,node_claudexor toneIndigo
```

## Components

### Runtime entry

- [Server runtime](https://github.com/razzant/ouroboros/blob/main/server.py): `server.py`
- [Headless CLI](https://github.com/razzant/ouroboros/blob/main/ouroboros/headless.py): `ouroboros/headless.py`
- [Task gateway](https://github.com/razzant/ouroboros/blob/main/ouroboros/gateway/tasks.py): `ouroboros/gateway/tasks.py`

### Task execution

- [Worker supervisor](https://github.com/razzant/ouroboros/blob/main/supervisor/workers.py): `supervisor/workers.py`
- [Agent pipeline](https://github.com/razzant/ouroboros/blob/main/ouroboros/agent_task_pipeline.py): `ouroboros/agent_task_pipeline.py`
- [Model routing](https://github.com/razzant/ouroboros/blob/main/ouroboros/llm_routing.py): `ouroboros/llm_routing.py`

### Continuity and records

- [Project registry](https://github.com/razzant/ouroboros/blob/main/ouroboros/projects_registry.py): `ouroboros/projects_registry.py`
- [Durable memory](https://github.com/razzant/ouroboros/blob/main/ouroboros/memory.py): `ouroboros/memory.py`
- [Task history](https://github.com/razzant/ouroboros/blob/main/ouroboros/chronicle_store.py): `ouroboros/chronicle_store.py`
- [Task results](https://github.com/razzant/ouroboros/blob/main/ouroboros/task_results.py): `ouroboros/task_results.py`
- [Task artifacts](https://github.com/razzant/ouroboros/blob/main/ouroboros/artifacts.py): `ouroboros/artifacts.py`
- [Supervisor state](https://github.com/razzant/ouroboros/blob/main/supervisor/state.py): `supervisor/state.py`
- [Cancel intents](https://github.com/razzant/ouroboros/blob/main/ouroboros/cancel_intents.py): `ouroboros/cancel_intents.py`

### Agent capabilities

- [Agent tools](https://github.com/razzant/ouroboros/blob/main/ouroboros/tools/core.py): `ouroboros/tools/core.py`
- [Delegated execution](https://github.com/razzant/ouroboros/blob/main/ouroboros/claudexor_runtime.py): `ouroboros/claudexor_runtime.py`
- [Review](https://github.com/razzant/ouroboros/blob/main/ouroboros/review.py): `ouroboros/review.py`
- [Self evolution](https://github.com/razzant/ouroboros/blob/main/supervisor/worker_promotion.py): `supervisor/worker_promotion.py`

### User interfaces

- [Web interface](https://github.com/razzant/ouroboros/blob/main/web/app.js): `web/app.js`
- [Android host](https://github.com/razzant/ouroboros/blob/main/android/host/src/ai/ouroboros/android/CoreService.java): `android/host/src/ai/ouroboros/android/CoreService.java`

### Other components

- **User**
- **Model provider**
- **Claudexor runtime**

## Connections

- User → Server runtime: uses (evidence: `README.md`)
- User → Headless CLI: uses (evidence: `README.md`)
- Server runtime → Task gateway: routes tasks (evidence: `server.py`)
- Task gateway → Headless CLI: starts tasks (evidence: `ouroboros/gateway/tasks.py`)
- Headless CLI → Worker supervisor: dispatches work (evidence: `supervisor/workers.py`)
- Worker supervisor → Agent pipeline: runs agent (evidence: `supervisor/workers.py`)
- Agent pipeline → Model routing: requests inference (evidence: `ouroboros/agent_task_pipeline.py`)
- Model routing → Model provider: calls provider (evidence: `README.md`)
- Agent pipeline → Agent tools: uses tools
- Agent pipeline → Delegated execution: delegates coding (evidence: `README.md`)
- Delegated execution → Claudexor runtime: runs harness (evidence: `README.md`)
- Agent pipeline → Review: owns review (evidence: `README.md`)
- Agent pipeline → Project registry: uses projects (evidence: `ouroboros/agent_task_pipeline.py`)
- Agent pipeline → Durable memory: uses memory (evidence: `README.md`)
- Agent pipeline → Task history: records history (evidence: `README.md`)
- Agent pipeline → Task results: writes results (evidence: `ouroboros/agent_task_pipeline.py`)
- Agent pipeline → Task artifacts: writes artifacts (evidence: `ouroboros/agent_task_pipeline.py`)
- Worker supervisor → Supervisor state: reads state (evidence: `supervisor/workers.py`)
- Worker supervisor → Self evolution: promotes workers (evidence: `supervisor/worker_promotion.py`)
- Task gateway → Cancel intents: accepts cancellation (evidence: `ouroboros/gateway/tasks.py`)
- Web interface → Server runtime: connects to runtime
- Android host → Server runtime: connects to runtime
