Memory and State

ClawLayer's memory system enables your OpenClaw agents to remember past conversations, learn user preferences, and build meaningful long-term relationships.

Overview

Memory is one of ClawLayer's core features that transforms stateless OpenClaw agents into context-aware assistants. The memory system stores and retrieves relevant information from past interactions, allowing agents to:

  • Remember user preferences and personal details

  • Recall previous conversations and context

  • Learn from past interactions

  • Provide personalized responses based on history

  • Build long-term relationships with users

Memory Architecture

ClawLayer's memory system consists of three layers:

┌─────────────────────────────────┐
│     Short-Term Memory           │
│  (Current conversation context) │
└────────────┬────────────────────┘

┌────────────▼────────────────────┐
│     Long-Term Memory            │
│  (Vector database storage)      │
└────────────┬────────────────────┘

┌────────────▼────────────────────┐
│     Knowledge Base              │
│  (Static agent knowledge)       │
└─────────────────────────────────┘

Memory Types

Short-Term Memory

Short-term memory holds the current conversation context within a single session. It's automatically managed by ClawLayer and stored in-memory for fast access.

Use cases:

  • Maintaining conversation flow

  • Tracking the current topic

  • Understanding immediate context

Long-Term Memory

Long-term memory persists across sessions using a vector database. It enables agents to recall information from days, weeks, or months ago.

Use cases:

  • Remembering user preferences

  • Recalling past decisions

  • Learning user patterns

  • Building user profiles

Knowledge Base

Static information that the agent always knows, defined at initialization.

Vector Database Providers

ClawLayer supports multiple vector database providers for long-term memory:

Pinecone

Pros: Managed service, easy setup, great performance Best for: Production deployments, teams wanting managed infrastructure

Weaviate

Pros: Self-hosted option, open-source, powerful querying Best for: Self-hosted deployments, advanced filtering needs

Qdrant

Pros: High performance, Rust-based, excellent for scale Best for: High-throughput applications, performance-critical systems

State Management

User State

Track user-specific information and preferences:

Conversation State

Track conversation-specific context and metadata:

Session State

Manage temporary session data:

Memory Retrieval

Automatic Retrieval

ClawLayer automatically retrieves relevant memories based on the current conversation:

Manual Retrieval

Explicitly retrieve memories for custom use cases:

Time-Based Retrieval

Retrieve memories from a specific time period:

Memory Configuration Options

Full Configuration

Memory Management

Delete User Memories

Allow users to delete their data:

Export User Data

Export user memories for compliance (GDPR, etc.):

Best Practices

1. Privacy and Compliance

Always respect user privacy and comply with regulations:

2. Optimize for Performance

Balance memory depth with performance:

3. Context Window Management

Manage the agent's context window effectively:

4. Memory Categories

Organize memories by type for better retrieval:

Examples

Example 1: Customer Support Agent

Example 2: Personal AI Assistant

Troubleshooting

Memories not being retrieved

Check your similarity threshold:

High memory costs

Optimize retention and storage:

Slow retrieval

Enable caching:

Next Steps

Need Help?

Last updated