Knowledge2026年4月7日·1 分钟阅读

Mem0 — Memory Layer for AI Applications

Add persistent, personalized memory to AI agents and assistants. Mem0 stores user preferences, past interactions, and learned context across sessions.

Agent 就绪

添加到 Agent 知识库

添加知识文档;源工具的安装与运行验证要求请参考正文说明。

Native · 96/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Knowledge
安装
Single
信任
信任等级:Established
入口
Mem0 — Memory Layer for AI Applications
直接安装命令
npx -y tokrepo@latest install 96da1f40-1823-4d87-a84f-7d8269edeb24 --target codex

先 dry-run 确认安装计划,再运行此命令。

TL;DR
Mem0 gives AI apps persistent memory across sessions with simple add/search APIs.
§01

What it is

Mem0 (pronounced 'memo') is a memory infrastructure layer for AI applications. It automatically extracts, stores, and retrieves relevant facts and preferences from conversations, giving AI agents persistent context across sessions without manual prompt engineering.

The project suits developers building chatbots, AI assistants, or agent systems that need to remember user preferences, project context, or learned behaviors between sessions.

§02

How it saves time or tokens

Without persistent memory, developers stuff prior conversation history into every prompt, burning tokens on repetitive context. Mem0 replaces this pattern with a search-based retrieval system: only relevant memories are fetched per query, reducing prompt size and improving response accuracy.

§03

How to use

  1. Install Mem0 with pip install mem0ai.
  2. Initialize the Memory object and add facts using m.add('fact', user_id='user').
  3. Search memories with m.search('query', user_id='user') to retrieve relevant context for your prompts.
§04

Example

from mem0 import Memory

m = Memory()

# Store user preferences
m.add('I prefer Python over JavaScript', user_id='alice')
m.add('My project uses PostgreSQL and Redis', user_id='alice')

# Retrieve relevant memories
results = m.search('what database does alice use?', user_id='alice')
print(results)
# [{'memory': 'Uses PostgreSQL and Redis', 'score': 0.95}]

# Multi-level memory: user, agent, and session scopes
m.add('Dark mode preferred', user_id='alice')
m.add('Always respond in bullet points', agent_id='support-bot')
§05

Related on TokRepo

§06

Common pitfalls

  • Do not store entire conversation transcripts as memories. Mem0 works best with extracted facts and preferences, not raw text dumps.
  • Memory search is semantic, not keyword-based. Queries like 'database' will match 'PostgreSQL' even without exact word overlap.
  • For production use, configure a persistent vector store backend. The default in-memory store loses data on restart.

常见问题

How does Mem0 differ from just storing chat history?+

Chat history stores raw messages chronologically. Mem0 extracts discrete facts and preferences, stores them as semantic vectors, and retrieves only relevant ones per query. This reduces token usage and improves response quality compared to stuffing full history into prompts.

What vector stores does Mem0 support?+

Mem0 supports multiple vector store backends including Qdrant, Chroma, Pinecone, and an in-memory default for development. You configure the backend when initializing the Memory object.

Can Mem0 handle multi-user applications?+

Yes. Mem0 supports user-level, agent-level, and session-level memory scopes. Each memory is tagged with identifiers so different users and agents maintain separate memory spaces.

Does Mem0 work with any LLM provider?+

Mem0 is LLM-agnostic. It stores and retrieves memories independently of which model you use. You can pair it with OpenAI, Anthropic, local models, or any other provider.

Is Mem0 open source?+

Yes. Mem0 is open source and available on GitHub. There is also a managed cloud offering for teams that want hosted memory infrastructure without managing vector stores.

引用来源 (3)
  • Mem0 GitHub— Mem0 provides persistent personalized memory for AI applications
  • Mem0 Docs— Supports user-level, agent-level, and session-level memory
  • Mem0 Search Docs— Vector-based semantic search for memory retrieval
🙏

来源与感谢

讨论

登录后参与讨论。
还没有评论,来写第一条吧。