ai-memory-mcp
AIMemory
Zero-Cloud, Git-Native Shared Long-Term Memory + Local MCP Server for Every AI Coding Harness.
简体中文 | AI Harness Integration Guide
Switch freely between Antigravity, Codex, Claude Code, Gemini CLI, GitHub Copilot, Cursor, OpenCode / DeepSeek Harness, and Windsurf — across multiple devices and parallel module conversations — without losing your engineering rules, project architecture, or hard-won pitfalls.
Why AIMemory?
flowchart LR
A1["Antigravity"] --> GW["Unified Entrypoint<br/>(Idempotent Marker / Local stdio MCP)"]
A2["Codex"] --> GW
A3["Claude Code"] --> GW
A4["Gemini CLI / Copilot / Cursor"] --> GW
A5["OpenCode / DeepSeek Harness"] --> GW
GW --> MEM["Your Private Git Memory Repo<br/>(Markdown, Zero Vendor Lock-In)"]
MEM --> L1["RULES.md + profile.md<br/>(Global Principles)"]
MEM --> L2["projects/<app>/overview.md<br/>(Architecture + Related-Module Graph)"]
MEM --> L3["projects/<app>/modules/*.md<br/>(Per-Module Isolation)"]Dimension | AIMemory (Git + Markdown + Local MCP) | Cloud / Heavy Vector Memory Engines |
Determinism | 100% deterministic core rules & module loading | Probabilistic top-K vector recall (may miss critical rules) |
Privacy & Compliance | 100% local + your own Private Git repo; built-in secret blocker | Often requires uploading project context to third-party SaaS |
Extra Token Cost | $0 — zero background LLM extraction, zero Ollama/GPU needed | Consumes extra LLM/embedding tokens on every ingest |
Audit & Rollback | Native | Opaque vector/graph store |
Parallel Conversations | 3-layer isolation ( | Shared mutable store prone to cross-module noise |
Related MCP server: mem-universe
Architecture: Code & Data Strictly Separated
This repo (
AIMemory, Public): Contains only the reusable template (template/), cross-platform setup/sync scripts (scripts/), the TypeScript local stdio MCP server (mcp-server/), and a standard Agent Skill (skills/ai-memory/SKILL.md).Your private memory repo (Private, e.g.
~/AI-MEMORYorD:\AI-MEMORY): Stores your actual preferences, project overviews, and module memories. Mount it dynamically via--root <path>.
Quick Start (1 Command)
1. Initialize Your Private Memory Repo & Connect Harnesses
Pass -Init (--init) to automatically copy template/ into a fresh private Git repository, connect your AI harnesses idempotently (preserving existing rules via <!-- BEGIN/END: ai-memory -->), and -PrintMcp (--print-mcp) to print exact MCP config snippets with your real local paths:
# Windows PowerShell: preview first (no files touched)
.\scripts\setup.ps1 -Init -MemoryRoot D:\AI-MEMORY -AutoDetect -PrintMcp -DryRun
# Apply and print exact MCP configs
.\scripts\setup.ps1 -Init -MemoryRoot D:\AI-MEMORY -Targets antigravity,codex,claude,copilot,opencode -PrintMcpmacOS / Linux:
chmod +x scripts/setup.sh scripts/sync.sh
./scripts/setup.sh --init --memory-root ~/AI-MEMORY --auto-detect --print-mcp --dry-run
./scripts/setup.sh --init --memory-root ~/AI-MEMORY --targets antigravity,codex,claude,opencode --print-mcp2. Enable the Optional Local MCP Server (Zero Native Dependencies)
cd mcp-server
npm install
npm run build
npm testPoint any MCP-capable harness to:
node /path/to/AIMemory/mcp-server/dist/src/index.js --root /path/to/your-private-memorySee docs/harnesses.md for copy-paste configs for Antigravity, Codex, Claude Code, Gemini CLI, GitHub Copilot, Cursor, OpenCode/DeepSeek, Windsurf, and Cline.
MCP Tools (6) & Prompts (5) Included
Tool | Purpose |
| Load |
| Return all projects, module index, |
| Load a module by filename or display name and auto-load related modules from |
| Bilingual (CJK + English) BM25 weighted search across all memory files (< 5 ms, zero external deps) |
| Safe writer with secret redline blocking, cross-process file locking, UTF-8/LF normalization, and automatic |
| Zero-path trigger for old/new chats: returns self-contained rules, templates, and context for |
Also ships with 5 MCP Prompts (
bootstrap-module,consolidate-project,takeover-module,new-module,distill-memory), exposed as/slash commands in clients that support MCP Prompts.
Daily Workflow: Short Commands
Once connected, use concise triggers in any supported harness:
Take over an existing module:
接手 <project>/<module>:<task>ortakeover <project>/<module>: <task>Build a new module:
新模块 <project>/<new-module>:<task>ornew-module <project>/<new-module>: <task>Distill & save memory:
沉淀/记记忆ordistill/remember
Then review and sync your private memory repo across devices safely:
.\scripts\sync.ps1 -MemoryRoot D:\AI-MEMORY
# Order: git status -> git diff -> secret scan -> git commit -> git pull --rebase -> git pushBootstrapping an Existing Project (One-Line Cold Start)
Detailed cold-start instructions live in on-demand guides/bootstrap.md (zero extra context cost in daily chats). Use one line depending on your setup:
Setup | Step 1: Extract a module from an existing chat | Step 2: Consolidate |
MCP enabled (with | Type | Type |
MCP enabled (any client / old chats) |
|
|
Pure Markdown (new chat) |
|
|
Pure Markdown (old chat before setup) |
|
|
License
Available Tools
6 toolsget_core_contextGet Core Memory ContextBRead-onlyIdempotent
Read RULES.md, profile.md, and optionally a project's overview.md from the local shared memory repository.
Inputs: project.
get_module_memoryGet Module MemoryARead-onlyIdempotent
Read a specific module's long-term memory file and optionally auto-load its related modules from overview.md.
Inputs: module (required), project (required), include_related.
get_workflow_guideGet Workflow GuideARead-onlyIdempotent
Get complete self-contained rules, templates, and current context for AIMemory workflows without needing the user to provide a memory path. Call this immediately when the user asks to 整理旧记忆 / 建档 / 汇总项目 / 接手模块 / 新模块 / 沉淀 / bootstrap / consolidate / takeover / distill — especially in existing or older conversations.
Inputs: action (required), task, module, project.
list_memory_indexList Memory IndexBRead-onlyIdempotent
List available projects and their module index (including last verified dates and related modules).
Inputs: project.
save_memorySave MemoryAIdempotent
Safely write/update a memory Markdown file with built-in secret blocking, file locking, UTF-8/LF normalization, and automatic Last Verified date stamping. Does NOT run git commit or git push.
Inputs: content (required), target_type (required), module, project, +2 more.
search_memorySearch MemoryBRead-onlyIdempotent
Search across all local memory markdown files using bilingual (CJK + English) BM25 ranking.
Inputs: query (required), limit, project, include_archive.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Most tools target clearly distinct operations: read core context, list index, read a module, search, save, and get workflow guide. The main ambiguity is between get_core_context (reads RULES.md/profile/overview) and get_workflow_guide (returns self-contained rules, templates, and context), which both deliver rules/context and could be confused by an agent. Descriptions do help differentiate their intended triggers, but the boundary is not fully crisp.
All six tools follow a consistent verb_noun snake_case pattern: get_core_context, get_module_memory, get_workflow_guide, list_memory_index, search_memory, save_memory. Verbs (get/list/search/save) are used predictably and no conventions are mixed.
Six tools is well-scoped for a local memory repository server, covering read, list, search, write, and workflow guidance without bloat. Each tool has a distinct role and none feels redundant or trivial.
Read/list/search/write (create+update) are covered via get_core_context, list_memory_index, get_module_memory, search_memory, and save_memory. However, there is no delete or remove-memory operation, and save_memory explicitly does not handle git commit/push, leaving lifecycle gaps an agent must work around manually. These notable missing operations prevent a higher completeness score.
Maintenance
Related MCP Connectors
Team memory for AI coding agents and code reviews, reviewed by humans and served over MCP.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Shared, scoped, reviewable team memory for AI coding agents.
Related MCP Servers
- AlicenseBqualityBmaintenancePersistent memory MCP server for AI coding agents (Claude Code, Codex, Gemini CLI). Hybrid retrieval (vector + BM25), cross-encoder reranking, knowledge graph, session checkpoint/resume, and multi-scope isolation. Local-first with LanceDB.3056 npm15MIT
- AlicenseAqualityDmaintenanceSelf-hosted MCP memory server that gives a multi-agent fleet one shared, git-backed memory for search, read, and write.81MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to persist and share durable memory — appending session logs with checkpoints and handoffs, claiming and completing tasks, and recording decision records — all stored as plain Markdown and JSONL files in a git repository. Everything written is full-text searchable, and the server speaks MCP so MCP-aware clients can plug in directly with zero vendor lock-in.MIT

LogNexusofficial
AlicenseAqualityBmaintenanceUniversal Git-powered persistent memory, context rules & native MCP server for AI coding agents. Prevents context amnesia with stateful workflows, Git Notes, and cross-model review gates across Claude, OpenAI, Gemini & DeepSeek in Cursor, Claude Code & VS Code.1012962 npm575 PyPI6MIT