Skip to main content
Glama

MemoryS

Local-first, human-governed memory for AI coding agents.
Built on plain Markdown (Obsidian-compatible) + Git + Stdio MCP + <50ms local Hooks — with zero Python runtime dependencies.

English | 简体中文


Why MemoryS?

Most AI agent memory tools optimize for automatic capture. Over time, agents silently record guesses, keep stale decisions alive, or mix rules across projects.

MemoryS takes a different stance: agents propose, humans publish.

  Claude Code / Codex / Cursor / Any MCP Client
        │                                 ▲
        │ memory_propose (draft only)     │ <50ms recall hook & read-only MCP
        ▼                                 │ (memory_search / read / trace)
  ┌─────────────────────┐        ┌──────────────────────────┐
  │ SQLite Review Queue │        │  Obsidian Vault + Git    │
  │ (secret & policy    │───────▶│  (Single Source of Truth)│
  │  guard built-in)    │ Human  │  • YAML frontmatter      │
  └─────────────────────┘ Publish│  • supersedes / as_of    │
                          Gate   │  • SOURCES.md provenance │
                                 └──────────────────────────┘

What Makes It Different

Capability

MemoryS

Auto-Capture Plugins

Hosted Vector Memory

Human publish gate

Agents can only queue drafts; vault writes require explicit confirmation + Git commit

Writes automatically

Writes automatically

Temporal rules (as_of)

Native effective_from / effective_until & supersedes chains

Rarely supported

Limited

Quote provenance (trace)

Every rule can link back to verbatim quotes in SOURCES.md

Opaque summaries

Chunk snippets

Zero-dependency local recall

Pure Python stdlib, <50ms UserPromptSubmit hook, no Docker / vector DB

Often requires LLM calls

Cloud or local DB

Cross-client shared brain

One Git/Obsidian vault shared across Claude Code, Codex, Cursor, etc.

Usually single-client

SDK-coupled

Review Console

Native macOS app (Swift + WKWebView + Keychain) + cross-platform local Web UI

CLI / web only

Cloud dashboard

Related MCP server: Axiom Meridian

Console Preview

Memory Library — browse active & historical cards, supersession chains, and source quotes:

MemoryS Library Console

Review & Publish — inspect agent proposals side-by-side before writing to your vault and committing to Git:

MemoryS Review Console


Quick Start (2 Minutes)

Requires Python 3.10+ and Git. No pip packages required for the runtime.

1. Install CLI & Initialize a Demo Vault

git clone https://github.com/52Rain/MemoryS.git
cd MemoryS
pip install -e .

# Create a Git-backed Obsidian vault with sample temporal rules
mem init ~/MemoryS --demo

(You can also run directly without pip install via python3 runtime/memory_cli.py ....)

2. Try Point-in-Time (as_of) Recall & Provenance

The demo vault includes a billing rule that changed on 2026-06-15:

# What was the active rule on May 1, 2026? -> returns v1 (7 days)
mem search --project acme-billing --as-of 2026-05-01

# What is active after June 15, 2026? -> returns v2 (Enterprise 14 days)
mem search --project acme-billing --as-of 2026-07-01

# Trace the verbatim quote behind v2
mem trace d-acme-billing-grace-v2

3. Connect Your AI Agents (Claude Code / Codex / Cursor)

Preview the exact MCP & Hook configuration first, or add --apply to write with .bak backups:

mem connect claude            # preview config snippets
mem connect claude --apply    # write ~/.claude.json & ~/.claude/settings.json

mem connect codex --apply     # write ~/.codex/config.toml & ~/.codex/hooks.json
mem connect cursor --apply    # write ~/.cursor/mcp.json

4. Launch the Review & Library Console

Cross-platform Web UI (Linux / Windows / macOS):

cd desktop-app && npm ci && npm run build && cd ..
mem ui

Native macOS App (Swift + WKWebView + Keychain, no Electron):

cd desktop-app
npm ci
npm run package
open build.noindex/MemoryS.app

Core Concepts

Vault Layout (Obsidian-Ready)

~/MemoryS/
├── START.md                        # Vault entry point
├── PROJECTS.md                     # Auto-generated project index
├── SOURCES.md                      # Append-only JSONL provenance quotes
├── notes/
│   ├── preferences/                # Always-on personal preferences
│   ├── methods/                    # Cross-project reusable playbooks
│   └── domain/                     # Domain knowledge
└── projects/
    └── acme-billing/
        ├── START.md                # Project aliases & local workspace paths
        ├── handoff.md              # Current work-in-progress handoff
        └── d-acme-billing-*.md     # Versioned project decisions

Dual-Layer Local Recall (recall_hook.py)

