# Add Mnemon

Add persistent graph-based memory via mnemon.

- Repository: https://github.com/nanocoai/nanoclaw (31069 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add nanocoai/nanoclaw --skill add-mnemon -g -a claude-code -y`
Codex: `npx skills add nanocoai/nanoclaw --skill add-mnemon -g -a codex -y`
Cursor: `npx skills add nanocoai/nanoclaw --skill add-mnemon -g -a cursor -y`
Gemini CLI: `npx skills add nanocoai/nanoclaw --skill add-mnemon -g -a gemini-cli -y`

## Description

Add persistent graph-based memory via mnemon. Agents recall past context before responding and remember insights after each turn.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Add Mnemon, Persistent Memory

Installs [mnemon](https://github.com/mnemon-dev/mnemon) in the agent container image. On each container start, `mnemon setup` registers Claude Code hooks that surface relevant memory before the agent responds and store new insights after each turn. Memory is written to the per-agent-group `.claude/` mount and survives container restarts.

## Provider Compatibility

mnemon hooks fire only under `--target claude-code`. Use this skill on agent groups that run the default Claude provider. The provider is the materialized `provider` key in each group's `container.json` (absent or `claude` = default Claude provider). Confirm it before applying:

```bash
grep -H '"provider"' groups/*/container.json 2>/dev/null   # no match, or "provider": "claude" = Claude
```

If a group sets a different provider (e.g. `"provider": "opencode"`), it spawns its own process and never invokes the `claude` CLI, so the hooks registered by `mnemon setup` do not run for that group.

## Phase 1: Pre-flight

### Check if already applied

```bash
grep -q 'MNEMON_VERSION' container/Dockerfile && echo "Already applied" || echo "Not applied"
```

If already applied, re-run Phase 2 anyway, every step is idempotent and skips work that is already in place, then continue to Phase 3 (Verify).

### Check latest mnemon version

```bash
curl -fsSL https://api.github.com/repos/mnemon-dev/mnemon/releases/latest | grep '"tag_name"'
```

Note the version (e.g. `v0.1.1`), use it as `MNEMON_VERSION` in the next step.

## Phase 2: Apply Changes

### 1. Dockerfile, install mnemon binary

Insert the mnemon block immediately above the `# ---- Bun runtime` section of `container/Dockerfile` (skip if `grep -q 'MNEMON_VERSION' container/Dockerfile` already matches):

The rest: https://github.com/nanocoai/nanoclaw/blob/HEAD/.claude/skills/add-mnemon/SKILL.md
