agent-memory
Skill2 starsChanged 4 months agoMITView on GitHub
You MUST consult this skill when designing cross-session memory for personalized agents — choosing storage formats, handling contradictory memories, building consolidation pipelines, evaluating memory quality, or deciding what to persist. Also trigger when an agent forgets user preferences across sessions, surfaces conflicting facts, grows unbounded memory, or needs to anticipate user needs from past context. NOT for operating an existing knowledge base (see knowledge-base), managing the context window within a session (see context-engineering), building a retrieval pipeline for a document corpus (see rag-design), or agent runtime orchestration (see agent-architecture).
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 7 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
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
JetBrainsSkillbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Also in 3 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
- JKHeadley/instar★ 86same 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
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 repository67 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-architectureSkill
- agent-evaluationSkill
- agent-post-trainingSkill
- agent-self-evolutionSkill
- agent-tool-designSkill
- api-designSkill
- application-architectureSkill
- brainstormSkill
- code-reviewerSkill
- coding-agent-designSkill
- concurrency-designSkill
- context-engineeringSkill
- dockerSkill
- game-audioSkill
- game-designSkill
- game-narrativeSkill
- game-patternsSkill
- game-performanceSkill
- game-renderingSkill
- game-visualsSkill
- git-commitSkill
- git-prSkill
- godot-shaderSkill
- godotSkill
- gpu-rendering-architectureSkill
- grafanaSkill
- helmSkill
- homelab-monitoringSkill
- k3sSkill
- k8s-networkingSkill
- k8s-operationsSkill
- k8s-storageSkill
- k8s-workloadsSkill
- knowledge-baseSkill
- level-designSkill
- llm-inference-servingSkill
- loggingSkill
- logqlSkill
- love2d-fennelSkill
- love2dSkill
- ml-platform-architectureSkill
- ml-post-trainingSkill
- multi-agent-collaborationSkill
- nix-dendriticSkill
- nix-packagingSkill
- nixSkill
- odin-designSkill
- odin-gamedevSkill
- orchestratorSkill
- physical-ai-systemsSkill
- plannerSkill
- prd-to-storiesSkill
- prd-writingSkill
- promqlSkill
- pr-reviewerSkill
- python-designSkill
- rag-designSkill
- ray-data-pipelinesSkill
- ray-kubernetes-infrastructureSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 33 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 71
If none of these hold, a stateless agent is the right design.
- Distinctive: line 101
JSON Cards: add hierarchical structure and categories, enabling partial field updates without rewriting the whole record.
- Distinctive: line 132
The question: When the same user provides contradictory information across sessions, which value wins?
- Distinctive: line 238
Detect locally: Use a local model for PII classification — don't send potentially sensitive data to an external API to decide whether it's …
“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
Memory is the mechanism that turns a stateless assistant into a personalized agent.
Without it, every session starts from zero. With it, the agent knows who the user is, what they care about, and what they've done before — and can act on that knowledge proactively.
Framing — The Two-Tier Architecture
Production memory systems use two complementary stores:
Tier 1 — Resident structured facts. A compact, always-in-context representation of what the agent knows about the user. Advanced JSON Cards (see §1) are the canonical format: small enough to fit in every prompt, structured enough to support partial updates and disambiguation. This tier provides the overview — the agent always knows the user's name, preferences, and key relationships.
Tier 2 — On-demand raw conversation retrieval. The full history of past sessions, stored verbatim and retrieved via semantic search when the agent needs precise details. This tier provides the details — the exact wording of a past request, the specific address the user mentioned three sessions ago.
Together, these tiers enable proactive service: the agent can synthesize structured facts (Tier 1) with retrieved details (Tier 2) to anticipate needs the user hasn't expressed yet ("Your passport expires before your Tokyo trip"). Neither tier alone achieves this — Tier 1 lacks precision, Tier 2 lacks overview.
Cognitive science mapping. The two-tier model loosely maps to human memory: episodic memory (specific past events, Tier 2), semantic memory (general facts about the user, Tier 1), and procedural memory (learned behavioral patterns, encoded in Tier 1 preference fields). This framing is useful for communication, not implementation — the engineering decisions are in §1–§5.
Symptom Table
| Symptom | Decision Point |
| Agent forgets user preferences across sessions | §1 — Storage format |
| Agent surfaces contradictory memories | §2 — Conflict resolution |
| Agent's memory grows unbounded | §3 — Consolidation |
| Agent remembers facts but can't anticipate needs | §4 — Evaluation (stuck at Level 1) |
| Agent leaks PII from memory | §5 — Privacy |
YAGNI Gate — Does This Agent Need Memory?
Memory adds real complexity: storage, retrieval, conflict resolution, consolidation, and privacy surface. Apply it only when the use case demands it.
Three criteria that justify memory:
- Repeated user interactions — the same user returns across multiple sessions
- Personalization improves outcomes — knowing the user's history changes what the agent does
- State too large for single-session context — the relevant history exceeds what fits in one context window
If none of these hold, a stateless agent is the right design. Many agents — single-use tools, document processors, code assistants with no user model — work correctly without any cross-session memory. Don't add the complexity unless the use case demands it.
§1 Storage Format Spectrum
The question: What data structure should hold user memories?
Five formats exist on a spectrum from simple to capable. The right choice depends on the volume, criticality, and structure of the data being stored.
| Format | Structure | Update model | Best for |
| Simple Notes | Atomic key-value facts | Full replacement | High-volume, non-critical facts |
| Enhanced Notes | Full paragraphs with context | Full replacement | Rich context, infrequent updates |
| JSON Cards | Hierarchical key-value with categories | Partial field updates | Structured data with known schema |
| Advanced JSON Cards | JSON Cards + backstory, person, relationship, timestamp | Partial field updates + disambiguation | Critical low-volume personalization data |
| Code | Executable Python objects + constraint methods | Regeneration | Deterministic aggregation, constraint enforcement |
Simple Notes store atomic facts as flat key-value pairs. O(1) read/write operations, but associations between facts are lost. Suitable for high-volume non-critical preferences where context doesn't matter.
Enhanced Notes store memories as full paragraphs preserving the context in which a fact was learned. Semantically complete but hard to partially update — changing one field requires rewriting the whole note.
JSON Cards add hierarchical structure and categories, enabling partial field updates without rewriting the whole record. Schema rigidity is the trade-off: new fact types require schema changes.
Advanced JSON Cards extend JSON Cards with backstory, person,
relationship, and timestamp fields. The backstory field is the key
addition — it records why a fact was stored, enabling disambiguation when
the same user provides different values in different contexts (e.g., "home
address for work deliveries" vs "vacation address"). This is the recommended
format for resident structured facts (Tier 1).
Code (Bojie Li argues) represents user memory as executable Python objects with constraint methods. This enables deterministic aggregation across sessions, conflict detection via constraint violations, and enforcement of invariants (e.g., "age must be consistent with birth year"). Highest capability, highest complexity — justified only when constraint enforcement is a hard requirement.
The hybrid recommendation. Most production systems use:
- Advanced JSON Cards for Tier 1 (resident structured facts, always in context)
- Raw conversation storage for Tier 2 (on-demand retrieval via RAG techniques)
This combination captures the overview (Tier 1) and the details (Tier 2) without the complexity of a full Code-based memory system.
-> Read references/memory-formats.md for concrete schema examples, migration
patterns, and format selection decision criteria.
§2 Conflict Resolution
The question: When the same user provides contradictory information across sessions, which value wins?
Contradictions are inevitable in long-running memory systems. A user moves, changes preferences, or corrects a previous statement. Three resolution strategies cover most cases:
Timestamp-based priority. For mutable facts (address, phone number, current preference), the most recent explicit statement wins. Requires reliable timestamps on every memory write.
Source credibility. An explicit user correction ("Actually, my address is now...") outranks an inferred fact ("the user mentioned this address in passing"). Tag memories with their source type at write time.
Contextual disambiguation. Advanced JSON Cards carry a backstory field
that records the context in which a fact was stored. Two different home
addresses may both be correct — one for work deliveries, one for personal
mail. The backstory field enables the agent to distinguish them rather than
treating them as a conflict.
The Mem0 pattern. Extract-compare-decide pipeline: when a new memory arrives, extract the candidate fact, compare it against existing memories, then decide: ADD (no existing fact), UPDATE (same fact, new value), DELETE (user explicitly revokes a fact), or NOOP (duplicate). This pipeline makes conflict resolution explicit and auditable rather than implicit in storage logic.
§3 Consolidation and Compression
The question: How do you prevent memory from growing unbounded?
Without active management, memory accumulates indefinitely. Raw session logs grow faster than they can be retrieved efficiently, and redundant facts accumulate across sessions.
Dual gating. Trigger consolidation when both conditions hold: (a) enough time has elapsed since the last consolidation, AND (b) enough new sessions have accumulated since the last consolidation. Either condition alone produces either too-frequent or too-infrequent runs.
Consolidation pipeline. Three stages:
- Importance scoring — rank memories by recency, frequency of reference, and explicit user emphasis
- Clustering — group related memories (all facts about the user's car, all address variants)
- Abstraction — generalize clusters into a single canonical memory, discarding redundant detail
Separate accumulation from consolidation. Accumulation is fast and continuous (every session appends). Consolidation is periodic and expensive (requires re-reading and re-writing many memories). Running them on different time windows prevents consolidation from blocking session writes.
The "User as Code" pattern (Bojie Li argues): split memory into two phases. The memory phase is an append-only log of raw facts from each session — cheap to write, never modified. The structuring phase periodically reads the log and regenerates the executable Python object (see §1 Code format) from scratch. This makes the structured representation always consistent with the full history, at the cost of periodic regeneration overhead.
For retrieval-based memory compression (compressing Tier 2 raw conversation
storage), → see rag-design for contextual retrieval patterns.
§4 Three-Level Evaluation
The question: How do you know if your memory system is actually working?
Most memory systems are tested only at Level 1. Levels 2 and 3 require deliberate test design.
Level 1 — Basic Recall. The agent retrieves a fact that was explicitly stored in a single session. "What's my account number?" → returns the stored value. Passing Level 1 means storage and retrieval work. Most systems reach this level.
Level 2 — Multi-Session Retrieval. The agent gathers and reconciles information scattered across multiple sessions, including disambiguation. "Which car needs service?" → correctly identifies the right vehicle when the user has two cars mentioned in different sessions. Passing Level 2 requires correct conflict resolution (§2) and the ability to aggregate across sessions.
Level 3 — Proactive Service. The agent synthesizes memories to anticipate needs the user hasn't expressed. "Your passport expires before your Tokyo trip" — the agent connected the passport expiry date (one session) with the trip dates (another session) and surfaced the conflict unprompted. Passing Level 3 requires the two-tier architecture: Tier 1 provides the overview that enables synthesis, Tier 2 provides the precise details.
Most systems plateau at Level 1. Level 3 is the goal for personalized agents that provide genuine value across sessions.
-> Read references/memory-evaluation.md for concrete test scenarios, per-level
rubrics, and the two-tier architecture as a prerequisite for Level 3.
§5 Privacy and PII
The question: How do you prevent the memory system from becoming a PII liability?
Memory systems accumulate sensitive data by design. Without active management, they become a liability.
Detect locally. Use a local model for PII classification — don't send potentially sensitive data to an external API to decide whether it's sensitive. The classification step itself is a privacy boundary.
Sanitize before storage, not after retrieval. Filtering PII at retrieval time means it was stored in the first place. Sanitize at the write path so the data never enters the store.
Define the policy explicitly. The boundary between "useful personalization" and "privacy violation" is context-dependent. Document which categories the system detects and stores: names, addresses, financial data, health data, relationship data. The policy must be explicit — implicit policies drift.
Minimum necessary principle. Store only what the agent needs to provide the service. A preference for dark mode doesn't require storing the user's home address. Scope each memory category to the capabilities it enables.
Routing Map
These are companion skills in the ai-agents family. Load the relevant one when building that layer.
| Concern | Companion Skill | Source |
| Retrieval pipeline for memory at scale | rag-design (planned) | Ch3 §3.2–3.3 |
| Context-window injection of memories | context-engineering | Ch2 |
| Memory tool interface design | agent-tool-design | Ch4 |
| Orchestration & autonomy | agent-architecture | Ch1 |
| Operating a personal wiki | knowledge-base | — |
| Sleep consolidation / experience distillation lifecycle | agent-self-evolution | Ch8 |
NOT For
Litmus: Is the question about designing how an agent persists and recalls user-specific information across sessions? → here.
- Operating a specific knowledge base (Obsidian, Notion, a personal wiki) →
knowledge-base - Managing what fits in the context window for a single session →
context-engineering - Building a retrieval pipeline for a document corpus (not user memory) →
rag-design - Agent runtime loop, orchestration, guardrails →
agent-architecture
References
| Reference | When to read |
references/memory-formats.md | Concrete schema examples for each format, migration patterns, format selection decision criteria, the hybrid recommendation in detail |
references/memory-evaluation.md | Three-level evaluation framework with concrete test scenarios, per-level rubrics, two-tier architecture as Level 3 prerequisite |
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.

