The “Did You Mean index?” Moment
You’ve set up memory flush, configured hybrid search with MiniLM-L6-v2, created your notes directory with seed files, and now you want to index everything. Naturally, you try:
docker compose run --rm openclaw-cli memory reindex \
--path /home/node/.openclaw/memory/notes --verboseAnd OpenClaw gently corrects you:
🦞 OpenClaw 2026.2.25 (unknown)
Pairing codes exist because even bots believe in consent—
and good security hygiene.
error: unknown command 'reindex'
(Did you mean index?)The command is memory index, not memory reindex. Let’s explore the full memory CLI.
Memory CLI Overview
From the CLI help output:
memory * Search and reindex memory filesThe memory command group contains subcommands for managing the agent’s knowledge base — the same SQLite + embedding system configured via memorySearch settings.
Available Subcommands
docker compose run --rm openclaw-cli memory --helpThe primary operations:
| Command | Purpose |
|---|---|
memory index | Build or rebuild the embedding index from memory files |
memory search | Query the memory store from the command line |
memory status | Show index statistics and health |
The memory index Command
Basic Usage
Index all notes in the memory directory:
docker compose run --rm openclaw-cli memory indexWith a Specific Path
Target a subdirectory:
docker compose run --rm openclaw-cli memory index \
--path /home/node/.openclaw/memory/notesVerbose Mode
Watch the indexing process in detail:
docker compose run --rm openclaw-cli memory index --verboseThis shows:
- Files discovered and scanned
- Chunks extracted from each document
- Embeddings generated (using
all-MiniLM-L6-v2) - Records written to
main.sqlite
What Indexing Does
The index command processes your memory files through this pipeline:
.md/.txt files → Chunk splitting → Embedding generation → SQLite storage- File discovery — Scans the memory directory for
.md,.txt, and other text files - Chunk splitting — Breaks documents into searchable segments
- Embedding generation — Runs each chunk through the configured model (
all-MiniLM-L6-v2locally) to produce 384-dimensional vectors - SQLite write — Stores the chunks, metadata, and embedding vectors in
main.sqlite
Why the Database Was Empty
In earlier troubleshooting, we saw the SQLite database was 0 bytes:
ls -l ~/.openclaw/memory/main.sqlite
# -rw-r--r-- 1 azureuser azureuser 0 Feb 25 23:37 main.sqliteAnd querying tables returned nothing:
sqlite3 ~/.openclaw/memory/main.sqlite ".tables"
# (empty output)This happens because creating the directory and restarting the gateway isn’t enough — you must explicitly run memory index to populate the database. The gateway creates the empty database file on startup, but it doesn’t auto-index existing notes.
Full Indexing Workflow
# 1. Ensure the memory directory exists with proper permissions
mkdir -p ~/.openclaw/memory/notes
sudo chown -R 1000:1000 ~/.openclaw/memory
chmod 770 ~/.openclaw/memory
chmod 770 ~/.openclaw/memory/notes
# 2. Create or add notes
cat > ~/.openclaw/memory/notes/seed.md <<'EOF'
# Seed note
This is a test note to initialize file-backed memory/search.
EOF
cat > ~/.openclaw/memory/notes/infrastructure.md <<'EOF'
# Infrastructure Notes
- Azure VM: B2s (2 vCPU, 4 GB RAM)
- Region: East US
- Docker version: 28.x
- OpenClaw version: 2026.2.25
EOF
# 3. Run the index command
docker compose run --rm openclaw-cli memory index --verbose
# 4. Verify the database was populated
sqlite3 ~/.openclaw/memory/main.sqlite \
"SELECT COUNT(*) FROM sqlite_master WHERE type='table';"The memory search Command
Basic Search
Query your indexed memory from the terminal:
docker compose run --rm openclaw-cli memory search "Azure VM setup"How Search Works
The search uses the same hybrid pipeline configured via memorySearch settings:
{
"agents": {
"defaults": {
"memorySearch": {
"provider": "local",
"model": "all-MiniLM-L6-v2",
"query": {
"hybrid": {
"enabled": true,
"vectorWeight": 0.7,
"textWeight": 0.3,
"candidateMultiplier": 4
}
}
}
}
}
}With hybrid search enabled:
- Vector search (70% weight) — Your query is embedded and compared against stored vectors using cosine similarity
- Text search (30% weight) — Standard text matching against chunk content
- Candidate multiplier (4x) — Retrieves 4x more candidates than needed, then re-ranks for better results
Search from Inside the Gateway
The agent uses the same search pipeline automatically. When the agent needs context, the session-memory hook triggers a memory search and injects relevant results into the conversation.
Index vs Reindex
While the CLI command is memory index (not reindex), the behavior depends on whether the database already has content:
| Scenario | Behavior |
|---|---|
| Empty database | Full index — all files processed |
| Populated database | Incremental — only new/changed files indexed |
| Force rebuild | Use --force flag to re-embed everything |
Force Re-Index
If your model or chunking strategy changed, force a complete rebuild:
docker compose run --rm openclaw-cli memory index --forceThis drops existing embeddings and regenerates everything. On a B2s VM, this takes roughly:
| Notes Count | Estimated Time |
|---|---|
| 10 files | ~5 seconds |
| 100 files | ~30 seconds |
| 1,000 files | ~5 minutes |
| 10,000 files | ~45 minutes |
Times are approximate for all-MiniLM-L6-v2 running on CPU.
Troubleshooting
”unable to open database file”
sqlite3 ~/.openclaw/memory/main.sqlite "SELECT COUNT(*) FROM embedding_cache;"
# Error: unable to open database "/home/azureuser/.openclaw/memory/main.sqlite":
# unable to open database fileThe directory doesn’t exist yet:
mkdir -p ~/.openclaw/memory
docker compose restart openclaw-gatewayDatabase Exists but Empty (0 bytes)
ls -l ~/.openclaw/memory/main.sqlite
# -rw-r--r-- 1 azureuser azureuser 0 Feb 25 23:37The database was created but never populated. Run the index command:
docker compose run --rm openclaw-cli memory indexPermission Denied During Index
If the CLI can’t write to the database:
sudo chown -R 1000:1000 ~/.openclaw/memory
chmod 660 ~/.openclaw/memory/main.sqlitesqlite3 Not Available
If you need to inspect the database directly:
sudo apt install sqlite3Then verify the schema:
sqlite3 ~/.openclaw/memory/main.sqlite \
"SELECT name FROM sqlite_master WHERE type IN ('table','index','trigger','view');"Automating Index Updates
Cron-Based Reindexing
Set up a cron job to reindex new notes periodically:
# Add to crontab:
# Reindex memory every hour
0 * * * * cd /home/azureuser/openclaw && \
docker compose run --rm openclaw-cli memory index 2>&1 | \
logger -t openclaw-memory-indexPost-Flush Indexing
When memory flush writes new notes (after session compaction), those notes won’t be searchable until indexed. Combine flush and index:
#!/bin/bash
# flush-and-index.sh
# Run after long sessions or on schedule
# The flush happens automatically during compaction.
# Index any new flush notes:
docker compose run --rm openclaw-cli memory index --verbose
echo "Memory index updated at $(date)"OpenClaw Built-In Cron
Use OpenClaw’s internal cron scheduler:
docker compose run --rm openclaw-cli cron --helpQuick Reference
# Index all memory files
docker compose run --rm openclaw-cli memory index
# Index with verbose output
docker compose run --rm openclaw-cli memory index --verbose
# Search memory
docker compose run --rm openclaw-cli memory search "query text"
# Force full reindex
docker compose run --rm openclaw-cli memory index --force
# Check memory status
docker compose run --rm openclaw-cli memory status
# WRONG — this command doesn't exist:
# docker compose run --rm openclaw-cli memory reindex ← error!Series Navigation
Previous: OpenClaw Gmail Watcher and Email Channel Integration
Part 30 of the OpenClaw on Azure series. Remember: it’s index, not reindex. The lobster remembers everything — if you index it first.

