Skip to main content
Glama

Mnemo

A portable, user-level memory layer for AI agents — shared across agents, exposed over MCP, with no embeddings required by default.

Named after Mnemosyne, the goddess of memory. Mnemo is a single-file, portable memory layer that any MCP-capable host can mount. Migrating it is as simple as copying one database file.

Features

  • User-level, cross-agent memory — different agents remember the same you.

  • MCP stdio server — mountable by any Model Context Protocol host.

  • No embeddings by default — a deterministic, auditable, portable blend of SQLite + FTS5 (BM25 full-text) + a lightweight relations table.

  • Optional vectors — sqlite-vec + a local bge-small model available as an opt-in (disabled by default) enhancement.

  • Web admin UI — a zero-build local React app to browse, search, edit, delete, inspect audit chains and relation graphs, and run consolidation.

  • Chinese full-text search — write-time segmentation via the built-in Intl.Segmenter (zero dependencies) makes even two-character terms recallable.

Related MCP server: nigrty

Design principles

  1. Hybrid architecture (full-text + relations, vectors optional).

  2. Facts carry a validity period rather than being destructively overwritten.

  3. Agent-generated facts are first-class and stored.

  4. Background consolidation (dedup / conflict expiry / aging).

  5. Everything is readable, editable, and deletable.

Quick start

npm install
npm run build     # tsc -> dist/
npm test          # node --experimental-strip-types --test

Web admin UI

npm run build
npm run ui        # serves http://127.0.0.1:4173  (alias: mnemo-ui)

From the browser you can browse/filter (by scope / kind / subject / tag), run full-text search (two-character CJK terms are recallable), create / edit / soft-delete / hard-delete facts, inspect audit chains (the superseded_by lineage), view the relation graph (SVG), and run consolidation manually (dry-run preview → commit).

  • Backend (src/web.ts): a zero-dependency Node HTTP server (node:http) that reuses store.ts / consolidate.ts to read and write the SQLite database directly, with a REST surface under /api/*. Configurable via MNEMO_UI_PORT (default 4173), MNEMO_UI_HOST (default 127.0.0.1), and MNEMO_DB.

  • Frontend (public/): React 18 loaded from a CDN via importmap, with JSX compiled in the browser by Babel-standalone — no npm dependencies and no build step.

  • The UI and any mounted stdio MCP server share the same database file safely (SQLite WAL, multiple connections).

MCP tools

Seven MCP tools are exposed:

Tool

Purpose

save_memory

Store a fact (with scope / kind / source / validity).

search_memory

BM25 full-text search (CJK-aware).

list_memories

List / filter facts.

update_memory

Edit a fact (keeps the old version as superseded).

forget_memory

Soft or hard delete.

link_memories

Create a typed relation between two facts.

consolidate

Deterministic housekeeping (dedup, conflict expiry, aging).

Tool prefix: mcp__mnemo__*.

Storage & runtime

  • Storage: better-sqlite3 (prebuilt binary, no compilation) + FTS5 (unicode61) + a fact_tags table + a relations table; opened with WAL, busy_timeout, and foreign_keys on.

  • Chinese retrieval: write-time segmentation with Intl.Segmenter (zero dependencies) so two-character words are recallable.

  • The five principles in practice: source ∈ {user, agent}; valid_from / valid_until / superseded_by (old facts are marked invalid, never dropped); soft and hard delete; dedup_key-based conflict expiry; UTC timestamps throughout.

  • The runtime database defaults to ~/.dsh/mnemo.db and is independent of the code location; override it with the MNEMO_DB environment variable.

Mounting in an MCP host (stdio)

mnemo:
  command: node
  args: ["<path-to>/Mnemo/dist/index.js"]
  env:
    MNEMO_DB: "~/.dsh/mnemo.db"   # shared database; this is also the default

Build first (npm install && npm run build to produce dist/index.js), then point your host's MCP configuration at it. The stdio transport ships with the MCP SDK, so mounting works out of the box.

Documentation

  • docs/design.md — full design document (storage schema, MCP tool interface, consolidation, injection strategy, milestones).

License

MIT

Available Tools

7 tools
consolidateA

Phase A 机械整理记忆(无 LLM,确定性):去重(内容重复合并,保留 user/高 confidence/新)、过期清理(episodic 超保留期软删;user 明示永不清)。默认 dry_run=true 只报告计划不落库。LLM 蒸馏(Phase B)由宿主 agent 另行编排。

Inputs: dedup, scope, dry_run, episodic_retention_days.

forget_memoryA

遗忘事实。hard=false(默认)软删除;hard=true 物理删除(GDPR,级联清理关系/标签)。

Inputs: id (required), hard.

list_memoriesA

按条件列出记忆(结构化,可读/审计),不做全文匹配。默认只列当前有效事实。

Inputs: tag, kind, limit, scope, +2 more.

save_memoryA

写入一条记忆事实。content 为明文(人可读)。给定 dedup_key 时,同 (scope,subject,kind,dedup_key) 的旧事实会被自动标记失效(保留审计链)。

Inputs: content (required), kind, tags, scope, +5 more.

search_memoryA

BM25 全文检索记忆(中文经 Intl.Segmenter 分词,2 字词可召回)。默认只返回当前有效事实。

Inputs: query (required), tag, kind, limit, +3 more.

update_memoryA

修改事实。改 content 会保留旧版本(标失效+superseded_by)并创建新版本(审计链);只改 tags/confidence/subject 则原地更新。

Inputs: id (required), tags, content, subject, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool maps to a distinct memory operation: create, search, list, update, delete, link, and maintain. The overlap between search_memory and list_memories is clearly resolved by describing full-text vs structured filtering, and update_memory is distinct from save_memory due to versioning semantics.

    Naming Consistency4/5

    Most tools follow a clear verb_noun snake_case pattern: save_memory, search_memory, update_memory, forget_memory, link_memories. Minor deviations include the plural 'memories' for list/link while others use singular 'memory', and consolidates is a bare verb without a noun object.

    Tool Count5/5

    Seven tools is well-scoped for a memory server: it covers ingestion, retrieval, structured listing, mutation, deletion, relationships, and maintenance. Each tool has a clear role and none feels redundant or unnecessary.

    Completeness4/5

    The core memory lifecycle is well covered: save, search, list, update, soft/hard delete, link, and consolidation. The main gap is that relationships can be created via link_memories but there is no explicit unlink or relationship-query tool, and there is no dedicated get_memory_by_id, though list_memories likely fills that role.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Local-first AI memory layer with hybrid retrieval and brain-inspired namespaces. Enables agents to save, search, and manage memories directly via MCP tools.
      6 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to store, recall, link, and manage durable local memories using ranked fuzzy search and optional graph context through a compact MCP interface.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to persist and retrieve structured memory across sessions and models via MCP tools for cataloging, searching, and saving facts, with automatic supersession and scope filtering.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables multiple MCP agents to read and write a single user-controlled, local-first fact layer under one user identity with explicit scopes, preserving sources, versions, permissions, and audit history. Supports structured memories such as preferences, facts, task state, and decisions, plus structured handoff capsules so one agent can resume another's work by task ID.
      MIT