$git clone https://github.com/shaneholloman/mcp-knowledge-graphPersistent memory for AI models through a local knowledge graph.
| 1 | # MCP Knowledge Graph |
| 2 | |
| 3 | **Persistent memory for AI models through a local knowledge graph.** |
| 4 | |
| 5 | Store and retrieve information across conversations using entities, relations, and observations. Works with Claude Code/Desktop and any MCP-compatible AI platform. |
| 6 | |
| 7 | ## Why ".aim" and "aim_" prefixes? |
| 8 | |
| 9 | AIM stands for **AI Memory** - the core concept of this system. The three AIM elements provide clear organization and safety: |
| 10 | |
| 11 | - **`.aim` directories**: Keep AI memory files organized and easily identifiable |
| 12 | - **`aim_` tool prefixes**: Group related memory functions together in multi-tool setups |
| 13 | - **`_aim` safety markers**: Each memory file starts with `{"type":"_aim","source":"mcp-knowledge-graph"}` to prevent accidental overwrites of unrelated JSONL files |
| 14 | |
| 15 | This consistent AIM naming makes it obvious which directories, tools, and files belong to the AI memory system. |
| 16 | |
| 17 | ## CRITICAL: Understanding `.aim` dir vs `_aim` file marker |
| 18 | |
| 19 | **Two different things with similar names:** |
| 20 | |
| 21 | - `.aim` = **Project-local directory name** (MUST be named exactly `.aim` for project detection to work) |
| 22 | - `_aim` = **File safety marker** (appears inside JSONL files: `{"type":"_aim","source":"mcp-knowledge-graph"}`) |
| 23 | |
| 24 | **For project-local storage:** |
| 25 | |
| 26 | - Directory MUST be named `.aim` in your project root |
| 27 | - Example: `my-project/.aim/memory.jsonl` |
| 28 | - The system specifically looks for this exact name |
| 29 | |
| 30 | **For global storage (--memory-path):** |
| 31 | |
| 32 | - Can be ANY directory you want |
| 33 | - Examples: `~/yourusername/.aim/`, `~/memories/`, `~/Dropbox/ai-memory/`, `~/Documents/ai-data/` |
| 34 | - Complete flexibility - choose whatever location works for you |
| 35 | |
| 36 | ## Storage Logic |
| 37 | |
| 38 | **File Location Priority:** |
| 39 | |
| 40 | 1. **Project with `.aim`** - Uses `.aim/memory.jsonl` (project-local) |
| 41 | 2. **No project/no .aim** - Uses configured global directory |
| 42 | 3. **Contexts** - Adds suffix: `memory-work.jsonl`, `memory-personal.jsonl` |
| 43 | |
| 44 | **Safety System:** |
| 45 | |
| 46 | - Every memory file starts with `{"type":"_aim","source":"mcp-knowledge-graph"}` |
| 47 | - System refuses to write to files without this marker |
| 48 | - Prevents accidental overwrite of unrelated JSONL files |
| 49 | |
| 50 | ## Master Database Concept |
| 51 | |
| 52 | **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`. |
| 53 | |
| 54 | - **Default Behavior**: All memory operations use the master database unless you specify a different one |
| 55 | - **Always Available**: Exists in both project-local and global locations |
| 56 | - **Primary Storage**: Your main knowledge graph that persists across all conversations |
| 57 | - **Named Databases**: Optional additional databases (`work`, `personal`, `health`) for organizing specific topics |
| 58 | |
| 59 | ## Key Features |
| 60 | |
| 61 | - **Master Database**: Primary memory store used by default for all operations |
| 62 | - **Multiple Databases**: Optional named databases for organizing memories by topic |
| 63 | - **Project Detection**: Automatic project-local memory using `.aim` directories |
| 64 | - **Location Override**: Force operations to use project or global storage |
| 65 | - **Safe Operations**: Built-in protection against overwriting unrelated files |
| 66 | - **Database Discovery**: List all available databases in both locations |
| 67 | |
| 68 | ## Quick Start |
| 69 | |
| 70 | ### Global Memory (Recommended) |
| 71 | |
| 72 | Add to your `claude_desktop_config.json` or `.claude.json`. Two common approaches: |
| 73 | |
| 74 | **Option 1: Default `.aim` directory (simple)** |
| 75 | |
| 76 | ```json |
| 77 | { |
| 78 | "mcpServers": { |
| 79 | "Aim-Memory-Bank": { |
| 80 | "command": "npx", |
| 81 | "args": [ |
| 82 | "-y", |
| 83 | "mcp-knowledge-graph", |
| 84 | "--memory-path", |
| 85 | "/Users/yourusername/.aim" |
| 86 | ] |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | ``` |
| 91 | |
| 92 | **Option 2: Dropbox/cloud sync (portable)** |
| 93 | |
| 94 | For accessing memories across multiple machines, use a synced folder. This is how the author of this MCP server keeps his own memories: |
| 95 | |
| 96 | ```json |
| 97 | { |
| 98 | "mcpServers": { |
| 99 | "Aim-Memory-Bank": { |
| 100 | "command": "npx", |
| 101 | "args": [ |
| 102 | "-y", |
| 103 | "mcp-knowledge-graph", |
| 104 | "--memory-path", |
| 105 | "/Users/yourusername/Dropbox/ai-memory" |
| 106 | ] |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | ``` |
| 111 | |
| 112 | This creates |