PluginBench
MCP Server
Maintained
MIT

io.github.kael-bit/engram MCP Server

io.github.kael-bit/engram

Hierarchical memory engine for AI agents with automatic decay, promotion, and semantic organization.

What is the io.github.kael-bit/engram MCP server?

The engram-rs MCP server is a memory engine for AI agents that implements a three-layer lifecycle (buffer/working/core) inspired by cognitive science. It automatically forgets unimportant information, promotes valuable memories through LLM quality gates, and organizes knowledge into self-organizing topic trees. Memories decay by activity and kind (episodic, semantic, procedural), with semantic deduplication and trigger-based recall for pre-action context.

engram-rs solves the problem of flat, unorganized agent memory by adding forgetting, lifecycle management, and semantic clustering. Instead of dumping everything into a vector database, it implements the Atkinson–Shiffrin memory model: new memories enter a buffer, get promoted to working memory through LLM evaluation, and eventually settle into core long-term identity. Memories decay at different rates based on type and access patterns, and related knowledge automatically clusters into browsable topic trees. Single Rust binary, SQLite backend, zero external dependencies.

How to install io.github.kael-bit/engram

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
Environment / auth
  • ENGRAM_URL

    URL of the engram server

  • ENGRAM_API_KEY
    secret

    API key for authentication

~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "engram": {
      "command": "npx",
      "args": [
        "-y",
        "engram-rs-mcp"
      ],
      "env": {
        "ENGRAM_URL": "<YOUR_ENGRAM_URL>",
        "ENGRAM_API_KEY": "<YOUR_ENGRAM_API_KEY>"
      }
    }
  }
}

Tools & capabilities

Tools this server exposes to the agent.

  • store_memory — Store a new memory with optional tags and memory kind (episodic, semantic, procedural).
  • recall — Semantic and keyword search across memories with configurable relevance threshold and token budget.
  • resume — Restore full agent context on startup: core memories, recent changes, topic index, and active triggers.
  • topic — Drill down into a specific topic cluster to view related memories.
  • triggers — Retrieve all memories tagged with a specific trigger (e.g., 'deploy', 'git-push') for pre-action context.
  • consolidate — Manually trigger background maintenance: decay, dedup, LLM triage, promotion gate, and topic tree rebuild.

Use cases

  • Store deployment lessons and recall them automatically before running deployments via trigger tags.
  • Maintain persistent agent identity across sessions by resuming full context on startup.
  • Automatically organize growing knowledge bases into topic trees without manual tagging.
  • Reduce noise by forgetting rarely-accessed episodic memories while preserving procedural workflows.
  • Merge duplicate memories detected via semantic similarity and LLM evaluation.

io.github.kael-bit/engram MCP server FAQ

What is engram-rs?

A memory engine for AI agents that implements a three-layer lifecycle (buffer/working/core) with automatic decay, LLM-powered promotion, and self-organizing topic trees. It solves the problem of flat, unorganized agent memory by adding forgetting and semantic clustering.

Is engram-rs free?

Yes, engram-rs is open-source under the MIT license. It requires no external services to run (single SQLite file), though you can optionally add an LLM (OpenAI, Anthropic, Ollama) for intelligent features like quality gating and topic naming.

How do I install it in Cursor or Claude?

For Cursor/Windsurf, add to your MCP config: {"mcpServers": {"engram": {"command": "npx", "args": ["-y", "engram-rs-mcp"]}}}. For Claude Code, run `npx engram-rs-mcp`. The install script handles setup: `curl -fsSL https://raw.githubusercontent.com/kael-bit/engram-rs/main/install.sh | bash`.

What LLM configuration is required?

engram-rs works without an LLM using keyword search and rule-based lifecycle. Adding an LLM (via ENGRAM_LLM_URL and ENGRAM_LLM_KEY) unlocks intelligent features: memory triage, quality gating for promotion, semantic dedup, and automatic topic naming. Supports OpenAI-compatible APIs and Anthropic native.

How much storage and memory does it use?

Binary is ~10 MB, runtime memory ~100 MB RSS. Storage is a single SQLite file with no external database required. Search latency is single-digit milliseconds.

Can I use it with multiple projects?

Yes, engram-rs supports namespace isolation via the X-Namespace header, allowing a single instance to serve multiple projects with separate memory stores.

README (reference)

Source of truth, from the repository.

engram-rs

CI License: MIT Rust GitHub stars Docker

Memory engine for AI agents. Two axes: time (three-layer decay & promotion) and space (self-organizing topic tree). Important memories get promoted, noise fades, related knowledge clusters automatically.

Most agent memory is a flat store — dump everything in, keyword search to get it back. No forgetting, no organization, no lifecycle. engram-rs adds the part that makes memory actually useful: the ability to forget what doesn't matter and surface what does.

<p align="center"> <img src="docs/engram-quickstart.gif" alt="engram demo — store, context reset, recall" width="720"> </p>

