---
title: "Project Structure"
description: "The repository is structured as a multi-language monorepo that organizes core memory engines, cross-platform SDKs, dual command-line interfaces, server tooling, and integrated agent plugins into di..."
last_updated: "2026-10-11T17:37:10.193334+00:00"
canonical_url: "https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/orientation/project-structure"
---

<details>
<summary>Relevant source files</summary>

The following files were used as context for generating this wiki page:

- [cli/python/src/mem0_cli/commands/__init__.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/__init__.py)
- [pyproject.toml](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/pyproject.toml)
- [cli/python/pyproject.toml](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/pyproject.toml)
- [mem0-ts/package.json](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/package.json)
- [cli/node/src/index.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/index.ts)
- [cli/python/src/mem0_cli/app.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/app.py)
- [cli/python/src/mem0_cli/backend/__init__.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/backend/__init__.py)
- [integrations/agent-plugin-core/python/memory_core.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/agent-plugin-core/python/memory_core.py)
- [integrations/mem0-agent-plugin/core/memory_core.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-agent-plugin/core/memory_core.py)
- [integrations/mem0-strands/python/pyproject.toml](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-strands/python/pyproject.toml)
- [cli/node/package.json](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/package.json)
- [mem0-ts/src/oss/src/index.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/index.ts)
- [mem0-ts/src/community/src/index.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/community/src/index.ts)
- [integrations/pi-agent-plugin/src/index.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/pi-agent-plugin/src/index.ts)
- [server/dashboard/package.json](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json)
- [integrations/openclaw/index.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/openclaw/index.ts)
- [mem0/__init__.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/__init__.py)
- [mem0-ts/src/community/package.json](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/community/package.json)
- [mem0-ts/src/oss/package.json](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/package.json)
- [cli/python/src/mem0_cli/__init__.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/__init__.py)
- [integrations/agent-plugin-core/typescript/package.json](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/agent-plugin-core/typescript/package.json)
- [integrations/vercel-ai-sdk/src/index.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/vercel-ai-sdk/src/index.ts)
- [mem0/client/__init__.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/client/__init__.py)
- [integrations/pi-agent-plugin/package.json](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/pi-agent-plugin/package.json)
- [integrations/mem0-strands/python/src/mem0_strands/__init__.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-strands/python/src/mem0_strands/__init__.py)
- [mem0/configs/__init__.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/configs/__init__.py)
- [cli/python/src/mem0_cli/__main__.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/__main__.py)
- [cli/cli-spec.json](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/cli-spec.json)
- [Makefile](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/Makefile)
- [mem0-ts/src/community/src/integrations/langchain/index.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/community/src/integrations/langchain/index.ts)
</details>

## Overview

The repository is structured as a multi-language monorepo that organizes core memory engines, cross-platform SDKs, dual command-line interfaces, server tooling, and integrated agent plugins into discrete, cohesive subdirectories. At the root level, build automation via Makefiles and Python Hatchling configurations (`pyproject.toml`) coordinate packaging, formatting, linting, and multi-version test environments for python artifacts.