On every prompt (UserPromptSubmit), MemoryS runs purely locally in <50ms:

  1. Layer 1 — Personal Preferences: Active cards under shared/preferences (budget-capped).

  2. Layer 2a — Dual-Path Project Matching: Matches projects by current working directory (cwd against paths) or by mentioning the project title/alias in the prompt text — even from an unrelated directory.

  3. Layer 2b — Relevant Shared Methods & Domain Knowledge: Keyword-scored active cards under shared/methods and shared/domain.

MCP Tools (mcp_server.py)

  • memory_search(query, project, scope, as_of, include_history) — Read-only search with temporal filtering.

  • memory_read(card_id) — Full card metadata, body, and supersedes / superseded_by chain.

  • memory_trace(card_id) — Resolve source_refs against SOURCES.md.

  • memory_propose(scope, title, body, effective_from, supersedes, quote, use_when, client) — Queue a draft proposal for human approval. Built-in guards reject API keys, private keys, and "do not record" directives.

Optional AI Conflict Check

In the Review Console, you can optionally configure any OpenAI Chat Completions compatible endpoint to check a pending proposal against active cards in the same scope. It is purely advisory and never blocks publishing.


Configuration & Environment Variables

Vault resolution priority:

  1. --vault <path> CLI flag

  2. MEMORYS_VAULT environment variable

  3. ~/.config/memorys/config.json (vault_path, set automatically by mem init)

  4. ~/MemoryS (if present)

Other environment variables:

  • MEMORYS_APP_DATA: Override SQLite queue directory (defaults to OS standard app data path).

  • MEMORYS_API_KEY: Optional API key for Web UI AI conflict checks (macOS App uses Keychain).


Development & Testing

# Run full unit & integration test suite (pure Python stdlib)
python3 -B -m unittest discover -v -s tests

# Build frontend console
cd desktop-app && npm ci && npm run build

See CONTRIBUTING.md and SECURITY.md for contribution guidelines and security model details.

License

MIT

Available Tools

4 tools
memory_proposeA

Submit a draft memory card or revision to the MemoryS pending review queue (does NOT modify the published vault). Automatically blocks secrets, tokens, private keys, and 'do not record' directives.

Inputs: body (required), scope (required), title (required), quote, +4 more.

memory_readA
Read-onlyIdempotent

Read a single memory card's full metadata, markdown body, path, and supersession chain.

Inputs: card_id (required).

memory_traceA
Read-onlyIdempotent

Resolve a card's source_refs against SOURCES.md (or legacy 来源记录.md) to return provenance quotes.

Inputs: card_id (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool maps to a distinct phase of the memory lifecycle: propose (write to pending queue), search (query published cards), read (fetch one card by identity), and trace (resolve provenance references). The propose description explicitly states it does not modify the published vault, cleanly separating it from the read-side tools. No two tools overlap in purpose.

    Naming Consistency5/5

    All four tools use the identical pattern of a shared `memory_` namespace prefix followed by a single distinct verb (propose, search, read, trace). Consistent snake_case throughout, no mixing of casing or verb styles.

    Tool Count4/5

    Four tools is lean but each is justified and this is a focused read-plus-submit service rather than a full CRUD application. It sits at the lower edge of comfortable scope, with no redundancy to trim.

    Completeness3/5

    The read side is well covered (search, read, trace), but the write side is one-directional: cards are submitted to a 'pending review queue' with no tool to list, approve, reject, or retract them, leaving an agent unable to complete the editorial workflow it initiates. There is also no delete/forget operation for retired memories.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides long-lived, cross-project technical memory for AI agents via markdown cards stored in git and indexed by SQLite, enabling search, retrieval, and human-reviewed knowledge management.
      ISC
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI coding agents to query a team's institutional coding rules and lessons learned, resolving a project → framework → language → global scope hierarchy so only the entries relevant to the current task are returned instead of whole knowledge-base files. It also supports governed proposal approval, PR and feature audits, meeting-transcript extraction, optional semantic ranking, and access-controlled audit logging, while keeping Markdown files as the source of truth.
      28
      57 PyPI
      Apache 2.0
    • A
      license
      Not graded
      quality
      A
      maintenance
      Gives AI coding agents persistent cross-session memory by storing atomic markdown knowledge cards with bidirectional wiki-links that agents recall before starting work. Syncs across clients and devices via git without any vector database or embeddings.
      9 npm
      ISC
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI coding agents to save insights from completed tasks as atomic markdown knowledge cards with bidirectional links, then recall relevant cards before starting new work so context carries across sessions. Cards live in a shared local directory readable and editable by humans, with optional git-based sync across devices and clients, and no vector database or embeddings required.
      9 npm
      ISC