

基本记忆
基本记忆 (Basic Memory) 可让您通过与 Claude 等大型语言模型 (LLM) 进行自然对话来构建持久知识,同时将所有内容保存在计算机上的简单 Markdown 文件中。它使用模型上下文协议 (MCP),使任何兼容的 LLM 都能读取和写入您的本地知识库。
从上次中断的地方继续对话
AI 助手可以在新对话中从本地文件加载上下文
笔记实时保存为本地 Markdown 文件
无需项目知识或特殊提示
https://github.com/user-attachments/assets/a55d8238-8dd0-454a-be4c-8860dbbd0ddc
Related MCP server: memento-mcp
快速入门
# Install with uv (recommended)
uv tool install basic-memory
# Configure Claude Desktop (edit ~/Library/Application Support/Claude/claude_desktop_config.json)
# Add this to your config:
{
"mcpServers": {
"basic-memory": {
"command": "uvx",
"args": [
"basic-memory",
"mcp"
]
}
}
}
# Now in Claude Desktop, you can:
# - Write notes with "Create a note about coffee brewing methods"
# - Read notes with "What do I know about pour over coffee?"
# - Search with "Find information about Ethiopian beans"
您可以通过~/basic-memory (默认目录位置)中的文件查看共享上下文。
通过 Smithery 进行替代安装
您可以使用Smithery为 Claude Desktop 自动配置基本内存:
npx -y @smithery/cli install @basicmachines-co/basic-memory --client claude
这将安装并配置 Basic Memory,无需手动编辑 Claude Desktop 配置文件。Smithery 服务器托管 MCP 服务器组件,而您的数据仍以 Markdown 文件的形式存储在本地。
Glama.ai
为什么是基本记忆?
大多数LLM互动都是短暂的——你提出一个问题,得到一个答案,然后一切都被遗忘了。每次对话都是全新的,没有之前对话的背景或知识。目前的解决方法存在局限性:
聊天记录记录了对话,但不是结构化的知识
RAG 系统可以查询文档,但不允许 LLM 写回
矢量数据库需要复杂的设置,并且通常位于云端
知识图谱通常需要专门的工具来维护
Basic Memory 用一种简单的方法解决了这些问题:结构化的 Markdown 文件,人类和 LLM 都可以读写。其主要优势如下:
**本地优先:**所有知识都保留在你控制的文件中
**双向:**您和 LLM 都可以读取和写入相同的文件
**结构化且简单:**使用熟悉的 Markdown 和语义模式
可遍历知识图谱: LLM 可以追踪主题之间的链接
**标准格式:**可与 Obsidian 等现有编辑器配合使用
**轻量级基础设施:**仅在本地 SQLite 数据库中索引的本地文件
使用基本记忆,您可以:
实践操作
假设你正在探索咖啡冲泡方法,并想记录你的知识。具体操作如下:
开始正常聊天:
I've been experimenting with different coffee brewing methods. Key things I've learned:
- Pour over gives more clarity in flavor than French press
- Water temperature is critical - around 205°F seems best
- Freshly ground beans make a huge difference
...继续对话。
请法学硕士 (LLM) 帮助构建这些知识:
"Let's write a note about coffee brewing methods."
LLM 在您的系统上创建一个新的 Markdown 文件(您可以在 Obsidian 或编辑器中立即看到它):
---
title: Coffee Brewing Methods
permalink: coffee-brewing-methods
tags:
- coffee
- brewing
---
# Coffee Brewing Methods
## Observations
- [method] Pour over provides more clarity and highlights subtle flavors
- [technique] Water temperature at 205°F (96°C) extracts optimal compounds
- [principle] Freshly ground beans preserve aromatics and flavor
## Relations
- relates_to [[Coffee Bean Origins]]
- requires [[Proper Grinding Technique]]
- affects [[Flavor Extraction]]
该笔记通过简单的 Markdown 格式嵌入语义内容并链接到其他主题。
您可以在计算机上的当前项目目录(默认~/$HOME/basic-memory )中实时看到此文件。
在与LLM聊天时,你可以参考一个话题:
Look at `coffee-brewing-methods` for context about pour over coffee
LLM 现在可以从知识图谱中构建丰富的上下文。例如:
Following relation 'relates_to [[Coffee Bean Origins]]':
- Found information about Ethiopian Yirgacheffe
- Notes on Colombian beans' nutty profile
- Altitude effects on bean characteristics
Following relation 'requires [[Proper Grinding Technique]]':
- Burr vs. blade grinder comparisons
- Grind size recommendations for different methods
- Impact of consistent particle size on extraction
每个相关文档都可以提供更多的背景信息,从而为您的知识库构建丰富的语义理解。
这会形成双向流动:
人类编写和编辑 Markdown 文件
LLM通过MCP协议进行读写
同步使一切保持一致
所有知识都保存在本地文件中。
技术实现
基本内存的底层:
将所有内容存储在 Markdown 文件中
使用 SQLite 数据库进行搜索和索引
从简单的 Markdown 模式中提取语义
维护从文件中提取的本地知识图谱
提供文件和知识图谱之间的双向同步
实现用于 AI 集成的模型上下文协议 (MCP)
公开允许人工智能助手遍历和操作知识图谱的工具
使用memory:// URL来跨工具和对话引用实体
文件格式只是带有一些简单标记的 Markdown:
每个 Markdown 文件都有:
前言
title: <Entity title>
type: <The type of Entity> (e.g. note)
permalink: <a uri slug>
- <optional metadata> (such as tags)
观察
观察是关于某个主题的事实。它们可以通过创建 Markdown 列表来添加,该列表具有特殊的格式,可以引用category 、使用“#”字符的tags以及可选的context 。
观察 Markdown 格式:
- [category] content #tag (optional context)
观察示例:
- [method] Pour over extracts more floral notes than French press
- [tip] Grind size should be medium-fine for pour over #brewing
- [preference] Ethiopian beans have bright, fruity flavors (especially from Yirgacheffe)
- [fact] Lighter roasts generally contain more caffeine than dark roasts
- [experiment] Tried 1:15 coffee-to-water ratio with good results
- [resource] James Hoffman's V60 technique on YouTube is excellent
- [question] Does water temperature affect extraction of different compounds differently?
- [note] My favorite local shop uses a 30-second bloom time
关系
关系是指向其他主题的链接。它们定义了实体在知识图谱中的连接方式。
Markdown 格式:
- relation_type [[WikiLink]] (optional context)
关系示例:
- pairs_well_with [[Chocolate Desserts]]
- grown_in [[Ethiopia]]
- contrasts_with [[Tea Brewing Methods]]
- requires [[Burr Grinder]]
- improves_with [[Fresh Beans]]
- relates_to [[Morning Routine]]
- inspired_by [[Japanese Coffee Culture]]
- documented_in [[Coffee Journal]]
与 VS Code 一起使用
对于一键安装,请单击下面的安装按钮之一...

