GitMem — Institutional memory for AI coding agents
What is GitMem?
Every time an AI agent makes a mistake, fixes a bug, or discovers a better approach, that knowledge disappears when the session ends. GitMem is an MCP server that gives AI coding agents persistent institutional memory — the ability to learn from mistakes, remember what works, track decisions, and carry context across sessions and projects.
It's not a note-taker. It's a memory system with teeth: scars surface automatically before the agent repeats a mistake, sessions close with structured reflection, and open threads carry forward so nothing falls through the cracks. One npx gitmem-mcp init and every session builds on the last — mistakes, wins, decisions, and human corrections compound into an agent that gets sharper in your dev context over time.
Scars
Mistakes captured as institutional memory. Surfaced automatically via recall before the agent repeats them.
Wins
Approaches that worked well. Document what succeeded so it can be replicated.
Sessions
Bounded work periods with context loading, reflection, and clean closure.
Threads
Unresolved work that carries across sessions. Never lose track of open items.
Decisions
Architectural choices logged with rationale and alternatives considered. Searchable forever.
Knowledge Graph
Trace any decision, scar, or session back to its origin. See how your institutional memory connects.
Quick Start
npx gitmem-mcp initOne command sets up everything: .gitmem/ directory, .mcp.json, CLAUDE.md, hooks, and permissions. Already have existing config? The wizard merges without destroying anything.
How It Works
Recall before acting
Before consequential actions, the agent checks institutional memory. Relevant scars surface automatically with severity and counter-arguments.
recall({ plan: "deploy to production" })
// → "Done ≠ Deployed ≠ Verified Working" (high severity)
// → "Database migrations must run before code deploy" (critical)Confirm and apply
Each scar must be acknowledged — APPLYING (with evidence), N_A (with reasoning), or REFUTED (acknowledging risk). No passive dismissal.
Learn from outcomes
When something breaks or works well, capture it. Scars require counter-arguments to prevent knowledge bloat.
create_learning({
learning_type: "scar",
title: "OAuth redirect URI must match exactly",
severity: "medium",
counter_arguments: [
"In development, localhost variations are usually fine",
"Some providers support wildcard redirects"
]
})Close and persist
Session close captures reflections, records scar usage, and persists open threads for the next session.
Key Features
| Feature | Description |
|---|---|
| Automatic Recall | Before taking action, agents check institutional memory for relevant lessons |
| Confirm Protocol | Scars require active acknowledgment — APPLYING, N_A, or REFUTED |
| Session Continuity | Context carries across sessions via threads, decisions, and rapport notes |
| Multi-Agent | Teams of agents share the same institutional memory via prepare_context |
| MCP Native | Works with Claude Code, Claude Desktop, Cursor, and any MCP client |
| Free Tier | Local .gitmem/ storage with 23 tools, no external dependencies |
23 tools, zero cost
The free tier includes session management, scar recall, learning creation, threads, and analytics — all stored locally in .gitmem/. No account, no API key, no cloud dependency.
Explore
Getting Started
Install GitMem and run your first session in under 5 minutes.
Concepts
Scars, sessions, threads, learning types, and tiers explained.
Tool Reference
Complete documentation for all 29 GitMem tools.
Guides
Closing ceremony, multi-agent workflows, and error handling.
Contributing
Development setup, testing tiers, and code style.
Changelog
Release history and what's new.