Skip to main content

主动式记忆伙伴

Project description

MEMOS — Active Memory System for AI Coding Assistants

Python License Version

📖 中文文档

MEMOS is a lightweight RAG engine designed for AI coding assistants. It provides cross-session memory — remembering technical decisions, bug fixes, user preferences, and code conventions from past conversations. Built on ChromaDB + bge-large-zh-v1.5 with a built-in MCP server.

Features

  • 🧠 Cross-Session Memory — Captures knowledge from conversations, retrieves it across sessions
  • 🔌 MCP Server — 11 tools for AI assistant integration (Claude Code, etc.)
  • 🔍 Hybrid Search — Vector similarity (1024-dim) × BM25 keyword scoring, time-decay ranking
  • 📊 Web Dashboard — Browse, search, manage memories; visual configuration editor
  • 🏗️ 4 Pipelines — AI-suggested + direct-write + auto-harvest + manual curation
  • 🗂️ Multi-Project — Scoped by working directory, contexts stay separate
  • ⚡ Lightweight — Local-only, single process, no external services

Quick Start

pip install memomate
memos init --force
memos dashboard

Open http://127.0.0.1:8000

Windows: If model download stalls, set $env:HF_ENDPOINT = "https://hf-mirror.com" before memos init.

Claude Code Integration

memos hook install

This registers MEMOS as an MCP server. Claude Code will automatically read and write memories during conversations.

Why MEMOS?

Existing memory solutions for AI coding assistants typically:

  • ❌ Store flat text without semantic search
  • ❌ Require external services (PostgreSQL, Redis, cloud APIs)
  • ❌ Lack cross-project isolation
  • ❌ Don't handle time-based memory decay

MEMOS addresses these with a self-contained, local-first architecture designed specifically for the AI-assisted coding workflow.

Architecture

graph LR
    subgraph AI Assistant
        A[Claude Code]
    end
    subgraph MEMOS
        B[MCP Server<br/>11 tools]
        C[Engine<br/>Retrieval + Extraction]
        D[Vector Store<br/>ChromaDB]
        E[Embedding Model<br/>bge 1024-dim]
        F[Web Dashboard<br/>FastAPI + Jinja2]
        G[Hybrid Search<br/>BM25 + Vector]
    end
    A <-->|stdio JSON-RPC| B
    B --> C
    C --> D & E & G
    F --> C

Project Structure

memos/
├── src/memos/
│   ├── config/      Pydantic models, loading chain, prompts
│   ├── storage/     Vector store abstraction (ChromaDB)
│   ├── engine/      Core: memory CRUD, extraction, review, BM25
│   ├── server/      MCP server (11 tools, FastMCP stdio)
│   ├── web/         FastAPI + Jinja2 dashboard
│   ├── cli/         argparse CLI (15+ commands)
│   ├── features/    Backup, daily review, notifications, wizard
│   └── hooks/       Claude Code hook scripts (prompt/stop)
├── memdb/           ChromaDB persistent data
├── model/           Local embedding models (~1.3GB)
└── etc/             Configuration files + i18n locales

MCP Tools (for AI Assistants)

Tool Pipeline Description
remember(text, metadata) A Buffer → LLM extraction
save_knowledge(text, type) B Direct write to store
recall(query, top_k, ...) Semantic + hybrid search
list_memories(type, limit) Paginate project memories
list_todos(status, limit) List pending action items
update_todo(id, status) Change todo status
delete_memory(memory_id) Delete by ID
update_memory(id, text, meta) Update content/metadata
force_extract() A Trigger immediate extraction
set_project_id(pid) Switch project scope
log_complete_turn(user, asst) A Log a conversation round

CLI Commands

Command Description
init First-time setup wizard
dashboard Launch web UI
server Start MCP server (stdio)
status View system health
doctor Diagnose and troubleshoot
config show / set / validate Manage configuration
export Export memories to JSONL
import Import from JSONL
backup / restore Full database backup
hook install / uninstall / status Claude Code hook management
auth regen Regenerate dashboard token
vacuum Reclaim deleted document space
reindex Rebuild BM25 index

Configuration

All settings in etc/config.json. Key sections:

{
  "llm": {
    "endpoints": [
      {"name": "default", "api_base": "http://localhost:11434/v1"}
    ],
    "active": "default"
  },
  "model": {"name": "bge-large-zh-v1.5", "vector_dim": 1024},
  "memory": {"decay_lambda": 0.02, "default_top_k": 5},
  "suggestion": {"active_suggestion_threshold": 0.65}
}

Override any field via MEMOS_{SECTION}_{FIELD} environment variables.

Requirements

  • Python 3.12+
  • ~2GB disk (bge-large-zh-v1.5 model ~1.3GB)
  • Windows / Linux / macOS

License

MIT

Project details


Download files

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

Source Distribution

memomate-0.4.7.tar.gz (357.8 kB view details)

Uploaded Source

Built Distribution

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

memomate-0.4.7-py3-none-any.whl (268.0 kB view details)

Uploaded Python 3

File details

Details for the file memomate-0.4.7.tar.gz.

File metadata

  • Download URL: memomate-0.4.7.tar.gz
  • Upload date:
  • Size: 357.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for memomate-0.4.7.tar.gz
Algorithm Hash digest
SHA256 d96674623b18d9dfb16b967e9b87812b87059d571f9fdebc0c7caf77257c101b
MD5 b94c5f525ee960126e0eb55c8fe1118a
BLAKE2b-256 bdb2f85399002a3f81bc5eb8e19e8f778e1c4fc2d357937e6d32025eae9f01c2

See more details on using hashes here.

File details

Details for the file memomate-0.4.7-py3-none-any.whl.

File metadata

  • Download URL: memomate-0.4.7-py3-none-any.whl
  • Upload date:
  • Size: 268.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for memomate-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 01e6d378762801a2828a0f6a1397284672236c50f7a1c023b6d2eaa19a625892
MD5 94e153385160364a2ea56dbddd7f455f
BLAKE2b-256 c04947c48cd66b87f042911971f97f53b4a6eccae87e7b778c61291e76538e1f

See more details on using hashes here.

Supported by

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