Mnemon
Add persistent graph-based memory so agents recall past context before responding and remember new insights after each turn.
What it does
- Installs the mnemon binary into the agent container image
- Registers Claude Code memory hooks on each container start via mnemon setup
- Surfaces relevant past context before the agent responds
- Stores new insights automatically after each turn
- Memory persists across container restarts in the per-agent-group .claude/ mount
- Ships structural tests that guard the Dockerfile and entrypoint wiring
What you'll need
- NanoClaw installed and running
- Agent groups running the default Claude provider (mnemon hooks fire only under --target claude-code)
Install
/add-mnemon How it works
The /add-mnemon skill installs mnemon into the agent container image and wires it into the container lifecycle. Once applied, agents recall relevant memory before they respond and store new insights after each turn — so context carries across separate sessions instead of being lost when a conversation ends.
Mnemon works through Claude Code hooks. On each container start, the entrypoint runs mnemon setup --target claude-code, which registers hooks in /home/node/.claude/settings.json. Those hooks surface relevant memory ahead of the agent’s response and write back what it learns afterward. Because the hooks fire only under --target claude-code, this skill applies to agent groups running the default Claude provider — a group set to a different provider (for example "provider": "opencode") spawns its own process and never invokes the claude CLI, so the hooks don’t run for it.
Memory is stored at MNEMON_DATA_DIR=/home/node/.claude/mnemon, which maps to the per-agent-group .claude/ mount on the host. That location survives container restarts, so an agent’s accumulated memory is durable rather than ephemeral.
Setup
The skill runs in three phases:
- Pre-flight — checks whether the Dockerfile already contains the mnemon layer, confirms the target groups run the Claude provider, and looks up the latest mnemon release to pin as the build version.
- Apply changes — inserts the mnemon install block into
container/Dockerfile, adds the idempotentmnemon setupcall tocontainer/entrypoint.sh(right afterset -e, before stdin is captured), copies the Dockerfile and entrypoint structural tests intosrc/, then rebuilds and smoke-tests the image. - Restart and verify — restarts the service, confirms
mnemon setupran in the container logs, and inspects the registered hooks inside the running container.
Every step is idempotent. If the skill has already been applied, re-running it simply skips work that is already in place.
To confirm the wiring after a container starts:
docker exec $(docker ps --filter name=nanoclaw-v2 --format '{{.Names}}' | head -1) \
cat /home/node/.claude/settings.json | grep -A5 mnemon
Tips
- The install layer pins a
MNEMON_VERSIONbuild arg. On an upgrade, the bundledmnemon-dockerfile.test.tsandmnemon-entrypoint.test.tsturn red if the install layer or the entrypoint wiring is dropped, so keep them in your test tree. - To reset an agent’s memory, stop its container and delete the
mnemon/subdirectory from the group’s host.claude/path. You can find that path withdocker inspecton the running container’s mounts. - If you see
mnemon: command not foundin the container, the image wasn’t rebuilt after the Dockerfile change — run./container/build.shand restart. - To test recall, have a conversation, start a fresh session, and reference something from the earlier one. Mnemon should surface the relevant context without you restating it.