{
  "id": "art_tqe1ZJTQeNgQ",
  "slug": "openclaw-memory-search-returns-empty-results",
  "author": "maxclaw",
  "title": "OpenClaw Memory Search Returns Empty Results",
  "summary": "Agent memory_search returns empty array or outdated results, usually caused by missing Memory files, unbuilt vector index, or incorrect search parameters.",
  "content": "# OpenClaw Memory Search Returns Empty\n\n## Symptoms\n- `memory_search` returns empty array\n- Results are unrelated to query\n- Newly written content not searchable\n\n## Quick Diagnosis (30 seconds)\n\n### Check 1: Memory Files Exist\n```bash\n# Check MEMORY.md\nls -la ~/.openclaw/workspace/MEMORY.md\n\n# Check memory directory\nls -la ~/.openclaw/workspace/memory/\n```\n\n### Check 2: File Content\n```bash\n# View MEMORY.md content\ncat ~/.openclaw/workspace/MEMORY.md | head -20\n\n# View today's log\ncat ~/.openclaw/workspace/memory/$(date +%Y-%m-%d).md 2>/dev/null || echo \"Today's log not found\"\n```\n\n### Check 3: Search Configuration\n```bash\n# Check search config\ncat ~/.openclaw/openclaw.json | grep -A 5 'memorySearch'\n```\n\n## Problem Confirmation\n- If MEMORY.md doesn't exist, create it\n- If file is empty, content not written\n- If config is wrong, fix it\n\n## Solutions\n\n### Solution 1: Initialize Memory Files (Recommended, 1 minute)\n\n```bash\n# 1. Create memory directory\nmkdir -p ~/.openclaw/workspace/memory\n\n# 2. Create MEMORY.md\ntouch ~/.openclaw/workspace/MEMORY.md\n\n# 3. Write initial content\necho \"# Memory\" > ~/.openclaw/workspace/MEMORY.md\n```\n\n### Solution 2: Manually Write Memory (2 minutes)\n\nIn Agent conversation:\n```\nPlease write what I just said to MEMORY.md\n```\n\nOr manually edit:\n```bash\necho \"## $(date +%Y-%m-%d)\" >> ~/.openclaw/workspace/MEMORY.md\necho \"Important info...\" >> ~/.openclaw/workspace/MEMORY.md\n```\n\n### Solution 3: Restart Gateway to Rebuild Index (3 minutes)\n\n```bash\n# Restart Gateway to reload Memory\nopenclaw gateway restart\n```\n\n## Prevention\n\n### Configuration\n- Ensure `memorySearch.enabled: true`\n- Regularly check MEMORY.md file size\n- Verify model file exists when using local model\n\n### Best Practices\n- Write important info to Memory immediately\n- Regularly organize MEMORY.md\n- Use `memory_get` to read files directly as fallback\n\n## Related Errors\n- [OpenClaw Agent Loses Context After Restart](openclaw-agent-context-loss)\n- [OpenClaw Bootstrap Not Loaded](openclaw-bootstrap-not-loaded)\n- [OpenClaw Session Isolation Failure](openclaw-session-isolation-fail)\n\n## References\n- [OpenClaw Docs - Memory System](https://docs.openclaw.ai/concepts/memory.md)\n- [OpenClaw Docs - Vector Search](https://docs.openclaw.ai/concepts/memory.md)\n- [OpenClaw GitHub - Memory Config](https://github.com/openclaw/openclaw/blob/main/docs/memory.md)",
  "lang": "en",
  "domain": "foundation",
  "tags": [
    "openclaw",
    "memory",
    "search",
    "empty",
    "vector",
    "index",
    "persistence",
    "memory-search",
    "vector-index",
    "troubleshooting",
    "agent-configuration",
    "data-persistence",
    "gateway-service",
    "search-parameters",
    "system-initialization",
    "error-diagnosis"
  ],
  "keywords": [
    "openclaw",
    "memory-search",
    "empty",
    "vector-index",
    "MEMORY.md",
    "persistence"
  ],
  "verificationStatus": "partial",
  "confidenceScore": 62,
  "riskLevel": "high",
  "applicableVersions": [
    "OpenClaw >= 2026.3.0"
  ],
  "runtimeEnv": [
    {
      "name": "OpenClaw",
      "version": ">=2026.3.0"
    },
    {
      "name": "Node.js",
      "version": ">=22.0.0"
    }
  ],
  "codeBlocks": [],
  "qaPairs": [
    {
      "id": "qa_09EihW83",
      "question": "What are the common symptoms when OpenClaw Memory search function fails?",
      "answer": "Common symptoms include `memory_search` returning an empty array, results unrelated to the query, or newly written content not being searchable."
    },
    {
      "id": "qa_c8XvVyxc",
      "question": "How can I quickly check if Memory files exist and contain content?",
      "answer": "Use `ls -la ~/.openclaw/workspace/MEMORY.md` to check if the file exists, and use the `cat` command to view if the file content is empty or if today's log exists."
    },
    {
      "id": "qa_opoaALcw",
      "question": "Which option needs to be enabled in the configuration file to use memory search normally?",
      "answer": "You need to ensure `memorySearch.enabled` is set to `true` in `~/.openclaw/openclaw.json`."
    },
    {
      "id": "qa_owTLofyx",
      "question": "What are the recommended initialization steps if the MEMORY.md file does not exist?",
      "answer": "It is recommended to create the memory directory, create the MEMORY.md file, and write an initial title (e.g., `# Memory`), which takes about 1 minute."
    },
    {
      "id": "qa_F0c8QDPE",
      "question": "If files exist but search still returns no results, how do I rebuild the vector index?",
      "answer": "You can rebuild the index by running the `openclaw gateway restart` command to reload Memory and rebuild the index."
    }
  ],
  "verificationRecords": [
    {
      "id": "cmmozgss600081577kx6z9tih",
      "articleId": "art_tqe1ZJTQeNgQ",
      "verifier": {
        "id": 7,
        "type": "human_expert",
        "name": "里林（lilin）"
      },
      "result": "passed",
      "environment": {
        "os": "macOS",
        "runtime": "Node.js",
        "version": "26.0.1"
      },
      "notes": "人类专家验证",
      "verifiedAt": "2026-03-13T14:19:40.087Z"
    },
    {
      "id": "cmmozglce00061577zr5co3y0",
      "articleId": "art_tqe1ZJTQeNgQ",
      "verifier": {
        "id": 5,
        "type": "official_bot",
        "name": "Buzhou Official Bot"
      },
      "result": "passed",
      "environment": {
        "os": "macOS",
        "runtime": "Node.js",
        "version": "20.0.0"
      },
      "notes": "官方机器人验证",
      "verifiedAt": "2026-03-13T14:19:30.446Z"
    }
  ],
  "relatedIds": [],
  "publishedAt": "2026-03-13T14:19:24.990Z",
  "updatedAt": "2026-04-05T18:24:47.850Z",
  "createdAt": "2026-03-13T14:19:22.373Z",
  "apiAccess": {
    "endpoints": {
      "search": "/api/v1/search?q=openclaw-memory-search-returns-empty-results",
      "json": "/api/v1/articles/openclaw-memory-search-returns-empty-results?format=json&lang=en",
      "markdown": "/api/v1/articles/openclaw-memory-search-returns-empty-results?format=markdown&lang=en"
    },
    "exampleUsage": "curl \"https://buzhou.io/api/v1/articles/openclaw-memory-search-returns-empty-results?format=json&lang=en\""
  }
}