# rociiu/talorys architecture

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

- Interactive diagram: https://gitdiagram.com/rociiu/talorys
- Repository: https://github.com/rociiu/talorys

## Overview

Talorys is a private, single-owner AI assistant deployed in the owner’s Cloudflare account. The main workflow is browser chat through the Pages API proxy into the private agent, which uses Workers AI and stored conversation context to return streaming responses. The product also manages memories and optional semantic recall, tasks, notes, scheduled automations, authentication, and push notifications. The graph combines README-documented deployment and capabilities with sampled routing and service references; several internal domain links are dashed where implementation excerpts were unavailable.

Main entry points: [`apps/agent/src/agent/talorys-agent.ts`](https://github.com/rociiu/talorys/blob/main/apps/agent/src/agent/talorys-agent.ts) (Durable Object agent), [`apps/agent/src/api/app.ts`](https://github.com/rociiu/talorys/blob/main/apps/agent/src/api/app.ts) (HTTP API router), [`apps/web/src/App.tsx`](https://github.com/rociiu/talorys/blob/main/apps/web/src/App.tsx) (Browser app), [`apps/web/src/lib/api.ts`](https://github.com/rociiu/talorys/blob/main/apps/web/src/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_browser["Browser app<br/>[App.tsx]"]
  node_webapi["API client<br/>[api.ts]"]
  node_pagesproxy["Pages API proxy<br/>[&#91;&#91;path&#93;&#93;.ts]"]
end

subgraph group_runtime["Private agent runtime"]
  node_router["HTTP API router<br/>[app.ts]"]
  node_auth["Authentication<br/>[auth-service.ts]"]
  node_chat["Chat routes<br/>[chat.ts]"]
  node_agent["Durable Object agent<br/>[talorys-agent.ts]"]
end

subgraph group_domains["Assistant capabilities"]
  node_memory["Memory lifecycle<br/>[service.ts]"]
  node_semantic["Semantic recall<br/>[routes.ts]"]
  node_tasks["Tasks and notes<br/>[data.ts]"]
  node_automations["Automations<br/>[automations.ts]"]
  node_scheduling["Alarm scheduling<br/>[scheduling.ts]"]
  node_push["Push notifications<br/>[service.ts]"]
end

subgraph group_platform["Persistence and services"]
  node_model["Workers AI<br/>[workers-ai.ts]"]
  node_conversations["Conversation data<br/>[conversations.ts]"]
  node_database[("SQLite storage<br/>[database.ts]")]
  node_vectors[("Vector store<br/>[vectorStore.ts]")]
  node_settings["Settings and usage<br/>[settings.ts]"]
end

node_owner(("Owner"))

node_owner -->|"uses"| node_browser
node_browser -->|"requests"| node_webapi
node_webapi -->|"forwards API"| node_pagesproxy
node_pagesproxy -->|"service binding"| node_router
node_router -.->|"guards routes"| node_auth
node_router -->|"routes chat"| node_chat
node_router -->|"runs within agent"| node_agent
node_chat -.->|"handles turns"| node_agent
node_agent -->|"requests inference"| node_model
node_agent -.->|"loads history"| node_conversations
node_conversations -.->|"reads and writes"| node_database
node_agent -.->|"uses memories"| node_memory
node_memory -->|"updates vectors"| node_vectors
node_semantic -->|"queries vectors"| node_vectors
node_router -->|"routes recall"| node_semantic
node_router -->|"routes data"| node_tasks
node_router -->|"routes automation"| node_automations
node_automations -.->|"schedules alarms"| node_scheduling
node_agent -->|"runs alarms"| node_scheduling
node_agent -.->|"sends notifications"| node_push
node_agent -->|"stores product data"| node_database
node_agent -.->|"uses configuration"| node_settings

click node_browser "https://github.com/rociiu/talorys/blob/main/apps/web/src/App.tsx"
click node_webapi "https://github.com/rociiu/talorys/blob/main/apps/web/src/lib/api.ts"
click node_pagesproxy "https://github.com/rociiu/talorys/blob/main/apps/web/functions/api/%5B%5Bpath%5D%5D.ts"
click node_router "https://github.com/rociiu/talorys/blob/main/apps/agent/src/api/app.ts"
click node_auth "https://github.com/rociiu/talorys/blob/main/apps/agent/src/auth/auth-service.ts"
click node_chat "https://github.com/rociiu/talorys/blob/main/apps/agent/src/api/routes/chat.ts"
click node_agent "https://github.com/rociiu/talorys/blob/main/apps/agent/src/agent/talorys-agent.ts"
click node_model "https://github.com/rociiu/talorys/blob/main/apps/agent/src/ai/workers-ai.ts"
click node_conversations "https://github.com/rociiu/talorys/blob/main/apps/agent/src/db/repositories/conversations.ts"
click node_database "https://github.com/rociiu/talorys/blob/main/apps/agent/src/db/database.ts"
click node_memory "https://github.com/rociiu/talorys/blob/main/apps/agent/src/memory/service.ts"
click node_semantic "https://github.com/rociiu/talorys/blob/main/apps/agent/src/semantic/routes.ts"
click node_vectors "https://github.com/rociiu/talorys/blob/main/apps/agent/src/semantic/vectorStore.ts"
click node_tasks "https://github.com/rociiu/talorys/blob/main/apps/agent/src/api/routes/data.ts"
click node_automations "https://github.com/rociiu/talorys/blob/main/apps/agent/src/api/routes/automations.ts"
click node_scheduling "https://github.com/rociiu/talorys/blob/main/apps/agent/src/agent/scheduling.ts"
click node_push "https://github.com/rociiu/talorys/blob/main/apps/agent/src/push/service.ts"
click node_settings "https://github.com/rociiu/talorys/blob/main/apps/agent/src/services/settings.ts"

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_browser,node_webapi,node_pagesproxy toneBlue
class node_router,node_auth,node_chat,node_agent toneAmber
class node_memory,node_semantic,node_tasks,node_automations,node_scheduling,node_push toneMint
class node_model,node_conversations,node_database,node_vectors,node_settings toneRose
class node_owner toneIndigo
```

## Components

### Web experience

- [Browser app](https://github.com/rociiu/talorys/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [API client](https://github.com/rociiu/talorys/blob/main/apps/web/src/lib/api.ts): `apps/web/src/lib/api.ts`
- [Pages API proxy](https://github.com/rociiu/talorys/blob/main/apps/web/functions/api/%5B%5Bpath%5D%5D.ts): `apps/web/functions/api/[[path]].ts`

### Private agent runtime

- [HTTP API router](https://github.com/rociiu/talorys/blob/main/apps/agent/src/api/app.ts): `apps/agent/src/api/app.ts`
- [Authentication](https://github.com/rociiu/talorys/blob/main/apps/agent/src/auth/auth-service.ts): `apps/agent/src/auth/auth-service.ts`
- [Chat routes](https://github.com/rociiu/talorys/blob/main/apps/agent/src/api/routes/chat.ts): `apps/agent/src/api/routes/chat.ts`
- [Durable Object agent](https://github.com/rociiu/talorys/blob/main/apps/agent/src/agent/talorys-agent.ts): `apps/agent/src/agent/talorys-agent.ts`

### Assistant capabilities

- [Memory lifecycle](https://github.com/rociiu/talorys/blob/main/apps/agent/src/memory/service.ts): `apps/agent/src/memory/service.ts`
- [Semantic recall](https://github.com/rociiu/talorys/blob/main/apps/agent/src/semantic/routes.ts): `apps/agent/src/semantic/routes.ts`
- [Tasks and notes](https://github.com/rociiu/talorys/blob/main/apps/agent/src/api/routes/data.ts): `apps/agent/src/api/routes/data.ts`
- [Automations](https://github.com/rociiu/talorys/blob/main/apps/agent/src/api/routes/automations.ts): `apps/agent/src/api/routes/automations.ts`
- [Alarm scheduling](https://github.com/rociiu/talorys/blob/main/apps/agent/src/agent/scheduling.ts): `apps/agent/src/agent/scheduling.ts`
- [Push notifications](https://github.com/rociiu/talorys/blob/main/apps/agent/src/push/service.ts): `apps/agent/src/push/service.ts`

### Persistence and services

- [Workers AI](https://github.com/rociiu/talorys/blob/main/apps/agent/src/ai/workers-ai.ts): `apps/agent/src/ai/workers-ai.ts`
- [Conversation data](https://github.com/rociiu/talorys/blob/main/apps/agent/src/db/repositories/conversations.ts): `apps/agent/src/db/repositories/conversations.ts`
- [SQLite storage](https://github.com/rociiu/talorys/blob/main/apps/agent/src/db/database.ts): `apps/agent/src/db/database.ts`
- [Vector store](https://github.com/rociiu/talorys/blob/main/apps/agent/src/semantic/vectorStore.ts): `apps/agent/src/semantic/vectorStore.ts`
- [Settings and usage](https://github.com/rociiu/talorys/blob/main/apps/agent/src/services/settings.ts): `apps/agent/src/services/settings.ts`

### Other components

- **Owner**

## Connections

- Owner → Browser app: uses
- Browser app → API client: requests
- API client → Pages API proxy: forwards API
- Pages API proxy → HTTP API router: service binding
- HTTP API router → Authentication: guards routes
- HTTP API router → Chat routes: routes chat (evidence: `apps/agent/src/api/app.ts`)
- HTTP API router → Durable Object agent: runs within agent (evidence: `apps/agent/src/api/app.ts`)
- Chat routes → Durable Object agent: handles turns
- Durable Object agent → Workers AI: requests inference
- Durable Object agent → Conversation data: loads history
- Conversation data → SQLite storage: reads and writes
- Durable Object agent → Memory lifecycle: uses memories
- Memory lifecycle → Vector store: updates vectors (evidence: `apps/agent/src/memory/service.ts`)
- Semantic recall → Vector store: queries vectors (evidence: `apps/agent/src/semantic/routes.ts`)
- HTTP API router → Semantic recall: routes recall (evidence: `apps/agent/src/api/app.ts`)
- HTTP API router → Tasks and notes: routes data (evidence: `apps/agent/src/api/app.ts`)
- HTTP API router → Automations: routes automation (evidence: `apps/agent/src/api/app.ts`)
- Automations → Alarm scheduling: schedules alarms
- Durable Object agent → Alarm scheduling: runs alarms
- Durable Object agent → Push notifications: sends notifications
- Durable Object agent → SQLite storage: stores product data
- Durable Object agent → Settings and usage: uses configuration
