Memory patterns, context strategies, and persistence recipes for AI agents. The #1 unsolved pain point in production AI agents — session persistence and context management.
Agent memory is the hottest unsolved problem in AI engineering (2026). Three repos in this space hit 220K+ stars in a single week. Every production agent eventually needs:
- Remembering what happened last turn
- Surfacing relevant past conversations
- Managing context windows without losing information
- Persisting state across sessions
- Choosing what to forget
This kit solves that. Patterns, not abstractions. Grab what works.
| Pattern | Use Case |
|---|---|
| Sliding Window | Keep last N turns — simple, cheap, works for short sessions |
| Summary Compression | Summarize older context to fit within token limits |
| Vector Recall | Semantic search over past conversations using embeddings |
| Hybrid Memory | Short-term window + long-term vector recall combined |
| Episodic vs Semantic | Separate specific events from general knowledge |
| Strategy | Description |
|---|---|
| Session Persistence | Save/load agent state across restarts |
| Cross-Session Recall | Remember user preferences and past sessions |
| Context Windowing | Manage context windows for long-running agents |
| Cache-Aware Design | Maximize prompt caching for memory operations |
| Guide | Description |
|---|---|
| MCP Memory Server Config | Configure MCP memory servers for agent persistence |
| MCP Memory Integration | Connect MCP tools to agent memory systems |
| Prompt | Use Case |
|---|---|
| Memory Injection | System prompt patterns for injecting memory context |
| Context Summarization | Prompts for summarizing conversation history |
| Recall Instructions | Instructions for agents to recall and use past info |
| Framework | Description |
|---|---|
| LangGraph Memory | Memory patterns in LangGraph agents |
| LlamaIndex Memory | Memory in LlamaIndex workflows |
| CrewAI Memory | Memory in CrewAI multi-agent systems |
git clone https://github.com/FreeAutomation-Tech/agent-memory-kit.git
cd agent-memory-kit
# Browse memory patterns
ls patterns/
# Use a pattern
cat patterns/sliding-window.md
# Run an example
python examples/chat-memory.py
# Test memory patterns
python -m pytest tests/patterns/ # Core memory patterns
strategies/ # Memory management strategies
mcp/ # MCP memory server integration
prompts/ # System prompts for memory
frameworks/ # Framework-specific guides
examples/ # Runnable Python examples
tools/ # Memory analysis tools
tests/ # Test files
# Read a pattern
cat patterns/hybrid-memory.md
# Try the chat memory example
python examples/chat-memory.py
# Analyze your context usage
python tools/context_analyzer.py --log conversation.log
# Test memory patterns
python tools/memory_test.py --pattern sliding-windowMIT — see LICENSE.
If you find this useful, please consider giving it a star ⭐ — it helps others discover it too!
Thank you for your support! 🙏