GitMem
Persistence memory MCP server that enables AI coding agents to recall and learn from past sessions, storing scars, wins, patterns, and decisions for continuous improvement.
README
<p align="center"> <img src="assets/banner.svg" alt="GitMem — Institutional memory for AI coding agents" width="700" /> </p>
<p align="center"> <a href="https://www.npmjs.com/package/gitmem-mcp"><img src="https://img.shields.io/npm/v/gitmem-mcp?style=flat-square&color=c41920&label=npm" alt="npm version" /></a> <a href="https://www.npmjs.com/package/gitmem-mcp"><img src="https://img.shields.io/npm/dm/gitmem-mcp?style=flat-square&color=333333&label=downloads" alt="npm downloads" /></a> <a href="https://github.com/gitmem-dev/gitmem/blob/main/LICENSE"><img src="https://img.shields.io/github/license/gitmem-dev/gitmem?style=flat-square&color=c41920" alt="MIT License" /></a> <a href="https://github.com/gitmem-dev/gitmem/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/gitmem-dev/gitmem/ci.yml?style=flat-square&color=333333&label=build" alt="Build" /></a> <img src="https://img.shields.io/badge/node-%3E%3D18-c41920?style=flat-square" alt="Node.js >= 18" /> </p>
<p align="center"> <a href="https://gitmem.ai/docs"><strong>Documentation</strong></a> · <a href="https://www.npmjs.com/package/gitmem-mcp"><strong>npm</strong></a> · <a href="https://gitmem.ai/docs/getting-started"><strong>Getting Started</strong></a> · <a href="https://gitmem.ai/docs/tools"><strong>Tool Reference</strong></a> </p>
GitMem is an MCP server that gives your AI coding agent persistent learning memory across agent sessions. It remembers mistakes (scars), successes (wins), and decisions — so your agent learns from experience instead of starting from scratch every time.
What's MCP? Model Context Protocol is how AI coding tools connect to external capabilities. GitMem is an MCP server — install it once and your agent gains persistent memory.
Works with Claude Code, Cursor, VS Code (Copilot), Windsurf, and any MCP-compatible client.
Quick Start
npx gitmem-mcp init
One command. The wizard auto-detects your IDE and sets up everything:
.gitmem/directory with starter scars- MCP server config (
.mcp.json,.vscode/mcp.json,.cursor/mcp.json, etc.) - Instructions file (
CLAUDE.md,.cursorrules,.windsurfrules,.github/copilot-instructions.md) - Lifecycle hooks (where supported)
.gitignoreupdated
Already have existing config? The wizard merges without destroying anything. Re-running is safe.
npx gitmem-mcp init --yes # Non-interactive
npx gitmem-mcp init --dry-run # Preview changes
npx gitmem-mcp init --client vscode # Force specific client
How It Works
recall --> work --> learn --> close --> recall --> ...
- Recall — Before acting, the agent checks memory for relevant lessons from past sessions
- Work — The agent does the task, applying past lessons automatically
- Learn — Mistakes become scars, successes become wins, strategies become patterns
- Close — Session reflection persists context for next time
Every scar includes counter-arguments — reasons why someone might reasonably ignore it. This prevents memory from becoming a pile of rigid rules.
What Gets Remembered
| Type | Purpose | Example |
|---|---|---|
| Scars | Mistakes to avoid | "Always validate UUID format before DB lookup" |
| Wins | Approaches that worked | "Parallel agent spawning cut review time by 60%" |
| Patterns | Reusable strategies | "5-tier test pyramid for MCP servers" |
| Decisions | Architectural choices with rationale | "Chose JWT over session cookies for stateless auth" |
| Threads | Unfinished work that carries across sessions | "Rate limiting still needs implementation" |
Key Features
- Automatic Recall — Scars surface before the agent takes similar actions
- Session Continuity — Context, threads, and rapport carry across sessions
- Closing Ceremony — Structured reflection captures what broke, what worked, and what to do differently
- 20+ MCP Tools — Full toolkit for memory management, search, threads, and multi-agent coordination
- Zero Config —
npx gitmem-mcp initand you're running - Non-Destructive — Merges with your existing
.mcp.json,CLAUDE.md, and hooks
Supported Clients
| Client | Setup | Hooks |
|---|---|---|
| Claude Code | npx gitmem-mcp init |
Full (session, recall, credential guard) |
| Cursor | npx gitmem-mcp init --client cursor |
Partial (session, recall) |
| VS Code (Copilot) | npx gitmem-mcp init --client vscode |
Instructions-based |
| Windsurf | npx gitmem-mcp init --client windsurf |
Instructions-based |
| Claude Desktop | Add to claude_desktop_config.json |
Manual |
| Any MCP client | npx gitmem-mcp init --client generic |
Instructions-based |
The wizard auto-detects your IDE. Use --client to override.
<details> <summary><strong>Manual MCP configuration</strong></summary>
Add this to your MCP client's config file:
{
"mcpServers": {
"gitmem": {
"command": "npx",
"args": ["-y", "gitmem-mcp"]
}
}
}
| Client | Config file |
|---|---|
| Claude Code | .mcp.json |
| Cursor | .cursor/mcp.json |
| VS Code | .vscode/mcp.json |
| Windsurf | ~/.codeium/windsurf/mcp_config.json |
</details>
CLI Commands
| Command | Description |
|---|---|
npx gitmem-mcp init |
Interactive setup wizard (auto-detects IDE) |
npx gitmem-mcp init --client <name> |
Setup for specific client (claude, cursor, vscode, windsurf, generic) |
npx gitmem-mcp init --yes |
Non-interactive setup |
npx gitmem-mcp init --dry-run |
Preview changes |
npx gitmem-mcp activate <key> |
Activate Pro tier (auto-applies schema) |
npx gitmem-mcp deactivate |
Remove Pro credentials, free device slot |
npx gitmem-mcp setup |
Output schema SQL (for manual Supabase setup) |
npx gitmem-mcp uninstall |
Clean removal (preserves .gitmem/ data) |
npx gitmem-mcp uninstall --all |
Full removal including data |
npx gitmem-mcp check |
Diagnostic health check |
Pro Tier
Self-hosted on your own Supabase. You bring the infrastructure, gitmem sets it up.
| What you get | Why your agent cares |
|---|---|
| Semantic search | Recall returns the right scars, not keyword noise |
| Session analytics | Spot patterns in what keeps going wrong |
| Sub-agent briefing | Hand institutional context to sub-agents automatically |
| Cloud persistence | Memory survives machine changes, shareable across team |
| A/B testing analytics | Measure which scar phrasings actually change agent behavior |
Quick start
npx supabase login # one time
export SUPABASE_URL="https://yourproject.supabase.co"
export SUPABASE_SERVICE_ROLE_KEY="eyJ..."
export OPENROUTER_API_KEY="sk-or-v1-..."
npx gitmem-mcp activate <your-license-key>
The activate command creates all tables, views, RPC functions, and indexes automatically. No manual SQL needed.
See docs/pro-setup-guide.md for the full guide.
The free tier gives you everything for solo projects. Pro makes recall smarter and memory portable.
GitMem + MEMORY.md
Your AI agent likely has its own memory file (MEMORY.md, .cursorrules, etc.). Here's how they work together:
| MEMORY.md | GitMem | |
|---|---|---|
| Loaded | Every turn (system prompt) | On-demand (tool calls) |
| Best for | Preferences, shortcuts, quick reference | Earned lessons, unfinished work, decisions |
| Updates | Agent writes directly | Session lifecycle (close ceremony) |
| Example | "User prefers terse output" | "Always validate UUID before DB lookup" |
Tip: Include .gitmem/agent-briefing.md in your MEMORY.md for a lightweight bridge between the two systems.
Privacy & Data
- Local-first — All data stored in
.gitmem/on your machine by default - No telemetry — GitMem does not collect usage data or phone home
- Cloud opt-in — Pro tier Supabase backend requires explicit configuration via environment variables
- Your data — Sessions, scars, and decisions belong to you. Delete
.gitmem/to remove everything
Development
git clone https://github.com/gitmem-dev/gitmem.git
cd gitmem
npm install
npm run build
npm test
See CONTRIBUTING.md for full development setup.
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。