# aethergases/ms-aeko-hub architecture

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

- Interactive diagram: https://gitdiagram.com/aethergases/ms-aeko-hub
- Repository: https://github.com/aethergases/ms-aeko-hub

## Overview

Aether AI Gateway exposes HTTP APIs for conversations, inventory reports, user memories, uploads, and metrics. A conversation request enters through the API handlers, is coordinated by the session service, uses user and session data plus the Aeko SDK, and persists the approved exchange. A separate worker generates memories from recent sessions. The graph also preserves OAuth, tool/integration, upload, and metric capabilities documented or referenced by the README and source index; unsampled implementation links are omitted where evidence is insufficient.

Main entry points: [`internal/http`](https://github.com/aethergases/ms-aeko-hub/tree/develop/internal/http) (HTTP handlers), [`cmd/api/main.py`](https://github.com/aethergases/ms-aeko-hub/blob/develop/cmd/api/main.py) (API composition), [`session/service.py`](https://github.com/aethergases/ms-aeko-hub/blob/develop/session/service.py) (Session service), [`cmd/memory_generator_worker/main.py`](https://github.com/aethergases/ms-aeko-hub/blob/develop/cmd/memory_generator_worker/main.py) (Memory generation worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_http_api["HTTP handlers"]
  node_app["API composition<br/>[main.py]"]
  node_oauth["OAuth service<br/>[service.py]"]
  node_oauth_store[("OAuth code cache<br/>[repository.py]")]
  node_auth_integrations["Auth integrations"]
  node_upload_service["Upload tickets<br/>[service.py]"]
  node_upload_cache[("Upload ticket cache<br/>[repository.py]")]
end

subgraph group_conversation["Conversation and memory"]
  node_session_service["Session service<br/>[service.py]"]
  node_session_repo[("Session repository<br/>[repository.py]")]
  node_session_cache[("Session window cache<br/>[repository.py]")]
  node_user_service["User service<br/>[service.py]"]
  node_user_repo[("User and memory store<br/>[repository.py]")]
  node_memory_worker["Memory generation worker<br/>[main.py]"]
end

subgraph group_ai_tools["AI tools and integrations"]
  node_agent_tools["Agent tools"]
  node_external_services["AI and data integrations"]
end

subgraph group_domain_data["Domain data and metrics"]
  node_improvement_plan["Improvement plans"]
  node_hub_metrics["Hub metrics"]
  node_aeko_metrics["Aeko run metrics<br/>[service.py]"]
  node_shared_ops["Request and event tracking"]
end

node_client(("Aether clients"))
node_aeko_sdk["Aeko AI core"]

node_client -->|"sends requests"| node_http_api
node_app -->|"registers routes"| node_http_api
node_http_api -->|"handles conversations"| node_session_service
node_session_service -->|"reads and writes"| node_session_repo
node_session_service -->|"loads windows"| node_session_cache
node_session_service -->|"loads user memories"| node_user_repo
node_session_service -->|"sends turns"| node_aeko_sdk
node_http_api -->|"routes sign-in"| node_oauth
node_oauth -.->|"stores authorization codes"| node_oauth_store
node_oauth -->|"gets identity profile"| node_auth_integrations
node_app -->|"configures tools"| node_agent_tools
node_app -->|"configures integrations"| node_external_services
node_agent_tools -.->|"uses integrations"| node_external_services
node_http_api -.->|"handles upload tickets"| node_upload_service
node_upload_service -.->|"persists tickets"| node_upload_cache
node_memory_worker -->|"reads sessions"| node_session_repo
node_memory_worker -->|"loads and stores memories"| node_user_repo
node_memory_worker -->|"generates summaries"| node_aeko_sdk
node_app -->|"configures metric sink"| node_aeko_metrics
node_aeko_metrics -.->|"records events"| node_shared_ops
node_app -.->|"composes metrics"| node_hub_metrics
node_http_api -.->|"serves plan endpoints"| node_improvement_plan

click node_http_api "https://github.com/aethergases/ms-aeko-hub/tree/develop/internal/http"
click node_app "https://github.com/aethergases/ms-aeko-hub/blob/develop/cmd/api/main.py"
click node_oauth "https://github.com/aethergases/ms-aeko-hub/blob/develop/oauth/service.py"
click node_oauth_store "https://github.com/aethergases/ms-aeko-hub/blob/develop/oauth/cache/repository.py"
click node_auth_integrations "https://github.com/aethergases/ms-aeko-hub/tree/develop/cmd/api/integrations"
click node_session_service "https://github.com/aethergases/ms-aeko-hub/blob/develop/session/service.py"
click node_session_repo "https://github.com/aethergases/ms-aeko-hub/blob/develop/session/database/repository.py"
click node_session_cache "https://github.com/aethergases/ms-aeko-hub/blob/develop/session/cache/repository.py"
click node_user_service "https://github.com/aethergases/ms-aeko-hub/blob/develop/user/service.py"
click node_user_repo "https://github.com/aethergases/ms-aeko-hub/blob/develop/user/database/repository.py"
click node_memory_worker "https://github.com/aethergases/ms-aeko-hub/blob/develop/cmd/memory_generator_worker/main.py"
click node_agent_tools "https://github.com/aethergases/ms-aeko-hub/tree/develop/cmd/api/tools"
click node_external_services "https://github.com/aethergases/ms-aeko-hub/tree/develop/cmd/api/integrations"
click node_upload_service "https://github.com/aethergases/ms-aeko-hub/blob/develop/upload_ticket/service.py"
click node_upload_cache "https://github.com/aethergases/ms-aeko-hub/blob/develop/upload_ticket/cache/repository.py"
click node_improvement_plan "https://github.com/aethergases/ms-aeko-hub/tree/develop/improvement_plan"
click node_hub_metrics "https://github.com/aethergases/ms-aeko-hub/tree/develop/hub_metrics"
click node_aeko_metrics "https://github.com/aethergases/ms-aeko-hub/blob/develop/aeko_metrics/service.py"
click node_shared_ops "https://github.com/aethergases/ms-aeko-hub/tree/develop/internal/shared"

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_http_api,node_app,node_oauth,node_oauth_store,node_auth_integrations,node_upload_service,node_upload_cache,node_client toneBlue
class node_session_service,node_session_repo,node_session_cache,node_user_service,node_user_repo,node_memory_worker toneAmber
class node_agent_tools,node_external_services toneMint
class node_improvement_plan,node_hub_metrics,node_aeko_metrics,node_shared_ops toneRose
class node_aeko_sdk toneIndigo
```

## Components

### API and identity

- [HTTP handlers](https://github.com/aethergases/ms-aeko-hub/tree/develop/internal/http): `internal/http`
- [API composition](https://github.com/aethergases/ms-aeko-hub/blob/develop/cmd/api/main.py): `cmd/api/main.py`
- [OAuth service](https://github.com/aethergases/ms-aeko-hub/blob/develop/oauth/service.py): `oauth/service.py`
- [OAuth code cache](https://github.com/aethergases/ms-aeko-hub/blob/develop/oauth/cache/repository.py): `oauth/cache/repository.py`
- [Auth integrations](https://github.com/aethergases/ms-aeko-hub/tree/develop/cmd/api/integrations): `cmd/api/integrations`
- [Upload tickets](https://github.com/aethergases/ms-aeko-hub/blob/develop/upload_ticket/service.py): `upload_ticket/service.py`
- [Upload ticket cache](https://github.com/aethergases/ms-aeko-hub/blob/develop/upload_ticket/cache/repository.py): `upload_ticket/cache/repository.py`

### Conversation and memory

- [Session service](https://github.com/aethergases/ms-aeko-hub/blob/develop/session/service.py): `session/service.py`
- [Session repository](https://github.com/aethergases/ms-aeko-hub/blob/develop/session/database/repository.py): `session/database/repository.py`
- [Session window cache](https://github.com/aethergases/ms-aeko-hub/blob/develop/session/cache/repository.py): `session/cache/repository.py`
- [User service](https://github.com/aethergases/ms-aeko-hub/blob/develop/user/service.py): `user/service.py`
- [User and memory store](https://github.com/aethergases/ms-aeko-hub/blob/develop/user/database/repository.py): `user/database/repository.py`
- [Memory generation worker](https://github.com/aethergases/ms-aeko-hub/blob/develop/cmd/memory_generator_worker/main.py): `cmd/memory_generator_worker/main.py`

### AI tools and integrations

- [Agent tools](https://github.com/aethergases/ms-aeko-hub/tree/develop/cmd/api/tools): `cmd/api/tools`
- [AI and data integrations](https://github.com/aethergases/ms-aeko-hub/tree/develop/cmd/api/integrations): `cmd/api/integrations`

### Domain data and metrics

- [Improvement plans](https://github.com/aethergases/ms-aeko-hub/tree/develop/improvement_plan): `improvement_plan`
- [Hub metrics](https://github.com/aethergases/ms-aeko-hub/tree/develop/hub_metrics): `hub_metrics`
- [Aeko run metrics](https://github.com/aethergases/ms-aeko-hub/blob/develop/aeko_metrics/service.py): `aeko_metrics/service.py`
- [Request and event tracking](https://github.com/aethergases/ms-aeko-hub/tree/develop/internal/shared): `internal/shared`

### Other components

- **Aether clients**
- **Aeko AI core**

## Connections

- Aether clients → HTTP handlers: sends requests
- API composition → HTTP handlers: registers routes (evidence: `cmd/api/main.py`)
- HTTP handlers → Session service: handles conversations (evidence: `internal/http/session_handlers.py`)
- Session service → Session repository: reads and writes (evidence: `session/service.py`)
- Session service → Session window cache: loads windows (evidence: `session/service.py`)
- Session service → User and memory store: loads user memories (evidence: `session/service.py`)
- Session service → Aeko AI core: sends turns (evidence: `session/service.py`)
- HTTP handlers → OAuth service: routes sign-in (evidence: `internal/http/oauth_handlers.py`)
- OAuth service → OAuth code cache: stores authorization codes
- OAuth service → Auth integrations: gets identity profile (evidence: `oauth/service.py`)
- API composition → Agent tools: configures tools (evidence: `cmd/api/main.py`)
- API composition → AI and data integrations: configures integrations (evidence: `cmd/api/main.py`)
- Agent tools → AI and data integrations: uses integrations
- HTTP handlers → Upload tickets: handles upload tickets
- Upload tickets → Upload ticket cache: persists tickets
- Memory generation worker → Session repository: reads sessions (evidence: `cmd/memory_generator_worker/main.py`)
- Memory generation worker → User and memory store: loads and stores memories (evidence: `cmd/memory_generator_worker/main.py`)
- Memory generation worker → Aeko AI core: generates summaries (evidence: `cmd/memory_generator_worker/main.py`)
- API composition → Aeko run metrics: configures metric sink (evidence: `cmd/api/main.py`)
- Aeko run metrics → Request and event tracking: records events
- API composition → Hub metrics: composes metrics (evidence: `cmd/api/main.py`)
- HTTP handlers → Improvement plans: serves plan endpoints
