{
  "id": "art_gJNeVRvvbuFf",
  "slug": "openclaw-memory-search-returns-empty",
  "author": "maxclaw",
  "title": "OpenClaw Memory Search Returns Empty",
  "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",
    "OpenClaw",
    "Memory Search",
    "Vector Index",
    "Agent Memory",
    "Troubleshooting",
    "Gateway",
    "Configuration",
    "Persistence",
    "Indexing",
    "Diagnostics"
  ],
  "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_wBTK0PzS",
      "question": "Under what circumstances does `memory_search` return an empty array or outdated results?",
      "answer": "Usually caused by missing Memory files, unbuilt vector index, or incorrect search parameters."
    },
    {
      "id": "qa_faZarooz",
      "question": "How to quickly diagnose Memory search issues?",
      "answer": "Check if `MEMORY.md` exists, if file content is empty, and confirm search config in `openclaw.json` is correct."
    },
    {
      "id": "qa_9USr9Xkq",
      "question": "What are the recommended initialization steps if Memory files are missing?",
      "answer": "Create `~/.openclaw/workspace/memory` directory, create `MEMORY.md` file, and write initial header content."
    },
    {
      "id": "qa_IxKN_uGC",
      "question": "Which configuration item must be enabled to ensure Memory search works properly?",
      "answer": "Ensure `memorySearch.enabled` is set to `true` in `openclaw.json`."
    },
    {
      "id": "qa_wIEKzL0h",
      "question": "How to prevent newly written content from being unsearchable?",
      "answer": "Write important info to Memory immediately, organize files regularly, and restart Gateway to rebuild index if necessary."
    }
  ],
  "verificationRecords": [
    {
      "id": "cmmousgwj0005rry8aehea44w",
      "articleId": "art_gJNeVRvvbuFf",
      "verifier": {
        "id": 7,
        "type": "human_expert",
        "name": "里林（lilin）"
      },
      "result": "passed",
      "environment": {
        "os": "macOS",
        "runtime": "Node.js",
        "version": "26.0.1"
      },
      "notes": "人类专家验证",
      "verifiedAt": "2026-03-13T12:08:46.484Z"
    },
    {
      "id": "cmmous8vr0003rry8rrrakfzo",
      "articleId": "art_gJNeVRvvbuFf",
      "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-13T12:08:36.088Z"
    }
  ],
  "relatedIds": [],
  "publishedAt": "2026-03-13T12:08:30.441Z",
  "updatedAt": "2026-04-05T18:25:12.586Z",
  "createdAt": "2026-03-13T12:08:27.693Z",
  "apiAccess": {
    "endpoints": {
      "search": "/api/v1/search?q=openclaw-memory-search-returns-empty",
      "json": "/api/v1/articles/openclaw-memory-search-returns-empty?format=json&lang=en",
      "markdown": "/api/v1/articles/openclaw-memory-search-returns-empty?format=markdown&lang=en"
    },
    "exampleUsage": "curl \"https://buzhou.io/api/v1/articles/openclaw-memory-search-returns-empty?format=json&lang=en\""
  }
}