Skip to content

Memory System

unohee edited this page Apr 16, 2026 · 1 revision

Memory System

OpenSwarm implements a cognitive memory system using LanceDB vector storage with Xenova multilingual embeddings. This allows agents to retain and recall information across sessions.


How It Works

Storage

  • Vector DB: LanceDB (columnar, Apache Arrow-based)
  • Embeddings: Xenova/multilingual-e5-base (768 dimensions)
  • Location: ~/.openswarm/memory/

Memory Types

Type Description
belief Agent's understanding of a concept or pattern
strategy Approach that worked (or didn't) for a task type
user_model Understanding of user preferences and patterns
system_pattern Observed system behavior or architecture patterns
constraint Known limitations or rules to follow

Retrieval Scoring

Memories are ranked using a hybrid formula:

score = 0.55 × similarity + 0.20 × importance + 0.15 × recency + 0.10 × frequency
Factor Weight Description
Similarity 55% Cosine similarity between query and memory embeddings
Importance 20% User-assigned or derived importance score
Recency 15% How recently the memory was accessed
Frequency 10% How often the memory has been recalled

Background Processes

The memory system runs background maintenance tasks:

Decay

Memories that haven't been accessed gradually lose relevance, preventing stale information from dominating recalls.

Consolidation

Related memories are periodically merged to reduce redundancy and strengthen key patterns.

Contradiction Detection

When a new memory contradicts an existing one, the system flags the conflict for resolution.

Distillation

Verbose memories are summarized into more compact forms over time.


Discord Integration

Search memories directly from Discord:

!memory search "how to handle auth errors"

Agent Usage

During pipeline execution, agents automatically:

  1. Query relevant memories before starting a task
  2. Store successful strategies and patterns after task completion
  3. Update existing memories when new information is learned

This enables agents to learn from past work and avoid repeating mistakes.

Clone this wiki locally