Shared git-backed memory store for AI coding agents
Teach your coding agents once. Every agent, on every machine, remembers.
Website · Guide · FAQ · Environments and projects · Sync · Commands · Contributing
pipx install lrdmem && lrdmem config set store ~/agent-memory && lrdmem install --agent claude
You told Claude to run phpcs before calling a task done. Last week. And the week before. Codex never heard it, and your laptop's agent has no idea what your desktop's agent learned yesterday.
lrdmem is a shared memory for AI coding agents. When you correct an agent, the lesson goes into a git repository you own. Claude Code, Codex and OpenCode all read from it, on every device, and the right lesson shows up at the moment the agent touches the file it applies to.
Every agent keeps its own memory, in its own file, on one machine:
So the same correction gets repeated per agent and per machine, the files grow into rulebooks loaded on every request whether they apply or not, and nothing records why a rule exists or whether it still holds. lrdmem keeps one memory for all of them, in a git repo you own, and shows each lesson only where it applies.
Agents mostly follow what's in their context. The problem is what's not in it, and what fades: in long sessions, adherence to rules drops with every function the agent writes, and stuffing everything into one always-on file costs tokens and success rate. lrdmem is built around four ideas:
flowchart LR E1["experience: forgot phpcs
codex · 10-21"] -->|supports| M["memory: phpcs-before-done
procedural · active"] E2["experience: forgot phpcs
claude · 10-24"] -->|supports| M E3["experience: PR review #128"] -->|supports| M M -->|post-edit / stop hook| R["vendor/bin/phpcs src/Service.php"] M -. related_to .-> M2["memory: tabs-in-php"] H["hypothesis: phpcs cache is stale"] -. derived_from .-> E1 What you get One store, three harnesses. Claude Code, Codex CLI and OpenCode run the same hooks through one entry point, as a plugin or wired by lrdmem install. Learns from chat, PR reviews and check runs. The bundled skill teaches agents to record corrections with lrdmem learn; lrdmem learn-pr turns your review comments into experiences; hooks record every obligation check that passes or fails. A memory model, not a notes folder. Six memory types (episodic, semantic, procedural, hypothesis, prospective, metacognitive), five states (candidate, active, contested, superseded, obsolete), typed relations and a revision for every change, all computed from evidence. A brain you can query. recall, associate, find, show, why (the timeline behind a rule), hot, stale, and graph to an HTML, JSON or DOT map. Plain Markdown in git. Every memory is a file you can read, edit, review and revert. [[links]] between memories work in Obsidian too. Every automatic commit follows Conventional Commits. Scoped by environment. Keep work/ and personal/ apart, each its own repo, shareable on its own. Company-wide rules live in /_global/; facts about you in _global/. Sync your way. lrdmem sync when you want, or autopush per device and per environment. Zero dependencies. Python 3.11+ standard library only. Hooks answer in about 100 ms. Install Ask your model to install it Paste this into Claude Code, Codex or OpenCode:
Install lrdmem for me. Follow the "Installing lrdmem for a user" section of https://github.com/larodiel/lrdmem/blob/main/AGENTS.md and ask me before each step that changes my setup. The agent checks Python and git, installs the CLI, asks where your store is (or creates one), opts in the repositories you name, connects the agents you choose (after showing you a dry run), and verifies the hooks. It never approves check commands, pushes or turns on autopush for you. The same steps by hand:
lrdmem is a CLI plus hooks and a skill for each harness. Install the CLI once per machine, point it at your store, then connect your agents.
pipx install lrdmem # or: uv tool install lrdmem · brew install larodiel/tap/lrdmem lrdmem config set store ~/agent-memory # any git repo you own lrdmem config set device notebook # a name for this machine, used in experiences and commits Connect each agent with either its plugin or lrdmem install, not both (both would run every hook twice).
The plugins carry the hooks and the skill and call the installed lrdmem CLI (set LRDMEM_BIN when it is not on PATH); without the CLI they stay silent and never block the agent. lrdmem install writes the same hooks into ~/.claude/settings.json or ~/.codex/hooks.json, copies the OpenCode plugin to ~/.config/opencode/plugins/lrdmem.js, and installs the skill. Run it with --dry-run first to see every change.
git init ~/agent-memory && mkdir -p ~/agent-memory/{_global,work/my-app} touch ~/agent-memory/{_global,work/my-app}/MEMORY.md lrdmem config set store ~/agent-memory lrdmem install --agent claude --dry-run # see exactly what changes lrdmem install --agent claude Then just work. When you correct the agent, it records the lesson; you can do it yourself too:
lrdmem learn --scope repo --agent me --memory php-tabs \ --mistake "indented with spaces" --correction "we use tabs" \ --description "PHP is indented with tabs" --body "Indent PHP with tabs." \ --why "house style" --how "check editor settings for *.php" --paths '**/*.php' lrdmem for src/Service.php # what an agent sees before editing this file lrdmem why php-tabs # every experience behind the rule lrdmem hot # rules that keep being broken lrdmem graph -o brain.html # the whole map Environments and projects The store is one folder (usually a git repo) with three levels. There is no command to create them: they are plain folders, and lrdmem finds them on its own.
An environment is any top-level folder of the store, except _global, bin and names starting with . or _. Use one per context you keep apart: work, personal, a client. A project is a folder inside an environment, named after the repository.
~/agent-memory/ the store (lrdmem config set store ~/agent-memory) ├── _global/ │ └── MEMORY.md ├── work/ environment "work" │ ├── _global/MEMORY.md rules for every work repo │ ├── shop-frontend/ project "shop-frontend" │ │ ├── MEMORY.md index of the memories below │ │ ├── run-phpcs.md a memory │ │ ├── experiences/ what happened, written once │ │ ├── edges/ typed relations between memories │ │ ├── revisions/ every change, revertible │ │ └── queue/ decisions consolidation left for you │ └── billing-service-api/ └── personal -> ~/repos/personal-memory environment "personal", its own git repo ├── _global/MEMORY.md └── lrdmem/ lrdmem creates experiences/, edges/, revisions/ and queue/ as it needs them. You only create the environment and project folders, each with an empty MEMORY.md.
There is nothing to configure per project. In any directory, lrdmem asks git for the main checkout (git rev-parse --git-common-dir) and uses its directory name as the repo key, so every worktree of a repo shares its memories, whatever the worktree folder is called:
~/sites/plugins/shop-frontend (main checkout) ┐ ~/sites/plugins/shop-frontend-auth (worktree) ├─> repo key: shop-frontend ~/sites/plugins/shop-frontend-cart (worktree) ┘ Then it looks for a folder with that name in every environment. With work/shop-frontend/ in the store, an agent in any of those checkouts reads, broadest first:
A repository with no folder in the store gets nothing: hooks stay quiet there, and commands need --env.
As a folder of the store's own repo (synced with it):
mkdir -p ~/agent-memory/work/_global touch ~/agent-memory/work/_global/MEMORY.md Or as its own git repo, to share it with a team or sync it apart from your personal memories, linked into the store:
git clone git@github.com:acme/agent-memory.git ~/repos/acme-memory ln -s ~/repos/acme-memory ~/agent-memory/acme Each environment repo syncs on its own (lrdmem sync acme) and has its own autopush setting (lrdmem config autopush on --env acme).
Create a folder named after the repository's main checkout directory (what basename of the checkout prints), with an empty index:
mkdir -p ~/agent-memory/work/shop-frontend touch ~/agent-memory/work/shop-frontend/MEMORY.md Check it from inside the repository or any of its worktrees:
cd ~/sites/plugins/shop-frontend-auth lrdmem for src/Main.php # prints the memories a hook would inject; empty is fine for a new project lrdmem lint work # checks the environment's folders and files More than one store lrdmem reads one store at a time. To keep memories apart (work, personal, clients, a team), you usually don't need a second store: make each one an environment of the same store, with its own git repo linked in.
~/agent-memory/ the one store ├── _global/ about you ├── personal -> ~/repos/my-memory your repo ├── acme-co -> ~/repos/acme-co-memory a team repo, shared with colleagues └── client-x -> ~/repos/client-x-memory a client's repo Each linked repo then behaves like a store of its own:
When you do want a completely separate store, such as a sandbox to try lrdmem on a copy, set LRDMEM_STORE. It overrides lrdmem config set store for every process that inherits it:
LRDMEM_STORE=~/memory-sandbox lrdmem recall "deploy" # one command export LRDMEM_STORE=~/memory-sandbox # this shell, and agents started from it Hooks see the variable only when the harness was started from that shell. Two stores never combine: a session reads one or the other. The device config (approvals, autopush, device name) is shared by every store, and an approval is keyed by the memory's store-relative path and the exact command text, so it carries over to another store only for an identical command at an identical path.
The store is plain git, so every computer works on its own clone and lrdmem commits, pulls and pushes for you. Each repository syncs separately: the store root (with _global/) and every environment that is a repo of its own.
Create an empty private repository on GitHub (or any git host) for the store root and for each environment repo, then:
cd ~/agent-memory && git remote add origin git@github.com:you/agent-memory.git cd ~/repos/acme-memory && git remote add origin git@github.com:acme/agent-memory.git # each environment repo lrdmem config set device desktop # a name for this computer lrdmem sync # commits and pushes every repository The first push sets the upstream for you.
Clone the store root, then put each environment repo where the store expects it. A linked environment is a symlink, and symlinks hold machine-specific paths, so recreate them on each computer instead of committing them (add the environment names to the store root's .gitignore):
git clone git@github.com:you/agent-memory.git ~/agent-memory git clone git@github.com:acme/agent-memory.git ~/repos/acme-memory ln -s ~/repos/acme-memory ~/agent-memory/acme lrdmem config set store ~/agent-memory lrdmem config set device notebook # must differ from the other computer's name lrdmem install --agent claude # and/or codex, opencode lrdmem lint # everything found and readable lrdmem allow # approvals are per computer: review and approve the checks again The device name matters: evidence from two computers counts as independent, which is what promotes a candidate to an active rule.
Sync never force-pushes and never stashes your changes. It skips a repository with a rebase in progress, and it does not pull or push one that has uncommitted changes outside the memory folders.
Sync stops before pushing anything, keeps your local commit, and backs out of the half-done pull, so the repo is left clean. It tells you which repository conflicted. Redo the pull by hand and resolve it like any git conflict:
cd ~/agent-memory # or the environment repo sync named git pull --rebase # stops at the conflicting files # edit them, keeping both sides' lines where you can; experiences never conflict, they are new files git add -A && git rebase --continue lrdmem sync What stays on each computer Not synced, by design: the device config (~/.config/lrdmem/config.json: store path, device name, autopush, approved commands), the hooks and skill lrdmem install wrote, and session state. Approve check commands on each computer after reading them; an approval never travels through git.
Every command reads the store from $LRDMEM_STORE or lrdmem config set store. --env picks an environment when a name is ambiguous or you are outside the repo; --agent is who acts (claude, codex, opencode, your name), recorded in experiences and revisions. lrdmem --version prints the version; lrdmem --help prints the options of any command.
lrdmem config set store points this device at a store; lrdmem config set device names the device (experiences and commit messages carry it; two devices count as independent evidence).
lrdmem config autopush on|off [--env ENV]: let hooks commit and push the store at the end of a task, for one environment or all. Off by default.
lrdmem install --agent claude|codex|opencode [--dry-run]: wires lrdmem's hooks (or the OpenCode plugin) and the skill into the harness's user config. It validates every file before writing, backs up what it edits, replaces only hooks it owns, and with --dry-run prints the plan and writes nothing.
Records a correction from the user (chat or PR review) as an experience and links it to a memory, creating the memory when it is new. A correction is active immediately.
lrdmem learn-pr --agent NAME [--env ENV]: reads a GitHub PR's review comments (through gh) and links each to the memories it reinforces. Only comments from owners, members and collaborators count, and only on PRs of the checkout's own GitHub remotes.
Records one experience: something that happened, written once and never edited. Pass the text as an argument, or a JSON object on stdin.
lrdmem memory propose --agent NAME [--env ENV] reads a JSON payload on stdin: an experience and the candidate memories extracted from it, each classified as new, equivalent (adds evidence to relates_to), complementary (new, plus a proposed relation), contradicts or insufficient (stays a hypothesis). It validates every candidate, refuses secrets and cross-repo references, and writes candidates, evidence, relations and revisions. The skill has a full example.
lrdmem feedback useful|incorrect|irrelevant [--note TEXT] [--agent NAME]: reports how a recalled memory did. Feedback is a signal for consolidation, never proof: one negative never deletes or demotes a memory.
The memories most relevant to a task, scored by keywords (accent-aware BM25), triggers, file and command entities, relations and evidence, with the reason each was recalled. Active memories first; candidates and hypotheses are labelled as not confirmed.
lrdmem associate [QUERY] [--file F] [--command C] [--limit N] [--json] [--env ENV]: lists memories associated with a text, file or command, with their signals. Agents run it before proposing candidates, to tell what is new.
lrdmem for [FILE] [--command C] [--session ID] [--env ENV]: prints exactly what a hook injects for a file or command. With --session, memories already injected in that session are skipped, as hooks do.
Lists memories grouped by folder, each with its type, state, confidence (a dash when it has no evidence yet) and description. Inside an opted-in repository it shows what applies there: _global/, the environment's _global/ and the repo's folder; elsewhere it shows the whole store.
lrdmem list # what applies to this repo lrdmem list --env work --states all lrdmem list --all --types procedural --json lrdmem find lrdmem find [--env ENV]: searches memories and experiences by keyword, with each memory's support count and related memories.
lrdmem show [--env ENV]: a memory with its body, type, state, confidence, priority, evidence, relations and number of revisions.
lrdmem why [--env ENV]: the experiences behind a memory, oldest first, then its revisions.
lrdmem hot [--min N]: memories reinforced by at least N independent experiences (default 3), ranked by confidence times support. These are the rules that keep being broken: candidates for an obligation with a check.
Lists file paths in backticks that no longer exist: absolute ones (~/…, /…) in every memory, relative ones (src/Foo.php) only in the current repo's own memories. Exits 1 when it finds any.
lrdmem graph [--format html|json|dot] [-o/--output FILE]: exports memories, experiences and typed relations as an interactive HTML page (default), JSON or Graphviz DOT, to stdout or a file.
lrdmem lint [ENV]: checks the store: frontmatter, slugs, MEMORY.md indexes, evidence and relation refs, secrets, cited paths, and experiences edited after their first commit. Exits 1 on problems.
Runs consolidation now (hooks also run it at the end of every task): marks expired memories obsolete, merges exact duplicates, promotes candidates with at least two independent supports (a correction, an outcome experience, feedback useful, or a check that passes after failing; repeated errors or discoveries never count), contests refuted memories and restores them when support returns, validates relations, and queues what needs judgment. Idempotent; stops at the budget and resumes on the next run.
lrdmem revert [--agent NAME]: restores what one revision changed and records a revert revision. The revision must belong to a memory visible from where it was recorded.
lrdmem allow [SLUG] [--env ENV]: approves a memory's check.run command on this device. Without a slug, lists commands waiting for approval. With one, it shows the command and asks for a yes in an interactive terminal; with no terminal (an agent's shell) it refuses, so only a person approves. Approval is by the exact text's hash: change one character and it needs approval again. Only approve commands you have read.
lrdmem check --on post-edit|stop [--files F...] [--env ENV]: runs the approved checks of obligations whose triggers match the files. Hooks call it after edits and at the end of a task; a failure at stop blocks the end of the task.
lrdmem sync [ENV]: pulls, commits and pushes the store, every environment repo or one. Never force-pushes, never autostashes, and stops on conflicts. Commit messages follow Conventional Commits (feat(memory): learn 2 memories, 1 experiences, refactor(memory): consolidate — merge 1, promote 2, contest 0).
lrdmem hook [--agent claude|codex|opencode]: what the plugins and installed hooks run. Reads the harness's JSON on stdin and answers in its format. Phases: session-start (pull where autopush is on; the MEMORY.md indexes in scope, lint problems, commands awaiting approval, pending decisions), pre-tool (memories for the file or command), post-tool (post-edit checks), prompt (a reminder to record corrections), stop (stop checks, consolidation, autopush). Never fails the agent, except a stop check that blocks.
lrdmem context [--agent NAME]: same as hook session-start; kept for setups wired to the older bin/memory context.
A memory store that agents and colleagues write to, and hooks that run commands, is an attack surface. lrdmem treats it as one:
Does anything leave my machine? Only what you push with git, to remotes you chose. No server, no account, no telemetry. Hooks run locally and never push unless you turned autopush on.
Does it cost anything or call a model? No. lrdmem runs no model. Consolidation, search and recall are plain code over files; the agents you already use write and read the memories.
I already have CLAUDE.md and AGENTS.md. Do I drop them? No. Keep project setup and always-true instructions there. Move the lessons that apply to some files or commands into lrdmem, where they show up only when they matter and keep the history of why.
How is this different from a hosted memory service? The memory is plain Markdown in your git repo: readable, reviewable, revertible, shareable by giving someone access to a repo. Recall is by keywords, file paths and triggers, not embeddings, so it is predictable and offline.
Can my team share memories? Yes. Make the team's environment its own git repo, linked into each person's store (see More than one store). Commands from a shared memory still run only after each person approves them on their own computer.
What happens if lrdmem isn't installed on a machine where the hooks are? The hooks find no CLI and stay silent; the agent is never blocked.
What if an agent writes something wrong? Memories an agent proposes on its own start as candidates and need independent evidence to become active; only your corrections are active right away. lrdmem feedback flags a bad one, consolidation contests refuted ones, and lrdmem revert undoes any recorded change. It's all git, too.
How do I remove it? Uninstall the plugin (claude plugin uninstall lrdmem@lrdmem), or restore the backup lrdmem install made (~/.claude/settings.json.bak- , ~/.codex/hooks.json.bak- ) and delete ~/.config/opencode/plugins/lrdmem.js and the lrdmem skill folders. Your store is a git repo and stays as it is.
The design follows what recent research says about agent memory: memory across sessions raises success on multi-session software tasks a lot (DreamBench-SWE); lessons distilled from failures and successes beat raw transcripts (ReasoningBank); agents follow context files but long sessions erode adherence (factorial study, Evaluating AGENTS.md); and graphs win on structured questions like "what superseded this rule" (MOOSEDev).
All 2 files in this release have provenance metadata.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
All 2 files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




