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.5.tar.gz (543.5 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.5-py3-none-any.whl (766.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: memoir_ai-0.1.5.tar.gz
  • Upload date:
  • Size: 543.5 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.5.tar.gz
Algorithm Hash digest
SHA256 925f12714cc019ab9984472f93d33935a526cff90aafc3c4f6098eb0e4d21bb9
MD5 55284844705c6965bc64f57833825e10
BLAKE2b-256 9e81276fd923f87ea61f5b5ade43721ddc876b3141267ae26b2cff1ab16222c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoir_ai-0.1.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: memoir_ai-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 766.9 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7699794d0c01637202721bb808f2b8ec504eeca003d2a770006dec91f85d7ed0
MD5 fea709b529b84241f5adebf3b0ecda73
BLAKE2b-256 436c6c66210fbecaae10af737224e0690e68b507459cd7072dfc0924e934f23e

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoir_ai-0.1.5-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