Files
openclaw/docs/concepts/memory-search.md
Tak Hoffman b83726d13e Feat: Add Active Memory recall plugin (#63286)
* Refine plugin debug plumbing

* Tighten plugin debug handling

* Reduce active memory overhead

* Abort active memory sidecar on timeout

* Rename active memory blocking subagent wording

* Fix active memory cache and recall selection

* Preserve active memory session scope

* Sanitize recalled context before retrieval

* Add active memory changelog entry

* Harden active memory debug and transcript handling

* Add active memory policy config

* Raise active memory timeout default

* Keep usage footer on primary reply

* Clear stale active memory status lines

* Match legacy active memory status prefixes

* Preserve numeric active memory bullets

* Reuse canonical session keys for active memory

* Let active memory subagent decide relevance

* Refine active memory plugin summary flow

* Fix active memory main-session DM detection

* Trim active memory summaries at word boundaries

* Add active memory prompt styles

* Fix active memory stale status cleanup

* Rename active memory subagent wording

* Add active memory prompt and thinking overrides

* Remove active memory legacy status compat

* Resolve active memory session id status

* Add active memory session toggle

* Add active memory global toggle

* Fix active memory toggle state handling

* Harden active memory transcript persistence

* Fix active memory chat type gating

* Scope active memory transcripts by agent

* Show plugin debug before replies
2026-04-09 11:27:37 -05:00

4.4 KiB

title, summary, read_when
title summary read_when
Memory Search How memory search finds relevant notes using embeddings and hybrid retrieval
You want to understand how memory_search works
You want to choose an embedding provider
You want to tune search quality

Memory Search

memory_search finds relevant notes from your memory files, even when the wording differs from the original text. It works by indexing memory into small chunks and searching them using embeddings, keywords, or both.

Quick start

If you have an OpenAI, Gemini, Voyage, or Mistral API key configured, memory search works automatically. To set a provider explicitly:

{
  agents: {
    defaults: {
      memorySearch: {
        provider: "openai", // or "gemini", "local", "ollama", etc.
      },
    },
  },
}

For local embeddings with no API key, use provider: "local" (requires node-llama-cpp).

Supported providers

Provider ID Needs API key Notes
OpenAI openai Yes Auto-detected, fast
Gemini gemini Yes Supports image/audio indexing
Voyage voyage Yes Auto-detected
Mistral mistral Yes Auto-detected
Bedrock bedrock No Auto-detected when the AWS credential chain resolves
Ollama ollama No Local, must set explicitly
Local local No GGUF model, ~0.6 GB download

How search works

OpenClaw runs two retrieval paths in parallel and merges the results:

flowchart LR
    Q["Query"] --> E["Embedding"]
    Q --> T["Tokenize"]
    E --> VS["Vector Search"]
    T --> BM["BM25 Search"]
    VS --> M["Weighted Merge"]
    BM --> M
    M --> R["Top Results"]
  • Vector search finds notes with similar meaning ("gateway host" matches "the machine running OpenClaw").
  • BM25 keyword search finds exact matches (IDs, error strings, config keys).

If only one path is available (no embeddings or no FTS), the other runs alone.

Improving search quality

Two optional features help when you have a large note history:

Temporal decay

Old notes gradually lose ranking weight so recent information surfaces first. With the default half-life of 30 days, a note from last month scores at 50% of its original weight. Evergreen files like MEMORY.md are never decayed.

Enable temporal decay if your agent has months of daily notes and stale information keeps outranking recent context.

MMR (diversity)

Reduces redundant results. If five notes all mention the same router config, MMR ensures the top results cover different topics instead of repeating.

Enable MMR if `memory_search` keeps returning near-duplicate snippets from different daily notes.

Enable both

{
  agents: {
    defaults: {
      memorySearch: {
        query: {
          hybrid: {
            mmr: { enabled: true },
            temporalDecay: { enabled: true },
          },
        },
      },
    },
  },
}

Multimodal memory

With Gemini Embedding 2, you can index images and audio files alongside Markdown. Search queries remain text, but they match against visual and audio content. See the Memory configuration reference for setup.

You can optionally index session transcripts so memory_search can recall earlier conversations. This is opt-in via memorySearch.experimental.sessionMemory. See the configuration reference for details.

Troubleshooting

No results? Run openclaw memory status to check the index. If empty, run openclaw memory index --force.

Only keyword matches? Your embedding provider may not be configured. Check openclaw memory status --deep.

CJK text not found? Rebuild the FTS index with openclaw memory index --force.

Further reading