# rezarasoulzadeh/orc architecture

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

- Interactive diagram: https://gitdiagram.com/rezarasoulzadeh/orc
- Repository: https://github.com/rezarasoulzadeh/orc

## Overview

Orc is a local, operator-controlled orchestrator for AI-assisted engineering, not a model provider. The main workflow adopts a Git project, captures its engineering context, turns an objective into persisted plans and tasks, schedules and dispatches work to registered agents in isolated worktrees, then validates and reviews results under operator-controlled lifecycle policies. Operators use the CLI, beta TUI, or Tauri desktop client. The graph includes durable memory and persisted workflows as additional capabilities. Relationships are grounded in the README and SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/storage/db.rs`](https://github.com/rezarasoulzadeh/orc/blob/main/src/storage/db.rs) (SQLite state), [`src/app.rs`](https://github.com/rezarasoulzadeh/orc/blob/main/src/app.rs) (Dispatch orchestration), [`src/cli`](https://github.com/rezarasoulzadeh/orc/tree/main/src/cli) (CLI), [`src/adoption.rs`](https://github.com/rezarasoulzadeh/orc/blob/main/src/adoption.rs) (Project adoption)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operator["Operator interfaces"]
  node_cli["CLI"]
  node_tui["Terminal UI<br/>[mod.rs]"]
  node_desktop["Desktop client<br/>[lib.rs]"]
end

subgraph group_planning["Project and planning"]
  node_project["Project adoption<br/>[adoption.rs]"]
  node_discovery["Repository discovery<br/>[discovery.rs]"]
  node_lead["Engineering Lead<br/>[lead.rs]"]
  node_planning_engine["Planning"]
  node_workflow["Persisted workflow<br/>[workflow.rs]"]
end

subgraph group_execution["Task execution"]
  node_tasks["Task model<br/>[task.rs]"]
  node_queue["Queue and scheduling<br/>[queue.rs]"]
  node_agents["Agent registry<br/>[registry.rs]"]
  node_dispatch["Dispatch orchestration<br/>[app.rs]"]
  node_worker["Worker execution<br/>[worker.rs]"]
  node_git["Git worktrees<br/>[git.rs]"]
end

subgraph group_governance["Lifecycle and governance"]
  node_validation["Validation<br/>[validation.rs]"]
  node_review["Review and acceptance<br/>[review.rs]"]
  node_memory["Durable memory<br/>[memory.rs]"]
end

subgraph group_persistence["Runtime state"]
  node_database[("SQLite state<br/>[db.rs]")]
end

node_operator(("Operator"))
node_provider{{"External AI providers"}}

node_operator -->|"issues commands"| node_cli
node_operator -->|"inspects queue"| node_tui
node_operator -->|"uses client"| node_desktop
node_cli -->|"initializes and adopts"| node_project
node_cli -->|"starts or advances"| node_workflow
node_cli -->|"dispatches tasks"| node_dispatch
node_project -->|"records project state"| node_database
node_project -->|"adopts Git repository"| node_git
node_discovery -->|"applies discovery"| node_database
node_workflow -->|"advances planning"| node_planning_engine
node_planning_engine -->|"uses Lead decisions"| node_lead
node_planning_engine -->|"creates tasks"| node_tasks
node_tasks -->|"persists task state"| node_database
node_queue -->|"checks eligibility"| node_agents
node_dispatch -->|"selects queued work"| node_queue
node_dispatch -->|"dispatches work"| node_worker
node_worker -->|"uses isolated worktree"| node_git
node_worker -->|"invokes provider"| node_provider
node_dispatch -->|"validates work"| node_validation
node_dispatch -->|"builds review"| node_review
node_review -->|"persists review state"| node_database
node_dispatch -->|"updates lifecycle state"| node_database
node_memory -->|"stores memory"| node_database
node_tui -->|"reads project state"| node_database
node_desktop -->|"manages project state"| node_database

click node_cli "https://github.com/rezarasoulzadeh/orc/tree/main/src/cli"
click node_tui "https://github.com/rezarasoulzadeh/orc/blob/main/src/tui/mod.rs"
click node_desktop "https://github.com/rezarasoulzadeh/orc/blob/main/src-tauri/src/lib.rs"
click node_project "https://github.com/rezarasoulzadeh/orc/blob/main/src/adoption.rs"
click node_discovery "https://github.com/rezarasoulzadeh/orc/blob/main/src/discovery.rs"
click node_lead "https://github.com/rezarasoulzadeh/orc/blob/main/src/lead.rs"
click node_planning_engine "https://github.com/rezarasoulzadeh/orc/blob/main/src/controller_planning.rs"
click node_workflow "https://github.com/rezarasoulzadeh/orc/blob/main/src/workflow.rs"
click node_tasks "https://github.com/rezarasoulzadeh/orc/blob/main/src/task.rs"
click node_queue "https://github.com/rezarasoulzadeh/orc/blob/main/src/queue.rs"
click node_agents "https://github.com/rezarasoulzadeh/orc/blob/main/src/registry.rs"
click node_dispatch "https://github.com/rezarasoulzadeh/orc/blob/main/src/app.rs"
click node_worker "https://github.com/rezarasoulzadeh/orc/blob/main/src/worker.rs"
click node_git "https://github.com/rezarasoulzadeh/orc/blob/main/src/git.rs"
click node_validation "https://github.com/rezarasoulzadeh/orc/blob/main/src/validation.rs"
click node_review "https://github.com/rezarasoulzadeh/orc/blob/main/src/review.rs"
click node_memory "https://github.com/rezarasoulzadeh/orc/blob/main/src/memory.rs"
click node_database "https://github.com/rezarasoulzadeh/orc/blob/main/src/storage/db.rs"

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_tui,node_desktop toneBlue
class node_project,node_discovery,node_lead,node_planning_engine,node_workflow toneAmber
class node_tasks,node_queue,node_agents,node_dispatch,node_worker,node_git toneMint
class node_validation,node_review,node_memory toneRose
class node_database,node_operator,node_provider toneIndigo
```

