AG

AgentMemory

9,400TypeScriptMemory

Persistent memory system for AI coding agents with benchmark-validated performance.

MemoryTypeScriptPersistentBenchmarks

Overview

AgentMemory is a persistent memory system specifically designed for AI coding agents. With over 9,400 stars and ranked #1 in persistent memory benchmarks, it provides long-term memory capabilities that enable agents to remember context across sessions, learn from interactions, and build cumulative knowledge.

Features

  • Cross-session persistent memory
  • Vector storage with semantic search
  • Hierarchical memory organization
  • Time-aware retrieval
  • Multiple backend support (SQLite, PostgreSQL, Redis, Chroma, Qdrant)

Installation

pip install agent-memory

Pros

  • +#1 performance on memory benchmarks
  • +Multiple backend options for different needs
  • +Framework agnostic - works with any agent
  • +Production-ready with real-world validation
  • +Clear documentation and examples

Cons

  • Additional dependency to manage
  • Multiple backend options can be confusing
  • Vector databases can add infrastructure cost
  • Memory retrieval adds latency to responses

Alternatives

Documentation

AgentMemory

Overview

AgentMemory is a persistent memory system specifically designed for AI coding agents. With over 9,400 stars and ranked #1 in persistent memory benchmarks, it provides long-term memory capabilities that enable agents to remember context across sessions, learn from interactions, and build cumulative knowledge.

Key Features

🧠 Persistent Memory

AgentMemory provides true persistent memory for AI agents:

  • Cross-Session Persistence: Memory survives agent restarts
  • Vector Storage: Semantic search across all memories
  • Hierarchical Organization: Organize memories by context and topic
  • Time-Aware Retrieval: Consider temporal context in memory retrieval

📊 Benchmark-Backed

Validated against real-world benchmarks:

  • #1 in Memory Benchmarks: Outperforms competitors on standard tests
  • Real-World Testing: Validated on actual coding agent workloads
  • Performance Metrics: Measured retrieval accuracy and latency
  • Scalability Testing: Tested with thousands of memory entries

🔗 Agent Integration

Seamless integration with popular agent frameworks:

from agent_memory import MemoryStore

# Initialize memory store
memory = MemoryStore(
    backend="sqlite",  # or "postgres", "redis", "chroma"
    embedding_model="text-embedding-3-small"
)

# Store memory
memory.store(
    content="The user prefers TypeScript over Python for new projects",
    context="project_preferences",
    metadata={"user_id": "user123"}
)

# Retrieve relevant memories
relevant = memory.retrieve(
    query="What language should I use for the new API?",
    top_k=5
)

📈 Memory Operations

Complete CRUD operations for memories:

# Create
memory.store("New memory content", context="general")

# Read
memories = memory.retrieve("search query", top_k=10)

# Update
memory.update(memory_id, "Updated content")

# Delete
memory.delete(memory_id)

# Search
results = memory.search("semantic search query")

# List
all_memories = memory.list(context="project_preferences")

Installation

pip install agent-memory

Supported Backends

BackendUse CasePersistencePerformance
SQLiteLocal development, small scale✅ YesFast
PostgreSQLProduction, large scale✅ YesVery Fast
RedisCaching, fast access⚠️ VolatileFastest
ChromaVector-first workloads✅ YesFast
QdrantEnterprise vector search✅ YesVery Fast

Integration Examples

Claude Code Integration

from agent_memory import ClaudeMemoryPlugin

# Add to Claude Code
memory_plugin = ClaudeMemoryPlugin(
    store=MemoryStore(backend="postgres"),
    auto_save=True,
    auto_retrieve=True
)

# Memory is automatically managed
# Agent remembers context across sessions

Cursor Integration

from agent_memory import CursorMemoryPlugin

memory_plugin = CursorMemoryPlugin(
    workspace_path="./my-project",
    auto_index=True
)

# Memory indexed from workspace files

Custom Agent Integration

from agent_memory import MemoryStore
from openai import OpenAI

