Design memory architectures for agents with layered persistence from working memory to knowledge graphs.
Prerequisites
Understanding of vector embeddings
Familiarity with graph databases
Instructions
Memory Layers
Layer
Persistence
Access
Use Case
Working
Context window
Zero latency
Current task
Short-term
Session
Searchable
Conversation state
Long-term
Cross-session
Structured
Learning over time
Entity
Permanent
Queryable
Entity consistency
Memory Architecture Comparison
System
Accuracy
Latency
Notes
Temporal KG
94.8%
2.58s
Best accuracy
MemGPT
93.4%
Variable
Good general
GraphRAG
75-85%
Variable
20-35% over RAG
Vector RAG
60-70%
Fast
Loses relationships
Why Vector Stores Fall Short
Vector stores lose relationship information. If agent learns "Customer X purchased Product Y on Date Z," it cannot answer "What did customers who bought Y also buy?"
Knowledge Graph Advantages
Preserve relationships between entities
Enable queries that traverse relationships
Support temporal validity periods
Temporal Knowledge Graphs
Add validity periods to facts:
# What was user's address on January 15?
temporal_graph.query("""
MATCH (user)-[r:LIVES_AT]->(address)
WHERE r.valid_from <= $date AND r.valid_until > $date
RETURN address
""", {"date": "2024-01-15"})
Memory Selection Guide
Simple persistence: File-system memory
Semantic search: Vector RAG with metadata
Relationship reasoning: Knowledge graph
Temporal validity: Temporal knowledge graph
Guidelines
Match architecture to query requirements
Use temporal validity to prevent outdated conflicts
Consolidate memories periodically
Design for retrieval failures gracefully
Consider privacy implications of persistence
Notes
Zep showed 90% retrieval latency reduction vs full-context
GraphRAG reduces hallucination by up to 30%
Entity memory maintains consistency across conversations
1---2name: memory-systems3description: Memory System Design4---5# Memory System Design67Design memory architectures for agents with layered persistence from working memory to knowledge graphs.89## Prerequisites1011- Understanding of vector embeddings12- Familiarity with graph databases1314## Instructions1516### Memory Layers1718| Layer | Persistence | Access | Use Case |19|-------|-------------|--------|----------|20| Working | Context window | Zero latency | Current task |21| Short-term | Session | Searchable | Conversation state |22| Long-term | Cross-session | Structured | Learning over time |23| Entity | Permanent | Queryable | Entity consistency |2425### Memory Architecture Comparison2627| System | Accuracy | Latency | Notes |28|--------|----------|---------|-------|29| Temporal KG | 94.8% | 2.58s | Best accuracy |30| MemGPT | 93.4% | Variable | Good general |31| GraphRAG | 75-85% | Variable | 20-35% over RAG |32| Vector RAG | 60-70% | Fast | Loses relationships |3334### Why Vector Stores Fall Short3536Vector stores lose relationship information. If agent learns "Customer X purchased Product Y on Date Z," it cannot answer "What did customers who bought Y also buy?"3738### Knowledge Graph Advantages3940- Preserve relationships between entities41- Enable queries that traverse relationships42- Support temporal validity periods4344### Temporal Knowledge Graphs4546Add validity periods to facts:4748```python49# What was user's address on January 15?50temporal_graph.query("""51 MATCH (user)-[r:LIVES_AT]->(address)52 WHERE r.valid_from <= $date AND r.valid_until > $date53 RETURN address54""", {"date": "2024-01-15"})55```5657### Memory Selection Guide5859- **Simple persistence**: File-system memory60- **Semantic search**: Vector RAG with metadata61- **Relationship reasoning**: Knowledge graph62- **Temporal validity**: Temporal knowledge graph6364## Guidelines65661. Match architecture to query requirements672. Use temporal validity to prevent outdated conflicts683. Consolidate memories periodically694. Design for retrieval failures gracefully705. Consider privacy implications of persistence7172## Notes7374- Zep showed 90% retrieval latency reduction vs full-context75- GraphRAG reduces hallucination by up to 30%76- Entity memory maintains consistency across conversations7778Source: muratcankoylan/Agent-Skills-for-Context-Engineering
Run npx skillmds@latest add mediar-ai/memory-systems in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Memory System Design It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
mediar-ai (@mediar-ai) published this skill. Their other Agent Skills are listed on their SkillMD profile.