# safwan-nj/taligent-nextgen-core architecture

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

- Interactive diagram: https://gitdiagram.com/safwan-nj/taligent-nextgen-core
- Repository: https://github.com/safwan-nj/taligent-nextgen-core

## Overview

TaliGent is a local-first Windows desktop agent, with a CLI and phone-based WhatsApp entry points. A user submits a task through the desktop UI or CLI; the backend coordinates planning and execution through an LLM and scoped tools, using Windows UI Automation first and screen vision as a fallback. Results return through the session/bus layer. The README also documents Telegram, BrainDB, long-task watchers, integrations and a separate Voice Studio. Relationships for unsampled subsystems are omitted unless explicitly documented; several implementation paths are represented at their enclosing source directory.

Main entry points: [`core/engine.py`](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/engine.py) (Core Engine), [`core/orchestrator.py`](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/orchestrator.py) (Task Orchestrator), [`headless_server.py`](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/headless_server.py) (WebSocket Backend), [`core/tools.py`](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/tools.py) (Tool Registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User Interfaces"]
  node_desktop["Electron Desktop UI<br/>[App.jsx]"]
  node_socket["WebSocket UI Client"]
  node_cli["Terminal CLI<br/>[cli_launcher.py]"]
end

subgraph group_runtime["Agent Runtime"]
  node_backend["WebSocket Backend<br/>[headless_server.py]"]
  node_engine["Core Engine<br/>[engine.py]"]
  node_orchestrator["Task Orchestrator<br/>[orchestrator.py]"]
  node_agentloop["Plan Execute Loop<br/>[agent_loop.py]"]
  node_llm["LLM Providers<br/>[llm_client.py]"]
  node_permissions["Security Capabilities<br/>[capabilities.py]"]
  node_bus["Message Bus<br/>[bus.py]"]
  node_sessions[("Chat Sessions<br/>[sessions.py]")]
  node_taskstore[("Workspace Task State<br/>[task_store.py]")]
  node_config["Runtime Configuration<br/>[config.py]"]
end

subgraph group_actions["Desktop Actions"]
  node_toolregistry["Tool Registry<br/>[tools.py]"]
  node_uia["Windows UI Automation<br/>[ui_automation.py]"]
  node_capture["Screen Capture<br/>[capture.py]"]
  node_vision["Visual Detection<br/>[detector.py]"]
end

subgraph group_connectors["Remote Connectors"]
  node_whatsapp["WhatsApp Manager"]
  node_wa_connector["WhatsApp Connector"]
  node_telegram["Telegram Connector"]
end

subgraph group_extras["Memory and Voice"]
  node_braindb[("BrainDB Memory<br/>[brain_db.py]")]
  node_watcher["Background Watchers"]
  node_voice_server["Voice Studio Web Server<br/>[server.py]"]
  node_voice_mcp["Voice Studio MCP<br/>[mcp_server.py]"]
end

node_user(("User"))
node_voice_user(("Voice Studio User"))
node_providers(("AI Provider Services"))
node_phone(("Phone User"))

node_user -->|"submits tasks"| node_desktop
node_desktop -->|"uses socket"| node_socket
node_socket -->|"sends commands"| node_backend
node_user -->|"runs tasks"| node_cli
node_cli -->|"uses engine"| node_engine
node_backend -.->|"dispatches tasks"| node_engine
node_engine -->|"delegates tasks"| node_orchestrator
node_orchestrator -->|"runs plan"| node_agentloop
node_orchestrator -->|"uses provider"| node_llm
node_llm -->|"requests completion"| node_providers
node_orchestrator -->|"selects tools"| node_toolregistry
node_engine -->|"checks permissions"| node_permissions
node_toolregistry -->|"uses UIA"| node_uia
node_toolregistry -->|"captures screen"| node_capture
node_capture -.->|"provides images"| node_vision
node_backend -.->|"publishes events"| node_bus
node_bus -.->|"broadcasts updates"| node_socket
node_engine -.->|"loads sessions"| node_sessions
node_engine -->|"stores task state"| node_taskstore
node_engine -->|"uses configuration"| node_config
node_phone -->|"sends commands"| node_whatsapp
node_whatsapp -->|"manages connection"| node_wa_connector
node_whatsapp -.->|"triggers tasks"| node_engine
node_user -.->|"sends messages"| node_telegram
node_orchestrator -->|"learns workflows"| node_braindb
node_engine -->|"monitors long tasks"| node_watcher
node_voice_user -->|"uses web studio"| node_voice_server
node_voice_user -->|"connects MCP client"| node_voice_mcp

click node_desktop "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/web_ui/src/App.jsx"
click node_socket "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/web_ui/src/hooks/useTaliGentSocket.js"
click node_cli "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/cli_launcher.py"
click node_backend "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/headless_server.py"
click node_engine "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/engine.py"
click node_orchestrator "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/orchestrator.py"
click node_agentloop "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/agent_loop.py"
click node_llm "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/llm_client.py"
click node_permissions "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/capabilities.py"
click node_toolregistry "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/tools.py"
click node_uia "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/ui_automation.py"
click node_capture "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/vision/capture.py"
click node_vision "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/vision/detector.py"
click node_bus "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/bus.py"
click node_sessions "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/sessions.py"
click node_taskstore "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/task_store.py"
click node_config "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/config.py"
click node_whatsapp "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/connectors/whatsapp/whatsapp_manager.py"
click node_wa_connector "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/connectors/whatsapp/whatsapp_connector.py"
click node_telegram "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/connectors/telegram/telegram_connector.py"
click node_braindb "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/brain_db.py"
click node_watcher "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/background_watcher.py"
click node_voice_server "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/voice_studio/server.py"
click node_voice_mcp "https://github.com/safwan-nj/taligent-nextgen-core/blob/main/voice_studio/mcp_server.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_desktop,node_socket,node_cli,node_user,node_voice_user,node_phone toneBlue
class node_backend,node_engine,node_orchestrator,node_agentloop,node_llm,node_permissions,node_bus,node_sessions,node_taskstore,node_config toneAmber
class node_toolregistry,node_uia,node_capture,node_vision toneMint
class node_whatsapp,node_wa_connector,node_telegram toneRose
class node_braindb,node_watcher,node_voice_server,node_voice_mcp,node_providers toneIndigo
```

## Components

### User Interfaces

- [Electron Desktop UI](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/web_ui/src/App.jsx): `web_ui/src/App.jsx`
- [WebSocket UI Client](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/web_ui/src/hooks/useTaliGentSocket.js): `web_ui/src/hooks/useTaliGentSocket.js`
- [Terminal CLI](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/cli_launcher.py): `cli_launcher.py`

### Agent Runtime

- [WebSocket Backend](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/headless_server.py): `headless_server.py`
- [Core Engine](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/engine.py): `core/engine.py`
- [Task Orchestrator](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/orchestrator.py): `core/orchestrator.py`
- [Plan Execute Loop](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/agent_loop.py): `core/agent_loop.py`
- [LLM Providers](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/llm_client.py): `core/llm_client.py`
- [Security Capabilities](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/capabilities.py): `core/capabilities.py`
- [Message Bus](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/bus.py): `core/bus.py`
- [Chat Sessions](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/sessions.py): `core/sessions.py`
- [Workspace Task State](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/task_store.py): `core/task_store.py`
- [Runtime Configuration](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/config.py): `core/config.py`

### Desktop Actions

- [Tool Registry](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/tools.py): `core/tools.py`
- [Windows UI Automation](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/ui_automation.py): `core/ui_automation.py`
- [Screen Capture](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/vision/capture.py): `vision/capture.py`
- [Visual Detection](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/vision/detector.py): `vision/detector.py`

### Remote Connectors

- [WhatsApp Manager](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/connectors/whatsapp/whatsapp_manager.py): `connectors/whatsapp/whatsapp_manager.py`
- [WhatsApp Connector](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/connectors/whatsapp/whatsapp_connector.py): `connectors/whatsapp/whatsapp_connector.py`
- [Telegram Connector](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/connectors/telegram/telegram_connector.py): `connectors/telegram/telegram_connector.py`

### Memory and Voice

- [BrainDB Memory](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/brain_db.py): `core/brain_db.py`
- [Background Watchers](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/core/background_watcher.py): `core/background_watcher.py`
- [Voice Studio Web Server](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/voice_studio/server.py): `voice_studio/server.py`
- [Voice Studio MCP](https://github.com/safwan-nj/taligent-nextgen-core/blob/main/voice_studio/mcp_server.py): `voice_studio/mcp_server.py`

### Other components

- **User**
- **Voice Studio User**
- **AI Provider Services**
- **Phone User**

## Connections

- User → Electron Desktop UI: submits tasks (evidence: `README.md`)
- Electron Desktop UI → WebSocket UI Client: uses socket (evidence: `web_ui/src/App.jsx`)
- WebSocket UI Client → WebSocket Backend: sends commands (evidence: `README.md`)
- User → Terminal CLI: runs tasks (evidence: `README.md`)
- Terminal CLI → Core Engine: uses engine (evidence: `README.md`)
- WebSocket Backend → Core Engine: dispatches tasks
- Core Engine → Task Orchestrator: delegates tasks (evidence: `core/engine.py`)
- Task Orchestrator → Plan Execute Loop: runs plan (evidence: `core/orchestrator.py`)
- Task Orchestrator → LLM Providers: uses provider (evidence: `core/orchestrator.py`)
- LLM Providers → AI Provider Services: requests completion (evidence: `core/llm_client.py`)
- Task Orchestrator → Tool Registry: selects tools (evidence: `core/orchestrator.py`)
- Core Engine → Security Capabilities: checks permissions (evidence: `core/engine.py`)
- Tool Registry → Windows UI Automation: uses UIA (evidence: `README.md`)
- Tool Registry → Screen Capture: captures screen (evidence: `README.md`)
- Screen Capture → Visual Detection: provides images
- WebSocket Backend → Message Bus: publishes events
- Message Bus → WebSocket UI Client: broadcasts updates
- Core Engine → Chat Sessions: loads sessions
- Core Engine → Workspace Task State: stores task state (evidence: `core/engine.py`)
- Core Engine → Runtime Configuration: uses configuration (evidence: `core/engine.py`)
- Phone User → WhatsApp Manager: sends commands (evidence: `README.md`)
- WhatsApp Manager → WhatsApp Connector: manages connection (evidence: `connectors/whatsapp/whatsapp_manager.py`)
- WhatsApp Manager → Core Engine: triggers tasks
- User → Telegram Connector: sends messages
- Task Orchestrator → BrainDB Memory: learns workflows (evidence: `README.md`)
- Core Engine → Background Watchers: monitors long tasks (evidence: `README.md`)
- Voice Studio User → Voice Studio Web Server: uses web studio (evidence: `README.md`)
- Voice Studio User → Voice Studio MCP: connects MCP client (evidence: `README.md`)
