Sponsored by Deepsite.site

Memory Engine

Created By
SimoneB79a month ago
Atomic memory model — knowledge stored as atoms (facts, decisions, events, preferences, logs, procedures, notes, session messages) Multi-factor ranking — recall combines FTS relevance × confidence × recency × weight (not just BM25) Organic decay — atoms lose weight over time if not accessed; critical ones get flagged for review Learning engine — generates questions for the human when it detects contradictions, gaps, weak atoms, or merge candidates Session watcher — automatically ingests OpenClaw session messages as atoms with TTL (event-driven via inotify/watchdog) Auto-bonding — creates relationship links between atoms automatically during import Graph traversal — navigate the knowledge graph with depth control and relation filtering Markdown import — one-way sync from your existing markdown notes (coexistence, not replacement) Merge & deduplicate — consolidate similar atoms intelligently TTL support — atoms that expire automatically Versioning — automatic atom history tracking
Overview

Version License: MIT Python MCP Registry Ready Docker

Memory Engine Logo

🧠 Memory Engine MCP

Local-first, graph-aware long-term memory for AI assistants.
SQLite + semantic search + knowledge graph + MCP tools for agents that need continuity.

Works with Claude Desktop · Claude Code · Cursor · Cline · Windsurf · OpenClaw · any MCP client


Why Memory Engine?

Most MCP memory servers are either simple key-value stores or plain text search wrappers.

Memory Engine is different: it models memory as typed atoms connected by typed bonds, then retrieves context with a hybrid ranking pipeline that combines:

  • full-text search (SQLite FTS5)
  • semantic similarity via local Ollama embeddings
  • confidence, recency, and weight
  • graph expansion from related memories

The goal is not just storage. The goal is a memory system that can recall, connect, decay, curate, and learn over time.

Highlights

  • Local-first — SQLite database, optional local embeddings via Ollama, no required cloud API.
  • MCP-native — exposes 31 tools through FastMCP.
  • Graph-aware recall — expands top hits through bidirectional bonds for richer context.
  • Semantic search — meaning-based retrieval with nomic-embed-text.
  • Markdown coexistence — import existing notes one-way without replacing your human-readable memory.
  • Error memory — remembers mistakes and corrections, with auto-promotion to preferences after repeated failures.
  • Cognitive curator — non-destructive maintenance pass for compaction, bond suggestions, duplicate detection, and isolated atom classification.
  • Session watcher — optional OpenClaw JSONL ingestion with short-lived raw messages and permanent session digests.

Architecture

AI assistant / MCP client
FastMCP server — 31 tools
Memory engine — hybrid ranking, graph recall, decay, learning
        ├── SQLite — atoms, bonds, FTS5, JSON metadata, versions
        ├── Ollama — optional local embeddings
        ├── Curator — conservative maintenance
        └── Session watcher — optional OpenClaw session ingestion

MCP Tools

Memory

ToolPurpose
rememberCreate or update an atom
recallSmart hybrid recall with graph expansion
working_setBuild a task-oriented context pack
semantic_searchPure semantic search
get_atomRead one atom with bonds
list_atomsBrowse atoms by domain/type/status
merge_atomsMerge duplicate atoms
export_atomExport one atom as markdown

Knowledge graph

ToolPurpose
link / unlinkCreate or remove typed bonds
search_graphTraverse the graph from one atom
suggest_bondsSuggest bonds for one atom
suggest_bonds_allSuggest or create bonds in bulk

Learning and maintenance

ToolPurpose
curator_runConservative curation pass
cognitive_statusGraph and memory health metrics
learning_runDetect contradictions, weak atoms, merge candidates, gaps
ask_pending / answer_humanHuman-in-the-loop clarification
decay_runRun decay cycle
cleanup_sessionsRemove expired session atoms
cleanup_duplicatesRemove duplicate session atoms
reindex_embeddingsRebuild embeddings

Error memory and preferences

ToolPurpose
error_checkCheck past failures before doing a task
error_logRecord a mistake and the correction
error_listBrowse unresolved/resolved errors
preference_searchSearch structured preferences

Import and introspection

ToolPurpose
import_markdownImport markdown notes into atoms
memory_summary3-level summary: global → domain → detail
statsDatabase statistics
versionServer version
recall_sessionSearch one OpenClaw session
session_summarySummarize one OpenClaw session

Quick start with Docker

git clone https://github.com/SimoneB79/memory-engine-mcp.git
cd memory-engine-mcp
cp docker-compose.yml docker-compose.local.yml
# Edit volume paths in docker-compose.local.yml if needed
docker compose -f docker-compose.local.yml up -d --build

Default endpoint:

http://localhost:8085/sse

Example MCP client config:

{
  "mcpServers": {
    "memory-engine": {
      "url": "http://localhost:8085/sse",
      "transport": "sse"
    }
  }
}

See docs/INSTALL.md for Docker, local Python, Claude Desktop, Cursor, and OpenClaw examples.

Local Python

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python server.py

Configuration

Main configuration file: config.json

Important environment variables:

VariableDefaultPurpose
MEMORY_DB_PATH/data/memory.dbSQLite database path
MARKDOWN_SOURCE/workspace/memoryMarkdown directory for import
MEMORY_HOST0.0.0.0Server bind address
MEMORY_PORT8085SSE port
OPENCLAW_SESSIONS_DIR/sessionsOptional OpenClaw sessions directory
SESSION_DIGEST_DIR/data/session_digestsOptional session digest output

Semantic search requires Ollama reachable from the container or host. Default:

{
  "ollama": {
    "enabled": true,
    "host": "http://ollama:11434",
    "model": "nomic-embed-text"
  }
}

If you do not use Ollama, set ollama.enabled to false; FTS recall still works.

Memory model

Atoms have:

  • title
  • body
  • type: fact, decision, event, preference, log, procedure, note, etc.
  • domain: project or topic namespace
  • confidence
  • weight
  • tags
  • optional TTL

Bonds connect atoms with relation types:

is_a · part_of · depends_on · contradicts · refines · derived_from · detail_of · related_to

Example usage

remember(
    title="Use PostgreSQL for analytics",
    body="SQLite is kept for local memory, PostgreSQL is used for multi-user analytics.",
    type="decision",
    domain="project:analytics",
    confidence=0.9,
    tags=["database", "architecture"]
)
recall(query="what database did we choose for analytics?", limit=5)
working_set(
    query="continue the analytics backend work",
    domain="project:analytics",
    limit=8,
    graph_depth=1
)

Publishing and registries

This repository is prepared for MCP discovery:

  • MCP Registry name: io.github.simoneb79/memory-engine-mcp
  • Registry metadata: server.json
  • Docker/OCI verification label: included in Dockerfile
  • Client config example: mcp.json

See docs/PUBLISHING.md for the publication checklist.

Repository status

License

MIT — see LICENSE.


Made with 🧠 by SimoneB79

Server Config

{
  "mcpServers": {
    "memory-engine": {
      "url": "http://localhost:8085/sse",
      "transport": "sse"
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
CursorThe AI Code Editor
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
DeepChatYour AI Partner on Desktop
Tavily Mcp
WindsurfThe new purpose-built IDE to harness magic
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
Playwright McpPlaywright MCP server
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
ChatWiseThe second fastest AI chatbot™
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Serper MCP ServerA Serper MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Amap Maps高德地图官方 MCP Server