# OpenClaw Memory System
The memory system is [[OpenClaw]]'s answer to "the agent should remember things across conversations." It stores memory as plain Markdown files in the agent's workspace, keeps a curated long-term file, and provides agentic tools so the model itself can search, recall, and persist.
The headline design choice: **memory is not a vector database, it's a folder of Markdown.** Vector search is layered on top, but the source of truth is human-readable files the operator can inspect, edit, version-control, and back up.
## Two Tiers
- **Daily memory**: `memory/YYYY-MM-DD.md`
- Append-only daily log
- Today's and yesterday's entries auto-loaded into context
- Captures running thread of recent activity
- **Long-term memory**: `MEMORY.md`
- Curated, durable knowledge about the user, project, conventions
- Loaded only in **main / private** sessions ; not in group/sandboxed contexts to limit leakage
Both files live inside the agent's workspace (`~/.openclaw/agents/<agentId>/`), so each isolated agent has its own memory ; consistent with the [[OpenClaw Multi-Agent Routing|multi-agent routing]] model.
## Agentic Tools
The agent has direct tool access:
- `memory_search` ; semantic recall across indexed snippets
- `memory_get` ; targeted file read by path
This means the model itself decides when to look something up; memory is not pre-stuffed into every prompt.
## Auto-Persist on Compaction
Before context compaction, OpenClaw runs a **silent agentic turn** that prompts the model to identify and persist durable memories. The user never sees this turn ; it just happens, on the way to the compaction step. The result is that important facts surface from long sessions into MEMORY.md without manual curation.
## Vector Search Layer
The retrieval engine is hybrid:
- **BM25** lexical scoring (classic term matching)
- **Vector** embeddings (semantic similarity)
- **MMR** (Maximal Marginal Relevance) re-ranking for diversity
- **Temporal decay** so older snippets fade unless reinforced
Embedding providers are pluggable: OpenAI, Gemini, Voyage, Mistral, [[Ollama]], local GGUF. Pick whatever matches the privacy/cost posture you want; local GGUF keeps everything inside the host.
## Pluggable Memory Engines
Beyond the default builtin engine, the docs reference:
- **Honcho memory** ; third-party provider
- **QMD memory engine** ; specialized storage format
Memory engines are plugins ; install via `openclaw plugins install`, then set the active engine in config.
## Why Plain Files Win
Compared to a vector-DB-only approach:
- **Inspectable**: open in any editor, diff in `git`
- **Migratable**: copy a folder, you've moved memory
- **Backup-trivial**: it's `tar` + your normal backup pipeline
- **Recoverable**: vector index can be rebuilt from the source files
The vector layer accelerates retrieval; it never owns the truth.
## References
- Memory overview: https://docs.openclaw.ai/concepts/memory
## Related
- [[OpenClaw]]
- [[OpenClaw Multi-Agent Routing]]
- [[OpenClaw Sub-Agents]]
- [[Claude Code Memory]]