## Components

### Operator interfaces

- [CLI](https://github.com/rezarasoulzadeh/orc/tree/main/src/cli): `src/cli`
- [Terminal UI](https://github.com/rezarasoulzadeh/orc/blob/main/src/tui/mod.rs): `src/tui/mod.rs`
- [Desktop client](https://github.com/rezarasoulzadeh/orc/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`

### Project and planning

- [Project adoption](https://github.com/rezarasoulzadeh/orc/blob/main/src/adoption.rs): `src/adoption.rs`
- [Repository discovery](https://github.com/rezarasoulzadeh/orc/blob/main/src/discovery.rs): `src/discovery.rs`
- [Engineering Lead](https://github.com/rezarasoulzadeh/orc/blob/main/src/lead.rs): `src/lead.rs`
- [Planning](https://github.com/rezarasoulzadeh/orc/blob/main/src/controller_planning.rs): `src/controller_planning.rs`
- [Persisted workflow](https://github.com/rezarasoulzadeh/orc/blob/main/src/workflow.rs): `src/workflow.rs`

### Task execution

- [Task model](https://github.com/rezarasoulzadeh/orc/blob/main/src/task.rs): `src/task.rs`
- [Queue and scheduling](https://github.com/rezarasoulzadeh/orc/blob/main/src/queue.rs): `src/queue.rs`
- [Agent registry](https://github.com/rezarasoulzadeh/orc/blob/main/src/registry.rs): `src/registry.rs`
- [Dispatch orchestration](https://github.com/rezarasoulzadeh/orc/blob/main/src/app.rs): `src/app.rs`
- [Worker execution](https://github.com/rezarasoulzadeh/orc/blob/main/src/worker.rs): `src/worker.rs`
- [Git worktrees](https://github.com/rezarasoulzadeh/orc/blob/main/src/git.rs): `src/git.rs`

### Lifecycle and governance

- [Validation](https://github.com/rezarasoulzadeh/orc/blob/main/src/validation.rs): `src/validation.rs`
- [Review and acceptance](https://github.com/rezarasoulzadeh/orc/blob/main/src/review.rs): `src/review.rs`
- [Durable memory](https://github.com/rezarasoulzadeh/orc/blob/main/src/memory.rs): `src/memory.rs`

### Runtime state

- [SQLite state](https://github.com/rezarasoulzadeh/orc/blob/main/src/storage/db.rs): `src/storage/db.rs`

### Other components

- **Operator**
- **External AI providers**

## Connections

- Operator → CLI: issues commands (evidence: `README.md`)
- Operator → Terminal UI: inspects queue (evidence: `README.md`)
- Operator → Desktop client: uses client (evidence: `README.md`)
- CLI → Project adoption: initializes and adopts (evidence: `README.md`)
- CLI → Persisted workflow: starts or advances (evidence: `README.md`)
- CLI → Dispatch orchestration: dispatches tasks (evidence: `README.md`)
- Project adoption → SQLite state: records project state (evidence: `README.md`)
- Project adoption → Git worktrees: adopts Git repository (evidence: `README.md`)
- Repository discovery → SQLite state: applies discovery (evidence: `README.md`)
- Persisted workflow → Planning: advances planning (evidence: `README.md`)
- Planning → Engineering Lead: uses Lead decisions (evidence: `src/app.rs`)
- Planning → Task model: creates tasks (evidence: `README.md`)
- Task model → SQLite state: persists task state (evidence: `src/storage/db.rs`)
- Queue and scheduling → Agent registry: checks eligibility (evidence: `src/queue.rs`)
- Dispatch orchestration → Queue and scheduling: selects queued work (evidence: `README.md`)
- Dispatch orchestration → Worker execution: dispatches work (evidence: `src/app.rs`)
- Worker execution → Git worktrees: uses isolated worktree (evidence: `README.md`)
- Worker execution → External AI providers: invokes provider (evidence: `README.md`)
- Dispatch orchestration → Validation: validates work (evidence: `src/app.rs`)
- Dispatch orchestration → Review and acceptance: builds review (evidence: `src/app.rs`)
- Review and acceptance → SQLite state: persists review state (evidence: `README.md`)
- Dispatch orchestration → SQLite state: updates lifecycle state (evidence: `src/app.rs`)
- Durable memory → SQLite state: stores memory (evidence: `src/memory.rs`)
- Terminal UI → SQLite state: reads project state (evidence: `src/tui/mod.rs`)
- Desktop client → SQLite state: manages project state (evidence: `src-tauri/src/lib.rs`)
