Memory Structure
- A row in SQLite with typed metadata and graph connections
- A vector embedding in LanceDB for similarity search
- A full-text indexed entry in Tantivy for keyword search
Eight Memory Types
Default Importance by Type
Graph Edges
Memories connect to each other via typed relationships:Auto-Association
When a memory is created, it’s automatically associated with similar memories:Hybrid Search
Memory search combines four strategies:Search Modes
MemoryType and sorts by Recent, Importance, or MostAccessed.
Three Creation Paths
Memories are created three ways:1. Branch-Initiated
During conversation, a branch uses thememory_save tool:
2. Compactor-Initiated
During context compaction, the compactor worker extracts memories from summarized messages:3. Cortex-Initiated
The cortex creates observations and consolidates memories system-wide:Recall Flow
Memory recall happens exclusively in branches: The channel never sees raw search results. It gets clean, curated conclusions.Example Recall
“You prefer tabs over spaces and have chosen the Airbnb ESLint style guide.”
Importance Scoring
Memory importance is influenced by: Explicit importance — Set by the LLM or derived from memory type Access frequency — Memories that are recalled often get boostedDecay
Non-identity memories decay over time:Memory Maintenance
Periodic background tasks keep the memory graph healthy:Decay
Reduce importance of old, unaccessed memories:Prune
Remove memories below importance threshold:forget() sets forgotten = true. The memory stays in the database but is excluded from search.
Merge
Detect near-duplicate memories and consolidate:Reindex
Rebuild vector/FTS indexes for consistency:Memory Bulletin
The cortex generates a periodically refreshed summary of the agent’s knowledge:Memory Import
Dump files into theingest/ folder and Spacebot extracts structured memories:
- Reads each file
- Uses an LLM to extract facts, preferences, decisions
- Creates typed memories with importance scores
- Auto-associates via similarity search
OpenClaw Migration
OpenClaw stores memories as markdown files:ingest/ and Spacebot converts them to typed graph memories automatically.
Cross-Channel Recall
Branches can read transcripts from other conversations:- Summarizing conversations across channels
- Finding context from related threads
- Pulling information from team discussions
Database Schema
SQLite Tables
LanceDB Schema
- Vector indexing (HNSW)
- Full-text indexing (Tantivy)
- Hybrid search queries
Configuration
Best Practices
When to create memories
When to create memories
Create memories for:
- Facts the user teaches you
- Preferences they express
- Decisions they make
- Goals they set
- Events that happen
- Ephemeral chat
- Questions without answers
- Temporary context
How to set importance
How to set importance
High importance (0.8-1.0):
- Identity information
- Core goals
- Major decisions
- Preferences
- Facts
- Minor decisions
- Events
- Observations
- Context notes
When to use graph edges
When to use graph edges
Let auto-association handle most connections.Manually create edges when:
- One memory explicitly updates another
- There’s a causal relationship
- You need to mark contradictions
Next Steps
Branches
Learn how branches search and curate memories
Cortex
Understand memory bulletin generation
Compaction
See how compaction extracts memories
Memory Tools
Reference for memory_save and memory_recall