Long-term memory for AI coding agents, shared across agents, projects and machines
open sourceMITself-hostablefreeMCP
ai-memory is a self-hosted long-term memory server for AI coding agents. Lifecycle hooks in Claude Code, Codex, Cursor, Gemini CLI, OpenCode and more than 30 other agents capture prompts and tool observations, redact recognised credentials, and consolidate them into a git-backed wiki of plain Markdown files per project, which later sessions search and get briefed from over MCP. Typed handoffs let you quit one agent mid-task and continue in another, ai-memory run can carry a session's local history across, a personal profile follows you into new repositories, and a shared server gives a team multi-user auth and an audit log. Capture, search, handoffs and memory decay need no LLM API key; an optional background pass with an LLM merges cold notes. One Rust binary by Fabio Akita, MIT licensed.
Ways to install
Package managers
Problems it solves
- switch from Claude Code to Codex mid-task without re-explaining the architecture and what already failed
- my coding agent forgets everything about the project between sessions
- share what one developer's AI sessions learned about the codebase with the rest of the team's agents
- keep AI agent memory as plain Markdown files I can grep, edit and keep in git
- carry my coding preferences into every new repository so agents stop asking
- pick up the same AI-assisted project on my laptop that I started on my desktop
- long-term memory for coding agents that works without paying for an LLM or embedding API
Features
- works with 30+ coding agents including Claude Code, Codex, Cursor, Gemini CLI and OpenCode
- lifecycle hooks capture prompts and tool observations automatically
- credential redaction before storage
- git-backed wiki of plain Markdown files as the source of truth
- typed handoffs between agents, each claimed exactly once
- ai-memory run carries a session's local history to the next agent
- cross-project personal profile
- multi-user server with per-person attribution and an audit log
- memory decay and compaction with zero LLM calls
- optional LLM pass that merges cold notes while idle
View 1 more
- single self-contained binary; Linux, macOS, WSL2, experimental native Windows
Capabilities
| Has a command line tool | plan not known |
|---|---|
| Has an MCP server | plan not known |
Alternatives
The same job
These do what ai-memory does.
- Engram Persistent memory for AI coding agents
- Mem0 The memory layer for AI agents
- MemPalace Local-first AI memory. Verbatim storage, pluggable backend, 96.6% R@5 raw on LongMemEval, zero API calls.
- Hindsight Long-term memory for AI agents that learns from experience
- OpenViking The context database for AI agents
- Letta Build stateful agents with memory that can learn and improve over time
