
MCP 服务器通过本地知识图谱支持 Claude 的持久内存——专注于本地开发的分支
概览
通过实体、关系和观察值存储和检索对话信息。支持Claude Code/Desktop及任何兼容MCP的AI平台。 AIM代表——该系统的核心概念。三个AIM元素提供清晰的组织和安全性: - : 保持AI内存文件有序且易于识别- :将相关内存功能在多工具设置中组合 - : 每个内存文件以{“type”:“_aim”,“source”:“mcp-knowledge-graph”}开头,以防止无关JSONL文件的意外覆盖 这种一致的AIM命名使得哪些目录、工具和文件属于AI内存系统。 - .aim = (必须精确命名为 .aim 才能实现项目检测)- _aim = (出现在 JSONL 文件中:{“type”:“_aim”,“source”:“mcp-knowledge-graph”}) - 目录必须在项目根中命名为.aim- 例如:my-project/.aim/memory。
概述(AI 翻译)
通过本地知识图谱实现AI模型的持久记忆。
通过实体、关系和观察值存储和检索对话信息。支持Claude Code/Desktop及任何兼容MCP的AI平台。
为什么用“.aim”和“aim_”前缀?
AIM代表AI内存——该系统的核心概念。三个AIM元素提供清晰的组织和安全性:
.aim目录:保持 AI 内存文件有序且易于识别aim_工具前缀:在多工具设置中将相关内存功能组合在一起_aim安全标记:每个内存文件以{"type":"_aim","source":"mcp-knowledge-graph"}开头,以防止意外覆盖无关的 JSONL 文件
这种一致的AIM命名使得哪些目录、工具和文件属于AI内存系统。
关键:理解 .aim dir 与 _aim 文件标记
两个名字相似的不同东西:
.aim= 项目本地目录名称(项目检测必须精确命名为.aim)_aim= 文件安全标记(出现在JSONL文件中:{"type":"_aim","source":"mcp-knowledge-graph"})
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MCP Knowledge Graph
Persistent memory for AI models through a local knowledge graph.
Store and retrieve information across conversations using entities, relations, and observations. Works with Claude Code/Desktop and any MCP-compatible AI platform.
Why “.aim” and “aim_” prefixes?
AIM stands for AI Memory - the core concept of this system. The three AIM elements provide clear organization and safety:
.aimdirectories: Keep AI memory files organized and easily identifiableaim_tool prefixes: Group related memory functions together in multi-tool setups_aimsafety markers: Each memory file starts with{"type":"_aim","source":"mcp-knowledge-graph"}to prevent accidental overwrites of unrelated JSONL files
This consistent AIM naming makes it obvious which directories, tools, and files belong to the AI memory system.
CRITICAL: Understanding .aim dir vs _aim file marker
Two different things with similar names:
.aim= Project-local directory name (MUST be named exactly.aimfor project detection to work)_aim= File safety marker (appears inside JSONL files:{"type":"_aim","source":"mcp-knowledge-graph"})
For project-local storage:
- Directory MUST be named
.aimin your project root - Example:
my-project/.aim/memory.jsonl - The system specifically looks for this exact name
For global storage (–memory-path):
- Can be ANY directory you want
- Examples:
~/yourusername/.aim/,~/memories/,~/Dropbox/ai-memory/,~/Documents/ai-data/ - Complete flexibility - choose whatever location works for you
Storage Logic
File Location Priority:
- Project with
.aim- Uses.aim/memory.jsonl(project-local) - No project/no .aim - Uses configured global directory
- Contexts - Adds suffix:
memory-work.jsonl,memory-personal.jsonl
Safety System:
- Every memory file starts with
{"type":"_aim","source":"mcp-knowledge-graph"} - System refuses to write to files without this marker
- Prevents accidental overwrite of unrelated JSONL files
Master Database Concept
The master database is your primary memory store - used by default when no specific database is requested. It’s always named default in listings and stored as memory.jsonl.
- Default Behavior: All memory operations use the master database unless you specify a different one
- Always Available: Exists in both project-local and global locations
- Primary Storage: Your main knowledge graph that persists across all conversations
- Named Databases: Optional additional databases (
work,personal,health) for organizing specific topics
Key Features
- Master Database: Primary memory store used by default for all operations
- Multiple Databases: Optional named databases for organizing memories by topic
- Project Detection: Automatic project-local memory using
.aimdirectories
安装
npx -y mcp-knowledge-graph --memory-path /Users/yourusername/.aim配置
{
"mcpServers": {
"Aim-Memory-Bank": {
"command": "npx",
"args": [
"-y",
"mcp-knowledge-graph",
"--memory-path",
"/Users/yourusername/.aim"
]
}
}
}