Single Rust binary, one SQLite file, zero external dependencies. No Python, no Redis, no vector DB — curl | bash and it runs. ~10 MB binary, ~100 MB RSS, single-digit ms search latency.

Quick Start

# Install (interactive — will prompt for embedding provider config)
curl -fsSL https://raw.githubusercontent.com/kael-bit/engram-rs/main/install.sh | bash

# Store a memory
curl -X POST http://localhost:3917/memories \
  -d '{"content": "Always run tests before deploying", "tags": ["deploy"]}'

# Recall by meaning
curl -X POST http://localhost:3917/recall \
  -d '{"query": "deployment checklist"}'

# Restore full context (session start)
curl http://localhost:3917/resume

What It Does

Three-Layer Lifecycle

Inspired by the Atkinson–Shiffrin memory model, memories are managed across three layers by importance:

Buffer (short-term) → Working (active knowledge) → Core (long-term identity)
      ↓                       ↓                           ↑
   eviction              importance decay           LLM quality gate
  • Buffer: Entry point for all new memories. Temporary staging — evicted when below threshold
  • Working: Promoted via consolidation. Never deleted, importance decays at different rates by kind
  • Core: Promoted through LLM quality gate. Never deleted

LLM Quality Gate

Promotion isn't rule-based guesswork — an LLM evaluates each memory in context and decides whether it genuinely warrants long-term retention.

Buffer → [LLM gate: "Is this a decision, lesson, or preference?"] → Working
Working → [sustained access + LLM gate] → Core

Automatic Decay

Decay is activity-driven — it only fires during active consolidation cycles, not wall-clock time. If the system is idle, memories stay intact.

Exponential decay follows the Ebbinghaus forgetting curve — fast at first, then long-tail. Memories never fully vanish (floor = 0.01), remaining retrievable under precise queries. When a memory is recalled, it gets an activation boost, strengthening frequently-used knowledge.

KindDecay rateHalf-lifeUse case
episodicFastest~35 epochsEvents, experiences, time-bound context
semanticMedium~58 epochsKnowledge, preferences, lessons (default)
proceduralSlowest~173 epochsWorkflows, instructions, how-to

Algorithm Visualizations

ChartWhat it shows
<img src="docs/images/chart_scoring.png" width="600">Sigmoid score compression. Raw scores are mapped through a sigmoid function, approaching 1.0 asymptotically. High-relevance results remain distinguishable instead of being crushed into the same value.
<img src="docs/images/chart_decay.png" width="600">Ebbinghaus forgetting curve. Exponential decay with kind-differentiated rates — episodic memories fade fastest, procedural slowest. Floor at 0.01 means memories never fully vanish; they remain retrievable under precise queries.
<img src="docs/images/chart_bias.png" width="600">Kind × layer weight bias. Additive biases adjust memory weight by type and layer. Procedural+core memories rank highest, episodic+buffer lowest — but the spread stays bounded so no single combination dominates.
<img src="docs/images/chart_reinforcement.png" width="600">Reinforcement signals. Repetition and access bonuses follow logarithmic saturation. Early interactions matter most; later ones contribute diminishing returns, discriminating between "used occasionally" and "used daily".
<img src="docs/images/chart_lifecycle.png" width="600">Use it or lose it. Left: a memory that's never recalled decays into the buffer layer. Right: periodic recall triggers activation boosts that keep the memory in the working layer. Dashed line shows the unrecalled trajectory for comparison.

Semantic Dedup & Merge

Two memories saying the same thing in different words? Detected and merged automatically:

"use PostgreSQL for auth" + "auth service runs on Postgres"
→ Merged into one, preserving context from both

Self-Organizing Topic Tree

Vector clustering groups related memories together, LLM names the clusters. No manual tagging required:

Memory Architecture
├── Three-layer lifecycle [4]
├── Embedding pipeline [3]
└── Consolidation logic [5]
Deploy & Ops
├── CI/CD procedures [3]
└── Production incidents [2]
User Preferences [6]

The problem this solves: vector search requires asking the right question. Topic trees let agents browse by subject — scan the directory, drill into the right branch.

Triggers

Tag a memory with trigger:deploy, and the agent can recall all deployment lessons before executing:

curl -X POST http://localhost:3917/memories \
  -d '{"content": "LESSON: always backup DB before migration", "tags": ["trigger:deploy", "lesson"]}'

# Pre-deployment check
curl http://localhost:3917/triggers/deploy

Session Recovery

Agent wakes up, calls GET /resume, gets full context back. No file scanning needed:

=== Core (24) ===
deploy: test → build → stop → start (procedural)
LESSON: never force-push to main
...

=== Recent ===
switched auth to OAuth2
published API docs

=== Topics (Core: 24, Working: 57, Buffer: 7) ===
kb1: "Deploy Procedures" [5]
kb2: "Auth Architecture" [3]
kb3: "Memory Design" [8]
...

