mnemon gives coding agents a long-term
memory: they remember facts and recall them in later sessions. It works
well. My problem was where the memories end up. By default, everything goes
into one global store.
That gets messy fast. In one repo, “always use tabs” is a rule. In another, it would be wrong. My homelab repo wants “never apply anything to the live cluster”, and a throwaway script folder wants the opposite. With one shared store, the agent recalls rules from the wrong project and follows them with total confidence.
mnemon can keep them apart already: pass --store <name> or set
MNEMON_STORE. But that has to happen on every call, from every agent, in
every project. Nobody does that, me included.
The fix: a shim
mnemon-auto is a small shell script I wrote that sits in front of the real
mnemon on your PATH. It looks at the git repo you’re in and adds
--store <repo-name> for you. Agents keep calling plain mnemon and don’t
know anything changed.
To show what happens, I put the shim in front of a stub mnemon that just
prints what it receives:
$ cd ~/Dev/home-management/blog/content/posts
$ mnemon remember "posts live at /<slug>/"
real mnemon --store blog remember posts live at /<slug>/
$ cd ~/Dev/home-management/argo-c2
$ mnemon recall "ingress"
real mnemon --store argo-c2 recall ingress
$ cd ~/code/"Side Project"
$ mnemon status
real mnemon --store side-project status
A few things to notice:
- The store comes from the repo root, not the folder you’re in. The first
call ran two folders deep and still landed in
blog. - Names are cleaned up:
Side Projectbecomesside-project. - New stores are created on first use, so a new repo needs no setup.
Some things really are global, like my git aliases or how I like commit messages written. For those there’s an escape hatch, and anything you choose yourself wins:
$ mnemon --global recall "git aliases"
real mnemon --store global recall git aliases
$ MNEMON_STORE=scratch mnemon status
real mnemon status
Install
git clone https://github.com/gscode1/mnemon-auto
cd mnemon-auto && ./install.sh
It installs to ~/.local/bin/mnemon, which has to come before the real binary
on your PATH. The installer checks that and tells you what to fix. It works
with any agent that shells out to mnemon: Pi, Claude Code, Cursor, whatever.
That’s the whole thing. If you use one memory for many different projects and your agent keeps “remembering” the wrong rules, give each repo its own store.