# sannongwangluo/tatai architecture

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

- Interactive diagram: https://gitdiagram.com/sannongwangluo/tatai
- Repository: https://github.com/sannongwangluo/tatai

## Overview

Tatai is a local-first desktop workbench for coordinating AI coding agents around shared project intent, plans, task progress, and verifiable evidence. A user works through the desktop UI or an agent through the stdio MCP server; both access project data, while migrated work-state writes go through one service into an event ledger. The product also provides architecture views, design/chat assistance, project monitoring, and backup/restore. README documents several capabilities whose implementation was not sampled; their wiring is shown only where documented, and the graph omits uncertain internal links.

Main entry points: [`src/server/index.ts`](https://github.com/sannongwangluo/tatai/blob/main/src/server/index.ts) (Local HTTP server), [`src/ui/App.tsx`](https://github.com/sannongwangluo/tatai/blob/main/src/ui/App.tsx) (Tatai desktop UI), [`src/server/work/service.ts`](https://github.com/sannongwangluo/tatai/blob/main/src/server/work/service.ts) (Work service), [`src/mcp/server.ts`](https://github.com/sannongwangluo/tatai/blob/main/src/mcp/server.ts) (MCP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User Interfaces"]
  node_desktop["Tatai desktop UI<br/>[App.tsx]"]
  node_tauri["Tauri shell<br/>[main.rs]"]
  node_http["Local HTTP server<br/>[index.ts]"]
  node_designui["Design and plan UI<br/>[DesignView.tsx]"]
  node_chatui["Project chat UI<br/>[ChatView.tsx]"]
end

subgraph group_coordination["Agent Coordination"]
  node_mcp["MCP server<br/>[server.ts]"]
  node_tools["MCP tools<br/>[index.ts]"]
end

subgraph group_work["Project Work Ledger"]
  node_workbench["Work service<br/>[service.ts]"]
  node_eventstore[("Event ledger<br/>[eventStore.ts]")]
  node_taskstate["Task state<br/>[tasks.ts]"]
  node_workdomain["Work domains"]
end

subgraph group_architecture["Architecture Views"]
  node_archparse["Static architecture parser<br/>[parse.ts]"]
  node_archmodels["Architecture model<br/>[blueprint.ts]"]
  node_archviews["Architecture views"]
end

subgraph group_support["Project Services"]
  node_projectdata[("Project files<br/>[workstation.ts]")]
  node_registry[("Project registry<br/>[registry.ts]")]
  node_chat["Chat and tools<br/>[chat.ts]"]
  node_reverse["Reverse design drafts<br/>[reverseDraft.ts]"]
  node_monitor["Live monitoring<br/>[live.ts]"]
  node_backup["Backup and restore<br/>[backup.ts]"]
end

node_person(("Project user"))
node_agent(("Coding agent"))
node_model(("Configured model service"))
node_filesystem[("Local project filesystem")]

node_person -->|"uses"| node_desktop
node_desktop -->|"calls API"| node_http
node_tauri -->|"hosts UI"| node_desktop
node_tauri -->|"starts service"| node_http
node_agent -->|"calls tools"| node_mcp
node_mcp -->|"dispatches"| node_tools
node_tools -->|"submits writes"| node_workbench
node_http -->|"submits writes"| node_workbench
node_workbench -->|"appends events"| node_eventstore
node_workbench -->|"projects state"| node_eventstore
node_taskstate -->|"reads events"| node_eventstore
node_http -->|"reads projects"| node_registry
node_mcp -->|"resolves data"| node_registry
node_http -->|"serves work APIs"| node_workdomain
node_tools -->|"reads work data"| node_workdomain
node_desktop -->|"shows graphs"| node_archviews
node_http -->|"starts parsing"| node_archparse
node_archparse -->|"builds graph"| node_archmodels
node_archviews -->|"reads graph data"| node_http
node_desktop -->|"shows design"| node_designui
node_desktop -->|"shows chat"| node_chatui
node_chatui -->|"sends turns"| node_http
node_http -->|"handles turns"| node_chat
node_chat -.->|"requests completion"| node_model
node_http -->|"requests draft"| node_reverse
node_reverse -.->|"requests draft"| node_model
node_http -->|"serves live state"| node_monitor
node_http -->|"handles backup"| node_backup
node_backup -->|"backs up privately"| node_filesystem
node_workdomain -->|"reads project data"| node_projectdata
node_projectdata -->|"reads and writes"| node_filesystem

click node_desktop "https://github.com/sannongwangluo/tatai/blob/main/src/ui/App.tsx"
click node_tauri "https://github.com/sannongwangluo/tatai/blob/main/src-tauri/src/main.rs"
click node_http "https://github.com/sannongwangluo/tatai/blob/main/src/server/index.ts"
click node_mcp "https://github.com/sannongwangluo/tatai/blob/main/src/mcp/server.ts"
click node_tools "https://github.com/sannongwangluo/tatai/blob/main/src/mcp/tools/index.ts"
click node_workbench "https://github.com/sannongwangluo/tatai/blob/main/src/server/work/service.ts"
click node_eventstore "https://github.com/sannongwangluo/tatai/blob/main/src/server/work/eventStore.ts"
click node_taskstate "https://github.com/sannongwangluo/tatai/blob/main/src/server/work/tasks.ts"
click node_workdomain "https://github.com/sannongwangluo/tatai/tree/main/src/server/work"
click node_projectdata "https://github.com/sannongwangluo/tatai/blob/main/src/server/workstation.ts"
click node_registry "https://github.com/sannongwangluo/tatai/blob/main/src/server/registry.ts"
click node_archparse "https://github.com/sannongwangluo/tatai/blob/main/src/arch/parse.ts"
click node_archmodels "https://github.com/sannongwangluo/tatai/blob/main/src/arch/blueprint.ts"
click node_archviews "https://github.com/sannongwangluo/tatai/blob/main/src/ui/arch/ProjectGraphView.tsx"
click node_designui "https://github.com/sannongwangluo/tatai/blob/main/src/ui/components/DesignView.tsx"
click node_chatui "https://github.com/sannongwangluo/tatai/blob/main/src/ui/components/ChatView.tsx"
click node_chat "https://github.com/sannongwangluo/tatai/blob/main/src/server/chat.ts"
click node_reverse "https://github.com/sannongwangluo/tatai/blob/main/src/server/reverseDraft.ts"
click node_monitor "https://github.com/sannongwangluo/tatai/blob/main/src/server/live.ts"
click node_backup "https://github.com/sannongwangluo/tatai/blob/main/src/server/work/backup.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_tauri,node_http,node_designui,node_chatui,node_person toneBlue
class node_mcp,node_tools,node_filesystem toneAmber
class node_workbench,node_eventstore,node_taskstate,node_workdomain toneMint
class node_archparse,node_archmodels,node_archviews toneRose
class node_projectdata,node_registry,node_chat,node_reverse,node_monitor,node_backup,node_agent,node_model toneIndigo
```

## Components

### User Interfaces

- [Tatai desktop UI](https://github.com/sannongwangluo/tatai/blob/main/src/ui/App.tsx): `src/ui/App.tsx`
- [Tauri shell](https://github.com/sannongwangluo/tatai/blob/main/src-tauri/src/main.rs): `src-tauri/src/main.rs`
- [Local HTTP server](https://github.com/sannongwangluo/tatai/blob/main/src/server/index.ts): `src/server/index.ts`
- [Design and plan UI](https://github.com/sannongwangluo/tatai/blob/main/src/ui/components/DesignView.tsx): `src/ui/components/DesignView.tsx`
- [Project chat UI](https://github.com/sannongwangluo/tatai/blob/main/src/ui/components/ChatView.tsx): `src/ui/components/ChatView.tsx`

### Agent Coordination

- [MCP server](https://github.com/sannongwangluo/tatai/blob/main/src/mcp/server.ts): `src/mcp/server.ts`
- [MCP tools](https://github.com/sannongwangluo/tatai/blob/main/src/mcp/tools/index.ts): `src/mcp/tools/index.ts`

### Project Work Ledger

- [Work service](https://github.com/sannongwangluo/tatai/blob/main/src/server/work/service.ts): `src/server/work/service.ts`
- [Event ledger](https://github.com/sannongwangluo/tatai/blob/main/src/server/work/eventStore.ts): `src/server/work/eventStore.ts`
- [Task state](https://github.com/sannongwangluo/tatai/blob/main/src/server/work/tasks.ts): `src/server/work/tasks.ts`
- [Work domains](https://github.com/sannongwangluo/tatai/tree/main/src/server/work): `src/server/work`

### Architecture Views

- [Static architecture parser](https://github.com/sannongwangluo/tatai/blob/main/src/arch/parse.ts): `src/arch/parse.ts`
- [Architecture model](https://github.com/sannongwangluo/tatai/blob/main/src/arch/blueprint.ts): `src/arch/blueprint.ts`
- [Architecture views](https://github.com/sannongwangluo/tatai/blob/main/src/ui/arch/ProjectGraphView.tsx): `src/ui/arch/ProjectGraphView.tsx`

### Project Services

- [Project files](https://github.com/sannongwangluo/tatai/blob/main/src/server/workstation.ts): `src/server/workstation.ts`
- [Project registry](https://github.com/sannongwangluo/tatai/blob/main/src/server/registry.ts): `src/server/registry.ts`
- [Chat and tools](https://github.com/sannongwangluo/tatai/blob/main/src/server/chat.ts): `src/server/chat.ts`
- [Reverse design drafts](https://github.com/sannongwangluo/tatai/blob/main/src/server/reverseDraft.ts): `src/server/reverseDraft.ts`
- [Live monitoring](https://github.com/sannongwangluo/tatai/blob/main/src/server/live.ts): `src/server/live.ts`
- [Backup and restore](https://github.com/sannongwangluo/tatai/blob/main/src/server/work/backup.ts): `src/server/work/backup.ts`

### Other components

- **Project user**
- **Coding agent**
- **Configured model service**
- **Local project filesystem**

## Connections

- Project user → Tatai desktop UI: uses
- Tatai desktop UI → Local HTTP server: calls API
- Tauri shell → Tatai desktop UI: hosts UI
- Tauri shell → Local HTTP server: starts service
- Coding agent → MCP server: calls tools
- MCP server → MCP tools: dispatches
- MCP tools → Work service: submits writes
- Local HTTP server → Work service: submits writes
- Work service → Event ledger: appends events
- Work service → Event ledger: projects state
- Task state → Event ledger: reads events
- Local HTTP server → Project registry: reads projects
- MCP server → Project registry: resolves data
- Local HTTP server → Work domains: serves work APIs
- MCP tools → Work domains: reads work data
- Tatai desktop UI → Architecture views: shows graphs
- Local HTTP server → Static architecture parser: starts parsing
- Static architecture parser → Architecture model: builds graph
- Architecture views → Local HTTP server: reads graph data
- Tatai desktop UI → Design and plan UI: shows design
- Tatai desktop UI → Project chat UI: shows chat
- Project chat UI → Local HTTP server: sends turns
- Local HTTP server → Chat and tools: handles turns
- Chat and tools → Configured model service: requests completion
- Local HTTP server → Reverse design drafts: requests draft
- Reverse design drafts → Configured model service: requests draft
- Local HTTP server → Live monitoring: serves live state
- Local HTTP server → Backup and restore: handles backup
- Backup and restore → Local project filesystem: backs up privately
- Work domains → Project files: reads project data
- Project files → Local project filesystem: reads and writes
