An OpenClaw owner asks "what did we decide about the trip last month?" and the agent finds nothing; how do you diagnose the miss?
answer
- was it ever written down
- could the agent call the tool
- index status, then a CLI search
- explicit provider fails closed
- rebuild, never delete the database
basics
~20 sConfirm a note from that month exists under memory/, that tool policy allows memory_search and the agent called it, then test the index with openclaw memory status --deep and openclaw memory search, rebuilding with openclaw memory index --force.
solid answer
~40 sWork from the file outwards. First, was the decision ever written? OpenClaw remembers only what is on disk, so look for a `memory/YYYY-MM-DD.md` note from that month; a conversation nobody wrote down is not in memory. Second, could the agent search? The `minimal` and `messaging` tool profiles leave out `group:memory`, and `/verbose on` shows whether `memory_search` was called. Third, is the index healthy? `openclaw memory status --deep` probes the embedding provider and index, and `openclaw memory search "trip" --agent <id>` reproduces the query outside the chat. An explicitly named provider whose key is broken makes search report memory unavailable; an index identity warning after a provider change means `openclaw memory index --force`. Never delete the agent database to reset the index.
code
bash · 4 linesopenclaw memory status --deep --agent main
openclaw memory search "trip" --agent main --max-results 10
openclaw memory index --force --agent main
openclaw memory search "trip" --agent main --jsongo deeper
Recall that OpenClaw only remembers what is written to memory files, so the first check is whether a note from that month exists under memory/.
Explain the path a recalled fact takes: dated note on disk, the index, memory_search to locate it, memory_get to read it, and what openclaw memory status reports at each step.
Diagnose in order: missing note, tool policy without group:memory, provider failing closed, stale or incompatible index, and ranking decay, and rebuild with memory index --force rather than deleting the database.
Decide which recall failures should be fixed in configuration and which in habit, for example promoting standing decisions into MEMORY.md instead of trusting search to find them later.
## The symptom An owner asks about a decision from a month ago and the agent says it has no record. In OpenClaw the curated `MEMORY.md` is in the prompt of a private session, but a month-old decision usually lives in a dated daily note, `memory/YYYY-MM-DD.md`, which the agent must find with `memory_search` and read with `memory_get`. A miss can sit at any step of that path, so diagnose it in order. ## 1. Was it ever written? OpenClaw has no hidden memory: the model remembers only what was saved to files. Look in the workspace's `memory/` folder for notes from the month in question and grep them for the trip. - If nothing is there, the conversation was never noted. The pre-compaction flush and the agent's own habit of writing notes are model behaviour, not guarantees; a short conversation may never have triggered either. - The transcript may still exist. `memory_search` covers transcripts only when they are among its sources, through session indexing or `memory.search.rememberAcrossConversations` (on by default for personal installs without DM isolation); otherwise the agent reaches them with `sessions_search` and `sessions_history`. - Check that the Gateway uses the same workspace on every run. A second workspace after a reinstall or a different agent produces exactly this symptom. ## 2. Could the agent search, and did it? - **Tool policy.** The `coding` profile includes `group:memory` (`memory_search`, `memory_get`); the `minimal` and `messaging` profiles do not. An agent on those profiles cannot search memory until the tools are added, for example with `tools.alsoAllow`. A line in AGENTS.md telling it to search does not grant the tool. - **Did it call the tool?** Turn on `/verbose on` in the chat and ask again; tool summaries show whether `memory_search` ran and what came back. ## 3. Is the index healthy? Reproduce the search outside the conversation: 1. `openclaw memory status --agent <id>` shows index state and provider; add `--deep` to probe the vector store and embedding provider. 2. `openclaw memory search "trip" --agent <id>` runs the same search from the terminal. Note that `--agent` defaults to the default agent, which may not be the agent that owns the chat. 3. If status shows an empty or stale index, or an index identity warning after the embedding provider or model changed, rebuild with `openclaw memory index --force --agent <id>`. 4. With `--json`, a search result carrying `stale: true` is not authoritative; an empty `results` array counts only when `stale` is absent. Never delete the agent's SQLite database or its WAL sidecars to reset memory: that file also holds sessions and transcripts. Use `openclaw memory index --force` to rebuild, or `openclaw memory reset` to clear only the derived index and embedding cache. ## 4. Is the provider failing? | Configuration | When embeddings fail | |---|---| | `memory.search.provider` unset (OpenAI by default) | recall can fall back to keyword ranking | | `provider: "none"` | keyword-only by design | | a remote provider named explicitly | `memory_search` reports memory unavailable | The default OpenAI embeddings need a real API key; signing in with Codex OAuth does not grant embeddings access. Keyword fallback still finds "trip" if the note uses that word, but misses a note that says "the Lisbon plan". ## 5. Is it a ranking miss? Dated notes decay with a 30-day half-life, so last month's note ranks at roughly half its original weight against evergreen files. A tight `minScore` or a low `maxResults` can push it out. A query with a distinctive word from the note (a place name, a date) usually brings it back; if the decision matters, it belongs in `MEMORY.md`, where it is evergreen and injected. ## Preventing the next miss - **Write decisions down on purpose.** Ending a planning conversation with "remember what we decided" produces a note; hoping the agent noticed does not. - **Keep the index healthy after changes.** Any change to the embedding provider, model or sources can make the index incompatible; rebuild deliberately instead of discovering it during a question. - **Pick a provider that will stay reachable.** A remote provider with an expiring key fails closed; a local provider (`memory.search.provider: "local"`) avoids that dependency at the cost of running the embedding model on the host. - **Keep the tool available where recall is expected.** If an agent is supposed to answer questions about the past, its tool policy must include `group:memory`. ## The fix that sticks Once found, ask the agent to record the decision durably. Standing decisions belong in `MEMORY.md`; detail stays in the daily note.
- Why is deleting openclaw-agent.sqlite the wrong way to reset a broken memory index?That database also holds the agent's canonical sessions, transcripts and other durable state, so deleting it or its `-wal`, `-shm` or `-journal` sidecars loses far more than the index. `openclaw memory index --force` rebuilds the derived index, and `openclaw memory reset` clears only the memory-owned index tables and embedding cache, leaving memory files and sessions alone.
- Status shows an index identity warning after you switched embedding providers. What does it mean and what do you run?The stored vectors were built with different provider, model or source settings, so OpenClaw pauses vector search instead of re-embedding everything silently. Confirm the agent's provider and sources with `openclaw memory status --deep --agent <id>`, then rebuild with `openclaw memory index --force --agent <id>`, accepting the embedding cost of the full reindex.
- If the agent cannot find it, the model must have forgotten the conversation.
- Telling the agent in AGENTS.md to search memory is enough when the tool is not allowed.
- Deleting the agent's SQLite database is the clean way to reset memory search.
- An explicitly configured embedding provider quietly falls back to keyword search when it fails.
- openclaw memory search always targets the agent that owns the chat.