# zhehaod/123 architecture

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

- Interactive diagram: https://gitdiagram.com/zhehaod/123
- Repository: https://github.com/zhehaod/123

## Overview

This is a persistent lab-assistant application: members sign in, converse with the assistant, and receive direct answers or specialist work carried out through typed routing and orchestration. Specialist work can include research, reference verification and sharing, email, meetings, and report checks or summaries. External email or meeting writes require approval, with meeting invitations and Zoom details handled at approval time. Conversations, work items, runs, tasks, and approvals are persisted through Supabase. The README documents capabilities beyond the sampled source; those are represented at subsystem level, while uncertain internal call links are omitted.

Main entry points: [`app/orchestration/service.py`](https://github.com/zhehaod/123/blob/main/app/orchestration/service.py) (Orchestration service), [`app/api/router.py`](https://github.com/zhehaod/123/blob/main/app/api/router.py) (FastAPI routes), [`app/approvals/execution.py`](https://github.com/zhehaod/123/blob/main/app/approvals/execution.py) (Approval execution), [`app/services/calendar_invite.py`](https://github.com/zhehaod/123/blob/main/app/services/calendar_invite.py) (Meeting services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Member application"]
  node_frontend["Web application<br/>[App.tsx]"]
  node_frontend_api["API clients<br/>[client.ts]"]
end

subgraph group_access["API and access"]
  node_api["FastAPI routes<br/>[router.py]"]
  node_auth_api["Auth routes<br/>[auth.py]"]
  node_auth_service["Supabase auth"]
end

subgraph group_assistant["Assistant runtime"]
  node_orchestration["Orchestration service<br/>[service.py]"]
  node_context["Conversation context<br/>[manager.py]"]
  node_routing["Routing policy"]
  node_supervisor["Supervisor workflow"]
  node_direct["Direct response<br/>[responder.py]"]
end

subgraph group_workflows["Research workflows"]
  node_specialists["Specialist agents"]
  node_approval["Approval execution<br/>[execution.py]"]
  node_reports["Report intake<br/>[report_intake.py]"]
  node_meeting_services["Meeting services<br/>[calendar_invite.py]"]
  node_mail_services["Mail services"]
end

subgraph group_integrations["Persistence and services"]
  node_context_repository["Context repository"]
  node_supabase[("Supabase")]
end

node_member(("Member"))
node_gemini["Gemini"]
node_outlook["Outlook"]
node_zoom["Zoom"]

node_member -->|"uses"| node_frontend
node_frontend -->|"requests"| node_frontend_api
node_frontend_api -->|"calls"| node_api
node_api -->|"dispatches"| node_auth_api
node_auth_api -->|"authenticates"| node_auth_service
node_auth_service -->|"uses Auth and REST"| node_supabase
node_api -->|"handles messages"| node_orchestration
node_orchestration -->|"records turns"| node_context
node_context -->|"reads and writes"| node_context_repository
node_context_repository -->|"persists context"| node_supabase
node_orchestration -->|"classifies requests"| node_routing
node_routing -.->|"classifies with"| node_gemini
node_orchestration -->|"handles direct replies"| node_direct
node_orchestration -->|"runs plans"| node_supervisor
node_orchestration -->|"dispatches tasks"| node_specialists
node_specialists -.->|"uses models"| node_gemini
node_orchestration -->|"prepares approved actions"| node_approval
node_approval -->|"sends approved mail"| node_outlook
node_approval -->|"executes approved meetings"| node_meeting_services
node_meeting_services -->|"sends invitations"| node_outlook
node_meeting_services -.->|"creates meetings"| node_zoom
node_reports -->|"reads mailbox"| node_outlook
node_reports -->|"stores submissions"| node_supabase

click node_frontend "https://github.com/zhehaod/123/blob/main/frontend/src/App.tsx"
click node_frontend_api "https://github.com/zhehaod/123/blob/main/frontend/src/api/client.ts"
click node_api "https://github.com/zhehaod/123/blob/main/app/api/router.py"
click node_auth_api "https://github.com/zhehaod/123/blob/main/app/api/auth.py"
click node_auth_service "https://github.com/zhehaod/123/blob/main/app/services/supabase_auth_service.py"
click node_orchestration "https://github.com/zhehaod/123/blob/main/app/orchestration/service.py"
click node_context "https://github.com/zhehaod/123/blob/main/app/context/manager.py"
click node_routing "https://github.com/zhehaod/123/tree/main/app/routing"
click node_supervisor "https://github.com/zhehaod/123/blob/main/app/graphs/supervisor_workflow.py"
click node_direct "https://github.com/zhehaod/123/blob/main/app/conversation/responder.py"
click node_specialists "https://github.com/zhehaod/123/tree/main/app/agents"
click node_approval "https://github.com/zhehaod/123/blob/main/app/approvals/execution.py"
click node_reports "https://github.com/zhehaod/123/blob/main/app/services/report_intake.py"
click node_meeting_services "https://github.com/zhehaod/123/blob/main/app/services/calendar_invite.py"
click node_mail_services "https://github.com/zhehaod/123/blob/main/app/services/outlook_mail_service.py"
click node_context_repository "https://github.com/zhehaod/123/blob/main/app/repositories/supabase_context_repository.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_frontend,node_frontend_api toneBlue
class node_api,node_auth_api,node_auth_service toneAmber
class node_orchestration,node_context,node_routing,node_supervisor,node_direct toneMint
class node_specialists,node_approval,node_reports,node_meeting_services,node_mail_services toneRose
class node_context_repository,node_supabase,node_member,node_gemini,node_outlook,node_zoom toneIndigo
```

## Components

### Member application

- [Web application](https://github.com/zhehaod/123/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API clients](https://github.com/zhehaod/123/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### API and access

- [FastAPI routes](https://github.com/zhehaod/123/blob/main/app/api/router.py): `app/api/router.py`
- [Auth routes](https://github.com/zhehaod/123/blob/main/app/api/auth.py): `app/api/auth.py`
- [Supabase auth](https://github.com/zhehaod/123/blob/main/app/services/supabase_auth_service.py): `app/services/supabase_auth_service.py`

### Assistant runtime

- [Orchestration service](https://github.com/zhehaod/123/blob/main/app/orchestration/service.py): `app/orchestration/service.py`
- [Conversation context](https://github.com/zhehaod/123/blob/main/app/context/manager.py): `app/context/manager.py`
- [Routing policy](https://github.com/zhehaod/123/tree/main/app/routing): `app/routing`
- [Supervisor workflow](https://github.com/zhehaod/123/blob/main/app/graphs/supervisor_workflow.py): `app/graphs/supervisor_workflow.py`
- [Direct response](https://github.com/zhehaod/123/blob/main/app/conversation/responder.py): `app/conversation/responder.py`

### Research workflows

- [Specialist agents](https://github.com/zhehaod/123/tree/main/app/agents): `app/agents`
- [Approval execution](https://github.com/zhehaod/123/blob/main/app/approvals/execution.py): `app/approvals/execution.py`
- [Report intake](https://github.com/zhehaod/123/blob/main/app/services/report_intake.py): `app/services/report_intake.py`
- [Meeting services](https://github.com/zhehaod/123/blob/main/app/services/calendar_invite.py): `app/services/calendar_invite.py`
- [Mail services](https://github.com/zhehaod/123/blob/main/app/services/outlook_mail_service.py): `app/services/outlook_mail_service.py`

### Persistence and services

- [Context repository](https://github.com/zhehaod/123/blob/main/app/repositories/supabase_context_repository.py): `app/repositories/supabase_context_repository.py`
- **Supabase**

### Other components

- **Member**
- **Gemini**
- **Outlook**
- **Zoom**

## Connections

- Member → Web application: uses
- Web application → API clients: requests
- API clients → FastAPI routes: calls
- FastAPI routes → Auth routes: dispatches
- Auth routes → Supabase auth: authenticates
- Supabase auth → Supabase: uses Auth and REST
- FastAPI routes → Orchestration service: handles messages
- Orchestration service → Conversation context: records turns
- Conversation context → Context repository: reads and writes
- Context repository → Supabase: persists context
- Orchestration service → Routing policy: classifies requests
- Routing policy → Gemini: classifies with
- Orchestration service → Direct response: handles direct replies
- Orchestration service → Supervisor workflow: runs plans
- Orchestration service → Specialist agents: dispatches tasks
- Specialist agents → Gemini: uses models
- Orchestration service → Approval execution: prepares approved actions
- Approval execution → Outlook: sends approved mail
- Approval execution → Meeting services: executes approved meetings
- Meeting services → Outlook: sends invitations
- Meeting services → Zoom: creates meetings
- Report intake → Outlook: reads mailbox
- Report intake → Supabase: stores submissions
