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 Website Docs

Memoir demo

Memoir is a high-performance semantic memory system for AI agents that brings Git-like version control to AI memory management. It replaces opaque vector databases with transparent, versioned, cryptographically secure memory storage using hierarchical semantic paths.

Project page: memoir-ai.dev — full overview, demos, and roadmap.

Why agents need versioned memory

AI memory is a Global Variable anti-pattern. Every production agent hits the same three walls: context contamination, token rent, and memory drift. Memoir brings version control to your agent's mind.

Your agent doesn't respect your git state. Context contamination happens every time you git checkout. Without branch-aware memory, your agent tries to apply experimental refactor patterns to stable production hotfixes.

You're paying "token rent" on a flat file. Using CLAUDE.md or MEMORY.md as a global store is a cache-killer. Every minor memory update invalidates your entire prefix cache, forcing you to pay full price to re-process your entire conversation.

Your agent's memory is code without version control. Today's AI memory — CLAUDE.md, vector stores, scratchpads — is treated like an append-only blob. One bad session poisons every future retrieval. Without memoir blame or memoir checkout, there's no way to audit who taught the agent a rule or revert a hallucination without wiping the whole store.

Key Features

  • Git-like Versioning — Branch, commit, merge, and rollback memories with cryptographic integrity.
  • Semantic Paths — Replace UUID keys with meaningful paths like profile.professional.skills.python.
  • O(log n) Lookups — Fast hierarchical search instead of expensive vector operations.
  • Memory Aggregation — Automatic consolidation of related memories at semantic locations.
  • Clean Architecture — Proper separation of storage, classification, and search layers.
  • Multiple Search Engines — Choose between fast keyword-based or intelligent LLM-powered search.

Multi-agent sessions

Multiple agent sessions working with Memoir
Multiple agent sessions working with Memoir.

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

No manual pip install needed if you have uv on PATH — the plugin auto-resolves to uvx --from memoir-ai memoir when the bare memoir binary isn't installed. Don't have uv? Install it once with the standard one-liner:

curl -LsSf https://astral.sh/uv/install.sh | sh

That's enough — the plugin handles the rest. It registers hooks for session start, user-prompt-submit, and stop, so your project gets automatic context injection and auto-captured memories. See the Claude Code plugin guide for the full slash-command and hook reference.

Install for Codex

Memoir's Codex plugin is distributed from this repository's Codex marketplace. In Codex, run /plugins, add the memoir marketplace from zhangfengcdt/memoir, restart Codex if prompted, then choose Memoir Plugins and install memoir.

You can also register the marketplace from the CLI:

codex plugin marketplace add zhangfengcdt/memoir

While developing from a local checkout, use codex plugin marketplace add /absolute/path/to/memoir instead. The repo marketplace lives at .agents/plugins/marketplace.json and points Codex at ./plugins/codex, relative to the repository root.

No manual pip install needed if you have uv on PATH — the Codex plugin resolves the Memoir CLI the same way the Claude Code plugin does: memoir on PATH first, then uvx --from memoir-ai==<pinned> memoir, then uv tool run --from memoir-ai==<pinned> memoir.

Enable Codex hooks with [features].hooks = true in ~/.codex/config.toml or pass --enable hooks for a smoke run. The Codex plugin ships lifecycle hooks; memory-recall, memoir-onboard, memoir-remember, memoir-status, and memoir-ui skills; Codex-specific transcript parsing; and local marketplace metadata. See the Codex plugin guide for setup, limitations, and the real Codex smoke-test flow.

Quick look

Memoir's CLI defaults to Anthropic claude-haiku-4-5 as of v0.1.6 — set your key first:

export ANTHROPIC_API_KEY="sk-..."

Then create a store and round-trip a memory:

# 1. Create a memoir store
memoir new my-memoir-store
cd my-memoir-store

# 2. Store with an explicit path (offline, no LLM call)
memoir remember "Sarah prefers tabs and 2-space indents" -p preferences.coding.style

# 3. Store with auto-classification (LLM picks the path; needs API key)
memoir remember "I work in Pacific time"

# 4. Read back by path (offline)
memoir get preferences.coding.style

# 5. Semantic search (LLM-backed)
memoir recall "what does Sarah prefer?"

# 6. Open the visual explorer (auto-opens in your browser)
memoir ui

Curious what the UI looks like before installing? Browse the UI Gallery.

Prefer a different model? memoir recall "..." --model gpt-4o-mini (needs OPENAI_API_KEY), or set MEMOIR_LLM_MODEL in your shell. Resolution order: --model flag → MEMOIR_LLM_MODELclaude-haiku-4-5.

See the full Quickstart for the Python API and version-control workflow.

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.
  • Codex — plugin install, hooks, skills, transcript parsing, smoke-test evidence.
  • 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.2.2.tar.gz (652.0 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.2.2-py3-none-any.whl (850.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: memoir_ai-0.2.2.tar.gz
  • Upload date:
  • Size: 652.0 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.2.2.tar.gz
Algorithm Hash digest
SHA256 5c2e53818c79aab37986744fc33056c65b7deee6fde3d63daf6180b3085602fb
MD5 e896403bc4180a7ea7b747bb8e5e30c4
BLAKE2b-256 f6aea16a4809ecacdcfc7d75c0bc7020f076b5f5b5d132b68284506fe7837539

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: memoir_ai-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 850.3 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.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 86ca29cf2231cd6667ec3b30cac7aa7820c14044bcb5ee55508522911671cf4c
MD5 1ef0eafcbadf1ac19e33ccf57d25d2a3
BLAKE2b-256 ab82a0b8573c363ee2fa201c95d9f97f56eb2e9511da385a19a89898a91b9c3a

See more details on using hashes here.

Provenance

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