zhangfengcdt/memoir

Hierarchical Agent Memory with Git-Like Version Control

What it solves

Memoir addresses the "global variable" problem in AI agent memory, where flat files or opaque vector databases lead to context contamination, high token costs (token rent), and memory drift. It prevents agents from applying irrelevant experimental patterns to stable production environments and provides a way to audit or revert hallucinations without wiping the entire memory store.

How it works

Memoir implements a hierarchical semantic memory system with Git-like version control. Instead of using UUIDs or flat blobs, it organizes memories using semantic paths (e.g., profile.professional.skills.python). It uses a clean architecture separating storage, classification, and search, allowing for O(log n) lookups and memory aggregation. Users can branch, commit, merge, and rollback memories to maintain cryptographic integrity across different agent sessions or project states.

Who it’s for

It is primarily designed for developers building coding agents and personal-assistant agents who need durable, versioned, and transparent long-term memory management.

Highlights

  • Git-like Versioning: Supports branching, committing, merging, and rolling back memories.
  • Semantic Paths: Uses meaningful hierarchical paths instead of opaque keys for memory organization.
  • High Performance: Offers O(log n) lookups and supports multiple search engines, including keyword-based and LLM-powered search.
  • Broad Integration: Ships as a plugin for Claude Code, Codex, Hermes, OpenClaw, and as an MCP server for hosts like Cursor, Windsurf, and VS Code.

Related

  • Project
  • Project
  • Project
  • Dispatch
  • Project