Open-source Claude Code plugin that passively accumulates long-term knowledge from every session into your ~/.claude/agents/*.md files. Agents get smarter over time — no manual edits.
- After every turn, Claude Code fires the Stop hook.
agent_updater.pyreads the session transcript and your agent.mdfiles.- It asks Claude Haiku (via
claude -p) what durable facts belong in each agent's knowledge base. - New bullet points are appended to the agent body. Frontmatter is never touched.
- Claude Code CLI installed and authenticated
- Python 3.8+
- At least one agent file in
~/.claude/agents/ - No pip packages needed
Shell (clone or curl):
git clone https://github.com/itskrishna21/claude-agent-memory
bash claude-agent-memory/install.shOr:
curl -fsSL https://raw.githubusercontent.com/itskrishna21/claude-agent-memory/main/install.sh | bashinstall.sh copies the script to ~/.claude/scripts/agent_updater.py and registers a Stop hook in ~/.claude/settings.json.
Plugin marketplace (preferred):
/plugin marketplace add itskrishna21/claude-agent-memory
/plugin install claude-agent-memory@claude-agent-memory
Use either the shell installer or the marketplace plugin — not both — or you'll register the Stop hook twice.
bash uninstall.shOr: /plugin uninstall claude-agent-memory@claude-agent-memory
Agent .md files are never deleted.
Create ~/.claude/agent-memory.json:
{
"last_n_messages": 15,
"dry_run": false,
"debug": false
}| Key | Default | Meaning |
|---|---|---|
last_n_messages |
15 |
How many recent transcript messages to send to Haiku |
dry_run |
false |
Print what would be appended; write nothing |
debug |
false |
Log to ~/.claude/logs/agent_memory.log |
Environment overrides:
AGENT_MEMORY_DRY_RUN=1AGENT_MEMORY_DEBUG=1
AGENT_MEMORY_DRY_RUN=1 AGENT_MEMORY_DEBUG=1 python3 ~/.claude/scripts/agent_updater.py < /dev/null
cat ~/.claude/logs/agent_memory.logWith empty stdin, the script falls back to the most recently modified transcript under ~/.claude/projects/.
Only global agents at ~/.claude/agents/*.md. Project-scoped agents (.claude/agents/ inside a repo) are not touched.
Knowledge is appended as bullet points below the existing body. Deduplication is substring-based.
Issues and PRs welcome at itskrishna21/claude-agent-memory.
MIT — free to use, modify, and distribute.