Skip to content

Memory & RAG System

ClawHalla includes a built-in RAG (Retrieval-Augmented Generation) system that gives agents semantic search over their memory files. Each agent can be configured independently — full RAG with vector embeddings, or simple .md file-based memory.

How It Works

Every agent in OpenClaw has a memory directory containing .md files (daily notes, curated knowledge, session logs). The RAG system indexes these files into a SQLite database with:

  • FTS5 full-text search — keyword matching with porter stemming
  • Vector embeddings — semantic similarity search using configurable embedding models
  • Chunk-level indexing — files are split into chunks for precise retrieval

When an agent needs context, it queries the RAG index to find the most relevant memory chunks — not just keyword matches, but semantically similar content.

Embedding Providers

ClawHalla supports multiple embedding providers. Choose based on your needs:

ProviderModelCostNotes
Ollamanomic-embed-textFreeRuns locally in Docker, recommended for ClawHalla
Node GGUFGGUF modelsFreeRuns inside Node.js via node-llama-cpp
OpenAItext-embedding-3-smallPaidCloud API, requires API key
Google Geminitext-embedding-004PaidCloud API, requires API key
Voyage AIvoyage-3-litePaidCloud API, requires API key
Mistralmistral-embedPaidCloud API, requires API key

Configuration via Mission Control

  1. Open Settings — Navigate to Settings > Memory tab in Mission Control

  2. Choose a provider — Select your embedding provider from the dropdown

  3. Configure provider — For Ollama, set the URL (default: http://ollama:11434). For cloud providers, enter your API key (stored encrypted in the Vault)

  4. Enable — Toggle memory search on

  5. Set per-agent modes — Choose which agents get RAG vs .md-only memory:

    • Default — Inherits the global setting
    • RAG — Full semantic search enabled
    • .md — File-based memory only (no embeddings)
  6. Save — Configuration is saved to openclaw.json and indexing starts automatically

Per-Agent Memory Modes

Not every agent needs semantic search. A coordinator agent might work fine with simple .md files, while a knowledge curator benefits from RAG. You can configure this per-agent:

openclaw.json
{
"agents": {
"defaults": {
"memorySearch": {
"provider": "ollama"
}
},
"list": [
{
"id": "mimir",
"memorySearch": {} // inherits from defaults (RAG enabled)
},
{
"id": "freya",
"memorySearch": { "enabled": false } // .md only
}
]
}
}

Semantic Search API

Query agent memory programmatically:

Terminal window
# Search an agent's memory
curl "http://localhost:3000/api/memory/rag?q=deployment+process&agent=thor&limit=5"
# Response
{
"ok": true,
"query": "deployment process",
"agent": "thor",
"results": [
{
"content": "...",
"score": 0.89,
"source": "memory/2026-03-28.md",
"chunk": 3
}
],
"count": 1
}

Reindexing

Memory is automatically indexed when files change. You can also trigger a manual reindex:

Terminal window
# Via API
curl -X POST http://localhost:3000/api/memory/rag -d '{"force": true}'
# Via CLI (inside container)
openclaw memory index --force

Troubleshooting

IssueSolution
”Memory search not configured”Go to Settings > Memory and enable a provider
No results returnedCheck that memory files exist and run a reindex
Ollama connection refusedEnsure the Ollama container is running: docker compose ps ollama
Slow indexingLarge memory directories take time on first index — subsequent updates are incremental