您可以将 Basic Memory 与 VS Code 结合使用,以便在编码时轻松检索和存储信息。点击上方的安装按钮进行一键安装,或按照下方的手动安装说明进行操作。
手动安装
将以下 JSON 块添加到 VS Code 中的“用户设置 (JSON)”文件中。您可以按下Ctrl + Shift + P并输入Preferences: Open User Settings (JSON)来执行此操作。
{
"mcp": {
"servers": {
"basic-memory": {
"command": "uvx",
"args": ["basic-memory", "mcp"]
}
}
}
}
或者,您可以将其添加到工作区中名为.vscode/mcp.json的文件中。这样您就可以与其他人共享该配置。
{
"servers": {
"basic-memory": {
"command": "uvx",
"args": ["basic-memory", "mcp"]
}
}
}
与 Claude Desktop 一起使用
基本内存是使用 MCP(模型上下文协议)构建的,并与 Claude 桌面应用程序( https://claude.ai/ )配合使用:
配置 Claude Desktop 使用基本内存:
编辑您的 MCP 配置文件(对于 OS X,通常位于~/Library/Application Support/Claude/claude_desktop_config.json ):
{
"mcpServers": {
"basic-memory": {
"command": "uvx",
"args": [
"basic-memory",
"mcp"
]
}
}
}
如果您想使用特定项目(请参阅多个项目),请更新您的 Claude Desktop 配置:
{
"mcpServers": {
"basic-memory": {
"command": "uvx",
"args": [
"basic-memory",
"--project",
"your-project-name",
"mcp"
]
}
}
}
同步您的知识:
如果您进行手动编辑,基本内存将实时同步项目中的文件。
在 Claude Desktop 中,法学硕士现在可以使用以下工具:
write_note(title, content, folder, tags) - Create or update notes
read_note(identifier, page, page_size) - Read notes by title or permalink
build_context(url, depth, timeframe) - Navigate knowledge graph via memory:// URLs
search_notes(query, page, page_size) - Search across your knowledge base
recent_activity(type, depth, timeframe) - Find recently updated information
canvas(nodes, edges, title, folder) - Generate knowledge visualizations
尝试的示例提示:
"Create a note about our project architecture decisions"
"Find information about JWT authentication in my notes"
"Create a canvas visualization of my project components"
"Read my notes on the authentication system"
"What have I been working on in the past week?"
更多信息
请参阅文档以了解更多信息,包括:
执照
AGPL-3.0
欢迎贡献。请参阅贡献指南,了解如何在本地设置项目并提交 PR。
星史
由 Basic Machines 倾情打造