# vancci-sloth/sloth architecture

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

- Interactive diagram: https://gitdiagram.com/vancci-sloth/sloth
- Repository: https://github.com/vancci-sloth/sloth

## Overview

Sloth is a desktop-first AI video production app, with web and Android clients. The main workflow selects a style, researches a topic or link, writes a script, creates voice and scenes, renders locally, then delivers a video for download or publishing. The graph preserves README-documented features including social publishing, image/clip creation, voice, and subtitles. Relationship evidence is limited to the supplied excerpts, SOURCE INDEX references, and README; unsampled implementations are represented by their documented source paths.

Main entry points: [`server/etapas.ts`](https://github.com/vancci-sloth/sloth/blob/main/server/etapas.ts) (Production stages), [`server/agent.ts`](https://github.com/vancci-sloth/sloth/blob/main/server/agent.ts) (Agent sessions), [`server/index.ts`](https://github.com/vancci-sloth/sloth/blob/main/server/index.ts) (Server API), [`web/src/App.tsx`](https://github.com/vancci-sloth/sloth/blob/main/web/src/App.tsx) (Desktop studio)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_desktop["Desktop studio<br/>[App.tsx]"]
  node_electron["Desktop shell<br/>[main.ts]"]
  node_mobile["Android app<br/>[App.tsx]"]
end

subgraph group_production["Video production"]
  node_stages["Production stages<br/>[etapas.ts]"]
  node_research["Idea research<br/>[index.ts]"]
  node_workspace[("Project files<br/>[disco.ts]")]
  node_render["Video rendering<br/>[motor.ts]"]
end

subgraph group_runtime["Agent runtime"]
  node_api["Server API<br/>[index.ts]"]
  node_agent["Agent sessions<br/>[agent.ts]"]
  node_providers["AI providers<br/>[providers.ts]"]
  node_claude["Claude integration<br/>[claude.ts]"]
  node_codex["Codex integration<br/>[codex.ts]"]
  node_opencode["OpenCode integration<br/>[opencode.ts]"]
end

subgraph group_media["Media features"]
  node_flow["Flow media<br/>[index.ts]"]
  node_voice["Voice generation<br/>[index.ts]"]
  node_subtitles["Local subtitles<br/>[subtitulos.ts]"]
  node_images["Image studio<br/>[imagen-codex.ts]"]
end

subgraph group_platform["Connected services"]
  node_publishing["Social publishing<br/>[index.ts]"]
  node_youtube["YouTube workflow<br/>[youtube.ts]"]
  node_license["Licensing service<br/>[index.ts]"]
end

node_creator(("Creator"))

node_creator -->|"chooses style"| node_desktop
node_desktop -->|"requests work"| node_api
node_api -->|"coordinates phases"| node_stages
node_stages -->|"starts research"| node_research
node_stages -->|"runs agent"| node_agent
node_agent -->|"selects model"| node_providers
node_agent -.->|"dispatches to"| node_claude
node_agent -.->|"dispatches to"| node_codex
node_agent -.->|"dispatches to"| node_opencode
node_stages -->|"stores project"| node_workspace
node_stages -->|"renders scenes"| node_render
node_creator -->|"uses companion"| node_mobile
node_mobile -->|"requests computer work"| node_api
node_stages -.->|"creates clips"| node_flow
node_stages -->|"generates narration"| node_voice
node_stages -->|"adds subtitles"| node_subtitles
node_creator -->|"requests images"| node_images
node_creator -->|"publishes video"| node_publishing
node_publishing -.->|"publishes to YouTube"| node_youtube
node_desktop -->|"manages license"| node_license
node_electron -.->|"hosts desktop app"| node_api

click node_desktop "https://github.com/vancci-sloth/sloth/blob/main/web/src/App.tsx"
click node_electron "https://github.com/vancci-sloth/sloth/blob/main/electron/main.ts"
click node_mobile "https://github.com/vancci-sloth/sloth/blob/main/movil/src/App.tsx"
click node_api "https://github.com/vancci-sloth/sloth/blob/main/server/index.ts"
click node_stages "https://github.com/vancci-sloth/sloth/blob/main/server/etapas.ts"
click node_research "https://github.com/vancci-sloth/sloth/blob/main/server/ideas/index.ts"
click node_agent "https://github.com/vancci-sloth/sloth/blob/main/server/agent.ts"
click node_providers "https://github.com/vancci-sloth/sloth/blob/main/shared/providers.ts"
click node_claude "https://github.com/vancci-sloth/sloth/blob/main/server/claude.ts"
click node_codex "https://github.com/vancci-sloth/sloth/blob/main/server/codex.ts"
click node_opencode "https://github.com/vancci-sloth/sloth/blob/main/server/opencode.ts"
click node_workspace "https://github.com/vancci-sloth/sloth/blob/main/server/disco.ts"
click node_render "https://github.com/vancci-sloth/sloth/blob/main/server/motor.ts"
click node_flow "https://github.com/vancci-sloth/sloth/blob/main/server/flow/index.ts"
click node_voice "https://github.com/vancci-sloth/sloth/blob/main/server/voz/index.ts"
click node_subtitles "https://github.com/vancci-sloth/sloth/blob/main/server/subtitulos.ts"
click node_images "https://github.com/vancci-sloth/sloth/blob/main/server/imagen-codex.ts"
click node_publishing "https://github.com/vancci-sloth/sloth/blob/main/server/redes/index.ts"
click node_youtube "https://github.com/vancci-sloth/sloth/blob/main/server/youtube.ts"
click node_license "https://github.com/vancci-sloth/sloth/blob/main/licencias/src/index.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_desktop,node_electron,node_mobile toneBlue
class node_stages,node_research,node_workspace,node_render toneAmber
class node_api,node_agent,node_providers,node_claude,node_codex,node_opencode toneMint
class node_flow,node_voice,node_subtitles,node_images toneRose
class node_publishing,node_youtube,node_license,node_creator toneIndigo
```

## Components

### User clients

- [Desktop studio](https://github.com/vancci-sloth/sloth/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Desktop shell](https://github.com/vancci-sloth/sloth/blob/main/electron/main.ts): `electron/main.ts`
- [Android app](https://github.com/vancci-sloth/sloth/blob/main/movil/src/App.tsx): `movil/src/App.tsx`

### Video production

- [Production stages](https://github.com/vancci-sloth/sloth/blob/main/server/etapas.ts): `server/etapas.ts`
- [Idea research](https://github.com/vancci-sloth/sloth/blob/main/server/ideas/index.ts): `server/ideas/index.ts`
- [Project files](https://github.com/vancci-sloth/sloth/blob/main/server/disco.ts): `server/disco.ts`
- [Video rendering](https://github.com/vancci-sloth/sloth/blob/main/server/motor.ts): `server/motor.ts`

### Agent runtime

- [Server API](https://github.com/vancci-sloth/sloth/blob/main/server/index.ts): `server/index.ts`
- [Agent sessions](https://github.com/vancci-sloth/sloth/blob/main/server/agent.ts): `server/agent.ts`
- [AI providers](https://github.com/vancci-sloth/sloth/blob/main/shared/providers.ts): `shared/providers.ts`
- [Claude integration](https://github.com/vancci-sloth/sloth/blob/main/server/claude.ts): `server/claude.ts`
- [Codex integration](https://github.com/vancci-sloth/sloth/blob/main/server/codex.ts): `server/codex.ts`
- [OpenCode integration](https://github.com/vancci-sloth/sloth/blob/main/server/opencode.ts): `server/opencode.ts`

### Media features

- [Flow media](https://github.com/vancci-sloth/sloth/blob/main/server/flow/index.ts): `server/flow/index.ts`
- [Voice generation](https://github.com/vancci-sloth/sloth/blob/main/server/voz/index.ts): `server/voz/index.ts`
- [Local subtitles](https://github.com/vancci-sloth/sloth/blob/main/server/subtitulos.ts): `server/subtitulos.ts`
- [Image studio](https://github.com/vancci-sloth/sloth/blob/main/server/imagen-codex.ts): `server/imagen-codex.ts`

### Connected services

- [Social publishing](https://github.com/vancci-sloth/sloth/blob/main/server/redes/index.ts): `server/redes/index.ts`
- [YouTube workflow](https://github.com/vancci-sloth/sloth/blob/main/server/youtube.ts): `server/youtube.ts`
- [Licensing service](https://github.com/vancci-sloth/sloth/blob/main/licencias/src/index.ts): `licencias/src/index.ts`

### Other components

- **Creator**

## Connections

- Creator → Desktop studio: chooses style
- Desktop studio → Server API: requests work (evidence: `web/src/App.tsx`)
- Server API → Production stages: coordinates phases (evidence: `server/index.ts`)
- Production stages → Idea research: starts research (evidence: `server/etapas.ts`)
- Production stages → Agent sessions: runs agent (evidence: `server/etapas.ts`)
- Agent sessions → AI providers: selects model (evidence: `shared/providers.ts`)
- Agent sessions → Claude integration: dispatches to
- Agent sessions → Codex integration: dispatches to
- Agent sessions → OpenCode integration: dispatches to
- Production stages → Project files: stores project (evidence: `server/etapas.ts`)
- Production stages → Video rendering: renders scenes (evidence: `server/etapas.ts`)
- Creator → Android app: uses companion
- Android app → Server API: requests computer work (evidence: `movil/src/App.tsx`)
- Production stages → Flow media: creates clips
- Production stages → Voice generation: generates narration
- Production stages → Local subtitles: adds subtitles
- Creator → Image studio: requests images
- Creator → Social publishing: publishes video
- Social publishing → YouTube workflow: publishes to YouTube
- Desktop studio → Licensing service: manages license
- Desktop shell → Server API: hosts desktop app
