文档系统
文档系统
相关源文件
本章引用的主要源码文件:
.github/workflows/docs-llms-txt-check.ymldocs/cookbooks/essentials/building-ai-companion.mdxdocs/cookbooks/essentials/controlling-memory-ingestion.mdxdocs/cookbooks/essentials/entity-partitioning-playbook.mdxdocs/cookbooks/essentials/exporting-memories.mdxdocs/cookbooks/integrations/healthcare-google-adk.mdxdocs/cookbooks/integrations/openai-tool-calls.mdxdocs/cookbooks/overview.mdxdocs/docs.jsondocs/llms.txtdocs/open-source/python-quickstart.mdxdocs/platform/features/contextual-add.mdxdocs/platform/features/entity-scoped-memory.mdxdocs/platform/features/v2-memory-filters.mdxdocs/templates/api_reference_template.mdxdocs/templates/concept_guide_template.mdxdocs/templates/cookbook_template.mdxdocs/templates/feature_guide_template.mdxdocs/templates/integration_guide_template.mdxdocs/templates/migration_guide_template.mdxdocs/templates/operation_guide_template.mdxdocs/templates/parameters_reference_template.mdxdocs/templates/quickstart_template.mdxdocs/templates/release_notes_template.mdxdocs/templates/section_overview_template.mdxdocs/templates/troubleshooting_playbook_template.mdxscripts/check-llms-txt-coverage.pyscripts/llms-txt-ignore.txt
本文档描述了 Mem0 基于 Mintlify 的文档系统,包括其结构、配置、本地开发工作流和集成功能。有关开发环境设置和测试的信息,请参阅开发环境设置。有关贡献指南,请参阅贡献指南。
目的与技术栈
Mem0 使用 Mintlify 作为其文档框架,为平台版和开源版提供全面、交互式且用户友好的文档。Mintlify 是一个现代化的文档平台,可以将 MDX 文件渲染为具有内置搜索、导航和交互功能的静态网站。
该文档系统支持:
- 多语言代码示例(Python、TypeScript、JavaScript、cURL)
docs/templates/api_reference_template.mdx:65-94 - 通过结构化模板实现的交互式 API 参考
docs/templates/api_reference_template.mdx:1-25 - 通过 Cookbook 实现的标准化叙述性演练
docs/templates/cookbook_template.mdx:1-10 - 通过 PostHog 实现的统计分析
docs/docs.json:567-569 - 通过 Intercom 实现的客户支持
docs/docs.json:571-573 - 已废弃页面的自动 URL 重定向(超过 200 条)
docs/docs.json:589-862
来源: docs/docs.json:1-863、docs/templates/api_reference_template.mdx:1-19、docs/templates/cookbook_template.mdx:1-10
文档架构
该文档系统弥合了高层自然语言概念与底层代码实体(如工厂和提供者)之间的差距。
来源: docs/docs.json:1-20、docs/docs.json:566-574、docs/llms.txt:1-15、docs/templates/integration_guide_template.mdx:1-5
将代码实体映射到文档
文档结构旨在反映 Python 和 TypeScript SDK 中实现的提供者生态系统。llms.txt 文件为 AI 代理提供了高层映射,帮助其理解哪些类用于平台版,哪些用于开源版。
来源: docs/llms.txt:25-51、docs/llms.txt:85-108、docs/platform/features/v2-memory-filters.mdx:18-30
配置文件结构
docs.json 是定义文档结构、主题和导航的核心配置文件。
核心配置元素
| 元素 | 用途 | 文件位置 |
|---|---|---|
$schema | Mintlify JSON 模式校验 | docs/docs.json:2 |
name | 项目名称("Mem0") | docs/docs.json:3 |
theme | 主题预设("aspen") | docs/docs.json:5 |
colors | 品牌颜色(主色:#8F74E0) | docs/docs.json:6-10 |
navigation | 标签页和页面结构 | docs/docs.json:17-544 |
integrations | 分析和支持工具 | docs/docs.json:566-574 |
来源: docs/docs.json:1-20、docs/docs.json:545-574
导航层级
文档组织为 8 个主要标签页:
- 欢迎:介绍和高层概述。
docs/docs.json:23-34 - Mem0 平台:托管产品功能(V2 过滤器、自定义类别、Webhook)。
docs/docs.json:36-134 - OpenClaw:代理框架和 Hermes 集成。
docs/docs.json:136-147 - 开源版:自托管设置、Python/Node 快速入门和组件配置。
docs/docs.json:149-354 - Cookbook:实用配方(健身伴侣、医疗入库控制)。
docs/docs.json:356-424 - 集成:第三方工具(LangChain、CrewAI、AWS Bedrock)。
docs/docs.json:426-473 - API 参考:内存、实体和用户的 REST API 契约。
docs/docs.json:475-523 - 发布说明:版本历史。
docs/docs.json:525-542
来源: docs/docs.json:17-544
文档模板
为保持一致性,仓库包含了常见页面类型的 MDX 模板。
| 模板 | 文件路径 | 关键特性 |
|---|---|---|
| Cookbook | docs/templates/cookbook_template.mdx | 叙事弧线:设置 → 问题 → 修复 → 生产模式。 |
| API 参考 | docs/templates/api_reference_template.mdx | 快速事实表、请求头/请求体、双语言示例。 |
| 迁移指南 | docs/templates/migration_guide_template.mdx | 计划 → 迁移 → 验证流程,包含回滚说明。 |
| 功能指南 | docs/templates/feature_guide_template.mdx | "何时使用此功能"块和功能剖析。 |
| 集成指南 | docs/templates/integration_guide_template.mdx | 联合价值声明和合作伙伴设置步骤。 |
来源: docs/templates/cookbook_template.mdx:1-25、docs/templates/api_reference_template.mdx:1-19、docs/templates/migration_guide_template.mdx:1-20、docs/templates/feature_guide_template.mdx:1-40
AI 上下文与验证
系统包含一个专门的 llms.txt 文件,旨在为 AI 编码助手(如 Claude Code 或 Cursor)提供简洁的上下文。
LLMs.txt 清单
该清单区分了:
- 平台版:使用
MemoryClient(Python)或mem0ai(npm)。docs/llms.txt:7-7 - 开源版:使用
Memory(Python)或mem0ai/oss(npm)。docs/llms.txt:8-8
覆盖率验证
一个 CI 工作流 docs-llms-txt-check.yml 运行 Python 脚本 scripts/check-llms-txt-coverage.py,以确保 llms.txt 清单与实际文档文件保持同步。
来源: docs/llms.txt:1-15、.github/workflows/docs-llms-txt-check.yml:1-20、scripts/check-llms-txt-coverage.py:1-10
内存入库与过滤文档
关于入库控制和过滤等高级功能的文档,强调了生产就绪模式。
来源: docs/cookbooks/essentials/controlling-memory-ingestion.mdx:17-21、docs/platform/features/v2-memory-filters.mdx:32-60