Skip to main content
Glama

dsh-living-memory-mcp

中文说明 (README.zh-CN.md)

Zero-dependency SQLite Living Memory MCP bridge — share one WAL-safe memory.sqlite3 ledger (facts, lessons, decisions, todos) across DeepSeek Harness (DSH), Mistral Vibe CLI, Claude Code, Codex, and Cursor.

  • Zero dependencies: Python 3.9+ standard library only (optional numpy + OpenAI-compatible embeddings endpoint for hybrid vector retrieval).

  • DSH native schema parity: Registers the legion_bigram SQLite UDF so memories_fts triggers, checksum, source tags, and memories_vec stay 100% compatible with DSH's dsh-living-memory ledger.

  • Dual-ecosystem package: Ships both DSH plugin manifests (package.json, cordis.patch.yml, dsh-plugin.json, index.js) and Agent Plugins 1.0 manifests (plugin.json, mcp.json, skills/living-memory/SKILL.md).

DeepSeek Harness (dsh-living-memory) ──┐
Mistral Vibe CLI (Agent Plugin / MCP) ─┼──► ~/.dsh/dsh-living-memory/memory.sqlite3
Claude Code / Codex / Cursor (MCP) ────┘    (SQLite WAL · FTS5 + LIKE RRF · Optional Vectors)

Install

1. DeepSeek Harness (DSH Plugin)

dsh plugin --profile desktop add github:Potato-AI0815/dsh-living-memory-mcp
# or for web profile:
dsh plugin --profile web add github:Potato-AI0815/dsh-living-memory-mcp

Generate ready-to-paste configs for your external CLI clients (Vibe / Claude / Codex / Cursor):

node bin/dsh-living-memory-mcp.mjs --print-config

2. Mistral Vibe CLI (Agent Plugins 1.0)

Clone or copy this repository into ~/.vibe/plugins/dsh-living-memory-mcp/, then run /reload. Tools appear under the livingMemory namespace.

Windows note: mcp.json uses python3 (POSIX default). On Windows, Microsoft Store's WindowsApps/python3.exe stub often intercepts python3 — replace mcp.json with mcp.windows.example.json (uses python), or launch via node bin/dsh-living-memory-mcp.mjs which auto-detects a real Python 3 interpreter.

3. Any MCP Client (Claude Code / Codex / Cursor)

{
  "mcpServers": {
    "living-memory": {
      "command": "python3",
      "args": ["/absolute/path/to/dsh-living-memory-mcp/server/mcp_living_memory.py"],
      "env": {
        "PYTHONUTF8": "1",
        "PYTHONIOENCODING": "utf-8",
        "DSH_LIVING_MEMORY_DB": "~/.dsh/dsh-living-memory/memory.sqlite3"
      }
    }
  }
}

Bootstrap a Fresh Ledger (No DSH Required)

python3 server/mcp_living_memory.py --init --db ~/memory.sqlite3
python3 server/mcp_living_memory.py --version

Related MCP server: local-memory

Tools

Tool

Purpose

memory_search

Hybrid FTS5 + raw-text LIKE + optional vector RRF retrieval (space / type filters)

memory_recent

Most recent active memories (descending by ID)

memory_todos

Active (open) todos only

memory_write

Write a fact, lesson, decision, or todo (24h exact-duplicate guard)

memory_close_todo

Mark an open todo done with closed_at timestamp and optional note

memory_stats

Read-only counts by type, space, FTS/vector index coverage


Configuration

Variable

Default

Meaning

DSH_LIVING_MEMORY_DB

~/.dsh/dsh-living-memory/memory.sqlite3

Ledger path (~ and env vars expand)

DSH_LIVING_MEMORY_AUTOCREATE

0

Set 1 to create the minimal schema automatically when missing

DSH_LIVING_MEMORY_TZ_OFFSET

8

UTC offset in hours written into ts

DSH_LIVING_MEMORY_SOURCE

manual:mcp

source tag written on inserts

DSH_LIVING_MEMORY_LIKE_FALLBACK

1

Always fuse a raw-text LIKE pass with FTS (set 0 to disable on huge ledgers)

DSH_EMBED_URL

(empty)

OpenAI-compatible embeddings endpoint; enables hybrid vector retrieval

DSH_EMBED_TIMEOUT

2.5

Embedding HTTP timeout in seconds

LEGION_VEC_MODEL

local:qwen3-embedding-0.6b

model_version partition tag in memories_vec

Vector search is off until DSH_EMBED_URL is configured. Everything else runs 100% offline.


CJK & Host Compatibility Note

DSH's built-in dsh-living-memory may index memories_fts using a host CJK word segmenter, whereas this zero-dependency server registers a deterministic CJK-bigram + word + date-normalizer legion_bigram UDF. To eliminate silent Chinese recall misses on mixed ledgers, memory_search always fuses a raw-text LIKE ranking pass with FTS5 (and optional vectors) via RRF (k=40), and degrades gracefully whenever numpy, memories_vec, memories_fts, or the embeddings endpoint is absent.


Test

python3 tests/smoke_test.py                                     # 45/45 write + FTS + protocol checks (temp ledger)
python3 tests/smoke_test.py --db ~/memory.sqlite3 --read-only   # 20/20 non-mutating checks against an existing ledger

License

MIT — see LICENSE.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Cross-client AI memory hub for AI agents. Lets Claude Code, Cursor, Windsurf, and 20+ other clients share one physical SQLite memory database. Features bi-temporal time axes, source attribution, Q-Value usage-based ranking, and FTS5 full-text search with SQLite triggers.
      286 PyPI
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to keep durable long-term memory on the user's own machine, writing sessions and messages into a local SQLite database and retrieving them via keyword, exact, or optional semantic search with surrounding context. Runs entirely offline over stdio, so no cloud service or API key is required to give an agent recall across sessions.
      1
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI coding agents to store, search, and recall persistent project-scoped and cross-project context — decisions, preferences, error patterns, file notes, and guidelines — using local SQLite with semantic or keyword search and no external API calls. An optional companion task server in the same package lets agents pick up queued work and execute it autonomously using that accumulated memory.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Gives AI coding agents direct, local-first read/write access to persistent memory — project decisions, preferences, error patterns, research, and cross-project guidelines — retrieved by semantic search backed by SQLite with no API keys or network calls. A companion server also exposes optional autonomous task-queue execution.
      -