# botvibeai/humem.cloud architecture

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

- Interactive diagram: https://gitdiagram.com/botvibeai/humem.cloud
- Repository: https://github.com/botvibeai/humem.cloud

## Overview

HuMem.cloud is an edge-hosted memory API and cognitive platform. In the principal flow, an agent or dashboard sends an authenticated memory request; the Worker verifies credentials and routes tenant traffic to a Durable Object, which persists and queries temporal memory and returns results. The README also describes multimodal and shared memory, background graph repair, cognitive-load summarization, identity continuity, and Linea-1 workflow governance. Those branches are represented where documented or excerpted; unsampled implementation details and some API routing are not inferred.

Main entry points: [`src/index.ts`](https://github.com/botvibeai/humem.cloud/blob/main/src/index.ts) (HuMem API Worker), [`src/MemCogDurableObject.ts`](https://github.com/botvibeai/humem.cloud/blob/main/src/MemCogDurableObject.ts) (MemCog Durable Object), [`linea-1/src/governor.ts`](https://github.com/botvibeai/humem.cloud/blob/main/linea-1/src/governor.ts) (Governance agent), [`public/index.js`](https://github.com/botvibeai/humem.cloud/blob/main/public/index.js) (Memory dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_worker["HuMem API Worker<br/>[index.ts]"]
  node_auth["Authentication and JWT<br/>[index.ts]"]
  node_semantic_kv[("Semantic cache KV")]
  node_memory_router["Tenant memory routing<br/>[index.ts]"]
end

subgraph group_memory["Memory runtime"]
  node_memcog["MemCog Durable Object"]
  node_memory_db[("Temporal memory store")]
  node_memory_ingest["Memory ingestion"]
  node_memory_query["Temporal memory query"]
end

subgraph group_cognition["Cognitive services"]
  node_dreaming["Alarm dreaming"]
  node_orcaos["OrcaOS services"]
end

subgraph group_workflow["Workflow governance"]
  node_linea_dispatch["Workflow dispatcher<br/>[dispatcher.ts]"]
  node_dynamic_workflow["Dynamic workflow engine<br/>[dispatcher.ts]"]
  node_governor["Governance agent<br/>[governor.ts]"]
  node_governance_db[("Governance records<br/>[governor.ts]")]
end

subgraph group_web["Web experience"]
  node_web_app["Memory dashboard<br/>[index.js]"]
  node_web_auth["Google sign-in<br/>[auth.js]"]
  node_paypal_ui["Subscription checkout<br/>[paypal.js]"]
  node_service_worker["Offline asset cache<br/>[sw.js]"]
end

node_agent(("AI agent"))
node_dashboard_user(("Dashboard user"))
node_humem_service["HuMem memory service"]
node_paypal_service["PayPal service"]

node_agent -->|"calls API"| node_worker
node_dashboard_user -->|"uses"| node_web_app
node_web_app -->|"posts memory"| node_worker
node_worker -->|"verifies requests"| node_auth
node_auth -->|"reads challenges"| node_semantic_kv
node_worker -->|"uses cache"| node_semantic_kv
node_worker -->|"routes tenant requests"| node_memory_router
node_memory_router -->|"dispatches request"| node_memcog
node_memcog -->|"reads and writes"| node_memory_db
node_memcog -->|"handles ingest"| node_memory_ingest
node_memcog -->|"handles query"| node_memory_query
node_memcog -->|"runs alarm"| node_dreaming
node_memory_query -->|"requests summaries"| node_orcaos
node_dreaming -.->|"requests graph repair"| node_orcaos
node_dashboard_user -->|"signs in"| node_web_auth
node_web_app -->|"queries memory"| node_worker
node_dashboard_user -->|"subscribes"| node_paypal_ui
node_paypal_ui -->|"creates subscription"| node_paypal_service
node_linea_dispatch -->|"gets service status"| node_governor
node_linea_dispatch -->|"creates workflow"| node_dynamic_workflow
node_dynamic_workflow -->|"returns runner"| node_linea_dispatch
node_governor -->|"records state"| node_governance_db
node_linea_dispatch -->|"triggers identity and fixes"| node_governor
node_governor -->|"queries identity context"| node_humem_service
node_governor -.->|"applies graph fixes"| node_humem_service
node_web_app -.->|"served with caching"| node_service_worker

click node_worker "https://github.com/botvibeai/humem.cloud/blob/main/src/index.ts"
click node_auth "https://github.com/botvibeai/humem.cloud/blob/main/src/index.ts"
click node_memory_router "https://github.com/botvibeai/humem.cloud/blob/main/src/index.ts"
click node_memcog "https://github.com/botvibeai/humem.cloud/blob/main/src/MemCogDurableObject.ts"
click node_memory_db "https://github.com/botvibeai/humem.cloud/blob/main/src/MemCogDurableObject.ts"
click node_memory_ingest "https://github.com/botvibeai/humem.cloud/blob/main/src/MemCogDurableObject.ts"
click node_memory_query "https://github.com/botvibeai/humem.cloud/blob/main/src/MemCogDurableObject.ts"
click node_dreaming "https://github.com/botvibeai/humem.cloud/blob/main/src/MemCogDurableObject.ts"
click node_linea_dispatch "https://github.com/botvibeai/humem.cloud/blob/main/linea-1/src/dispatcher.ts"
click node_dynamic_workflow "https://github.com/botvibeai/humem.cloud/blob/main/linea-1/src/dispatcher.ts"
click node_governor "https://github.com/botvibeai/humem.cloud/blob/main/linea-1/src/governor.ts"
click node_governance_db "https://github.com/botvibeai/humem.cloud/blob/main/linea-1/src/governor.ts"
click node_web_app "https://github.com/botvibeai/humem.cloud/blob/main/public/index.js"
click node_web_auth "https://github.com/botvibeai/humem.cloud/blob/main/public/auth.js"
click node_paypal_ui "https://github.com/botvibeai/humem.cloud/blob/main/public/paypal.js"
click node_service_worker "https://github.com/botvibeai/humem.cloud/blob/main/public/sw.js"

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_worker,node_auth,node_semantic_kv,node_memory_router,node_dashboard_user toneBlue
class node_memcog,node_memory_db,node_memory_ingest,node_memory_query toneAmber
class node_dreaming,node_orcaos toneMint
class node_linea_dispatch,node_dynamic_workflow,node_governor,node_governance_db toneRose
class node_web_app,node_web_auth,node_paypal_ui,node_service_worker,node_agent,node_humem_service,node_paypal_service toneIndigo
```

## Components

### API and access

- [HuMem API Worker](https://github.com/botvibeai/humem.cloud/blob/main/src/index.ts): `src/index.ts`
- [Authentication and JWT](https://github.com/botvibeai/humem.cloud/blob/main/src/index.ts): `src/index.ts`
- **Semantic cache KV**
- [Tenant memory routing](https://github.com/botvibeai/humem.cloud/blob/main/src/index.ts): `src/index.ts`

### Memory runtime

- [MemCog Durable Object](https://github.com/botvibeai/humem.cloud/blob/main/src/MemCogDurableObject.ts): `src/MemCogDurableObject.ts`
- [Temporal memory store](https://github.com/botvibeai/humem.cloud/blob/main/src/MemCogDurableObject.ts): `src/MemCogDurableObject.ts`
- [Memory ingestion](https://github.com/botvibeai/humem.cloud/blob/main/src/MemCogDurableObject.ts): `src/MemCogDurableObject.ts`
- [Temporal memory query](https://github.com/botvibeai/humem.cloud/blob/main/src/MemCogDurableObject.ts): `src/MemCogDurableObject.ts`

### Cognitive services

- [Alarm dreaming](https://github.com/botvibeai/humem.cloud/blob/main/src/MemCogDurableObject.ts): `src/MemCogDurableObject.ts`
- **OrcaOS services**

### Workflow governance

- [Workflow dispatcher](https://github.com/botvibeai/humem.cloud/blob/main/linea-1/src/dispatcher.ts): `linea-1/src/dispatcher.ts`
- [Dynamic workflow engine](https://github.com/botvibeai/humem.cloud/blob/main/linea-1/src/dispatcher.ts): `linea-1/src/dispatcher.ts`
- [Governance agent](https://github.com/botvibeai/humem.cloud/blob/main/linea-1/src/governor.ts): `linea-1/src/governor.ts`
- [Governance records](https://github.com/botvibeai/humem.cloud/blob/main/linea-1/src/governor.ts): `linea-1/src/governor.ts`

### Web experience

- [Memory dashboard](https://github.com/botvibeai/humem.cloud/blob/main/public/index.js): `public/index.js`
- [Google sign-in](https://github.com/botvibeai/humem.cloud/blob/main/public/auth.js): `public/auth.js`
- [Subscription checkout](https://github.com/botvibeai/humem.cloud/blob/main/public/paypal.js): `public/paypal.js`
- [Offline asset cache](https://github.com/botvibeai/humem.cloud/blob/main/public/sw.js): `public/sw.js`

### Other components

- **AI agent**
- **Dashboard user**
- **HuMem memory service**
- **PayPal service**

## Connections

- AI agent → HuMem API Worker: calls API (evidence: `README.md`)
- Dashboard user → Memory dashboard: uses (evidence: `public/index.js`)
- Memory dashboard → HuMem API Worker: posts memory (evidence: `public/index.js`)
- HuMem API Worker → Authentication and JWT: verifies requests (evidence: `src/index.ts`)
- Authentication and JWT → Semantic cache KV: reads challenges (evidence: `src/index.ts`)
- HuMem API Worker → Semantic cache KV: uses cache (evidence: `src/index.ts`)
- HuMem API Worker → Tenant memory routing: routes tenant requests (evidence: `src/index.ts`)
- Tenant memory routing → MemCog Durable Object: dispatches request (evidence: `src/index.ts`)
- MemCog Durable Object → Temporal memory store: reads and writes (evidence: `src/MemCogDurableObject.ts`)
- MemCog Durable Object → Memory ingestion: handles ingest (evidence: `src/MemCogDurableObject.ts`)
- MemCog Durable Object → Temporal memory query: handles query (evidence: `src/MemCogDurableObject.ts`)
- MemCog Durable Object → Alarm dreaming: runs alarm (evidence: `src/MemCogDurableObject.ts`)
- Temporal memory query → OrcaOS services: requests summaries (evidence: `src/MemCogDurableObject.ts`)
- Alarm dreaming → OrcaOS services: requests graph repair
- Dashboard user → Google sign-in: signs in (evidence: `public/auth.js`)
- Memory dashboard → HuMem API Worker: queries memory (evidence: `public/index.js`)
- Dashboard user → Subscription checkout: subscribes (evidence: `public/paypal.js`)
- Subscription checkout → PayPal service: creates subscription (evidence: `public/paypal.js`)
- Workflow dispatcher → Governance agent: gets service status (evidence: `linea-1/src/dispatcher.ts`)
- Workflow dispatcher → Dynamic workflow engine: creates workflow (evidence: `linea-1/src/dispatcher.ts`)
- Dynamic workflow engine → Workflow dispatcher: returns runner (evidence: `linea-1/src/dispatcher.ts`)
- Governance agent → Governance records: records state (evidence: `linea-1/src/governor.ts`)
- Workflow dispatcher → Governance agent: triggers identity and fixes (evidence: `linea-1/src/dispatcher.ts`)
- Governance agent → HuMem memory service: queries identity context (evidence: `linea-1/src/governor.ts`)
- Governance agent → HuMem memory service: applies graph fixes
- Memory dashboard → Offline asset cache: served with caching
