# engram

Hierarchical memory engine with three-stage retention and decay for AI agents. Keeps essential project context alive across session restarts.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 28
- Author: kael-bit
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/kael-bit/engram-rs
- Updated: 2026-03-03
- HTML: https://affpapa.org/en/nevibecode/mcp/kael-bit-engram

## What it does

The server manages agent memory across buffer, working, and core tiers. Instead of relying on hardcoded heuristics, an LLM evaluates whether a memory merits promotion into long-term storage. Retention rates depend directly on content type. Episodic records fade fastest, whereas procedural workflows persist over extended epochs. Recurring access triggers a score reinforcement.

Under the hood, the engine compiles into a single Rust binary using SQLite, bypassing separate vector databases. It clusters related entries into subject branches and merges duplicated facts without manual tagging.

The MCP connection will fail without a running backend supplying `ENGRAM_URL` and `ENGRAM_API_KEY`. The interactive setup script also halts until you provide embedding credentials.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `ENGRAM_URL`, `ENGRAM_API_KEY` — 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 ENGRAM_URL=<ENGRAM_URL> --env ENGRAM_API_KEY=<ENGRAM_API_KEY> --transport stdio kael-bit-engram -- npx -y engram-rs-mcp
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add kael-bit-engram --env ENGRAM_URL=<ENGRAM_URL> --env ENGRAM_API_KEY=<ENGRAM_API_KEY> -- npx -y engram-rs-mcp
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "kael-bit-engram": {
            "command": "npx",
            "args": [
                "-y",
                "engram-rs-mcp"
            ],
            "env": {
                "ENGRAM_URL": "<ENGRAM_URL>",
                "ENGRAM_API_KEY": "<ENGRAM_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "kael-bit-engram": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "engram-rs-mcp"
            ],
            "env": {
                "ENGRAM_URL": "<ENGRAM_URL>",
                "ENGRAM_API_KEY": "<ENGRAM_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e ENGRAM_URL=<ENGRAM_URL> -e ENGRAM_API_KEY=<ENGRAM_API_KEY> kael-bit-engram npx -y engram-rs-mcp
```
Replace <…> with your own values

## When to use it
- retain critical decisions across separate coding sessions
- deprecate obsolete context automatically through decay cycles
- cluster stored memories into searchable topic hierarchies
- fetch deployment guidelines using specific trigger tags

## Example prompts
- Store a rule that unit tests must pass before any production deployment.
- Retrieve all stored lessons tagged for database migrations.
- Restore working context from previous sessions using engram.

## 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

## Other versions with the same name
- [engram · nickcirv](https://affpapa.org/en/nevibecode/mcp/nickcirv-engram.md) — ★ 143
- [engram · tstockham96](https://affpapa.org/en/nevibecode/mcp/tstockham96-engram.md) — ★ 47
- [Engram · get-engram](https://affpapa.org/en/nevibecode/mcp/engram.md) — ★ 19
- [Engram · rwnalds](https://affpapa.org/en/nevibecode/mcp/rwnalds-engram.md) — ★ 17
- [engram · hbarefoot](https://affpapa.org/en/nevibecode/mcp/hbarefoot-engram.md) — ★ 9

---
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
