A repo-level memory pattern for AI coding agents. Learnings survive across fresh agent sessions instead of being re-discovered from scratch every time.
Every new agent session starts with a blank context. Environment quirks, non-obvious build invocations, root causes of resolved bugs, and dead ends all get re-learned — or worse, re-broken — session after session, unless something persists them.
Two files, working together:
agent-memory.mdat the repo root — a curated, git-tracked log of durable learnings (setup quirks, resolved bug root causes, dead ends, repo conventions not enforced by code).- A block in
CLAUDE.md(orAGENTS.md) instructing agents to readagent-memory.mdat the start of non-trivial work and when stuck, and to append to it when they learn something durable.
CLAUDE.md/AGENTS.md holds the always-loaded behavior (when to read and
write); agent-memory.md holds the accumulated content, read on demand — so
the memory log can grow without growing every session's baseline context
cost.
/plugin marketplace add brianschroeder/simple-agent-memory
/plugin install simple-agent-memory
Then, in any repo, ask Claude Code to set up agent memory (e.g. "set up agent memory for this repo") and the skill will:
- create
agent-memory.mdat the repo root, if it doesn't already exist - append the instruction block to
CLAUDE.md(orAGENTS.md), if it isn't already there
Both steps are non-destructive — existing content is never overwritten.
If you're not using Claude Code plugins, just copy the two files by hand:
- Copy
skills/agent-memory/assets/agent-memory.template.mdtoagent-memory.mdat your repo root. - Copy the block from
skills/agent-memory/assets/claude-md-block.mdinto yourCLAUDE.mdorAGENTS.md.
Works with any agent that reads CLAUDE.md/AGENTS.md at session start —
not Claude Code-specific.
Don't switch to importing agent-memory.md (e.g. @agent-memory.md) into
CLAUDE.md unless the log is small and always relevant. Imports load the
whole file into context at every session start, so the baseline cost grows
as the log grows. Reading it on demand — at task start and when stuck —
keeps sessions lean and only pays the cost when the memory is actually
needed.
MIT — see LICENSE.
