# justvugg/colibri architecture

> Architecture diagram of the GitHub repository justvugg/colibri, 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/justvugg/colibri
- Repository: https://github.com/justvugg/colibri
- Video tour (about a minute): https://gitdiagram.com/justvugg/colibri/video

## Overview

colibri is a local large-model runtime: users install or select a model, then chat with it through a browser UI or API gateway; inference can also generate images or decisions. The README documents hardware-aware setup, resumable downloads, CPU/Vulkan/CUDA execution, and a broad family of model engines. The graph includes those documented capabilities and sampled UI, gateway, agent, and training modules. Many runtime/setup implementations were not excerpted, so their connections are shown only where documented or evidenced by the source index.

Main entry points: [`c/colibri.c`](https://github.com/justvugg/colibri/blob/main/c/colibri.c) (Model engines), [`c/setup_flow.py`](https://github.com/justvugg/colibri/blob/main/c/setup_flow.py) (Setup workflow), [`ui/server.py`](https://github.com/justvugg/colibri/blob/main/ui/server.py) (Chat UI server), [`web/src/App.tsx`](https://github.com/justvugg/colibri/blob/main/web/src/App.tsx) (Web dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and models"]
  node_setupflow["Setup workflow<br/>[setup_flow.py]"]
  node_hardware["Hardware detection<br/>[setup_hw.py]"]
  node_catalog["Model catalog<br/>[setup_catalog.py]"]
  node_download["Model downloads<br/>[setup_download.py]"]
  node_family["Family registry<br/>[family_registry.py]"]
end

subgraph group_runtime["Inference runtime"]
  node_engine["Model engines<br/>[colibri.c]"]
  node_gguf["GGUF loading<br/>[st_gguf.h]"]
  node_compute["GPU backends<br/>[backend_vulkan.c]"]
  node_image["Image generation<br/>[image_engine.py]"]
  node_decisions["Decision models<br/>[laya.c]"]
end

subgraph group_gateway["Gateway and clients"]
  node_gateway["Inference gateway<br/>[openai_server.py]"]
  node_ui_server["Chat UI server<br/>[server.py]"]
  node_browser["Web dashboard<br/>[App.tsx]"]
  node_api["Browser API client<br/>[api.ts]"]
  node_agents["Agent integration<br/>[agents.py]"]
  node_responses["Responses adapter<br/>[responses_shim.py]"]
end

subgraph group_training["Model adaptation"]
  node_trainer["QLoRA trainer<br/>[train_main.c]"]
  node_trainmodel["Training forward pass<br/>[train_model.h]"]
end

node_user(("User"))
node_operator(("Operator"))
node_weights[("Model files")]

node_user -->|"selects model"| node_setupflow
node_setupflow -->|"detects hardware"| node_hardware
node_setupflow -->|"recommends model"| node_catalog
node_setupflow -->|"downloads weights"| node_download
node_download -->|"writes files"| node_weights
node_setupflow -->|"starts runtime"| node_engine
node_engine -.->|"selects family"| node_family
node_engine -->|"loads GGUF"| node_gguf
node_engine -->|"runs on GPU"| node_compute
node_engine -->|"reads weights"| node_weights
node_engine -->|"supports image runs"| node_image
node_engine -->|"runs decision models"| node_decisions
node_user -->|"chats or generates"| node_browser
node_browser -->|"requests inference"| node_api
node_api -.->|"calls API"| node_gateway
node_gateway -.->|"dispatches inference"| node_engine
node_browser -.->|"uses dashboard"| node_ui_server
node_ui_server -->|"proxies requests"| node_gateway
node_ui_server -->|"routes agent actions"| node_agents
node_ui_server -.->|"adapts responses"| node_responses
node_operator -->|"trains adapter"| node_trainer
node_trainer -->|"runs training"| node_trainmodel
node_trainer -.->|"loads base model"| node_weights

click node_setupflow "https://github.com/justvugg/colibri/blob/main/c/setup_flow.py"
click node_hardware "https://github.com/justvugg/colibri/blob/main/c/setup_hw.py"
click node_catalog "https://github.com/justvugg/colibri/blob/main/c/setup_catalog.py"
click node_download "https://github.com/justvugg/colibri/blob/main/c/setup_download.py"
click node_family "https://github.com/justvugg/colibri/blob/main/c/family_registry.py"
click node_engine "https://github.com/justvugg/colibri/blob/main/c/colibri.c"
click node_gguf "https://github.com/justvugg/colibri/blob/main/c/st_gguf.h"
click node_compute "https://github.com/justvugg/colibri/blob/main/c/backend_vulkan.c"
click node_image "https://github.com/justvugg/colibri/blob/main/c/image_engine.py"
click node_decisions "https://github.com/justvugg/colibri/blob/main/c/laya.c"
click node_gateway "https://github.com/justvugg/colibri/blob/main/c/openai_server.py"
click node_ui_server "https://github.com/justvugg/colibri/blob/main/ui/server.py"
click node_browser "https://github.com/justvugg/colibri/blob/main/web/src/App.tsx"
click node_api "https://github.com/justvugg/colibri/blob/main/web/src/lib/api.ts"
click node_agents "https://github.com/justvugg/colibri/blob/main/ui/agents.py"
click node_responses "https://github.com/justvugg/colibri/blob/main/ui/responses_shim.py"
click node_trainer "https://github.com/justvugg/colibri/blob/main/c/train/train_main.c"
click node_trainmodel "https://github.com/justvugg/colibri/blob/main/c/train/train_model.h"

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_setupflow,node_hardware,node_catalog,node_download,node_family,node_user toneBlue
class node_engine,node_gguf,node_compute,node_image,node_decisions,node_weights toneAmber
class node_gateway,node_ui_server,node_browser,node_api,node_agents,node_responses toneMint
class node_trainer,node_trainmodel toneRose
class node_operator toneIndigo
```

## Components

### Setup and models

- [Setup workflow](https://github.com/justvugg/colibri/blob/main/c/setup_flow.py): `c/setup_flow.py`
- [Hardware detection](https://github.com/justvugg/colibri/blob/main/c/setup_hw.py): `c/setup_hw.py`
- [Model catalog](https://github.com/justvugg/colibri/blob/main/c/setup_catalog.py): `c/setup_catalog.py`
- [Model downloads](https://github.com/justvugg/colibri/blob/main/c/setup_download.py): `c/setup_download.py`
- [Family registry](https://github.com/justvugg/colibri/blob/main/c/family_registry.py): `c/family_registry.py`

### Inference runtime

- [Model engines](https://github.com/justvugg/colibri/blob/main/c/colibri.c): `c/colibri.c`
- [GGUF loading](https://github.com/justvugg/colibri/blob/main/c/st_gguf.h): `c/st_gguf.h`
- [GPU backends](https://github.com/justvugg/colibri/blob/main/c/backend_vulkan.c): `c/backend_vulkan.c`
- [Image generation](https://github.com/justvugg/colibri/blob/main/c/image_engine.py): `c/image_engine.py`
- [Decision models](https://github.com/justvugg/colibri/blob/main/c/laya.c): `c/laya.c`

### Gateway and clients

- [Inference gateway](https://github.com/justvugg/colibri/blob/main/c/openai_server.py): `c/openai_server.py`
- [Chat UI server](https://github.com/justvugg/colibri/blob/main/ui/server.py): `ui/server.py`
- [Web dashboard](https://github.com/justvugg/colibri/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Browser API client](https://github.com/justvugg/colibri/blob/main/web/src/lib/api.ts): `web/src/lib/api.ts`
- [Agent integration](https://github.com/justvugg/colibri/blob/main/ui/agents.py): `ui/agents.py`
- [Responses adapter](https://github.com/justvugg/colibri/blob/main/ui/responses_shim.py): `ui/responses_shim.py`

### Model adaptation

- [QLoRA trainer](https://github.com/justvugg/colibri/blob/main/c/train/train_main.c): `c/train/train_main.c`
- [Training forward pass](https://github.com/justvugg/colibri/blob/main/c/train/train_model.h): `c/train/train_model.h`

### Other components

- **User**
- **Operator**
- **Model files**

## Connections

- User → Setup workflow: selects model (evidence: `README.md`)
- Setup workflow → Hardware detection: detects hardware (evidence: `README.md`)
- Setup workflow → Model catalog: recommends model (evidence: `README.md`)
- Setup workflow → Model downloads: downloads weights (evidence: `README.md`)
- Model downloads → Model files: writes files (evidence: `README.md`)
- Setup workflow → Model engines: starts runtime (evidence: `README.md`)
- Model engines → Family registry: selects family
- Model engines → GGUF loading: loads GGUF
- Model engines → GPU backends: runs on GPU (evidence: `README.md`)
- Model engines → Model files: reads weights (evidence: `README.md`)
- Model engines → Image generation: supports image runs (evidence: `README.md`)
- Model engines → Decision models: runs decision models (evidence: `README.md`)
- User → Web dashboard: chats or generates (evidence: `README.md`)
- Web dashboard → Browser API client: requests inference (evidence: `web/src/App.tsx`)
- Browser API client → Inference gateway: calls API
- Inference gateway → Model engines: dispatches inference
- Web dashboard → Chat UI server: uses dashboard
- Chat UI server → Inference gateway: proxies requests (evidence: `ui/server.py`)
- Chat UI server → Agent integration: routes agent actions (evidence: `ui/server.py`)
- Chat UI server → Responses adapter: adapts responses (evidence: `ui/server.py`)
- Operator → QLoRA trainer: trains adapter (evidence: `c/train/train_main.c`)
- QLoRA trainer → Training forward pass: runs training (evidence: `c/train/train_main.c`)
- QLoRA trainer → Model files: loads base model
