Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claude-agent-memory

License: MIT GitHub

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.

How it works

  1. After every turn, Claude Code fires the Stop hook.
  2. agent_updater.py reads the session transcript and your agent .md files.
  3. It asks Claude Haiku (via claude -p) what durable facts belong in each agent's knowledge base.
  4. New bullet points are appended to the agent body. Frontmatter is never touched.

Requirements

  • Claude Code CLI installed and authenticated
  • Python 3.8+
  • At least one agent file in ~/.claude/agents/
  • No pip packages needed

Install

Shell (clone or curl):

git clone https://github.com/itskrishna21/claude-agent-memory
bash claude-agent-memory/install.sh

Or:

curl -fsSL https://raw.githubusercontent.com/itskrishna21/claude-agent-memory/main/install.sh | bash

install.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.

Uninstall

bash uninstall.sh

Or: /plugin uninstall claude-agent-memory@claude-agent-memory

Agent .md files are never deleted.

Optional config

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=1
  • AGENT_MEMORY_DEBUG=1

Dry-run test

AGENT_MEMORY_DRY_RUN=1 AGENT_MEMORY_DEBUG=1 python3 ~/.claude/scripts/agent_updater.py < /dev/null
cat ~/.claude/logs/agent_memory.log

With empty stdin, the script falls back to the most recently modified transcript under ~/.claude/projects/.

What gets updated

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.

Contributing

Issues and PRs welcome at itskrishna21/claude-agent-memory.

License

MIT — free to use, modify, and distribute.

About

Passively accumulates long-term knowledge from Claude Code sessions into ~/.claude/agents/*.md

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages