# hritvikgupta/worklone architecture

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

- Interactive diagram: https://gitdiagram.com/hritvikgupta/worklone
- Repository: https://github.com/hritvikgupta/worklone

## Overview

Worklone is a self-hosted AI workforce platform: users manage employees and teams, then chat or assign work for agents to reason, invoke tools, and return results. Its backend also documents workflows, integrations, scheduling, realtime dispatch, and employee learning; these are retained as distinct branches. The excerpts establish API routing, frontend navigation, persistence helpers, and worker startup, but not most agent, workflow, or dispatch internals, so those links are shown only when README or indexed caller references support them. The integration catalog is represented as one subsystem rather than enumerating hundreds of tools.

Main entry points: [`backend/api/routes.py`](https://github.com/hritvikgupta/worklone/blob/main/backend/api/routes.py) (API router), [`backend/api/main.py`](https://github.com/hritvikgupta/worklone/blob/main/backend/api/main.py) (FastAPI application), [`backend/api/routers/employee.py`](https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/employee.py) (Employee endpoints), [`backend/api/routers/workflows.py`](https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/workflows.py) (Workflow endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User experience"]
  node_frontend["Worklone app<br/>[App.tsx]"]
end

subgraph group_api["API and identity"]
  node_api_entry["FastAPI application<br/>[main.py]"]
  node_routes["API router<br/>[routes.py]"]
  node_auth_api["Auth endpoints<br/>[auth.py]"]
  node_employee_api["Employee endpoints<br/>[employee.py]"]
  node_chat_api["Chat endpoint<br/>[chat.py]"]
  node_workflow_api["Workflow endpoints<br/>[workflows.py]"]
  node_teams_api["Team endpoints<br/>[teams.py]"]
  node_dashboard_api["Dashboard endpoints<br/>[dashboard.py]"]
  node_auth_service["Identity service<br/>[service.py]"]
end

subgraph group_agents["AI workforce"]
  node_employee_service["Employee service"]
  node_react_agent["ReAct employee<br/>[react_agent.py]"]
  node_product_agent["Product employee<br/>[katy.py]"]
  node_katy_service["Product service<br/>[katy_service.py]"]
  node_learning["Learning loop"]
end

subgraph group_execution["Work execution"]
  node_tool_catalog["Tool catalog<br/>[catalog.py]"]
  node_tool_contract["Tool interface<br/>[base.py]"]
  node_tool_integrations["Integration tools"]
  node_workflow_engine["Workflow engine"]
  node_dispatch["Dispatch coordination"]
  node_worker["Background worker<br/>[main.py]"]
  node_realtime["Realtime sockets<br/>[socket_server.py]"]
  node_notion["Notion integration<br/>[query_database.py]"]
end

subgraph group_state["Persistence and integrations"]
  node_database[("SQLite database<br/>[database.py]")]
  node_auth_store[("Auth and chat store<br/>[auth_store.py]")]
  node_workflow_store[("Workflow store<br/>[workflow_store.py]")]
  node_oauth["OAuth resolution<br/>[oauth_common.py]"]
end

node_user(("Organization user"))
node_external_services{{"Business services"}}

node_user -->|"uses"| node_frontend
node_frontend -.->|"requests"| node_api_entry
node_api_entry -->|"mounts"| node_routes
node_routes -->|"routes to"| node_auth_api
node_routes -->|"routes to"| node_employee_api
node_routes -->|"routes to"| node_chat_api
node_routes -->|"routes to"| node_workflow_api
node_routes -->|"routes to"| node_teams_api
node_routes -->|"routes to"| node_dashboard_api
node_auth_api -->|"delegates to"| node_auth_service
node_auth_service -->|"reads and writes"| node_auth_store
node_chat_api -->|"delegates to"| node_katy_service
node_katy_service -->|"invokes"| node_product_agent
node_employee_api -->|"delegates to"| node_employee_service
node_employee_service -->|"invokes"| node_react_agent
node_employee_api -->|"uses"| node_tool_catalog
node_react_agent -.->|"selects tools"| node_tool_catalog
node_tool_catalog -.->|"registers tools"| node_tool_contract
node_tool_integrations -->|"implements"| node_tool_contract
node_notion -->|"resolves token"| node_oauth
node_notion -->|"calls Notion"| node_external_services
node_react_agent -.->|"learns from use"| node_learning
node_workflow_api -.->|"persists workflows"| node_workflow_store
node_workflow_api -.->|"starts workflows"| node_workflow_engine
node_api_entry -->|"starts scheduler"| node_workflow_store
node_api_entry -->|"starts dispatcher"| node_dispatch
node_api_entry -->|"mounts sockets"| node_realtime
node_dispatch -.->|"queues jobs"| node_worker
node_worker -->|"consumes jobs"| node_dispatch
node_auth_store -->|"opens SQLite"| node_database
node_workflow_store -->|"uses SQLite"| node_database
node_dashboard_api -.->|"reads data"| node_auth_store
node_dashboard_api -.->|"queries data"| node_database
node_teams_api -.->|"coordinates employees"| node_employee_service
node_user -.->|"connects integrations"| node_external_services

click node_frontend "https://github.com/hritvikgupta/worklone/blob/main/frontend/src/App.tsx"
click node_api_entry "https://github.com/hritvikgupta/worklone/blob/main/backend/api/main.py"
click node_routes "https://github.com/hritvikgupta/worklone/blob/main/backend/api/routes.py"
click node_auth_api "https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/auth.py"
click node_employee_api "https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/employee.py"
click node_chat_api "https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/chat.py"
click node_workflow_api "https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/workflows.py"
click node_teams_api "https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/teams.py"
click node_dashboard_api "https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/dashboard.py"
click node_auth_service "https://github.com/hritvikgupta/worklone/blob/main/backend/lib/auth/service.py"
click node_employee_service "https://github.com/hritvikgupta/worklone/blob/main/backend/services/employee_service.py"
click node_react_agent "https://github.com/hritvikgupta/worklone/blob/main/backend/core/agents/employee/react_agent.py"
click node_product_agent "https://github.com/hritvikgupta/worklone/blob/main/backend/core/agents/product_manager/katy.py"
click node_katy_service "https://github.com/hritvikgupta/worklone/blob/main/backend/services/katy_service.py"
click node_learning "https://github.com/hritvikgupta/worklone/tree/main/backend/core/agents/evolution"
click node_tool_catalog "https://github.com/hritvikgupta/worklone/blob/main/backend/core/tools/catalog.py"
click node_tool_contract "https://github.com/hritvikgupta/worklone/blob/main/backend/core/tools/system_tools/base.py"
click node_tool_integrations "https://github.com/hritvikgupta/worklone/tree/main/backend/core/tools/integration_tools_v2"
click node_workflow_engine "https://github.com/hritvikgupta/worklone/tree/main/backend/core/workflows"
click node_dispatch "https://github.com/hritvikgupta/worklone/tree/main/backend/core/dispatch"
click node_worker "https://github.com/hritvikgupta/worklone/blob/main/backend/worker/main.py"
click node_realtime "https://github.com/hritvikgupta/worklone/blob/main/backend/realtime/socket_server.py"
click node_database "https://github.com/hritvikgupta/worklone/blob/main/backend/db/database.py"
click node_auth_store "https://github.com/hritvikgupta/worklone/blob/main/backend/db/stores/auth_store.py"
click node_workflow_store "https://github.com/hritvikgupta/worklone/blob/main/backend/db/stores/workflow_store.py"
click node_oauth "https://github.com/hritvikgupta/worklone/blob/main/backend/lib/oauth/oauth_common.py"
click node_notion "https://github.com/hritvikgupta/worklone/blob/main/backend/core/tools/integration_tools_v2/notion/query_database.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_user toneBlue
class node_api_entry,node_routes,node_auth_api,node_employee_api,node_chat_api,node_workflow_api,node_teams_api,node_dashboard_api,node_auth_service toneAmber
class node_employee_service,node_react_agent,node_product_agent,node_katy_service,node_learning toneMint
class node_tool_catalog,node_tool_contract,node_tool_integrations,node_workflow_engine,node_dispatch,node_worker,node_realtime,node_notion toneRose
class node_database,node_auth_store,node_workflow_store,node_oauth,node_external_services toneIndigo
```

## Components

### User experience

- [Worklone app](https://github.com/hritvikgupta/worklone/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`

### API and identity

- [FastAPI application](https://github.com/hritvikgupta/worklone/blob/main/backend/api/main.py): `backend/api/main.py`
- [API router](https://github.com/hritvikgupta/worklone/blob/main/backend/api/routes.py): `backend/api/routes.py`
- [Auth endpoints](https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/auth.py): `backend/api/routers/auth.py`
- [Employee endpoints](https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/employee.py): `backend/api/routers/employee.py`
- [Chat endpoint](https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/chat.py): `backend/api/routers/chat.py`
- [Workflow endpoints](https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/workflows.py): `backend/api/routers/workflows.py`
- [Team endpoints](https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/teams.py): `backend/api/routers/teams.py`
- [Dashboard endpoints](https://github.com/hritvikgupta/worklone/blob/main/backend/api/routers/dashboard.py): `backend/api/routers/dashboard.py`
- [Identity service](https://github.com/hritvikgupta/worklone/blob/main/backend/lib/auth/service.py): `backend/lib/auth/service.py`

### AI workforce

- [Employee service](https://github.com/hritvikgupta/worklone/blob/main/backend/services/employee_service.py): `backend/services/employee_service.py`
- [ReAct employee](https://github.com/hritvikgupta/worklone/blob/main/backend/core/agents/employee/react_agent.py): `backend/core/agents/employee/react_agent.py`
- [Product employee](https://github.com/hritvikgupta/worklone/blob/main/backend/core/agents/product_manager/katy.py): `backend/core/agents/product_manager/katy.py`
- [Product service](https://github.com/hritvikgupta/worklone/blob/main/backend/services/katy_service.py): `backend/services/katy_service.py`
- [Learning loop](https://github.com/hritvikgupta/worklone/tree/main/backend/core/agents/evolution): `backend/core/agents/evolution`

### Work execution

- [Tool catalog](https://github.com/hritvikgupta/worklone/blob/main/backend/core/tools/catalog.py): `backend/core/tools/catalog.py`
- [Tool interface](https://github.com/hritvikgupta/worklone/blob/main/backend/core/tools/system_tools/base.py): `backend/core/tools/system_tools/base.py`
- [Integration tools](https://github.com/hritvikgupta/worklone/tree/main/backend/core/tools/integration_tools_v2): `backend/core/tools/integration_tools_v2`
- [Workflow engine](https://github.com/hritvikgupta/worklone/tree/main/backend/core/workflows): `backend/core/workflows`
- [Dispatch coordination](https://github.com/hritvikgupta/worklone/tree/main/backend/core/dispatch): `backend/core/dispatch`
- [Background worker](https://github.com/hritvikgupta/worklone/blob/main/backend/worker/main.py): `backend/worker/main.py`
- [Realtime sockets](https://github.com/hritvikgupta/worklone/blob/main/backend/realtime/socket_server.py): `backend/realtime/socket_server.py`
- [Notion integration](https://github.com/hritvikgupta/worklone/blob/main/backend/core/tools/integration_tools_v2/notion/query_database.py): `backend/core/tools/integration_tools_v2/notion/query_database.py`

### Persistence and integrations

- [SQLite database](https://github.com/hritvikgupta/worklone/blob/main/backend/db/database.py): `backend/db/database.py`
- [Auth and chat store](https://github.com/hritvikgupta/worklone/blob/main/backend/db/stores/auth_store.py): `backend/db/stores/auth_store.py`
- [Workflow store](https://github.com/hritvikgupta/worklone/blob/main/backend/db/stores/workflow_store.py): `backend/db/stores/workflow_store.py`
- [OAuth resolution](https://github.com/hritvikgupta/worklone/blob/main/backend/lib/oauth/oauth_common.py): `backend/lib/oauth/oauth_common.py`

### Other components

- **Organization user**
- **Business services**

## Connections

- Organization user → Worklone app: uses (evidence: `README.md`)
- Worklone app → FastAPI application: requests
- FastAPI application → API router: mounts (evidence: `backend/api/main.py`)
- API router → Auth endpoints: routes to (evidence: `backend/api/routes.py`)
- API router → Employee endpoints: routes to (evidence: `backend/api/routes.py`)
- API router → Chat endpoint: routes to (evidence: `backend/api/routes.py`)
- API router → Workflow endpoints: routes to (evidence: `backend/api/routes.py`)
- API router → Team endpoints: routes to (evidence: `backend/api/routes.py`)
- API router → Dashboard endpoints: routes to (evidence: `backend/api/routes.py`)
- Auth endpoints → Identity service: delegates to (evidence: `backend/api/routers/auth.py`)
- Identity service → Auth and chat store: reads and writes (evidence: `backend/lib/auth/service.py`)
- Chat endpoint → Product service: delegates to (evidence: `backend/api/routers/chat.py`)
- Product service → Product employee: invokes (evidence: `backend/services/katy_service.py`)
- Employee endpoints → Employee service: delegates to (evidence: `backend/api/routers/employee.py`)
- Employee service → ReAct employee: invokes (evidence: `backend/services/employee_service.py`)
- Employee endpoints → Tool catalog: uses (evidence: `backend/api/routers/employee.py`)
- ReAct employee → Tool catalog: selects tools
- Tool catalog → Tool interface: registers tools
- Integration tools → Tool interface: implements (evidence: `backend/core/tools/integration_tools_v2/notion/query_database.py`)
- Notion integration → OAuth resolution: resolves token (evidence: `backend/core/tools/integration_tools_v2/notion/query_database.py`)
- Notion integration → Business services: calls Notion (evidence: `backend/core/tools/integration_tools_v2/notion/query_database.py`)
- ReAct employee → Learning loop: learns from use
- Workflow endpoints → Workflow store: persists workflows
- Workflow endpoints → Workflow engine: starts workflows
- FastAPI application → Workflow store: starts scheduler (evidence: `backend/api/main.py`)
- FastAPI application → Dispatch coordination: starts dispatcher (evidence: `backend/api/main.py`)
- FastAPI application → Realtime sockets: mounts sockets (evidence: `backend/api/main.py`)
- Dispatch coordination → Background worker: queues jobs (evidence: `backend/worker/main.py`)
- Background worker → Dispatch coordination: consumes jobs (evidence: `backend/worker/main.py`)
- Auth and chat store → SQLite database: opens SQLite (evidence: `backend/db/stores/auth_store.py`)
- Workflow store → SQLite database: uses SQLite (evidence: `backend/db/stores/workflow_store.py`)
- Dashboard endpoints → Auth and chat store: reads data
- Dashboard endpoints → SQLite database: queries data (evidence: `backend/api/routers/dashboard.py`)
- Team endpoints → Employee service: coordinates employees
- Organization user → Business services: connects integrations (evidence: `README.md`)
