Skip to main content

Mnemosyne 7.0.0 — Zero-Dependency AI Memory System

Mnemosyne (慧记) — a zero-dependency, local-first AI memory system with multi-tier forgetting, a hash-chain ledger, a plugin SDK, a local web dashboard, and MCP support.

Quick Start

# Zero-dependency core — no pip install required
python -c "from mnemosyne import MemoryBrain; print('Ready!')"

# Or install in development mode
pip install -e .

Core Features

Feature Description
Multi-tier memory Hot / warm / cold tiers with economic forgetting (migrate, never delete)
Zero-dependency Core uses only the Python standard library (3.8+)
Hash-chain ledger SHA-256 chained ledger — verify_chain() detects tampering
Plugin SDK VectorBackendPlugin / CryptoPlugin / RerankerPlugin + official plugins
MCP tools 13 tools over stdio JSON-RPC, with token auth and multi-tenant namespaces
Web UI Tech-aesthetic local dashboard (no CDN) via web_server.py
Async API AsyncMemoryBrain wrapper (asyncio)
Chinese-optimized Bigram tokenization + FTS5 + built-in synonym dictionary
Security notary Detects credentials, invisible Unicode, HTML injection; field-level redaction

Usage

CLI

# Initialize the memory database
python mnemosyne.py --dir ./mem init

# Store a memory
python mnemosyne.py --dir ./mem retain --content "苹果公司成立于1976年"

# Search memories
python mnemosyne.py --dir ./mem recall "苹果" --k 5

# Consolidate similar memories
python mnemosyne.py --dir ./mem consolidate --dry-run

# View status / health check
python mnemosyne.py --dir ./mem status --json
python mnemosyne.py --dir ./mem doctor --json

# Knowledge graph query
python mnemosyne.py --dir ./mem graph-query "张三" --depth 2 --json

# Ledger integrity / audit
python mnemosyne.py --dir ./mem verify-integrity --json
python mnemosyne.py --dir ./mem ledger-audit <memory_id>

# Export / import
python mnemosyne.py --dir ./mem export --format json --out ./memories.json
python mnemosyne.py --dir ./mem import ./memories.json

# Migrate JSONL -> SQLite
python mnemosyne.py --dir ./mem migrate --jsonl ./mem/index.jsonl

# Start the web dashboard
python -c "from web_server import run_server; run_server(port=9090)"

Python API

from mnemosyne import MemoryBrain

brain = MemoryBrain("./my_memories", enable_embeddings=False)
brain.ensure_init()

# Store
brain.retain("苹果公司成立于1976年", fast=True)

# Recall
results = brain.recall("苹果", k=5)
for score, record, reasons in results:
    print(f"Score: {score:.4f} | {record['content']}")

# Token-budgeted recall
results, cost_report = brain.recall("苹果", k=5, budget_tokens=100)

# Conversation history
brain.add_conversation_turn("session-1", "user", "Tell me about Apple")
hits = brain.search_conversations("Apple", session_id="session-1")

# Context snapshot
snapshot = brain.build_context_prompt(query="Apple", max_chars=2000)

Async API

import asyncio
from plugins.async_wrapper import AsyncMemoryBrain

async def main():
    brain = AsyncMemoryBrain("./memories", enable_embeddings=False)
    await brain.async_retain("Hello World", fast=True)
    results = await brain.async_recall("Hello", k=5)
    print(results)
    brain.close()

asyncio.run(main())

Plugins

# Crypto plugin (requires cryptography; degrades gracefully otherwise)
brain = MemoryBrain("./memories", plugins=["crypto"])

# Numpy vector backend (requires numpy; optional sentence-transformers model)
brain = MemoryBrain("./memories", plugins=["numpy_vector"])

# Reranker plugin
brain = MemoryBrain("./memories", plugins=["reranker"])

Project Structure

Mnemosyne7.0.0/
├── mnemosyne.py              # Thin facade (36 lines) re-exporting the mnemosyne package
├── mnemosyne/                # Core engine package (brain/storage/retrieval/cognitive/notary/...)
├── storage/                  # Storage backends (sqlite_backend / ledger / session_store / plugin_sdk)
├── context/                  # Context snapshots (snapshot_builder)
├── context_engine/           # Context compression engine (engine-agnostic core + Hermes adapter)
├── lexical/                  # Built-in synonym dictionary
├── profiles/                 # User profile management
├── providers/                # External provider adapter + multi-source router
├── security/                 # Contradiction detection + security report
├── session/                  # Conversation importer
├── visualization/            # Knowledge tree generator
├── plugins/                  # Extra plugins (HRR, Async)
├── mnemosyne_plugins/        # Official plugins (numpy_vector / crypto / reranker)
├── mcp_server.py             # MCP server (13 tools + auth + multi-tenant)
├── web_server.py             # Local web dashboard
├── tests/                    # unittest suite
├── benchmarks/               # Performance benchmarks
├── quality_eval/             # Retrieval quality evaluation
├── examples/                 # Runnable examples (Ollama / LangChain / MCP / CLI / embedded)
└── docs/                     # Full Chinese docs (architecture, modules, plugins, API, deployment)

Testing

python -m unittest discover -s tests -v
python -m unittest tests.test_plugins -v

Documentation

  • README_CN.md — 中文说明(Chinese README)
  • docs/ — full documentation: architecture, data model, 15 module docs, 7 plugin docs, API/CLI/MCP reference, deployment, integration, commercialization
  • COMPLIANCE.md — HIPAA / 等保 / GDPR / PIPL compliance mapping
  • comparison.md — feature comparison with alternatives
  • CHANGELOG.md — version history
  • Reports: quality_report.md (retrieval quality), benchmark_report.md (performance), security_report.md (security)

License

MIT License. See the LICENSE file.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mnemosyne_os-7.0.0.tar.gz (225.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mnemosyne_os-7.0.0-py3-none-any.whl (232.3 kB view details)

Uploaded Python 3

File details

Details for the file mnemosyne_os-7.0.0.tar.gz.

File metadata

  • Download URL: mnemosyne_os-7.0.0.tar.gz
  • Upload date:
  • Size: 225.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.16

File hashes

Hashes for mnemosyne_os-7.0.0.tar.gz
Algorithm Hash digest
SHA256 9e00775709416ed41337aeb3777d4519e2daaafcd512c684eea017c635eb6b94
MD5 311c9d04bc8ed8739874dc35e804ce30
BLAKE2b-256 d5e3e2fdce734c9a9c8e69e96d09f56b5621f450711fc0fcdcb70798a3378398

See more details on using hashes here.

File details

Details for the file mnemosyne_os-7.0.0-py3-none-any.whl.

File metadata

  • Download URL: mnemosyne_os-7.0.0-py3-none-any.whl
  • Upload date:
  • Size: 232.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.16

File hashes

Hashes for mnemosyne_os-7.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e998247515a9fb1da5cfbf35a520138f3818b8ad80c55aa473c129f5e429cc49
MD5 f6199ad8b602aaa607b74f9df27ccbaa
BLAKE2b-256 25929236101eca1cb3afb4f22c65bf0ebb2b41207a84aba51c4e1ee75b0f642f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

7.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page