class MemoryEnhancedAgent:
    def __init__(self):
        self.memory = MemoryStore(backend="chroma")
        self.client = OpenAI()
    
    async def chat(self, message: str, user_id: str) -> str:
        # Retrieve relevant memories
        memories = self.memory.retrieve(
            query=message,
            top_k=5,
            filter={"user_id": user_id}
        )
        
        # Build context
        context = "\n".join([m.content for m in memories])
        
        # Generate response with memory context
        response = self.client.chat.completions.create(
            model="gpt-4o",
            messages=[
                {"role": "system", "content": f"Relevant memories:\n{context}"},
                {"role": "user", "content": message}
            ]
        )
        
        # Store new memory
        self.memory.store(
            content=f"User asked: {message}\nAgent responded: {response}",
            context="conversation",
            metadata={"user_id": user_id}
        )
        
        return response.choices[0].message.content

Advanced Patterns

Memory Summarization

# Auto-summarize long conversations
memory.summarize(
    context="conversation",
    filter={"session_id": "session123"},
    summary_key="session_summary"
)

Memory Compression

# Compress old memories to save space
memory.compress(
    older_than="30 days",
    strategy="summarize"  # or "embed"
)

Multi-Tenant Memory

# Separate memories by user/project
memory.store("Content", context="general", metadata={"tenant": "user123"})
memory.store("Content", context="general", metadata={"tenant": "user456"})

# Retrieve with tenant filter
memories = memory.retrieve("query", filter={"tenant": "user123"})

Memory Export/Import

# Export memories
export = memory.export(format="json")  # or "csv", "parquet"

# Import memories
memory.import_data(export, format="json")

Pros

  • Benchmark #1: Top performance on memory benchmarks
  • Multiple Backends: Choose the right storage for your needs
  • Framework Agnostic: Works with any agent framework
  • Production Ready: Used in production by many teams
  • Well-Documented: Clear documentation and examples
  • Active Development: Rapidly improving with community feedback

Cons

  • Additional Dependency: One more component to manage
  • Setup Complexity: Multiple backend options can be confusing
  • Cost: Vector databases can add infrastructure cost
  • Latency: Memory retrieval adds some latency to agent responses

Use Cases

Use CaseWhy AgentMemory
Coding AgentsRemember codebase context across sessions
Multi-tenant SystemsIsolate memories by user or project
Long-term ProjectsBuild cumulative knowledge over time
Benchmark ValidationUse proven memory performance
Flexible StorageChoose backend for your needs

Comparison with Alternatives

FeatureAgentMemoryMem0ZepLangChain Memory
ParadigmPersistent storageSelf-improvingEntity extractionConversation buffer
Vector Search✅ Yes✅ Yes✅ Yes⚠️ Via plugins
Multi-Tenant✅ Yes✅ Yes⚠️ Via session_id❌ No
Benchmarks✅ #1⚠️ Limited⚠️ Limited❌ No
Backend Options✅ 5 options⚠️ Cloud only⚠️ Limited⚠️ Limited
Framework SupportUniversalUniversalUniversalLangChain only
Learning CurveMediumLowMediumLow
Best forCoding agentsPersonalizationStructured memorySimple conversations

Best Practices

  1. Choose backend wisely — SQLite for dev, Postgres for production
  2. Use context tags — Organize memories by topic and project
  3. Set top_k appropriately — Balance relevance vs. context window
  4. Implement summarization — Compress old memories to save space
  5. Use multi-tenant isolation — Separate memories by user/project
  6. Backup regularly — Export memories for disaster recovery

Troubleshooting

IssueSolution
Memories not retrievedCheck embedding model matches stored memories
Slow retrievalUse SQLite for small scale, Postgres for large
Memory conflictsUse update instead of store for existing memories
Backend connection failsVerify database credentials and network
Embedding errorsCheck embedding model is available and loaded

Resources

Comparison

FeatureAgentMemoryLangChain MemoryCustom SQLite
Persistence✅ Yes⚠️ Limited✅ Yes
Vector Search✅ Yes⚠️ Via plugins❌ No
Multi-Tenant✅ Yes❌ No⚠️ Manual
Benchmarks✅ #1❌ No❌ No
Framework SupportUniversalLangChain onlyUniversal
Ease of UseMediumEasyHard

Last updated: May 2026