openclaw - 💡(How to fix) Fix QMD Memory Backend: Collection Name Inconsistency Between Gateway and QMD CLI [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#54942Fetched 2026-04-08 01:34:16
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1locked ×1

When configuring OpenClaw to use QMD as the memory backend, there's an inconsistency in collection naming between different components:

  1. OpenClaw Gateway expects collection name: memory-dir-main
  2. QMD CLI creates collection name: memory-main (or vice versa depending on version)

This causes the memory search to fail with "Collection not found" errors.

Error Message

  1. Observe error: Collection not found: memory-dir-main (or memory-main)
  2. Or improve error messages to indicate the expected vs actual collection names

Root Cause

Looking at the code in search-manager-DNBHwaee.js:

{
  path: path.join(workspaceDir, "memory"),
  pattern: "**/*.md",
  base: "memory-dir"  // This generates "memory-dir-main"
}

But QMD may create collections with different naming conventions, causing conflicts.

Fix Action

Workaround

Use builtin memory backend instead of qmd:

{
  "memory": {
    "backend": "builtin"
  }
}

Code Example

{
     "memory": {
       "backend": "qmd",
       "qmd": {
         "includeDefaultMemory": true
       }
     }
   }

---

qmd search 房地 地产 --json -n 3 -c memory-dir-main failed (code 1): 
Collection not found: memory-dir-main

---

{
  path: path.join(workspaceDir, "memory"),
  pattern: "**/*.md",
  base: "memory-dir"  // This generates "memory-dir-main"
}

---

{
  "memory": {
    "backend": "builtin"
  }
}
RAW_BUFFERClick to expand / collapse

Bug Report: QMD Memory Backend Collection Name Inconsistency

Environment

  • OpenClaw Version: 2026.3.23-2 (7ffe7e4)
  • OS: Linux ccisok 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC
  • QMD Version: 2.0.1
  • Installation Method: npm install -g openclaw

Description

When configuring OpenClaw to use QMD as the memory backend, there's an inconsistency in collection naming between different components:

  1. OpenClaw Gateway expects collection name: memory-dir-main
  2. QMD CLI creates collection name: memory-main (or vice versa depending on version)

This causes the memory search to fail with "Collection not found" errors.

Steps to Reproduce

  1. Install QMD: npm install -g @tobilu/qmd
  2. Configure OpenClaw to use QMD backend:
    {
      "memory": {
        "backend": "qmd",
        "qmd": {
          "includeDefaultMemory": true
        }
      }
    }
  3. Start OpenClaw Gateway
  4. Try to use memory search: memory_search tool with any query
  5. Observe error: Collection not found: memory-dir-main (or memory-main)

Expected Behavior

OpenClaw Gateway and QMD should use consistent collection naming, or the collection name should be configurable.

Actual Behavior

Gateway fails to find the collection because of naming mismatch:

qmd search 房地 地产 --json -n 3 -c memory-dir-main failed (code 1): 
Collection not found: memory-dir-main

Root Cause Analysis

Looking at the code in search-manager-DNBHwaee.js:

{
  path: path.join(workspaceDir, "memory"),
  pattern: "**/*.md",
  base: "memory-dir"  // This generates "memory-dir-main"
}

But QMD may create collections with different naming conventions, causing conflicts.

Workaround

Use builtin memory backend instead of qmd:

{
  "memory": {
    "backend": "builtin"
  }
}

Additional Context

  • The issue appears to be related to how scopeCollectionBase() generates collection names
  • Different agents may use different naming patterns (memory-dir-main vs memory-main)
  • The configuration file at ~/.openclaw/agents/{agent}/qmd/xdg-config/index.yml gets overwritten by Gateway on startup

Suggested Fix

  1. Make collection name generation consistent across all components
  2. Or allow users to configure the collection name explicitly
  3. Or improve error messages to indicate the expected vs actual collection names

Labels: bug, memory, qmd Priority: Medium

extent analysis

Fix Plan

To resolve the collection naming inconsistency, we will implement a configurable collection name feature. Here are the steps:

  • Update the OpenClaw configuration to include a collectionName field:
    {
      "memory": {
        "backend": "qmd",
        "qmd": {
          "includeDefaultMemory": true,
          "collectionName": "memory-main"
        }
      }
    }
  • Modify the search-manager-DNBHwaee.js file to use the configured collection name:
    const collectionName = config.memory.qmd.collectionName;
    {
      path: path.join(workspaceDir, "memory"),
      pattern: "**/*.md",
      base: collectionName
    }
  • Update the QMD CLI to respect the configured collection name. If the collection name is not provided, it will default to memory-main.

Verification

To verify the fix, follow these steps:

  1. Update the OpenClaw configuration with the collectionName field.
  2. Restart the OpenClaw Gateway.
  3. Run the memory_search tool with a query.
  4. Check that the collection name in the QMD CLI matches the configured name.

Extra Tips

  • Make sure to update the documentation to reflect the new collectionName configuration option.
  • Consider adding a validation check to ensure that the configured collection name is valid and consistent across all components.
  • If you encounter any issues, check the OpenClaw logs for error messages indicating the expected vs actual collection names.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING