# yahya-tech-ai/saro architecture

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

- Interactive diagram: https://gitdiagram.com/yahya-tech-ai/saro
- Repository: https://github.com/yahya-tech-ai/saro

## Overview

Saro is an AI workspace whose implemented path centers on mode-aware chat: a user works in the web UI, submits a message, the chat API builds a prompt and calls a configured model provider, streams the reply, and saves conversation history. Separate APIs manage provider configuration and saved chats. The repository also includes Aro Mini, a standalone inference API backed by a local PyTorch checkpoint. README capabilities such as coding, research, and agent modes are represented by prompt modes; broader automation and overnight execution are not evidenced here. UI-to-route wiring is not shown in the sampled source.

Main entry points: [`lib/store.ts`](https://github.com/yahya-tech-ai/saro/blob/main/lib/store.ts) (Chat and message store), [`app/api/chat/route.ts`](https://github.com/yahya-tech-ai/saro/blob/main/app/api/chat/route.ts) (Chat streaming), [`lib/modes.ts`](https://github.com/yahya-tech-ai/saro/blob/main/lib/modes.ts) (Mode prompts), [`lib/config.ts`](https://github.com/yahya-tech-ai/saro/blob/main/lib/config.ts) (Provider configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace UI"]
  node_frontend["Saro workspace<br/>[page.tsx]"]
end

subgraph group_api["Workspace API"]
  node_chat_api["Chat streaming<br/>[route.ts]"]
  node_config_api["Model settings API<br/>[route.ts]"]
  node_status_api["Provider status API<br/>[route.ts]"]
  node_chats_api["Chat listing API<br/>[route.ts]"]
  node_chat_item_api["Chat detail API<br/>[route.ts]"]
  node_turns_api["Turn save API<br/>[route.ts]"]
  node_aro_route["Aro Mini route<br/>[route.ts]"]
end

subgraph group_persistence["Configuration and chat state"]
  node_modes["Mode prompts<br/>[modes.ts]"]
  node_config["Provider configuration<br/>[config.ts]"]
  node_store["Chat and message store<br/>[store.ts]"]
  node_db[("SQLite database<br/>[db.ts]")]
end

subgraph group_aro["Aro Mini inference"]
  node_aro_server["Inference API server<br/>[server.py]"]
  node_aro_model["Transformer generation<br/>[model.py]"]
end

node_user(("Workspace user"))
node_provider{{"External model provider"}}
node_checkpoint["Model checkpoint<br/>[aro_mini_v0_1.pt]"]

node_user -->|"uses"| node_frontend
node_chat_api -->|"reads settings"| node_config
node_chat_api -->|"builds prompt"| node_modes
node_chat_api -->|"loads and saves"| node_store
node_chat_api -->|"requests completion"| node_provider
node_config_api -->|"reads and saves"| node_config
node_status_api -->|"reads settings"| node_config
node_chats_api -->|"lists chats"| node_store
node_chat_item_api -->|"reads and deletes"| node_store
node_turns_api -->|"parses modes"| node_modes
node_turns_api -->|"saves turns"| node_store
node_store -->|"queries"| node_db
node_store -->|"normalizes modes"| node_modes
node_aro_server -->|"loads and generates"| node_aro_model
node_aro_model -->|"loads weights"| node_checkpoint

click node_frontend "https://github.com/yahya-tech-ai/saro/blob/main/app/page.tsx"
click node_chat_api "https://github.com/yahya-tech-ai/saro/blob/main/app/api/chat/route.ts"
click node_config_api "https://github.com/yahya-tech-ai/saro/blob/main/app/api/config/route.ts"
click node_status_api "https://github.com/yahya-tech-ai/saro/blob/main/app/api/status/route.ts"
click node_chats_api "https://github.com/yahya-tech-ai/saro/blob/main/app/api/chats/route.ts"
click node_chat_item_api "https://github.com/yahya-tech-ai/saro/blob/main/app/api/chats/%5Bid%5D/route.ts"
click node_turns_api "https://github.com/yahya-tech-ai/saro/blob/main/app/api/turns/route.ts"
click node_aro_route "https://github.com/yahya-tech-ai/saro/blob/main/app/api/aro-mini/route.ts"
click node_modes "https://github.com/yahya-tech-ai/saro/blob/main/lib/modes.ts"
click node_config "https://github.com/yahya-tech-ai/saro/blob/main/lib/config.ts"
click node_store "https://github.com/yahya-tech-ai/saro/blob/main/lib/store.ts"
click node_db "https://github.com/yahya-tech-ai/saro/blob/main/lib/db.ts"
click node_aro_server "https://github.com/yahya-tech-ai/saro/blob/main/aro-mini/server.py"
click node_aro_model "https://github.com/yahya-tech-ai/saro/blob/main/aro-mini/model.py"
click node_checkpoint "https://github.com/yahya-tech-ai/saro/blob/main/aro-mini/aro_mini_v0_1.pt"

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_frontend,node_user toneBlue
class node_chat_api,node_config_api,node_status_api,node_chats_api,node_chat_item_api,node_turns_api,node_aro_route toneAmber
class node_modes,node_config,node_store,node_db toneMint
class node_aro_server,node_aro_model toneRose
class node_provider,node_checkpoint toneIndigo
```

## Components

### Workspace UI

- [Saro workspace](https://github.com/yahya-tech-ai/saro/blob/main/app/page.tsx): `app/page.tsx`

### Workspace API

- [Chat streaming](https://github.com/yahya-tech-ai/saro/blob/main/app/api/chat/route.ts): `app/api/chat/route.ts`
- [Model settings API](https://github.com/yahya-tech-ai/saro/blob/main/app/api/config/route.ts): `app/api/config/route.ts`
- [Provider status API](https://github.com/yahya-tech-ai/saro/blob/main/app/api/status/route.ts): `app/api/status/route.ts`
- [Chat listing API](https://github.com/yahya-tech-ai/saro/blob/main/app/api/chats/route.ts): `app/api/chats/route.ts`
- [Chat detail API](https://github.com/yahya-tech-ai/saro/blob/main/app/api/chats/%5Bid%5D/route.ts): `app/api/chats/[id]/route.ts`
- [Turn save API](https://github.com/yahya-tech-ai/saro/blob/main/app/api/turns/route.ts): `app/api/turns/route.ts`
- [Aro Mini route](https://github.com/yahya-tech-ai/saro/blob/main/app/api/aro-mini/route.ts): `app/api/aro-mini/route.ts`

### Configuration and chat state

- [Mode prompts](https://github.com/yahya-tech-ai/saro/blob/main/lib/modes.ts): `lib/modes.ts`
- [Provider configuration](https://github.com/yahya-tech-ai/saro/blob/main/lib/config.ts): `lib/config.ts`
- [Chat and message store](https://github.com/yahya-tech-ai/saro/blob/main/lib/store.ts): `lib/store.ts`
- [SQLite database](https://github.com/yahya-tech-ai/saro/blob/main/lib/db.ts): `lib/db.ts`

### Aro Mini inference

- [Inference API server](https://github.com/yahya-tech-ai/saro/blob/main/aro-mini/server.py): `aro-mini/server.py`
- [Transformer generation](https://github.com/yahya-tech-ai/saro/blob/main/aro-mini/model.py): `aro-mini/model.py`

### Other components

- **Workspace user**
- **External model provider**
- [Model checkpoint](https://github.com/yahya-tech-ai/saro/blob/main/aro-mini/aro_mini_v0_1.pt): `aro-mini/aro_mini_v0_1.pt`

## Connections

- Workspace user → Saro workspace: uses (evidence: `README.md`)
- Chat streaming → Provider configuration: reads settings (evidence: `app/api/chat/route.ts`)
- Chat streaming → Mode prompts: builds prompt (evidence: `app/api/chat/route.ts`)
- Chat streaming → Chat and message store: loads and saves (evidence: `app/api/chat/route.ts`)
- Chat streaming → External model provider: requests completion (evidence: `app/api/chat/route.ts`)
- Model settings API → Provider configuration: reads and saves (evidence: `app/api/config/route.ts`)
- Provider status API → Provider configuration: reads settings (evidence: `app/api/status/route.ts`)
- Chat listing API → Chat and message store: lists chats (evidence: `app/api/chats/route.ts`)
- Chat detail API → Chat and message store: reads and deletes (evidence: `app/api/chats/[id]/route.ts`)
- Turn save API → Mode prompts: parses modes (evidence: `app/api/turns/route.ts`)
- Turn save API → Chat and message store: saves turns (evidence: `app/api/turns/route.ts`)
- Chat and message store → SQLite database: queries (evidence: `lib/store.ts`)
- Chat and message store → Mode prompts: normalizes modes (evidence: `lib/store.ts`)
- Inference API server → Transformer generation: loads and generates (evidence: `aro-mini/server.py`)
- Transformer generation → Model checkpoint: loads weights (evidence: `aro-mini/model.py`)
