# ai-memory

Long-term memory server for AI coding assistants. It keeps architectural context across sessions in a local database without spending tokens until retrieval.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 54
- Author: alphaonedev
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/alphaonedev/ai-memory-mcp
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/ai-memory

## What it does

ai-memory supplies external memory to coding assistants via a local SQLite database powered by FTS5 full-text indexing. It stores user preferences and codebase conventions, automatically elevating critical knowledge to persistent status. Stored facts stay outside the prompt window, which keeps token consumption at zero until an actual search occurs.

Large setups can swap the storage engine for PostgreSQL with Apache AGE to build knowledge graphs. Version 0.9.0 rejects direct unauthenticated HTTP writes by default, while typical MCP tool calls remain open for local workflows. The Docker deployment expects an explicit `AI_MEMORY_DB` environment path to run.

## Requirements
- Needs: Docker
- Environment variables: `AI_MEMORY_DB` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env AI_MEMORY_DB=<AI_MEMORY_DB> --transport stdio ai-memory -- docker run -i --rm -e AI_MEMORY_DB ghcr.io/alphaonedev/ai-memory:0.5.1
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add ai-memory --env AI_MEMORY_DB=<AI_MEMORY_DB> -- docker run -i --rm -e AI_MEMORY_DB ghcr.io/alphaonedev/ai-memory:0.5.1
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "ai-memory": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "AI_MEMORY_DB",
                "ghcr.io/alphaonedev/ai-memory:0.5.1"
            ],
            "env": {
                "AI_MEMORY_DB": "<AI_MEMORY_DB>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "ai-memory": {
            "type": "stdio",
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "AI_MEMORY_DB",
                "ghcr.io/alphaonedev/ai-memory:0.5.1"
            ],
            "env": {
                "AI_MEMORY_DB": "<AI_MEMORY_DB>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e AI_MEMORY_DB=<AI_MEMORY_DB> ai-memory docker run -i --rm -e AI_MEMORY_DB ghcr.io/alphaonedev/ai-memory:0.5.1
```
Replace <…> with your own values

## When to use it
- retain architectural choices across separate coding sessions
- retrieve previous code corrections via full-text search
- store project rules without bloating the model context window
- share persistent context among different AI assistants

## Example prompts
- Recall our decisions on API error formatting from earlier sessions
- Store this module layout guideline in persistent memory
- Search memory for our database migration rules

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
