# yashchokhat/cortexai architecture

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

- Interactive diagram: https://gitdiagram.com/yashchokhat/cortexai
- Repository: https://github.com/yashchokhat/cortexai

## Overview

CortexAI’s principal product is the ESP32 edge-agent firmware, with a browser portal for device setup and management. The user configures a device, connects it to Wi-Fi, and uses the local portal to manage settings and agent capabilities; the agent can then use an LLM and invoke tools on-device. The README also describes chat coding and offline edge computing. Source excerpts establish firmware startup and portal routing, but not most capability wiring, so those relationships are shown as unverified. The separate Flutter app and Go backend are omitted because the README identifies vertex-agent as the primary product.

Main entry points: [`vertex-agent/components/common/app_claw/include/app_claw.h`](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/common/app_claw/include/app_claw.h) (Claw runtime), [`vertex-agent/application/edge_agent/components/http_server/frontend_source/src/App.tsx`](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/App.tsx) (Portal UI), [`vertex-agent/application/edge_agent/main/main.c`](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/main/main.c) (Firmware startup), [`vertex-agent/application/edge_agent/components/http_server/http_server_core.c`](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/http_server_core.c) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["Device firmware"]
  node_firmware_start["Firmware startup<br/>[main.c]"]
  node_device_config["Device configuration<br/>[app_config.h]"]
end

subgraph group_portal["Local web portal"]
  node_web_server["HTTP server<br/>[http_server_core.c]"]
  node_web_ui["Portal UI<br/>[App.tsx]"]
  node_portal_api["Portal API client<br/>[client.ts]"]
  node_setup["Setup wizard"]
  node_status["Device status<br/>[StatusPage.tsx]"]
  node_llm_settings["LLM settings<br/>[LlmPage.tsx]"]
  node_im_settings["Messaging settings<br/>[ImPage.tsx]"]
  node_file_manager["File manager<br/>[FilesPage.tsx]"]
end

subgraph group_agent["Agent capabilities"]
  node_claw_runtime["Claw runtime<br/>[app_claw.h]"]
  node_llm["LLM configuration<br/>[cap_llm_config.c]"]
  node_im["Messaging integrations<br/>[cap_im_platform.c]"]
  node_lua["Lua tools<br/>[cap_lua.c]"]
  node_skills["Skills management<br/>[cap_skill_mgr.c]"]
  node_memory[("Agent memory")]
  node_mcp["MCP services<br/>[cap_mcp_client.c]"]
end

subgraph group_connectivity["Network and services"]
  node_wifi["Wi-Fi manager<br/>[wifi_manager.c]"]
end

node_user(("Device operator"))
node_external_llm{{"LLM provider"}}
node_messaging_service{{"Messaging platforms"}}

node_user -->|"manages device"| node_web_ui
node_firmware_start -->|"loads configuration"| node_device_config
node_firmware_start -->|"starts Wi-Fi"| node_wifi
node_firmware_start -->|"starts server"| node_web_server
node_firmware_start -->|"updates runtime"| node_claw_runtime
node_web_ui -->|"calls API client"| node_portal_api
node_web_ui -->|"routes to"| node_setup
node_web_ui -->|"routes to"| node_status
node_web_ui -->|"routes to"| node_llm_settings
node_web_ui -->|"routes to"| node_im_settings
node_web_ui -->|"routes to"| node_file_manager
node_portal_api -.->|"sends requests"| node_web_server
node_web_server -.->|"manages settings"| node_device_config
node_web_server -.->|"exposes controls"| node_claw_runtime
node_claw_runtime -.->|"uses configuration"| node_llm
node_claw_runtime -.->|"invokes tools"| node_lua
node_claw_runtime -.->|"uses skills"| node_skills
node_claw_runtime -.->|"uses memory"| node_memory
node_claw_runtime -.->|"discovers tools"| node_mcp
node_claw_runtime -.->|"supports messaging"| node_im
node_llm -.->|"connects to"| node_external_llm
node_im -.->|"connects to"| node_messaging_service

