Provides persistent learning memory for AI coding agents to remember mistakes, successes, and architectural decisions across sessions.
Also known as gitmem-dev/gitmem, gitmem-mcp
- Stars
- 9
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- 1.2.1
- Last commit
- Nov 13, 2026
- License
- MIT
What is GitMem MCP?
GitMem provides persistent learning memory for AI coding agents to remember mistakes, successes, and architectural decisions across sessions.
Summary generated from the project's README
About GitMem MCP server
GitMem provides a persistent memory layer for AI coding agents to retain knowledge across different sessions. It allows agents to store mistakes as scars, successes as wins, and architectural choices as decisions. This prevents developers from having to repeat instructions or re-explain context every time a new chat session begins.
Users can set up the server using a single command that auto-detects environments like Claude Code, Cursor, VS Code, or Windsurf. The system is local-first, storing data in a .gitmem directory on your machine. For teams or advanced users, a Pro tier is available that connects to a self-hosted Supabase instance to enable semantic search and cloud persistence.
The server includes over 20 MCP tools for managing memory, searching through past lessons, and handling unfinished work threads. It integrates with existing configuration files like .cursorrules or CLAUDE.md to ensure the agent has immediate access to relevant context without manual intervention.
What you can do with it
- 1Preventing recurring coding mistakesAn AI agent can recall specific errors to avoid, such as validation requirements, before writing new code.
Written from the project's README. Every use case is checked against a quote from it.
How to install GitMem MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall GitMem MCP in Claude Code
$ claude mcp add --env 'SUPABASE_SERVICE_ROLE_KEY=<YOUR_SUPABASE_SERVICE_ROLE_KEY>' gitmem -- npx -y gitmem-mcpInstall GitMem MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"gitmem": {
"command": "npx",
"args": [
"-y",
"gitmem-mcp"
],
"env": {
"SUPABASE_SERVICE_ROLE_KEY": "<YOUR_SUPABASE_SERVICE_ROLE_KEY>"
}
}
}
}Install GitMem MCP in VS Code
.vscode/mcp.json
{
"servers": {
"gitmem": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"gitmem-mcp"
],
"env": {
"SUPABASE_SERVICE_ROLE_KEY": "<YOUR_SUPABASE_SERVICE_ROLE_KEY>"
}
}
}
}Install GitMem MCP in VS Code CLI
$ code --add-mcp '{"name":"gitmem","type":"stdio","command":"npx","args":["-y","gitmem-mcp"],"env":{"SUPABASE_SERVICE_ROLE_KEY":"<YOUR_SUPABASE_SERVICE_ROLE_KEY>"}}'Install GitMem MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"gitmem": {
"command": "npx",
"args": [
"-y",
"gitmem-mcp"
],
"env": {
"SUPABASE_SERVICE_ROLE_KEY": "<YOUR_SUPABASE_SERVICE_ROLE_KEY>"
}
}
}
}Install GitMem MCP in Codex
$ codex mcp add gitmem --env 'SUPABASE_SERVICE_ROLE_KEY=<YOUR_SUPABASE_SERVICE_ROLE_KEY>' -- npx -y gitmem-mcpInstall GitMem MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.gitmem] command = "npx" args = ["-y", "gitmem-mcp"] [mcp_servers.gitmem.env] SUPABASE_SERVICE_ROLE_KEY = "<YOUR_SUPABASE_SERVICE_ROLE_KEY>"
Install GitMem MCP in Gemini CLI
$ gemini mcp add -s user -e 'SUPABASE_SERVICE_ROLE_KEY=<YOUR_SUPABASE_SERVICE_ROLE_KEY>' gitmem npx -- -y gitmem-mcpInstall GitMem MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"gitmem": {
"command": "npx",
"args": [
"-y",
"gitmem-mcp"
],
"env": {
"SUPABASE_SERVICE_ROLE_KEY": "<YOUR_SUPABASE_SERVICE_ROLE_KEY>"
}
}
}
}Configuration
SUPABASE_SERVICE_ROLE_KEYSecretSupabase service role key for pro tier features. Not required for free tier.
OPENROUTER_API_KEYSUPABASE_URLSupabase project URL for pro tier features (semantic search, analytics). Not required for free tier.
| Name | Description | |
|---|---|---|
| SUPABASE_SERVICE_ROLE_KEY | Supabase service role key for pro tier features. Not required for free tier. | Secret |
| OPENROUTER_API_KEY | — | |
| SUPABASE_URL | Supabase project URL for pro tier features (semantic search, analytics). Not required for free tier. |
Automated checks
Ran Nov 12, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachablePass
- Open source license (OSI)Pass
- Commit or release in the last yearPass
- Package name not close to a popular packagePass
- Remote endpoint uses HTTPSNot checked
- Destructive tools are labelledNot checked
- No hidden instructions to the modelPass
- No critical advisory in the package or its dependenciesPass
README
View on GitHubGitMem 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.
Add this to your MCP client's config file:
{
"mcpServers": {
"gitmem": {
"command": "npx",
"args": ["-y", "gitmem-mcp@latest"]
}
}
}
| Client | Config file |
|---|---|
| Claude Code | .mcp.json |
| Cursor | .cursor/mcp.json |
| VS Code | .vscode/mcp.json |
| Windsurf | ~/.codeium/windsurf/mcp_config.json |
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.
GitMem MCP questions
How do I add GitMem MCP to Claude Code?
Run claude mcp add --env 'SUPABASE_SERVICE_ROLE_KEY=<YOUR_SUPABASE_SERVICE_ROLE_KEY>' gitmem -- npx -y gitmem-mcp in your terminal. Add --scope user to make it available in every project.
How do I add GitMem MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.