Skip to main content

High-performance semantic memory system integrating LangMem with ProllyTree

Project description

Memoir

Memoir Logo

Git for AI Memory

Hierarchical Memory with Git-Like Version Control

Python License Status Docs

Memoir demo

Memoir is a hierarchical memory system for AI agents, with Git-like version control built in. Instead of storing facts as opaque embeddings and guessing at relevance through vector similarity, Memoir classifies every fact into a semantic taxonomy path like preferences.coding.style or workflow.coding.testing. Retrieval becomes explainable (you see which path was chosen and why) and efficient (O(log n) tree lookup — no vector index, no embedding model to host, no re-rank stage). Memoir is framework-agnostic — usable from any agent runtime via its CLI, Python SDK, or MCP server — and sits alongside any static prompt or instruction file your agent already uses, carrying the evolving layer (decisions, debugging trails, accumulated preferences, branch-specific context) that a static file can't version or query.

Why Memoir for Coding Agents

  • Hierarchical paths, not embeddings. Every fact lands at a named path in a 3-level taxonomy (~200 paths in v1.1.0). No vector DB to operate, no similarity threshold to tune — lookup is a tree walk and results trace directly back to the path that matched.
  • Explainable retrieval. Unlike semantic/vector search, you can always answer why a memory was surfaced: the agent picked path preferences.coding.style and read the value there. Good for debugging, auditability, and reproducibility.
  • Efficient at scale. Taxonomy classification is O(log n), not O(n). No embedding inference on the hot path, no vector index to warm, no re-ranker. The CLI returns typical recalls in hundreds of milliseconds.
  • Complements static prompts. System prompts and instruction files are great for invariants. Memoir handles the evolving layer — per-session decisions, debugging history, branch-specific context — so the prompt stays lean and the history stays queryable.
  • Branches for experiments. Try a refactor direction or a new coding style on experiment/*, keep it if it works, discard it if it doesn't — same workflow you already trust from git.
  • Taxonomy designed for coding workflows. v1.1.0 maps to how coding agents actually think — workflow.coding, debugging, knowledge, preferences.tools — not generic prose buckets.
  • Framework-agnostic, agent-native ergonomics. Works with Claude Code, LangGraph, custom runtimes, or anything that can shell out. --json on every CLI command, stable exit codes, KV-cache-friendly output shapes, and an MCP server for any MCP-compatible client.

Install from PyPI

pip install memoir-ai

The distribution name on PyPI is memoir-ai. The Python import is import memoir and the CLI is memoir.

Install for Claude Code

Inside a Claude Code session, run:

/plugin marketplace add zhangfengcdt/memoir
/plugin install memoir@memoir

The plugin registers hooks for session start, user-prompt-submit, and stop, so your project gets automatic context injection and auto-captured memories. Each project gets its own store under ~/.memoir/memoir_<hash>/ (override with MEMOIR_STORE). See the Claude Code plugin guide for the full slash-command and hook reference.

Quick look

export MEMOIR_STORE=/tmp/my_store
memoir new "$MEMOIR_STORE"
memoir remember "prefer pytest over unittest, parametrize aggressively"
memoir recall "what's my testing setup?"

That's the core loop — auto-classified on the way in, semantically retrieved on the way out.

Documentation

Full docs live at zhangfengcdt.github.io/memoir:

  • Quickstart — five-minute tour of the core loop.
  • CLI Reference — every command, flag, and exit code.
  • UI — the visual explorer (Tree / Graph / Timeline / Places + /stats).
  • Claude Code — plugin install, slash commands, hooks, lifecycle.
  • Architecture — taxonomy, classifier, store, search.
  • API Reference — Python SDK.
  • Examples — context branching, memory debugging, reproducible testing.

Contributing

Memoir is alpha and contributions are very welcome — especially from people building coding agents, since that's the audience we're optimizing for. Good first paths in:

  • Pick an issue from the issue tracker or open one describing a gap.
  • Fork the repo, branch off main, and run make ci before opening a PR (lint, tests, docs build must be green).
  • Bug reports with a minimal reproducer and benchmark / taxonomy proposals for coding-agent use cases are particularly appreciated.

License

Apache License 2.0 — see LICENSE.

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

memoir_ai-0.1.4.tar.gz (539.3 kB view details)

Uploaded Source

Built Distribution

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

memoir_ai-0.1.4-py3-none-any.whl (452.8 kB view details)

Uploaded Python 3

File details

Details for the file memoir_ai-0.1.4.tar.gz.

File metadata

  • Download URL: memoir_ai-0.1.4.tar.gz
  • Upload date:
  • Size: 539.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for memoir_ai-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e304fa9bc3b4290d8b3c444a8fbe325653d1d7244671b778065060d1a7826bef
MD5 b4f1a7f841bff3540e3cda893b9f24ec
BLAKE2b-256 90ce1ebd11712e48969b5f527bfbde052d27582a62d5b48e3a390319e77086c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoir_ai-0.1.4.tar.gz:

Publisher: release.yml on zhangfengcdt/memoir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file memoir_ai-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: memoir_ai-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 452.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for memoir_ai-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4987ab36a614f4a92f7d4aaabf74ba90bb11ba0d62e5289243ced727ace2527b
MD5 d39b1cca2318283da5a663d64d169ee8
BLAKE2b-256 892c964d7e60433d3156d23ce2119e32246392f7c50f5f647f637be002517639

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoir_ai-0.1.4-py3-none-any.whl:

Publisher: release.yml on zhangfengcdt/memoir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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