# npl1228/treamai architecture

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

- Interactive diagram: https://gitdiagram.com/npl1228/treamai
- Repository: https://github.com/npl1228/treamai

## Overview

TreamAI is a chat collaboration application with an AI agent that stores team knowledge and answers questions from it. Users enter through the web client, authenticate and navigate chats, then send messages; the backend routes messages to ordinary chat handling or private-agent intent classification, retrieval, and response generation. Team messages also feed buffered summarization and memory storage, while pruning maintains that memory. The graph preserves documented social, notification, meeting, and account areas, but their backend wiring is not fully visible in the excerpts; dashed edges mark those evidence limits.

Main entry points: [`frontend/src/App.jsx`](https://github.com/npl1228/treamai/blob/main/frontend/src/App.jsx) (Route shell), [`backend/bot.py`](https://github.com/npl1228/treamai/blob/main/backend/bot.py) (Message dispatcher), [`backend/pipelines/private_agent_pipeline.py`](https://github.com/npl1228/treamai/blob/main/backend/pipelines/private_agent_pipeline.py) (Private agent intent), [`backend/pipelines/storage_pipeline.py`](https://github.com/npl1228/treamai/blob/main/backend/pipelines/storage_pipeline.py) (Message summarization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Route shell<br/>[App.jsx]"]
  node_layout["App navigation<br/>[Layout.jsx]"]
  node_landing["Landing<br/>[Landing.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_chatroom["Chat room<br/>[ChatRoom.jsx]"]
  node_chatlist["Chat list<br/>[ChatList.jsx]"]
  node_chatinfo["Chat details<br/>[ChatInfo.jsx]"]
  node_friends["Friends<br/>[FriendsList.jsx]"]
  node_notifications["Notifications<br/>[Notifications.jsx]"]
  node_settings["Settings<br/>[Settings.jsx]"]
  node_meeting["Meeting room<br/>[MeetingRoom.jsx]"]
end

subgraph group_server["Backend services"]
  node_backend["HTTP and socket API<br/>[main.py]"]
  node_bot["Message dispatcher<br/>[bot.py]"]
end

subgraph group_agent["AI knowledge workflows"]
  node_private["Private agent intent"]
  node_retrieval["Memory retrieval"]
  node_storagepipe["Message summarization"]
  node_pruning["Memory pruning"]
  node_gemini["Gemini language model<br/>[gemini.py]"]
end

subgraph group_state["Persistent memory"]
  node_sql[("Account and chat data<br/>[storage.py]")]
  node_chroma[("Semantic memory<br/>[chroma.py]")]
end

node_user(("User"))
node_geminisvc{{"Google Gemini API"}}

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_login
node_app -->|"wraps pages"| node_layout
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_chatroom
node_app -->|"routes to"| node_chatlist
node_app -->|"routes to"| node_chatinfo
node_app -->|"routes to"| node_friends
node_app -->|"routes to"| node_notifications
node_app -->|"routes to"| node_settings
node_app -->|"routes to"| node_meeting
node_user -.->|"sends messages"| node_chatroom
node_chatroom -.->|"calls API"| node_backend
node_backend -->|"reads and writes"| node_sql
node_backend -->|"dispatches messages"| node_bot
node_bot -->|"reads chat data"| node_sql
node_bot -->|"routes private agent"| node_private
node_bot -->|"routes queries"| node_retrieval
node_bot -->|"routes storage"| node_storagepipe
node_private -->|"routes queries"| node_retrieval
node_private -->|"loads projects"| node_sql
node_private -->|"stores and corrects nodes"| node_chroma
node_private -->|"classifies intent"| node_gemini
node_retrieval -->|"loads weights"| node_sql
node_retrieval -->|"searches and updates"| node_chroma
node_retrieval -->|"generates response"| node_gemini
node_storagepipe -->|"buffers messages"| node_sql
node_storagepipe -->|"summarizes messages"| node_gemini
node_storagepipe -->|"stores nodes"| node_chroma
node_storagepipe -->|"triggers check"| node_pruning
node_pruning -->|"reads and deletes"| node_chroma
node_gemini -->|"generates content"| node_geminisvc
node_layout -.->|"shows chats"| node_chatlist
node_layout -.->|"links notifications"| node_notifications
node_user -.->|"manages contacts"| node_friends
node_user -.->|"joins meetings"| node_meeting

click node_app "https://github.com/npl1228/treamai/blob/main/frontend/src/App.jsx"
click node_layout "https://github.com/npl1228/treamai/blob/main/frontend/src/components/Layout.jsx"
click node_landing "https://github.com/npl1228/treamai/blob/main/frontend/src/pages/Landing.jsx"
click node_login "https://github.com/npl1228/treamai/blob/main/frontend/src/pages/Login.jsx"
click node_dashboard "https://github.com/npl1228/treamai/blob/main/frontend/src/pages/Dashboard.jsx"
click node_chatroom "https://github.com/npl1228/treamai/blob/main/frontend/src/pages/ChatRoom.jsx"
click node_chatlist "https://github.com/npl1228/treamai/blob/main/frontend/src/pages/ChatList.jsx"
click node_chatinfo "https://github.com/npl1228/treamai/blob/main/frontend/src/pages/ChatInfo.jsx"
click node_friends "https://github.com/npl1228/treamai/blob/main/frontend/src/pages/FriendsList.jsx"
click node_notifications "https://github.com/npl1228/treamai/blob/main/frontend/src/pages/Notifications.jsx"
click node_settings "https://github.com/npl1228/treamai/blob/main/frontend/src/pages/Settings.jsx"
click node_meeting "https://github.com/npl1228/treamai/blob/main/frontend/src/pages/MeetingRoom.jsx"
click node_backend "https://github.com/npl1228/treamai/blob/main/backend/main.py"
click node_sql "https://github.com/npl1228/treamai/blob/main/backend/memory/storage.py"
click node_bot "https://github.com/npl1228/treamai/blob/main/backend/bot.py"
click node_private "https://github.com/npl1228/treamai/blob/main/backend/pipelines/private_agent_pipeline.py"
click node_retrieval "https://github.com/npl1228/treamai/blob/main/backend/pipelines/retrieval_pipeline.py"
click node_storagepipe "https://github.com/npl1228/treamai/blob/main/backend/pipelines/storage_pipeline.py"
click node_pruning "https://github.com/npl1228/treamai/blob/main/backend/pipelines/pruning_pipeline.py"
click node_gemini "https://github.com/npl1228/treamai/blob/main/backend/llm/gemini.py"
click node_chroma "https://github.com/npl1228/treamai/blob/main/backend/memory/chroma.py"

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_app,node_layout,node_landing,node_login,node_dashboard,node_chatroom,node_chatlist,node_chatinfo,node_friends,node_notifications,node_settings,node_meeting,node_user toneBlue
class node_backend,node_bot toneAmber
class node_private,node_retrieval,node_storagepipe,node_pruning,node_gemini,node_geminisvc toneMint
class node_sql,node_chroma toneRose
```

## Components

### Web application

- [Route shell](https://github.com/npl1228/treamai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [App navigation](https://github.com/npl1228/treamai/blob/main/frontend/src/components/Layout.jsx): `frontend/src/components/Layout.jsx`
- [Landing](https://github.com/npl1228/treamai/blob/main/frontend/src/pages/Landing.jsx): `frontend/src/pages/Landing.jsx`
- [Login](https://github.com/npl1228/treamai/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Dashboard](https://github.com/npl1228/treamai/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Chat room](https://github.com/npl1228/treamai/blob/main/frontend/src/pages/ChatRoom.jsx): `frontend/src/pages/ChatRoom.jsx`
- [Chat list](https://github.com/npl1228/treamai/blob/main/frontend/src/pages/ChatList.jsx): `frontend/src/pages/ChatList.jsx`
- [Chat details](https://github.com/npl1228/treamai/blob/main/frontend/src/pages/ChatInfo.jsx): `frontend/src/pages/ChatInfo.jsx`
- [Friends](https://github.com/npl1228/treamai/blob/main/frontend/src/pages/FriendsList.jsx): `frontend/src/pages/FriendsList.jsx`
- [Notifications](https://github.com/npl1228/treamai/blob/main/frontend/src/pages/Notifications.jsx): `frontend/src/pages/Notifications.jsx`
- [Settings](https://github.com/npl1228/treamai/blob/main/frontend/src/pages/Settings.jsx): `frontend/src/pages/Settings.jsx`
- [Meeting room](https://github.com/npl1228/treamai/blob/main/frontend/src/pages/MeetingRoom.jsx): `frontend/src/pages/MeetingRoom.jsx`

### Backend services

- [HTTP and socket API](https://github.com/npl1228/treamai/blob/main/backend/main.py): `backend/main.py`
- [Message dispatcher](https://github.com/npl1228/treamai/blob/main/backend/bot.py): `backend/bot.py`

### AI knowledge workflows

- [Private agent intent](https://github.com/npl1228/treamai/blob/main/backend/pipelines/private_agent_pipeline.py): `backend/pipelines/private_agent_pipeline.py`
- [Memory retrieval](https://github.com/npl1228/treamai/blob/main/backend/pipelines/retrieval_pipeline.py): `backend/pipelines/retrieval_pipeline.py`
- [Message summarization](https://github.com/npl1228/treamai/blob/main/backend/pipelines/storage_pipeline.py): `backend/pipelines/storage_pipeline.py`
- [Memory pruning](https://github.com/npl1228/treamai/blob/main/backend/pipelines/pruning_pipeline.py): `backend/pipelines/pruning_pipeline.py`
- [Gemini language model](https://github.com/npl1228/treamai/blob/main/backend/llm/gemini.py): `backend/llm/gemini.py`

### Persistent memory

- [Account and chat data](https://github.com/npl1228/treamai/blob/main/backend/memory/storage.py): `backend/memory/storage.py`
- [Semantic memory](https://github.com/npl1228/treamai/blob/main/backend/memory/chroma.py): `backend/memory/chroma.py`

### Other components

- **User**
- **Google Gemini API**

## Connections

- User → Route shell: uses
- Route shell → Landing: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Login: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → App navigation: wraps pages (evidence: `frontend/src/App.jsx`)
- Route shell → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Chat room: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Chat list: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Chat details: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Friends: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Notifications: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Settings: routes to (evidence: `frontend/src/App.jsx`)
- Route shell → Meeting room: routes to (evidence: `frontend/src/App.jsx`)
- User → Chat room: sends messages
- Chat room → HTTP and socket API: calls API
- HTTP and socket API → Account and chat data: reads and writes (evidence: `backend/main.py`)
- HTTP and socket API → Message dispatcher: dispatches messages (evidence: `backend/main.py`)
- Message dispatcher → Account and chat data: reads chat data (evidence: `backend/bot.py`)
- Message dispatcher → Private agent intent: routes private agent (evidence: `backend/bot.py`)
- Message dispatcher → Memory retrieval: routes queries (evidence: `backend/bot.py`)
- Message dispatcher → Message summarization: routes storage (evidence: `backend/bot.py`)
- Private agent intent → Memory retrieval: routes queries (evidence: `backend/pipelines/private_agent_pipeline.py`)
- Private agent intent → Account and chat data: loads projects (evidence: `backend/pipelines/private_agent_pipeline.py`)
- Private agent intent → Semantic memory: stores and corrects nodes (evidence: `backend/pipelines/private_agent_pipeline.py`)
- Private agent intent → Gemini language model: classifies intent (evidence: `backend/pipelines/private_agent_pipeline.py`)
- Memory retrieval → Account and chat data: loads weights (evidence: `backend/pipelines/retrieval_pipeline.py`)
- Memory retrieval → Semantic memory: searches and updates (evidence: `backend/pipelines/retrieval_pipeline.py`)
- Memory retrieval → Gemini language model: generates response (evidence: `backend/pipelines/retrieval_pipeline.py`)
- Message summarization → Account and chat data: buffers messages (evidence: `backend/pipelines/storage_pipeline.py`)
- Message summarization → Gemini language model: summarizes messages (evidence: `backend/pipelines/storage_pipeline.py`)
- Message summarization → Semantic memory: stores nodes (evidence: `backend/pipelines/storage_pipeline.py`)
- Message summarization → Memory pruning: triggers check (evidence: `backend/pipelines/storage_pipeline.py`)
- Memory pruning → Semantic memory: reads and deletes (evidence: `backend/pipelines/pruning_pipeline.py`)
- Gemini language model → Google Gemini API: generates content
- App navigation → Chat list: shows chats
- App navigation → Notifications: links notifications
- User → Friends: manages contacts
- User → Meeting room: joins meetings
