# memorilabs/memori architecture

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

- Interactive diagram: https://gitdiagram.com/memorilabs/memori
- Repository: https://github.com/memorilabs/memori

## Overview

Memori is a persistent-memory system for LLM agents, exposed through Python and TypeScript SDKs and agent integrations. The principal workflow attributes an agent’s interactions, captures conversations and execution outcomes, then recalls relevant memories for later requests. Its documented capabilities also include provider/framework integrations, BYODB, OpenClaw, Hermes, and MCP. The graph combines README-documented behavior with relationships visible in indexed source; unsampled internals and integration wiring are represented conservatively.

Main entry points: [`memori/__init__.py`](https://github.com/memorilabs/memori/blob/main/memori/__init__.py) (Python SDK), [`core/src/retrieval/pipeline.rs`](https://github.com/memorilabs/memori/blob/main/core/src/retrieval/pipeline.rs) (Vector Retrieval), [`core/src/storage/manager.rs`](https://github.com/memorilabs/memori/blob/main/core/src/storage/manager.rs) (Rust Storage Manager), [`memori/llm/adapters`](https://github.com/memorilabs/memori/tree/main/memori/llm/adapters) (LLM Adapters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sdk["SDKs and Core"]
  node_python["Python SDK<br/>[__init__.py]"]
  node_typescript["TypeScript SDK<br/>[engine.ts]"]
  node_llm_adapters["LLM Adapters"]
  node_network["API Client<br/>[_network.py]"]
end

subgraph group_memory["Memory Pipeline"]
  node_capture["Conversation Capture<br/>[_manager.py]"]
  node_augmentation["Memory Augmentation<br/>[_manager.py]"]
  node_recall["Memory Recall<br/>[recall.py]"]
  node_retrieval["Vector Retrieval<br/>[pipeline.rs]"]
  node_search["Fact Search"]
  node_embeddings["Embeddings"]
end

subgraph group_data["Storage and Provisioning"]
  node_storage_manager["Storage Manager<br/>[_manager.py]"]
  node_rust_storage["Rust Storage Manager<br/>[manager.rs]"]
  node_sql_drivers["SQL Drivers"]
  node_provisioning["Database Provisioning<br/>[_manager.py]"]
end

subgraph group_integrations["Agent Integrations"]
  node_openclaw["OpenClaw Plugin<br/>[index.ts]"]
  node_hermes["Hermes Provider<br/>[__init__.py]"]
  node_claude["Claude Code MCP<br/>[index.ts]"]
end

node_agent(("Agent or App"))
node_llm{{"LLM Provider"}}
node_cloud{{"Memori Cloud API"}}
node_database[("BYODB Database")]

node_agent -->|"registers with"| node_python
node_agent -->|"registers with"| node_typescript
node_python -->|"registers provider"| node_llm_adapters
node_llm -->|"serves requests"| node_llm_adapters
node_llm_adapters -.->|"captures turns"| node_capture
node_python -->|"starts persistence"| node_capture
node_capture -->|"enqueues input"| node_augmentation
node_augmentation -->|"queues writes"| node_storage_manager
node_python -->|"enables recall"| node_recall
node_recall -.->|"requests matches"| node_retrieval
node_retrieval -->|"uses vectors"| node_embeddings
node_retrieval -->|"ranks facts"| node_search
node_retrieval -->|"fetches rows"| node_rust_storage
node_python -->|"uses client"| node_network
node_network -.->|"sends API requests"| node_cloud
node_storage_manager -.->|"connects through adapter"| node_database
node_rust_storage -->|"dispatches by dialect"| node_sql_drivers
node_rust_storage -.->|"reads and writes"| node_database
node_provisioning -->|"requests database"| node_cloud
node_openclaw -.->|"integrates memory"| node_python
node_hermes -->|"uses SDK"| node_python
node_claude -->|"connects via MCP"| node_cloud

click node_python "https://github.com/memorilabs/memori/blob/main/memori/__init__.py"
click node_typescript "https://github.com/memorilabs/memori/blob/main/memori-ts/src/core/engine.ts"
click node_llm_adapters "https://github.com/memorilabs/memori/tree/main/memori/llm/adapters"
click node_capture "https://github.com/memorilabs/memori/blob/main/memori/memory/_manager.py"
click node_augmentation "https://github.com/memorilabs/memori/blob/main/memori/memory/augmentation/_manager.py"
click node_recall "https://github.com/memorilabs/memori/blob/main/memori/memory/recall.py"
click node_retrieval "https://github.com/memorilabs/memori/blob/main/core/src/retrieval/pipeline.rs"
click node_search "https://github.com/memorilabs/memori/tree/main/core/src/search"
click node_embeddings "https://github.com/memorilabs/memori/tree/main/core/src/embeddings"
click node_network "https://github.com/memorilabs/memori/blob/main/memori/_network.py"
click node_storage_manager "https://github.com/memorilabs/memori/blob/main/memori/storage/_manager.py"
click node_rust_storage "https://github.com/memorilabs/memori/blob/main/core/src/storage/manager.rs"
click node_sql_drivers "https://github.com/memorilabs/memori/tree/main/core/src/storage/drivers"
click node_provisioning "https://github.com/memorilabs/memori/blob/main/memori/provisioning/_manager.py"
click node_openclaw "https://github.com/memorilabs/memori/blob/main/integrations/openclaw/src/index.ts"
click node_hermes "https://github.com/memorilabs/memori/blob/main/integrations/hermes/src/memori_hermes/__init__.py"
click node_claude "https://github.com/memorilabs/memori/blob/main/integrations/claude-code/index.ts"

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_python,node_typescript,node_llm_adapters,node_network toneBlue
class node_capture,node_augmentation,node_recall,node_retrieval,node_search,node_embeddings,node_database toneAmber
class node_storage_manager,node_rust_storage,node_sql_drivers,node_provisioning,node_cloud toneMint
class node_openclaw,node_hermes,node_claude toneRose
class node_agent,node_llm toneIndigo
```

## Components

### SDKs and Core

- [Python SDK](https://github.com/memorilabs/memori/blob/main/memori/__init__.py): `memori/__init__.py`
- [TypeScript SDK](https://github.com/memorilabs/memori/blob/main/memori-ts/src/core/engine.ts): `memori-ts/src/core/engine.ts`
- [LLM Adapters](https://github.com/memorilabs/memori/tree/main/memori/llm/adapters): `memori/llm/adapters`
- [API Client](https://github.com/memorilabs/memori/blob/main/memori/_network.py): `memori/_network.py`

### Memory Pipeline

- [Conversation Capture](https://github.com/memorilabs/memori/blob/main/memori/memory/_manager.py): `memori/memory/_manager.py`
- [Memory Augmentation](https://github.com/memorilabs/memori/blob/main/memori/memory/augmentation/_manager.py): `memori/memory/augmentation/_manager.py`
- [Memory Recall](https://github.com/memorilabs/memori/blob/main/memori/memory/recall.py): `memori/memory/recall.py`
- [Vector Retrieval](https://github.com/memorilabs/memori/blob/main/core/src/retrieval/pipeline.rs): `core/src/retrieval/pipeline.rs`
- [Fact Search](https://github.com/memorilabs/memori/tree/main/core/src/search): `core/src/search`
- [Embeddings](https://github.com/memorilabs/memori/tree/main/core/src/embeddings): `core/src/embeddings`

### Storage and Provisioning

- [Storage Manager](https://github.com/memorilabs/memori/blob/main/memori/storage/_manager.py): `memori/storage/_manager.py`
- [Rust Storage Manager](https://github.com/memorilabs/memori/blob/main/core/src/storage/manager.rs): `core/src/storage/manager.rs`
- [SQL Drivers](https://github.com/memorilabs/memori/tree/main/core/src/storage/drivers): `core/src/storage/drivers`
- [Database Provisioning](https://github.com/memorilabs/memori/blob/main/memori/provisioning/_manager.py): `memori/provisioning/_manager.py`

### Agent Integrations

- [OpenClaw Plugin](https://github.com/memorilabs/memori/blob/main/integrations/openclaw/src/index.ts): `integrations/openclaw/src/index.ts`
- [Hermes Provider](https://github.com/memorilabs/memori/blob/main/integrations/hermes/src/memori_hermes/__init__.py): `integrations/hermes/src/memori_hermes/__init__.py`
- [Claude Code MCP](https://github.com/memorilabs/memori/blob/main/integrations/claude-code/index.ts): `integrations/claude-code/index.ts`

### Other components

- **Agent or App**
- **LLM Provider**
- **Memori Cloud API**
- **BYODB Database**

## Connections

- Agent or App → Python SDK: registers with (evidence: `README.md`)
- Agent or App → TypeScript SDK: registers with (evidence: `README.md`)
- Python SDK → LLM Adapters: registers provider (evidence: `memori/__init__.py`)
- LLM Provider → LLM Adapters: serves requests (evidence: `README.md`)
- LLM Adapters → Conversation Capture: captures turns
- Python SDK → Conversation Capture: starts persistence (evidence: `memori/__init__.py`)
- Conversation Capture → Memory Augmentation: enqueues input (evidence: `memori/memory/_manager.py`)
- Memory Augmentation → Storage Manager: queues writes (evidence: `memori/memory/augmentation/_manager.py`)
- Python SDK → Memory Recall: enables recall (evidence: `memori/__init__.py`)
- Memory Recall → Vector Retrieval: requests matches
- Vector Retrieval → Embeddings: uses vectors (evidence: `core/src/retrieval/pipeline.rs`)
- Vector Retrieval → Fact Search: ranks facts (evidence: `core/src/retrieval/pipeline.rs`)
- Vector Retrieval → Rust Storage Manager: fetches rows (evidence: `core/src/retrieval/pipeline.rs`)
- Python SDK → API Client: uses client (evidence: `memori/__init__.py`)
- API Client → Memori Cloud API: sends API requests
- Storage Manager → BYODB Database: connects through adapter
- Rust Storage Manager → SQL Drivers: dispatches by dialect (evidence: `core/src/storage/manager.rs`)
- Rust Storage Manager → BYODB Database: reads and writes
- Database Provisioning → Memori Cloud API: requests database
- OpenClaw Plugin → Python SDK: integrates memory
- Hermes Provider → Python SDK: uses SDK
- Claude Code MCP → Memori Cloud API: connects via MCP (evidence: `README.md`)
