agent-memory
Skill86 starsChanged 4 months agoMITView on GitHub
Teach cross-session memory patterns using MEMORY.md — what to save, how to organize it, how to maintain it over time, and how to structure topic files as memory grows. Works in any Claude Code project with no external dependencies. Trigger words: remember this, save for later, across sessions, persistent memory, don't forget, note this, keep this, write this down.
38 other projects use a version of this.
Adopted by
Most recently taken up by
- isaacbitran/agent-memorytheir own version, first seen Nov 8, 2026
- msking18/agent-memory-mcptheir own version, first seen Nov 8, 2026
- komluk/scaffoldingtheir own version, first seen Nov 7, 2026
- MemTether/MemTethertheir own version, first seen Nov 1, 2026
- tigerless-labs/agent-memorytheir own version, first seen Oct 22, 2026
- brianschroeder/simple-agent-memorytheir own version, first seen Oct 21, 2026
Used with
Projects with it also use observability, data-analysis and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
OpenAISkillobservability
Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.
Also in 4 projects that use this
shanggqmSkilldata-analysis
数据分析技能,提供结构化的数据查询、统计分析和报告生成工作流。当用户需要查询数据库、进行数据统计分析、生成分析报告时使用。按规范输出原始数据、计算结果、Markdown报告和HTML可视化报告。
Also in 3 projects that use this
Microsoft AzureSkillskill-authoring
Write Agent Skills that comply with the agentskills.io specification. WHEN: "create a skill", "new skill", "write a skill", "skill template", "skill structure", "review skill", "skill PR", "skill compliance", "SKILL.md format", "skill frontmatter", "skill best practices". DO NOT USE FOR: general documentation. INVOKES: vally CLI.
Also in 3 projects that use this
VercelSkilltechnical-writing
Write, edit, review, or audit user-facing documentation for the eve repository. Use for changes under docs/, documentation tied to eve APIs or CLI behavior, docs work based on Slack or support feedback, and requests to make eve docs clearer, more natural, or less AI-patterned while verifying claims against current source, tests, CLI help, public releases, and repository conventions.
Also in 3 projects that use this
JetBrainsSkillwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
Also in 4 projects that use this
AnthropicSkillpdf
Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.
Also in 5 projects that use this
Other versions38 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 38
- tigerless-labs/agent-memory★ 4.3ksame name
- databricks/app-templates★ 218same name
- OpenHands/extensions★ 167same name
- nimadorostkar/Claude-Skills-collection★ 33same name
- VoDaiLocz/kilo-kit-mcp★ 28same name
- jayzeng/agentmemory★ 24same name
- komluk/scaffolding★ 16same name
- xChuCx/agent-memory★ 11same name
- t4sh/skills4sh★ 5same name
- GPTtang/skill-atlas★ 4same name
28 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- autonomousSkill
- buildSkill
- instar-projectSkill
- secret-setupSkill
- setup-wizardSkill
- test-as-selfSkill
- agent-identitySkill
- agent-passportSkill
- agent-readinessSkill
- command-guardSkill
- credential-leak-detectorSkill
- instar-devSkill
- instar-feedbackSkill
- instar-identitySkill
- instar-schedulerSkill
- instar-sessionSkill
- instar-telegramSkill
- iterative-converging-auditSkill
- knowledge-baseSkill
- smart-web-fetchSkill
- spec-convergeSkill
- systematic-debuggingSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 33 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
Create .claude/MEMORY.md with this structure:
- Distinctive: line 155
Don't wait until the session ends.
- Distinctive: line 168
When adding a dated lesson:
- Very specific: line 215
Don't put architecture decisions in MEMORY.md.
- Distinctive: line 233
When multiple agents work on the same project, they can share MEMORY.md — but this requires a discipline: write facts, not opinions.
“Common” is measured: kept by at least 6 in 10 of the 33 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
agent-memory — Cross-Session Memory Patterns for Claude Code
Claude Code has no memory between sessions by default. Every conversation starts blank. But a project's knowledge accumulates — commands discovered, patterns debugged, preferences revealed, mistakes made and corrected. Without persistence, that knowledge is lost every time the window closes.
This skill establishes a simple, durable memory pattern using a single file: MEMORY.md.
The Core Pattern
One file. Written by the agent. Read at session start.
.claude/
MEMORY.md # The agent's persistent knowledge base
identity/ # Optional: separate identity files (see agent-identity skill)
memory/ # Optional: topic files as memory grows
debugging.md
deployment.md
user-preferences.mdSetting Up MEMORY.md
Create .claude/MEMORY.md with this structure:
# [Project/Agent] Memory
> This file persists across sessions. Write here when you learn something
> worth remembering. Remove entries that become outdated. Keep it useful,
> not comprehensive.
## Project Patterns
[Commands, scripts, conventions specific to this project]
## Tools & Scripts
[Purpose-built scripts and how to invoke them]
## Lessons Learned
[Mistakes made and corrections. Dated entries.]
## User Preferences
[Communication style, workflow preferences, discovered through interaction]
## Open Questions
[Unresolved things to investigate — remove when resolved]Then add this to your CLAUDE.md:
## Memory
At the start of every session, read `.claude/MEMORY.md` before doing any work.
After context compaction, re-read it immediately.
When you learn something worth keeping, write it to MEMORY.md before the session ends.What to Write vs. What to Skip
The most common mistake: writing everything, making the file so long it stops being read carefully.
Write to MEMORY.md:
- Project-specific commands, especially non-obvious ones
- "Run
npm run build:prodnotnpm run build— the latter overwrites staging"
- "Run
- Scripts you built and their locations
- ".claude/scripts/check-email.py — reads Gmail unread, takes --limit flag"
- Mistakes made once that shouldn't happen again
- "2025-03-12: Pushed to main while on detached HEAD. Always verify branch before committing."
- User preferences discovered through interaction, not assumed
- "Prefers Telegram summaries over file links"
- Patterns that took time to figure out
- "Prisma requires explicit
includefor relations — no auto-eager-loading"
- "Prisma requires explicit
Do not write to MEMORY.md:
- Session-specific context ("currently working on auth PR")
- Information available in the codebase or docs
- Reminders for things you'll do this session (use a TODO comment)
- Generic programming knowledge any agent would have
- Things that will be outdated next week
The test: Would a fresh session six months from now benefit from this? If no, skip it.
Organizing Growing Memory
MEMORY.md works well up to ~150-200 lines. Beyond that, introduce topic files:
mkdir -p .claude/memoryMove detailed sections to topic files and keep MEMORY.md as an index:
# Memory Index
## Quick Reference
- Build: `npm run build:prod`
- Deploy: `.claude/scripts/deploy.sh --env production`
- DB migrate: `npm run db:migrate` (always after schema changes)
## Topic Files
- Debugging patterns: `.claude/memory/debugging.md`
- Deployment notes: `.claude/memory/deployment.md`
- User preferences: `.claude/memory/user-preferences.md`
- API integrations: `.claude/memory/apis.md`
## Recent Lessons
[Last 3-5 lessons only — older ones move to topic files]Reference topic files in CLAUDE.md:
## Memory
Read at session start:
- `.claude/MEMORY.md` — always
- `.claude/memory/debugging.md` — when debugging
- `.claude/memory/deployment.md` — when deployingWriting Memory During a Session
Don't wait until the session ends. Write memory entries when you learn something:
# Append an entry immediately
cat >> .claude/MEMORY.md << 'EOF'
## New Discovery (2025-03-20)
- The Redis connection string requires `?family=6` for IPv6 — without it,
connections timeout silently on this server.
EOFWhen adding a dated lesson:
DATE=$(date +%Y-%m-%d)
cat >> .claude/MEMORY.md << EOF
## Lesson (${DATE})
- [What happened, what was wrong, what the correct approach is]
EOFMaintaining Memory Over Time
Memory files need occasional pruning — entries go stale, contexts change, projects evolve.
Review MEMORY.md when:
- Starting a major new phase of the project
- A remembered pattern stops being true
- The file grows past 200 lines
What to prune:
- Lessons from debugging a problem that's now fixed and closed
- Preferences that were superseded
- Scripts that no longer exist
- Anything prefixed "TODO" that was resolved
What to archive, not delete:
- Significant debugging investigations (move to
.claude/memory/archive/) - Historical context that might matter for understanding decisions
Memory vs. Documentation
MEMORY.md is not documentation. It's the agent's personal notebook.
| MEMORY.md | Docs (docs/) |
| For the agent | For humans |
| Informal, first-person | Structured, third-person |
| Includes mistakes and corrections | Shows correct state |
| Updated constantly | Updated deliberately |
| Short entries OK | Complete explanations expected |
Don't put architecture decisions in MEMORY.md. Do put "when I touch the auth module, I always forget to rebuild the token cache — run npm run cache:reset after any change to lib/auth/."
Memory After Compaction
Context compaction is the main threat to in-session memory. When the context window fills and compresses, the agent loses anything it learned mid-session that wasn't written to disk.
Two protections:
- Write early — When you learn something important, write it to MEMORY.md before you forget or before compaction hits.
- Re-read after compaction — Claude Code fires a
PostCompactnotification event when context compresses. If you have a hook registered for it, you can automatically re-read MEMORY.md. Without a hook, train yourself to re-read when you notice context was compressed.
Multiple Agents, Shared Memory
When multiple agents work on the same project, they can share MEMORY.md — but this requires a discipline: write facts, not opinions. Shared memory entries should be:
- Verifiable ("The deploy script requires X")
- Durable ("This pattern has been stable for 3 months")
- Agent-neutral ("Whoever runs this, the same caveat applies")
Agent-specific preferences, styles, or goals should stay in each agent's own identity files (see the agent-identity skill).
Going Further
This works when things go well. But the agent has to remember to write its memories — and sessions don't always end cleanly. Crash, timeout, context overflow — and anything learned but not yet written is gone.
Instar turns memory from a discipline into infrastructure. Hooks guarantee MEMORY.md is read at every session start and after every context compaction. A scheduled reflection job runs automatically — consolidating what the agent learned across all its sessions, pruning what's stale, surfacing what matters. Your agent doesn't just store memories. It actively maintains them.
And memory is just one piece. With Instar, your agent also gets:
- Persistent identity — knows who it is and who you are, every session
- A job scheduler — recurring tasks on cron, running while you sleep
- Background sessions — spawn parallel workers for deep tasks
- Telegram integration — two-way messaging from your phone
One command, about 2 minutes:
npx instarYour agent stops losing what it learned yesterday. instar.sh
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

