# leobtlh/openorchestra architecture

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

- Interactive diagram: https://gitdiagram.com/leobtlh/openorchestra
- Repository: https://github.com/leobtlh/openorchestra

## Overview

OpenOrchestra runs configurable multi-agent code competitions: a user selects a domain and task, the CLI starts orchestration, agents produce candidate solutions, an evaluator scores them, and the orchestrator selects a winner and records learning. Supporting branches cover domain and skill discovery, agent-count optimization, integrations, and persistent pattern memory. The graph includes core learning modules identified by the source index; unsampled internals are represented only where their references or the README support the relationship.

Main entry points: [`src/openorchestra/core/competition_orchestrator.py`](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/competition_orchestrator.py) (Competition orchestrator), [`src/openorchestra/memory/competition_memory.py`](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/memory/competition_memory.py) (Competition memory), [`src/openorchestra/integrations/opencode_adapter.py`](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/integrations/opencode_adapter.py) (OpenCode adapter), [`src/openorchestra/core/domain_manager.py`](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/domain_manager.py) (Domain manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and configuration"]
  node_cli["CLI commands<br/>[main.py]"]
  node_config["Project config<br/>[config.py]"]
  node_domain_config["Default domains"]
end

subgraph group_competition["Competition runtime"]
  node_orchestrator["Competition orchestrator"]
  node_agent_interface["Agent interface<br/>[agent_interface.py]"]
  node_agent_pool["Agent pool<br/>[agent_pool.py]"]
  node_optimizer["Agent optimizer<br/>[optimizer.py]"]
end

subgraph group_domains["Domains and evaluation"]
  node_domain_manager["Domain manager<br/>[domain_manager.py]"]
  node_skill_detector["Skill detector<br/>[skill_detector.py]"]
  node_evaluator["Quality evaluator"]
end

subgraph group_integrations["Agent integrations"]
  node_opencode_adapter["OpenCode adapter"]
  node_autodev_adapter["AutoDev adapter<br/>[autodev_adapter.py]"]
  node_process["Executable probe<br/>[process.py]"]
end

subgraph group_learning["Learning and memory"]
  node_hierarchical_learner["Hierarchical learner"]
  node_context_compressor["Context compressor"]
  node_pattern_cluster["Pattern clustering<br/>[pattern_cluster.py]"]
  node_pattern_signature["Pattern signatures"]
  node_lru_cache["LRU cache<br/>[lru_cache.py]"]
  node_memory["Competition memory"]
end

node_user(("Competition user"))
node_opencode(("OpenCode executable"))
node_sqlite[("SQLite memory store")]

node_user -->|"runs commands"| node_cli
node_cli -->|"starts competition"| node_orchestrator
node_cli -->|"loads config"| node_config
node_cli -->|"manages domains"| node_domain_manager
node_domain_manager -.->|"loads defaults"| node_domain_config
node_domain_manager -->|"checks skills"| node_skill_detector
node_skill_detector -->|"queries domains"| node_domain_manager
node_orchestrator -->|"loads settings"| node_config
node_orchestrator -->|"resolves domain"| node_domain_manager
node_orchestrator -->|"chooses agent count"| node_optimizer
node_orchestrator -->|"runs agents"| node_opencode_adapter
node_orchestrator -->|"runs tournament"| node_autodev_adapter
node_orchestrator -->|"scores solutions"| node_evaluator
node_orchestrator -->|"records learning"| node_memory
node_agent_pool -->|"creates agents"| node_agent_interface
node_agent_interface -->|"delegates execution"| node_opencode_adapter
node_agent_interface -->|"delegates execution"| node_autodev_adapter
node_opencode_adapter -->|"runs command"| node_opencode
node_opencode_adapter -->|"detects skills"| node_skill_detector
node_opencode_adapter -->|"probes executable"| node_process
node_autodev_adapter -->|"probes executable"| node_process
node_memory -->|"reads and writes"| node_sqlite
node_memory -->|"caches context"| node_lru_cache
node_memory -->|"clusters patterns"| node_pattern_cluster
node_memory -->|"signs patterns"| node_pattern_signature
node_pattern_cluster -->|"compares signatures"| node_pattern_signature
node_hierarchical_learner -->|"uses signatures"| node_pattern_signature
node_context_compressor -->|"uses signatures"| node_pattern_signature

click node_cli "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/cli/main.py"
click node_config "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/config.py"
click node_domain_config "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/configs/default_domains.yaml"
click node_orchestrator "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/competition_orchestrator.py"
click node_agent_interface "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/agent_interface.py"
click node_agent_pool "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/agent_pool.py"
click node_optimizer "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/optimizer.py"
click node_domain_manager "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/domain_manager.py"
click node_skill_detector "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/skill_detector.py"
click node_evaluator "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/evaluators/quality_evaluator.py"
click node_opencode_adapter "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/integrations/opencode_adapter.py"
click node_autodev_adapter "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/integrations/autodev_adapter.py"
click node_process "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/integrations/process.py"
click node_hierarchical_learner "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/hierarchical_learner.py"
click node_context_compressor "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/context_compressor.py"
click node_pattern_cluster "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/pattern_cluster.py"
click node_pattern_signature "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/pattern_signature.py"
click node_lru_cache "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/lru_cache.py"
click node_memory "https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/memory/competition_memory.py"

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_config,node_domain_config,node_user toneBlue
class node_orchestrator,node_agent_interface,node_agent_pool,node_optimizer,node_sqlite toneAmber
class node_domain_manager,node_skill_detector,node_evaluator toneMint
class node_opencode_adapter,node_autodev_adapter,node_process toneRose
class node_hierarchical_learner,node_context_compressor,node_pattern_cluster,node_pattern_signature,node_lru_cache,node_memory,node_opencode toneIndigo
```

## Components

### Entry and configuration

- [CLI commands](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/cli/main.py): `src/openorchestra/cli/main.py`
- [Project config](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/config.py): `src/openorchestra/core/config.py`
- [Default domains](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/configs/default_domains.yaml): `src/openorchestra/configs/default_domains.yaml`

### Competition runtime

- [Competition orchestrator](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/competition_orchestrator.py): `src/openorchestra/core/competition_orchestrator.py`
- [Agent interface](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/agent_interface.py): `src/openorchestra/core/agent_interface.py`
- [Agent pool](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/agent_pool.py): `src/openorchestra/core/agent_pool.py`
- [Agent optimizer](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/optimizer.py): `src/openorchestra/core/optimizer.py`

### Domains and evaluation

- [Domain manager](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/domain_manager.py): `src/openorchestra/core/domain_manager.py`
- [Skill detector](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/skill_detector.py): `src/openorchestra/core/skill_detector.py`
- [Quality evaluator](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/evaluators/quality_evaluator.py): `src/openorchestra/evaluators/quality_evaluator.py`

### Agent integrations

- [OpenCode adapter](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/integrations/opencode_adapter.py): `src/openorchestra/integrations/opencode_adapter.py`
- [AutoDev adapter](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/integrations/autodev_adapter.py): `src/openorchestra/integrations/autodev_adapter.py`
- [Executable probe](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/integrations/process.py): `src/openorchestra/integrations/process.py`

### Learning and memory

- [Hierarchical learner](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/hierarchical_learner.py): `src/openorchestra/core/hierarchical_learner.py`
- [Context compressor](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/context_compressor.py): `src/openorchestra/core/context_compressor.py`
- [Pattern clustering](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/pattern_cluster.py): `src/openorchestra/core/pattern_cluster.py`
- [Pattern signatures](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/pattern_signature.py): `src/openorchestra/core/pattern_signature.py`
- [LRU cache](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/core/lru_cache.py): `src/openorchestra/core/lru_cache.py`
- [Competition memory](https://github.com/leobtlh/openorchestra/blob/main/src/openorchestra/memory/competition_memory.py): `src/openorchestra/memory/competition_memory.py`

### Other components

- **Competition user**
- **OpenCode executable**
- **SQLite memory store**

## Connections

- Competition user → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Competition orchestrator: starts competition (evidence: `src/openorchestra/cli/main.py`)
- CLI commands → Project config: loads config (evidence: `src/openorchestra/cli/main.py`)
- CLI commands → Domain manager: manages domains (evidence: `src/openorchestra/cli/main.py`)
- Domain manager → Default domains: loads defaults
- Domain manager → Skill detector: checks skills (evidence: `src/openorchestra/core/domain_manager.py`)
- Skill detector → Domain manager: queries domains (evidence: `src/openorchestra/core/skill_detector.py`)
- Competition orchestrator → Project config: loads settings (evidence: `src/openorchestra/core/competition_orchestrator.py`)
- Competition orchestrator → Domain manager: resolves domain (evidence: `src/openorchestra/core/competition_orchestrator.py`)
- Competition orchestrator → Agent optimizer: chooses agent count (evidence: `src/openorchestra/core/competition_orchestrator.py`)
- Competition orchestrator → OpenCode adapter: runs agents (evidence: `src/openorchestra/core/competition_orchestrator.py`)
- Competition orchestrator → AutoDev adapter: runs tournament (evidence: `src/openorchestra/core/competition_orchestrator.py`)
- Competition orchestrator → Quality evaluator: scores solutions (evidence: `src/openorchestra/core/competition_orchestrator.py`)
- Competition orchestrator → Competition memory: records learning (evidence: `src/openorchestra/core/competition_orchestrator.py`)
- Agent pool → Agent interface: creates agents (evidence: `src/openorchestra/core/agent_pool.py`)
- Agent interface → OpenCode adapter: delegates execution (evidence: `src/openorchestra/core/agent_interface.py`)
- Agent interface → AutoDev adapter: delegates execution (evidence: `src/openorchestra/core/agent_interface.py`)
- OpenCode adapter → OpenCode executable: runs command (evidence: `src/openorchestra/integrations/opencode_adapter.py`)
- OpenCode adapter → Skill detector: detects skills (evidence: `src/openorchestra/integrations/opencode_adapter.py`)
- OpenCode adapter → Executable probe: probes executable (evidence: `src/openorchestra/integrations/opencode_adapter.py`)
- AutoDev adapter → Executable probe: probes executable (evidence: `src/openorchestra/integrations/autodev_adapter.py`)
- Competition memory → SQLite memory store: reads and writes (evidence: `src/openorchestra/memory/competition_memory.py`)
- Competition memory → LRU cache: caches context (evidence: `src/openorchestra/memory/competition_memory.py`)
- Competition memory → Pattern clustering: clusters patterns (evidence: `src/openorchestra/memory/competition_memory.py`)
- Competition memory → Pattern signatures: signs patterns (evidence: `src/openorchestra/memory/competition_memory.py`)
- Pattern clustering → Pattern signatures: compares signatures (evidence: `src/openorchestra/core/pattern_cluster.py`)
- Hierarchical learner → Pattern signatures: uses signatures (evidence: `src/openorchestra/core/hierarchical_learner.py`)
- Context compressor → Pattern signatures: uses signatures (evidence: `src/openorchestra/core/context_compressor.py`)
