Agent memory patterns
Skill m00kk/agent-skills-playbook/skills/agent-memory-patterns
15 production Agent Skills — MCP, LangGraph, RAG, security, Cursor SDK. MIT licensed.
npx -y skills add m00kk/agent-skills-playbook --skill agent-memory-patternsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Implements short-term and long-term memory for agents: conversation buffers, summarization, vector memory, and user preference stores. Use when building agent memory, pgvector recall, persistent context, or reducing context bloat.
SKILL.md
1.7 KB, as published. Nobody here has run it
Agent Memory Patterns
Memory tiers
| Tier | Lifetime | Storage | Use |
|---|---|---|---|
| Working | Current turn | Context window | Latest messages |
| Session | Hours | Checkpointer / Redis | Thread state |
| Long-term | Weeks+ | Vector DB / SQL | Facts, preferences |
Workflow
- [ ] Decide what must persist vs re-derived each run
- [ ] Summarize old turns before window overflows
- [ ] Store long-term as atomic facts with source + timestamp
- [ ] Retrieve by embedding + metadata filter (user_id)
- [ ] Allow user delete/export (GDPR-friendly)
Summarization node (LangGraph)
After N messages:
- Call LLM: "Summarize decisions and open tasks only"
- Replace old messages with summary + last K verbatim turns
- Keep tool results that affect ongoing work
Long-term fact schema
{
"user_id": "hash",
"fact": "Prefers TypeScript over Python",
"source": "explicit_user_message",
"created_at": "ISO-8601",
"confidence": 0.9
}
Poisoning defenses
- Do not write memory from untrusted retrieved docs without validation
- Separate "user stated" vs "inferred" labels
- Cap facts per user; decay stale entries
Vector memory
- Embed fact + optional tags
- Query with current user goal + user_id filter
- Top 3 facts only — avoid dumping memory into every prompt
Pair with rag-agent-pipeline for document knowledge vs user memory.