Memory Tools
NullClaw provides four memory tools that enable agents to store and retrieve long-term facts:memory_store— Persist facts to long-term memorymemory_recall— Search memory with hybrid retrievalmemory_list— List all stored memoriesmemory_forget— Delete memory entries
- Multiple backends — SQLite, Markdown, None
- Hybrid search — BM25 + vector similarity with RRF merge
- Temporal decay — Recent memories weighted higher
- MMR diversification — Avoid redundant results
- Vector sync — Automatic embedding sync to vector store
Memory Architecture
Memory Backend
Memory tools operate on a pluggableMemory backend:
Memory Categories
Memories are organized into three categories:core— User preferences, stable facts (e.g., “User prefers Zig”)daily— Temporary session notes (e.g., “Working on feature X today”)conversation— Key conversation excerpts (use sparingly)
Hybrid Retrieval Pipeline
When aMemoryRuntime is available, memory_recall uses a sophisticated retrieval pipeline:
- BM25 full-text search — Exact keyword matching
- Vector similarity search — Semantic similarity via embeddings
- RRF merge — Reciprocal Rank Fusion combines rankings
- Temporal decay — Recent memories boosted
- MMR diversification — Remove redundant results
Falls back to raw
mem.recall() (BM25 only)
memory_store
Persist facts to long-term memory with automatic vector sync.Parameters
string
required
Unique key for this memory (used for updates and deletion)
string
required
The information to remember
string
default:"core"
Memory category:
core, daily, or conversationConfiguration
Usage
Store a core fact:Vector Sync
Whenmem_rt is configured, stored memories are automatically:
- Embedded via configured embedding provider
- Upserted to vector store (e.g., Qdrant, Chroma)
- Available for semantic search in
memory_recall
Duplicate Keys
Storing with an existing key overwrites the previous content:memory_recall now returns “Project completed” for key “status”.
Source
src/tools/memory_store.zig:12-61
memory_recall
Search long-term memory for relevant facts using hybrid retrieval.Parameters
string
required
Keywords or phrase to search for in memory
integer
default:5
Maximum results to return (1-100)
Configuration
Usage
Search for facts about Zig:Hybrid Search Results
Whenmem_rt is configured, results include hybrid scores:
bm25— Exact keyword matchvector— Semantic similarity- Higher score = better match
Internal Memory Filtering
Memories with keys starting with__bootstrap. are filtered from results:
memory_recall("Zig") returns only user_pref, not bootstrap internals.
Source
src/tools/memory_recall.zig:14-163
memory_list
List all stored memories (optionally filtered by category).Parameters
string
Filter by category:
core, daily, or conversationConfiguration
Usage
List all memories:Source
src/tools/memory_list.zig
memory_forget
Delete a memory by key with automatic vector store cleanup.Parameters
string
required
The key of the memory to forget
Configuration
Usage
Delete a memory:Vector Store Cleanup
Whenmem_rt is configured, memory_forget automatically:
- Deletes the memory from the primary backend (SQLite/Markdown)
- Deletes the corresponding vector embedding from the vector store
Source
src/tools/memory_forget.zig:11-57
Memory Backends
SQLite Backend
- BM25 full-text search via SQLite FTS5
- Category filtering
- Metadata support
- Persistent across restarts
Markdown Backend
- Human-readable markdown file
- Simple key-value structure
- Substring search (not BM25)
- Great for debugging
None Backend (No-Op)
- All operations are no-ops
- Useful for testing without persistence
- Store/recall return empty results
Memory Runtime
For hybrid search with vector embeddings, configure aMemoryRuntime:
Retrieval Parameters
k— Number of candidates from each method (BM25, vector)bm25_weight— Weight for BM25 scores in RRF merge (default: 0.6)vector_weight— Weight for vector scores in RRF merge (default: 0.4)temporal_decay_days— Days after which memory score decays by 50% (default: 30)mmr_lambda— MMR diversification parameter (0 = max diversity, 1 = max relevance)
Use Cases
User Preferences
Project Context
Conversation Highlights
Recall During Task
Testing
Run memory tool tests:- Store/recall/list/forget operations
- Category filtering
- Hybrid search with MemoryRuntime
- Internal memory filtering
- No backend (NoneMemory) behavior