Sources: [Makefile:1-52](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/Makefile#L1-L52), [pyproject.toml:1-174](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/pyproject.toml#L1-L174)

TypeScript modules are separated into standalone packages such as the main client library (`mem0-ts`), open-source memory store implementations (`mem0-ts/src/oss`), and community extensions (`mem0-ts/src/community`), while dashboard services reside within dedicated web application directories (`server/dashboard`). Parallel Python and Node.js command-line tool packages (`cli/python`, `cli/node`) implement the standard command interface defined by shared command-line specifications (`cli/cli-spec.json`). Furthermore, specialized agent plugins (`integrations/openclaw`, `integrations/pi-agent-plugin`, `integrations/vercel-ai-sdk`, `integrations/mem0-strands`) tie into shared agent cores (`integrations/agent-plugin-core`) to provide background capture, auto-recall, and lifecycle hooks across diverse AI frameworks.

Sources: [mem0-ts/package.json:1-150](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/package.json#L1-L150), [server/dashboard/package.json:1-84](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L1-L84), [cli/cli-spec.json:1-562](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/cli-spec.json#L1-L562), [integrations/openclaw/index.ts:1-58](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/openclaw/index.ts#L1-L58)

## Monorepo Build and Packaging Layout

### Root Build Configuration and Packaging

The repository root uses Hatchling as its build backend to package the core Python library under project name `mem0ai` version `2.2.1`. The root `pyproject.toml` defines required core runtime dependencies including vector store clients, Pydantic, OpenAI, httpx, posthog, pytz, SQLAlchemy, and protobuf, alongside extensive optional feature groups.

| Optional Feature Group | Target / Purpose |
| :--- | :--- |
| `nlp` | spaCy natural language processing support (`spacy>=3.7.0`) |
| `vector-stores` | Integrations for vector backends like Chroma, Weaviate, Pinecone, FAISS, Qdrant variants, and relational extensions |
| `llms` | Large language model provider integrations including Groq, Together, LiteLLM, Ollama, and Google Generative AI |
| `extras` | Additional utilities, AWS boto3, LangChain ecosystems, and transformers |
| `test` | Test execution frameworks (`pytest`, `pytest-mock`, `pytest-asyncio`) |
| `dev` | Developer tools including Ruff and pre-commit hooks |

Sources: [pyproject.toml:1-87](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/pyproject.toml#L1-L87)

> [!NOTE]
> Hatchling build targets explicitly scope packaged files to the `mem0` source directory and config assets while filtering out non-source files via exclusion rules.

Sources: [pyproject.toml:92-106](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/pyproject.toml#L92-L106)

### Tooling Automation and Makefiles

The root `Makefile` exposes automation commands for formatting, sorting imports, building, publishing, and running multi-version test matrices via Hatch environments.

```
.PHONY: format sort lint

# Variables
ISORT_OPTIONS = --profile black
PROJECT_NAME := mem0ai

# Default target
all: format sort lint

install:
	hatch env create

install_all:
	pip install ruff==0.16.0 groq together boto3 'litellm>=1.83.7,<1.98.0' ollama chromadb weaviate weaviate-client sentence_transformers vertexai \
	            google-generativeai elasticsearch opensearch-py vecs "pinecone<7.0.0" pinecone-text faiss-cpu langchain-community \
							upstash-vector azure-search-documents langchain-memgraph langchain-neo4j langchain-aws rank-bm25 pymochow pymongo psycopg kuzu databricks-sdk valkey

# Format code with ruff
format:
	hatch run format

# Sort imports with isort
sort:
	hatch run isort mem0/

# Lint code with ruff
lint:
	hatch run lint

docs:
	cd docs && mintlify dev

build:
	hatch build

publish:
	hatch publish

clean:
	rm -rf dist

test:
	hatch run test

test-py-3.10:
	hatch run dev_py_3_10:test

test-py-3.11:
	hatch run dev_py_3_11:test

test-py-3.12:
	hatch run dev_py_3_12:test
```
Sources: [Makefile:1-52](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/Makefile#L1-L52)

> [!WARNING]
> Running `make install_all` executes a broad `pip install` covering diverse vector database connectors and LLM libraries simultaneously, which requires compatible native compilation dependencies on the host system.

Sources: [Makefile:13-17](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/Makefile#L13-L17)

### Subpackage Layouts and Tool Configurations

Subpackages within the monorepo maintain independent `pyproject.toml` manifests with dedicated linting and testing parameters. The Strands integration package (`integrations/mem0-strands/python/pyproject.toml`) configures `mem0-strands` with required dependencies on `strands-agents>=1.45.0` and `mem0ai>=2.0.11`, while defining MyPy type-checking rules.

```
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "mem0-strands"
version = "0.1.1"
description = "Persistent long-term memory for Strands agents, backed by Mem0."
readme = "README.md"
requires-python = ">=3.10"
license = "Apache-2.0"
authors = [
    {name = "Mem0", email = "founders@mem0.ai"}
]
keywords = ["strands", "strands-agents", "agents", "ai", "memory", "mem0", "vector-search", "personalization"]
classifiers = [
    "Development Status :: 4 - Beta",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: Apache Software License",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Topic :: Scientific/Engineering :: Artificial Intelligence",
]

# strands-agents>=1.45.0: first release shipping the `strands.memory` module
# (MemoryStore / MemoryManager) that Mem0MemoryStore implements.
dependencies = [
    "strands-agents>=1.45.0",
    "mem0ai>=2.0.11",
]

[project.urls]
Homepage = "https://mem0.ai"
Documentation = "https://github.com/mem0ai/mem0/tree/main/integrations/mem0-strands#readme"
Repository = "https://github.com/mem0ai/mem0"
Issues = "https://github.com/mem0ai/mem0/issues"

[project.optional-dependencies]
dev = [
    "pytest>=8.0.0,<9.0.0",
    "pytest-asyncio>=0.25.0,<1.0.0",
    "ruff>=0.11.0,<1.0.0",
    "mypy>=1.15.0,<2.0.0",
    "hatch",
]

```
Sources: [integrations/mem0-strands/python/pyproject.toml:1-48](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-strands/python/pyproject.toml#L1-L48)

Similarly, the Python CLI package (`cli/python/pyproject.toml`) declares `mem0-cli` using Typer and Rich for console interaction, defining `mem0 = "mem0_cli.app:main"` as its primary executable script entry point.

```
dependencies = [
    "typer>=0.9.0",
    "rich>=13.0.0",
    "httpx>=0.24.0",
]

[project.optional-dependencies]
oss = ["mem0ai>=0.1.0"]
dev = [
    "pytest>=7.0",
    "pytest-asyncio>=0.21",
    "ruff>=0.1.0",
]

[project.scripts]
mem0 = "mem0_cli.app:main"

```
Sources: [cli/python/pyproject.toml:27-43](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/pyproject.toml#L27-L43)

## Python Core Engine Architecture

### Entry Modules and Version Resolution

The core Python library is initialized via the package entry module `mem0/__init__.py`. This module dynamically resolves the package version string using `importlib.metadata.version("mem0ai")` to query the installed distribution metadata.

```python
import importlib.metadata

__version__ = importlib.metadata.version("mem0ai")

from mem0.client.main import AsyncMemoryClient, MemoryClient  # noqa
from mem0.memory.main import AsyncMemory, Memory  # noqa
```
Sources: [mem0/__init__.py:1-6](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/__init__.py#L1-L6)

> [!NOTE]
> The package version is retrieved dynamically from distribution metadata at runtime rather than being hardcoded in the source tree, ensuring that editable and bundled installations reflect the precise version declared by Hatchling.

Sources: [mem0/__init__.py:1-3](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/__init__.py#L1-L3)

### Core Component Exports

The package init module exposes primary memory engine interfaces and remote client classes for both synchronous and asynchronous execution workflows. These symbols are imported directly from their respective internal implementation modules with `# noqa` directives silencing unused import linters.

| Export Symbol | Module Path | Purpose |
| :--- | :--- | :--- |
| `Memory` | `mem0.memory.main` | Synchronous core memory engine for storage, search, and history |
| `AsyncMemory` | `mem0.memory.main` | Asynchronous core memory engine for non-blocking I/O operations |
| `MemoryClient` | `mem0.client.main` | Synchronous remote platform API client |
| `AsyncMemoryClient` | `mem0.client.main` | Asynchronous remote platform API client |

Sources: [mem0/__init__.py:5-6](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/__init__.py#L5-L6)

> [!IMPORTANT]
> The sub-package initialization files `mem0/client/__init__.py` and `mem0/configs/__init__.py` are intentionally left blank as structural namespace containers, delegating concrete initialization to submodule imports.

Sources: [mem0/client/__init__.py:1-1](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/client/__init__.py#L1-L1), [mem0/configs/__init__.py:1-1](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0/configs/__init__.py#L1-L1)

## TypeScript SDK and OSS Packages

### Package Manifest and Root Export Structure

The TypeScript monorepo workspace under `mem0-ts` splits its architecture into two primary packages: the core `mem0ai` package and the community-contributed `@mem0/community` package. The root `mem0-ts/package.json` configures bundling automation using `tsup`, emitting CommonJS (`.js`) and ESM (`.mjs`) builds alongside bundled declaration maps while defining conditional export paths for `.` and `./oss`.

Sources: [mem0-ts/package.json:1-70](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/package.json#L1-L70)

The core OSS entry point `mem0-ts/src/oss/src/index.ts` re-exports the entire memory subsystem, covering core memory definitions, vector stores, embedding providers, LLM backends, and rerankers.

| Export Category | Representative Modules | Sources |
| :--- | :--- | :--- |
| Memory & Core | `./memory`, `./memory/memory.types`, `./types`, `./utils/factory` | [mem0-ts/src/oss/src/index.ts:1-3,60](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/index.ts#L1-L3,60) |
| Embeddings | `./embeddings/openai`, `./embeddings/ollama`, `./embeddings/aws_bedrock`, `./embeddings/fastembed` | [mem0-ts/src/oss/src/index.ts:4-15](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/index.ts#L4-L15) |
| LLMs | `./llms/openai`, `./llms/anthropic`, `./llms/ollama`, `./llms/litellm` | [mem0-ts/src/oss/src/index.ts:16-28](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/index.ts#L16-L28) |
| Vector Stores | `./vector_stores/qdrant`, `./vector_stores/pinecone`, `./vector_stores/pgvector`, `./vector_stores/chromadb` | [mem0-ts/src/oss/src/index.ts:29-54](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/index.ts#L29-L54) |
| Rerankers | `./rerankers/cohere`, `./rerankers/llm`, `./rerankers/cross_encoder` | [mem0-ts/src/oss/src/index.ts:55-59](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/index.ts#L55-L59) |

Sources: [mem0-ts/src/oss/src/index.ts:1-60](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/oss/src/index.ts#L1-L60)

> [!NOTE]
> The `tsup` build configuration marks `@mem0/community` as an external dependency while forcing internal inclusion of community files matching `src/community/**`, ensuring clean boundary separation between core OSS features and peripheral integrations.

Sources: [mem0-ts/package.json:64-69](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/package.json#L64-L69)

### Community Package and Framework Integrations

The `@mem0/community` package (`mem0-ts/src/community/package.json`) manages peripheral ecosystem integrations such as LangChain. It specifies dual export targets for the root package and the LangChain integration module, pinning required peer and runtime dependencies on `@langchain/core`, `@langchain/community`, and `mem0ai`.

Sources: [mem0-ts/src/community/package.json:1-38](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/community/package.json#L1-L38)

The community entry module `mem0-ts/src/community/src/index.ts` exposes framework bindings, delegating to submodule declarations like the LangChain integration entry point.

```typescript
export * from "./integrations/langchain";
```
Sources: [mem0-ts/src/community/src/index.ts:1-1](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/community/src/index.ts#L1-L1)

> [!WARNING]
> The community build configuration explicitly targets Node.js version 18 or greater (`"node": ">=18"`) and requires a strict public access publish configuration (`"access": "public"`).

Sources: [mem0-ts/src/community/package.json:85-90](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/mem0-ts/src/community/package.json#L85-L90)

## Dual CLI Implementations and Specifications

### Package Structure and Node.js Dependencies

The Node.js CLI package residing at `cli/node/package.json` defines the official command-line interface under the package name `@mem0/cli` at version `0.2.14`. It targets Node.js version `18.0.0` or higher and configures its executable binary mapping under the `bin` field to point `./dist/index.js` to the `mem0` command.

Sources: [cli/node/package.json:1-20](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/package.json#L1-L20)

| Dependency | Version | Purpose | Sources |
| :--- | :--- | :--- | :--- |
| `commander` | `^12.0.0` | Command-line option parsing and routing | [cli/node/package.json:32-33](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/package.json#L32-L33) |
| `chalk` | `^5.3.0` | Terminal string styling | [cli/node/package.json:34-34](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/package.json#L34-L34) |
| `cli-table3` | `^0.6.4` | Tabular data formatting | [cli/node/package.json:35-35](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/package.json#L35-L35) |
| `ora` | `^8.0.0` | Terminal spinners for asynchronous actions | [cli/node/package.json:36-36](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/package.json#L36-L36) |
| `boxen` | `^7.1.0` | Boxed terminal banners | [cli/node/package.json:37-37](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/package.json#L37-L37) |

Sources: [cli/node/package.json:32-38](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/package.json#L32-L38)

> [!NOTE]
> Development tooling in `cli/node/package.json` relies on `tsup` for bundling, `tsx` for direct execution during development, `vitest` for test runner execution, and `biome` for linting and code style checking.

Sources: [cli/node/package.json:9-17](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/package.json#L9-L17), [cli/node/package.json:39-47](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/package.json#L39-L47)

### Python CLI Layout and Specifications

The Python CLI package structures its commands and backend abstractions within `cli/python/src/mem0_cli/`, exposing version metadata and backend factory bindings through initializers.

```python
"""mem0 CLI — the command-line interface for the mem0 memory layer."""

```
Sources: [cli/python/src/mem0_cli/__init__.py:1-2](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/__init__.py#L1-L2)

The backend package initialization module `cli/python/src/mem0_cli/backend/__init__.py` imports and re-exports the `Backend` abstract base class and `get_backend` factory function from the backend subsystem.

```python
"""Backend abstraction layer for mem0 CLI."""

from mem0_cli.backend.base import Backend, get_backend

__all__ = ["Backend", "get_backend"]
```
Sources: [cli/python/src/mem0_cli/backend/__init__.py:1-5](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/backend/__init__.py#L1-L5)

Command modules are organized as a submodule package namespace under `cli/python/src/mem0_cli/commands/__init__.py`.

```python
"""CLI command modules."""
```
Sources: [cli/python/src/mem0_cli/commands/__init__.py:1-1](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/__init__.py#L1-L1)

Unified behavior across both CLI implementations is governed by the master specification file `cli/cli-spec.json`, which defines configuration defaults, API endpoint mappings, error messages, and command options.

| Configuration Field | Key / Setting | Default Value / Target | Sources |
| :--- | :--- | :--- | :--- |
| Config Directory | `configDir` | `~/.mem0` | [cli/cli-spec.json:35-38](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/cli-spec.json#L35-L38) |
| Config File | `configFile` | `config.json` | [cli/cli-spec.json:35-38](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/cli-spec.json#L35-L38) |
| Base URL | `defaultBaseUrl` | `https://api.mem0.ai` | [cli/cli-spec.json:39-40](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/cli-spec.json#L39-L40) |
| API Authentication | `authHeader` / `authScheme` | `Authorization` / `Token` | [cli/cli-spec.json:98-101](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/cli-spec.json#L98-L101) |
| Request Timeout | `timeout` | `30` seconds | [cli/cli-spec.json:98-102](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/cli-spec.json#L98-L102) |

Sources: [cli/cli-spec.json:35-40](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/cli-spec.json#L35-L40), [cli/cli-spec.json:98-102](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/cli-spec.json#L98-L102)

> [!WARNING]
> The specification mandates specific error handling mapping: an HTTP `401` status triggers `AuthError` with the message `"Authentication failed. Your API key may be invalid or expired."`, while missing API keys prompt the user to run `mem0 init` or set the `MEM0_API_KEY` environment variable.

Sources: [cli/cli-spec.json:109-126](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/cli-spec.json#L109-L126)

## Server Dashboard Application Layout

### Web Dashboard Workspace and Metadata

The server web dashboard resides inside `server/dashboard/` and is managed as a private Next.js application using `pnpm` version `10.34.2`. Its project configuration specifies execution scripts for development, production builds, local serving, linting, formatting, and typechecking.

| Script Name | Command | Purpose | Sources |
| :--- | :--- | :--- | :--- |
| `dev` | `next dev` | Start Next.js development server | [server/dashboard/package.json:6-8](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L6-L8) |
| `build` | `next build` | Compile production application bundle | [server/dashboard/package.json:6-8](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L6-L8) |
| `start` | `next start` | Launch production server instance | [server/dashboard/package.json:8-10](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L8-L10) |
| `lint` | `prettier --check .` | Verify code style with Prettier | [server/dashboard/package.json:10-11](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L10-L11) |
| `format` | `prettier --write .` | Format codebase files with Prettier | [server/dashboard/package.json:10-12](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L10-L12) |
| `typecheck` | `tsc --noEmit` | Run TypeScript type validation without emitting files | [server/dashboard/package.json:11-13](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L11-L13) |

Sources: [server/dashboard/package.json:6-13](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L6-L13)

> [!NOTE]
> The dashboard package enforces strict private visibility (`"private": true`) and pins Next.js to version `15.5.24` alongside React `19.0.0` within its dependency tree.

Sources: [server/dashboard/package.json:4-4](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L4-L4), [server/dashboard/package.json:48-50](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L48-L50)

### UI Primitives and State Management Dependencies

The dashboard application integrates component primitives from Radix UI alongside Redux Toolkit for state management, Tailwind CSS for styling utility, and React Hook Form with Zod validation.

| Dependency Group | Key Packages | Purpose | Sources |
| :--- | :--- | :--- | :--- |
| Component Library | `@radix-ui/react-accordion`, `@radix-ui/react-dialog`, `@radix-ui/react-dropdown-menu`, `@radix-ui/react-tabs` | Accessible headless UI primitives | [server/dashboard/package.json:15-17](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L15-L17), [server/dashboard/package.json:20-23](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L20-L23), [server/dashboard/package.json:34-37](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L34-L37) |
| State & Data | `@reduxjs/toolkit`, `react-redux`, `@tanstack/react-table`, `axios` | Global state, table rendering, and HTTP communication | [server/dashboard/package.json:38-41](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L38-L41), [server/dashboard/package.json:54-56](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L54-L56) |
| Forms & Validation | `react-hook-form`, `@hookform/resolvers`, `zod` | Form state handling and schema validation | [server/dashboard/package.json:14-16](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L14-L16), [server/dashboard/package.json:54-55](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L54-L55), [server/dashboard/package.json:64-66](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L64-L66) |
| Styling & Motion | `tailwindcss`, `framer-motion`, `lucide-react`, `next-themes` | Layout utility, animations, icon sets, and dark mode support | [server/dashboard/package.json:44-50](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L44-L50), [server/dashboard/package.json:80-82](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L80-L82) |

Sources: [server/dashboard/package.json:14-38](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L14-L38), [server/dashboard/package.json:44-66](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L44-L66), [server/dashboard/package.json:80-82](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L80-L82)

> [!WARNING]
> Development tooling in `server/dashboard/package.json` relies on TypeScript `5.6.3`, Tailwind CSS Typography (`@tailwindcss/typography`), and ESLint configured with the Next.js rule set.

Sources: [server/dashboard/package.json:67-69](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L67-L69), [server/dashboard/package.json:77-79](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L77-L79), [server/dashboard/package.json:81-83](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/server/dashboard/package.json#L81-L83)

## Agent Integration Plugins and Frameworks

### Ecosystem Organization and Package Structure

The repository houses several ecosystem integrations and shared agent harnesses under the `integrations/` directory, spanning both Python and TypeScript runtimes. These plugins embed Mem0 functionality directly into popular coding agents, framework runtimes, and LLM orchestration layers such as OpenClaw, Pi Agent, Strands, and the Vercel AI SDK. Shared packages such as `@mem0/agent-plugin-core` provide common utility implementations across TypeScript agent harnesses.

| Package Name | Language / Runtime | Manifest Path | Primary Purpose | Sources |
| :--- | :--- | :--- | :--- | :--- |
| `@mem0/pi-agent-plugin` | TypeScript / Node.js | `integrations/pi-agent-plugin/package.json` | Persistent, scoped, semantic memory extension for Pi Coding Agent across sessions and projects | [integrations/pi-agent-plugin/package.json:1-6](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/pi-agent-plugin/package.json#L1-L6) |
| `@mem0/agent-plugin-core` | TypeScript / Node.js | `integrations/agent-plugin-core/typescript/package.json` | Private core utility and lifecycle management package for TypeScript agent plugins | [integrations/agent-plugin-core/typescript/package.json:1-6](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/agent-plugin-core/typescript/package.json#L1-L6) |
| `mem0-strands` | Python | `integrations/mem0-strands/python/pyproject.toml` | Persistent long-term memory store for Strands agents with automatic injection and server-side extraction | [integrations/mem0-strands/python/pyproject.toml:5-15](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-strands/python/pyproject.toml#L5-L15) |
| `mem0-agent-plugin` | Python | `integrations/mem0-agent-plugin/core/memory_core.py` | Shared Python core providing session hooks, extraction instructions, and secret redaction patterns | [integrations/mem0-agent-plugin/core/memory_core.py:2-88](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-agent-plugin/core/memory_core.py#L2-L88) |
| `openclaw-mem0` | TypeScript / Node.js | `integrations/openclaw/index.ts` | OpenClaw plugin providing dual-mode long-term memory, auto-recall, auto-capture, and 6 core tools | [integrations/openclaw/index.ts:1-17](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/openclaw/index.ts#L1-L17) |
| `vercel-ai-sdk` | TypeScript / Node.js | `integrations/vercel-ai-sdk/src/index.ts` | [Vercel AI SDK integration](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/ecosystem-integrations/vercel-ai-sdk-integration) facade providing provider wrappers and utility functions for memory operations | [integrations/vercel-ai-sdk/src/index.ts:1-5](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/vercel-ai-sdk/src/index.ts#L1-L5) |

Sources: [integrations/pi-agent-plugin/package.json:1-6](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/pi-agent-plugin/package.json#L1-L6), [integrations/agent-plugin-core/typescript/package.json:1-6](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/agent-plugin-core/typescript/package.json#L1-L6), [integrations/mem0-strands/python/pyproject.toml:5-15](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-strands/python/pyproject.toml#L5-L15), [integrations/mem0-agent-plugin/core/memory_core.py:2-88](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-agent-plugin/core/memory_core.py#L2-L88), [integrations/openclaw/index.ts:1-17](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/openclaw/index.ts#L1-L17), [integrations/vercel-ai-sdk/src/index.ts:1-5](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/vercel-ai-sdk/src/index.ts#L1-L5)

> [!NOTE]
> The Python agent plugin core defines standardized instructions for repository and personal memory extraction alongside regular expression filters for test commands, build commands, and sensitive credential redaction.

Sources: [integrations/mem0-agent-plugin/core/memory_core.py:74-88](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-agent-plugin/core/memory_core.py#L74-L88), [integrations/mem0-agent-plugin/core/memory_core.py:128-161](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-agent-plugin/core/memory_core.py#L128-L161)

### Plugin Runtime Exports and Capabilities

Individual ecosystem integrations expose entry points, tool registrations, scoping handlers, and configuration schemas to hook into their respective agent runtimes. Pi Agent and OpenClaw packages bundle extension modules, skill loaders, and telemetry collectors, while the Vercel AI SDK wrapper exposes helper functions like `addMemories`, `retrieveMemories`, `searchMemories`, and `getMemories`.

```typescript
export type {
  Scope,
  Mem0Config,
  ScopeContext,
  CustomCategory,
} from "./types.ts";
export { DEFAULT_CUSTOM_CATEGORIES } from "./types.ts";

export { loadConfig, CONFIG_DIR } from "./config/index.ts";

export { registerMemoryTool, buildToolExecute } from "./memory/tools.ts";
export { detectAppId, detectRunId, resolveSearchFilters, resolveAddParams } from "./memory/scoping.ts";
export { formatAge, formatMemoryCompact, formatMemoryList, groupByCategory } from "./memory/formatting.ts";

export { setupAutoCapture, extractConversation } from "./capture/index.ts";

export { MEMORY_POLICY } from "./prompt.ts";

export { registerCommands } from "./commands.ts";

export { captureEvent, captureToolEvent, captureCommandEvent, _getEventQueue, _resetForTesting } from "./telemetry.ts";

```
Sources: [integrations/pi-agent-plugin/src/index.ts:1-22](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/pi-agent-plugin/src/index.ts#L1-L22)

> [!WARNING]
> [Pi Agent plugin](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/agent-plugins/pi-agent-plugin) dependency overrides enforce specific minimum versions for security-critical packages including `form-data`, `uuid`, `esbuild`, `undici`, and `axios` within its pnpm configuration block.

Sources: [integrations/pi-agent-plugin/package.json:70-83](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/pi-agent-plugin/package.json#L70-L83)

## Related

- [Overview](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/orientation/overview)
- [Quick Start](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/orientation/quick-start)


## Sitemap

See the full [sitemap](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/llms.txt) for all pages in this wiki.