Triggers: deploy, git-push, database-migration
SectionContentPurpose
CoreFull text of permanent rules and identityThe unforgettable stuff
RecentRecently changed memoriesShort-term continuity
TopicsTopic index (table of contents)Drill in on demand, no full load
TriggersPre-action tagsAuto-recall lessons before risky ops

Agent reads the directory, finds relevant topics, calls POST /topic to expand on demand.

Search & Retrieval

Semantic embeddings + BM25 keyword search with CJK tokenization (jieba). IDF-weighted scoring — rare terms get boosted, common terms auto-downweighted. No stopword lists to maintain.

# Semantic search
curl -X POST http://localhost:3917/recall \
  -d '{"query": "how do we handle auth", "budget_tokens": 2000}'
# Note: min_score defaults to 0.30. Use "min_score": 0.0 to get all results.

# Topic drill-down
curl -X POST http://localhost:3917/topic \
  -d '{"ids": ["kb3"]}'

Background Maintenance

Fully automatic, activity-driven — no writes means the cycle is skipped:

Consolidation (every 30 minutes)

  1. Decay — reduce importance of unaccessed memories
  2. Dedup — merge near-identical memories (cosine > 0.78)
  3. Triage — LLM categorizes new Buffer memories
  4. Gate — LLM batch-evaluates promotion candidates
  5. Reconcile — resolve ambiguous similar pairs (results cached)
  6. Topic tree rebuild — re-cluster and name

Topic Distillation — when a topic grows too large (10+ memories), overlapping content is condensed into fewer, richer entries.

Namespace Isolation

Single instance, multiple projects. Use X-Namespace to isolate:

curl -X POST http://localhost:3917/memories \
  -H "X-Namespace: my-project" \
  -d '{"content": "API uses OAuth2 bearer tokens"}'

Install

# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/kael-bit/engram-rs/main/install.sh | bash

# Windows (PowerShell)
irm https://raw.githubusercontent.com/kael-bit/engram-rs/main/install.ps1 | iex

Docker

docker run -d --name engram-rs \
  -p 3917:3917 \
  -v engram-data:/data \
  -e ENGRAM_LLM_URL=https://api.openai.com/v1 \
  -e ENGRAM_LLM_KEY=sk-... \
  ghcr.io/kael-bit/engram-rs:latest

LLM Configuration

engram-rs works without an LLM — keyword search and rule-based lifecycle still function. Adding an LLM unlocks intelligent features (triage, gate, merge, topic naming):

export ENGRAM_LLM_URL=https://api.openai.com/v1
export ENGRAM_LLM_KEY=sk-...

# Any OpenAI-compatible API (Ollama, LM Studio, etc.)
export ENGRAM_LLM_URL=http://localhost:11434/v1

# Anthropic native
export ENGRAM_LLM_PROVIDER=anthropic
export ENGRAM_LLM_KEY=sk-ant-...

Two-tier model config — strong model for judgment, lightweight for text processing:

ENGRAM_GATE_MODEL=gpt-4o          # quality decisions
ENGRAM_LLM_MODEL=gpt-4o-mini     # text processing

For AI Agents

Add to your agent's system prompt:

Set up engram-rs (persistent memory) by following the guide at:
https://raw.githubusercontent.com/kael-bit/engram-rs/main/docs/SETUP.md

Integration

Works with Claude Code, Cursor, Windsurf, OpenClaw, and any MCP-compatible tool.

17 MCP tools (MCP docs) | Full HTTP API (Setup guide)

# MCP (Claude Code)
npx engram-rs-mcp

# MCP (Cursor / Windsurf / generic)
{"mcpServers": {"engram": {"command": "npx", "args": ["-y", "engram-rs-mcp"]}}}

Web Dashboard

Built-in web UI at http://localhost:3917/ui for browsing memories, viewing the topic tree, and monitoring LLM usage.

Specs

Binary~10 MB
Memory~100 MB RSS in production
StorageSQLite, no external database
LanguageRust
PlatformsLinux, macOS, Windows (x86_64 + aarch64)
LicenseMIT

License

MIT

<a href="https://glama.ai/mcp/servers/@kael-bit/engram-rs"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@kael-bit/engram-rs/badge" /> </a>

Related MCP servers

KAKagan logo

Kagan

Active

Supervised kanban board for AI coding agents with isolated git worktrees and human review gates.

10
TypeScript
MIT
View repository →

Persistent memory for AI assistants: store, search, and connect knowledge across conversations with adaptive neural learning.

12
Python
Apache-2.0
View repository →

Give coding agents right-to-left awareness: lint, normalise Arabic, detect direction.

Build proven high converting product showrooms and websites from your existing ecommerce catalog

0
TypeScript
MIT
View repository →

Semantic code intelligence — call graphs, dependencies, impact analysis, and test coverage.

View repository →

NASA-validated computed planetary positions for your AI: 19 astrology tools, never hallucinated.

0
TypeScript
View repository →