Skip to main content
Glama

AIMemory

CI License: MIT MiaoBiao/AI-Memory MCP server

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/&lt;app&gt;/overview.md<br/>(Architecture + Related-Module Graph)"]
    MEM --> L3["projects/&lt;app&gt;/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 git diff, pre-commit secret scan, instant rollback

Opaque vector/graph store

Parallel Conversations

3-layer isolation (profile → overview → modules/<m>.md) + file locks

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-MEMORY or D:\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 -PrintMcp

macOS / 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-mcp

2. Enable the Optional Local MCP Server (Zero Native Dependencies)

cd mcp-server
npm install
npm run build
npm test

Point any MCP-capable harness to:

node /path/to/AIMemory/mcp-server/dist/src/index.js --root /path/to/your-private-memory

See 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

get_core_context(project?)

Load RULES.md, profile.md, and optionally projects/<project>/overview.md

list_memory_index(project?)

Return all projects, module index, Last Verified dates, and related-module edges

get_module_memory(project, module, include_related?)

Load a module by filename or display name and auto-load related modules from overview.md

search_memory(query, project?, limit?, include_archive?)

Bilingual (CJK + English) BM25 weighted search across all memory files (< 5 ms, zero external deps)

save_memory(...)

Safe writer with secret redline blocking, cross-process file locking, UTF-8/LF normalization, and automatic Last Verified date stamping

get_workflow_guide(action, project?, module?)

Zero-path trigger for old/new chats: returns self-contained rules, templates, and context for bootstrap_module, consolidate_project, takeover_module, new_module, or distill_memory

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> or takeover <project>/<module>: <task>

  • Build a new module: 新模块 <project>/<new-module>:<task> or new-module <project>/<new-module>: <task>

  • Distill & save memory: 沉淀 / 记记忆 or distill / 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 push

Bootstrapping 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 overview.md, edges & profile.md

MCP enabled (with / Prompts)

Type / → bootstrap-module (project, module)

Type / → consolidate-project (project)

MCP enabled (any client / old chats)

Use ai-memory to bootstrap <project>/<module>

Use ai-memory to consolidate <project>

Pure Markdown (new chat)

bootstrap <project>/<module>

consolidate <project>

Pure Markdown (old chat before setup)

Follow D:\AI-MEMORY\RULES.md: bootstrap <project>/<module>

Follow D:\AI-MEMORY\RULES.md: consolidate <project>


License

MIT

Available Tools

6 tools
get_core_contextGet Core Memory ContextB
Read-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 MemoryA
Read-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 GuideA
Read-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 IndexB
Read-onlyIdempotent

List available projects and their module index (including last verified dates and related modules).

Inputs: project.

save_memorySave MemoryA
Idempotent

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 MemoryB
Read-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

    A3.7/5.0

    Scored across 6 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    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.

    Completeness3/5

    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

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Persistent 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.
      30
      56 npm
      15
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Self-hosted MCP memory server that gives a multi-agent fleet one shared, git-backed memory for search, read, and write.
      8
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables 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
    • A
      license
      A
      quality
      B
      maintenance
      Universal 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.
      10
      12
      962 npm
      575 PyPI
      6
      MIT