click node_firmware_start "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/main/main.c"
click node_device_config "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/app_config/include/app_config.h"
click node_claw_runtime "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/common/app_claw/include/app_claw.h"
click node_web_server "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/http_server_core.c"
click node_web_ui "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/App.tsx"
click node_portal_api "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/api/client.ts"
click node_setup "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/SetupWizardPage.tsx"
click node_status "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/StatusPage.tsx"
click node_llm_settings "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/LlmPage.tsx"
click node_im_settings "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/ImPage.tsx"
click node_file_manager "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/FilesPage.tsx"
click node_wifi "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/common/wifi_manager/wifi_manager.c"
click node_llm "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_capabilities/cap_llm_config/src/cap_llm_config.c"
click node_im "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_capabilities/cap_im_platform/src/cap_im_platform.c"
click node_lua "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_capabilities/cap_lua/src/cap_lua.c"
click node_skills "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_capabilities/cap_skill_mgr/src/cap_skill_mgr.c"
click node_memory "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_modules/claw_memory/src/claw_memory_storage.c"
click node_mcp "https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_capabilities/cap_mcp_client/src/cap_mcp_client.c"

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_firmware_start,node_device_config toneBlue
class node_web_server,node_web_ui,node_portal_api,node_setup,node_status,node_llm_settings,node_im_settings,node_file_manager toneAmber
class node_claw_runtime,node_llm,node_im,node_lua,node_skills,node_memory,node_mcp toneMint
class node_wifi toneRose
class node_user,node_external_llm,node_messaging_service toneIndigo
```

## Components

### Device firmware

- [Firmware startup](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/main/main.c): `vertex-agent/application/edge_agent/main/main.c`
- [Device configuration](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/app_config/include/app_config.h): `vertex-agent/application/edge_agent/components/app_config/include/app_config.h`

### Local web portal

- [HTTP server](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/http_server_core.c): `vertex-agent/application/edge_agent/components/http_server/http_server_core.c`
- [Portal UI](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/App.tsx): `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/App.tsx`
- [Portal API client](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/api/client.ts): `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/api/client.ts`
- [Setup wizard](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/SetupWizardPage.tsx): `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/SetupWizardPage.tsx`
- [Device status](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/StatusPage.tsx): `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/StatusPage.tsx`
- [LLM settings](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/LlmPage.tsx): `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/LlmPage.tsx`
- [Messaging settings](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/ImPage.tsx): `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/ImPage.tsx`
- [File manager](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/FilesPage.tsx): `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/pages/FilesPage.tsx`

### Agent capabilities

- [Claw runtime](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/common/app_claw/include/app_claw.h): `vertex-agent/components/common/app_claw/include/app_claw.h`
- [LLM configuration](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_capabilities/cap_llm_config/src/cap_llm_config.c): `vertex-agent/components/claw_capabilities/cap_llm_config/src/cap_llm_config.c`
- [Messaging integrations](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_capabilities/cap_im_platform/src/cap_im_platform.c): `vertex-agent/components/claw_capabilities/cap_im_platform/src/cap_im_platform.c`
- [Lua tools](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_capabilities/cap_lua/src/cap_lua.c): `vertex-agent/components/claw_capabilities/cap_lua/src/cap_lua.c`
- [Skills management](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_capabilities/cap_skill_mgr/src/cap_skill_mgr.c): `vertex-agent/components/claw_capabilities/cap_skill_mgr/src/cap_skill_mgr.c`
- [Agent memory](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_modules/claw_memory/src/claw_memory_storage.c): `vertex-agent/components/claw_modules/claw_memory/src/claw_memory_storage.c`
- [MCP services](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/claw_capabilities/cap_mcp_client/src/cap_mcp_client.c): `vertex-agent/components/claw_capabilities/cap_mcp_client/src/cap_mcp_client.c`

### Network and services

- [Wi-Fi manager](https://github.com/yashchokhat/cortexai/blob/main/vertex-agent/components/common/wifi_manager/wifi_manager.c): `vertex-agent/components/common/wifi_manager/wifi_manager.c`

### Other components

- **Device operator**
- **LLM provider**
- **Messaging platforms**

## Connections

- Device operator → Portal UI: manages device
- Firmware startup → Device configuration: loads configuration (evidence: `vertex-agent/application/edge_agent/main/main.c`)
- Firmware startup → Wi-Fi manager: starts Wi-Fi (evidence: `vertex-agent/application/edge_agent/main/main.c`)
- Firmware startup → HTTP server: starts server (evidence: `vertex-agent/application/edge_agent/main/main.c`)
- Firmware startup → Claw runtime: updates runtime (evidence: `vertex-agent/application/edge_agent/main/main.c`)
- Portal UI → Portal API client: calls API client (evidence: `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/App.tsx`)
- Portal UI → Setup wizard: routes to (evidence: `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/App.tsx`)
- Portal UI → Device status: routes to (evidence: `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/App.tsx`)
- Portal UI → LLM settings: routes to (evidence: `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/App.tsx`)
- Portal UI → Messaging settings: routes to (evidence: `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/App.tsx`)
- Portal UI → File manager: routes to (evidence: `vertex-agent/application/edge_agent/components/http_server/frontend_source/src/App.tsx`)
- Portal API client → HTTP server: sends requests
- HTTP server → Device configuration: manages settings
- HTTP server → Claw runtime: exposes controls
- Claw runtime → LLM configuration: uses configuration
- Claw runtime → Lua tools: invokes tools
- Claw runtime → Skills management: uses skills
- Claw runtime → Agent memory: uses memory
- Claw runtime → MCP services: discovers tools
- Claw runtime → Messaging integrations: supports messaging
- LLM configuration → LLM provider: connects to
- Messaging integrations → Messaging platforms: connects to
