# Memory OpenClaw's memory system uses plain Markdown in the agent workspace as the foundational approach. Files serve as the authoritative source rather than RAM-based storage. ## Memory File Structure The system organizes information across two layers: ### Daily logs (`memory/YYYY-MM-DD.md`) Append-only daily entries, with today's and yesterday's files loaded at session start. ### Long-term memory (`MEMORY.md`) Curated persistent information, loaded only in private sessions. ## Writing to Memory Recommended storage patterns: - **Decisions, preferences, and durable facts** go to `MEMORY.md` - **Ephemeral notes and contextual information** in daily logs - **Explicit requests to remember something** should be written immediately ## Automatic Memory Management When sessions approach token limits, OpenClaw triggers a silent agentic turn prompting memory consolidation before context compaction occurs. This flush mechanism can be configured via `agents.defaults.compaction.memoryFlush` settings: ```json5 { agents: { defaults: { compaction: { memoryFlush: { enabled: true, softThresholdTokens: 4000, prompt: "...", systemPrompt: "..." } } } } } ``` ## Search Capabilities The system supports vector-based semantic search across memory files, with configurable backends including: | Backend | Description | |---------|-------------| | Built-in SQLite | Optional vector acceleration | | QMD sidecar | Local-first search combining BM25 + vectors + reranking | | Hybrid search | Merges both keyword and semantic signals | ### Tools - `memory_search` - Semantic queries across memory files - `memory_get` - Direct file retrieval