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.
Local-first memory your agents can explain, rewind, and branch.
Memoir replaces opaque vector memory with a local-first, taxonomy-structured, Git-versioned store. Recall by path, not by similarity. Time-travel to reproduce bugs. Branch to test risky strategies. Built for coding agents and custom runtimes alike.
One memory system. Every runtime.
Python install for the SDK or CLI.
Claude Code plugin install. Run inside a Claude Code session.
Using Codex or OpenCode instead? Codex install · OpenCode install →
Every production agent hits the same three walls: context contamination, token rent, and memory drift. Memoir brings version control to your agent's mind.
Context contamination happens every time you git checkout. Without branch-aware memory, your agent tries to apply experimental refactor patterns to stable production hotfixes.
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.
One bad session poisons every future retrieval. Without memoir blame or memoir checkout, there is no way to audit who taught the agent a rule or revert a hallucination without wiping the entire store.
Memoir replaces fuzzy retrieval with version-controlled, branch-aware memory. It ships as a Claude Code plugin — a set of automatic skills and hooks that follow your git workflow.
Instead of "vibe search" (vector DB), Memoir uses hierarchical paths like api.v2.auth to fetch the exact 10 tokens needed — keeping your prompt cache stable.
memoir get api.v2.auth
→ "JWT, 15-min expiry, refresh on 401" Memoir branches follow your git branches automatically via Claude Code hooks. No manual sync, no contamination across checkouts.
$ git checkout migrate-to-deck-gl
→ memoir · switched to migrate-to-deck-gl Lessons learned on a feature branch can be reviewed and merged into the main knowledge base — just like code.
memoir merge feature/deck-gl → main
3 paths added · 1 conflict resolved Nine entry points. Pick your runtime — Memoir stores are compatible across all of them.
Memoir installs as a first-class Claude Code plugin. Auto-capture on session end, context injection on start.
# Inside a Claude Code session:
/plugin marketplace add zhangfengcdt/memoir
/plugin install memoir@memoir
# That's it. Next session starts with:
# • auto-capture of session memories
# • context injection on start
# • slash commands (/memoir-remember, /memory-recall, /memoir-ui) Codex's marketplace plugin. Same skills as Claude Code — onboard, recall, remember, status, UI — plus Codex-native transcript parsing.
# In Codex, run /plugins:
# add marketplace from zhangfengcdt/memoir
# choose Memoir Plugins → install memoir
# (Restart Codex if prompted.)
# Or register the marketplace from the CLI:
codex plugin marketplace add zhangfengcdt/memoir
# Enable hooks once in ~/.codex/config.toml:
# [features]
# hooks = true
# Or for a smoke run:
# codex --enable hooks
# Skills shipped: memoir-onboard, memory-recall,
# memoir-remember, memoir-status, memoir-ui
# CLI resolution: memoir on PATH → uvx → uv tool run
# (no manual pip install needed if uv is on PATH) opencode-memoir, a community-maintained plugin, brings Memoir to OpenCode through its native plugin system. Same per-project stores, auto-capture, and slash commands.
# Add the plugin to ~/.config/opencode/opencode.jsonc:
# {
# "plugin": ["opencode-memoir"]
# }
# OpenCode resolves the package from npm automatically.
# Then, inside any project:
/memoir:status # verify the store was created
/memoir:remember # save an explicit memory
/memoir:recall # list and use stored memories
/memoir:onboard # build the project snapshot
# The memoir CLI resolves automatically (uvx fallback).
# Community plugin by @disafronov. Memoir fills Hermes's pluggable memory slot. Talk to your assistant normally — it remembers across sessions, forgets on request, and keeps forked side-threads isolated until you merge them.
# Install the memory tool:
pip install memoir-ai
# Add the plugin to Hermes:
hermes plugins install zhangfengcdt/memoir/plugins/hermes
# Turn it on, then verify:
hermes memory setup # choose: memoir
hermes memory status # Provider: memoir … available ✓
# That's it. From now on Hermes auto-captures
# durable facts and recalls them in new sessions —
# remember / forget / branch all in plain language. openclaw-memoir, a community-maintained plugin, adds versioned long-term memory to the OpenClaw assistant gateway. Conversations stay isolated by default, so side chats never pollute a user's profile.
# Install the memory tool:
pip install memoir-ai
# Install the plugin:
openclaw plugins install https://github.com/zhangfengcdt/openclaw-memoir
# Allow conversation access, then restart:
openclaw config set plugins.entries.memory-memoir.hooks.allowConversationAccess true
systemctl --user restart openclaw-gateway
# Verify:
openclaw memoir status
# Auto-captures facts each turn and injects relevant
# memory into prompts — remember / forget / branch
# available in chat via /memoir. One server, every MCP host. memoir-mcp puts the same git-versioned, taxonomy-structured store inside Claude Desktop, Cursor, Cline, Windsurf, VS Code (Copilot), Zed, Continue, and more — recall, remember, branch, and trace provenance from any of them.
# Install the MCP extra (or skip install and use uvx):
pipx install "memoir-ai[mcp]"
# Add to your host's mcpServers config — Claude Desktop,
# Cursor, Cline, Windsurf all share this shape:
# {
# "mcpServers": {
# "memoir": {
# "command": "uvx",
# "args": ["--from", "memoir-ai[mcp]", "memoir-mcp"],
# "env": { "MEMOIR_STORE": "~/.memoir/mcp" }
# }
# }
# }
# Tools exposed to the host:
# memoir_recall memoir_remember memoir_forget
# memoir_status memoir_branches memoir_checkout
# memoir_commits Drop into LangGraph, LangChain, CrewAI, AutoGen — or any Python runtime. Async-first API.
pip install memoir-ai
# remember.py
from memoir import MemoryClient
memory = MemoryClient(store="./my_store")
await memory.remember(
"user prefers pytest with parametrize",
namespace="user-123",
)
results = await memory.recall(
"what's my testing setup?",
namespace="user-123",
) Memoir is a drop-in LangGraph BaseStore — give your graph Git-versioned, taxonomy-structured long-term memory, branchable and queryable by namespace. No second database to keep in sync.
pip install "memoir-ai[langmem]"
# Memoir is a drop-in LangGraph BaseStore
from memoir.integration.langgraph import LangGraphMemoryStore, MemoryConfig
store = LangGraphMemoryStore(MemoryConfig(storage_path="./agent_memory"))
# Hand it to any graph as long-term memory:
# graph = builder.compile(store=store)
# Persist and recall by namespace — versioned underneath
store.put(("pipelines", "etl-orders"), "partitioning",
{"content": "orders partitioned by event_date; dedupe on order_id"})
hits = store.search(("pipelines", "etl-orders"), query="how is the orders table partitioned?") Every command returns --json. Stable exit codes. Pipe into any agent runtime that shells out.
pip install memoir-ai
memoir new ./my_store
export MEMOIR_STORE=./my_store
memoir remember "prefer pytest, parametrize aggressively"
memoir recall "testing setup" --json
memoir branch create experiment
memoir time-travel HEAD~5
memoir ui # opens the web explorer at :8080 A real Claude Code session — same plugin, same store, same commands.