Skip to content

QMD default memory collection can generate phantom memory-alt-* lookups when only MEMORY.md exists #65913

Description

@shawnduggan

Summary

With memory.backend = "qmd" and memory.qmd.includeDefaultMemory = true, OpenClaw can generate and later search a managed collection for lowercase memory.md even when the workspace only has uppercase MEMORY.md.

That can produce a phantom managed collection lookup like:

Collection not found: memory-alt-main

while QMD itself is otherwise healthy.

Why I think this is a real bug, not bad local state

In this repo checkout there is a concrete source inconsistency around default QMD collection generation:

  • packages/memory-host-sdk/src/host/backend-config.ts:330-333 still declares three default entries:
    • MEMORY.md -> memory-root
    • memory.md -> memory-alt
    • memory/ -> memory-dir
  • src/memory-host-sdk/host/backend-config.ts:337-340 only declares:
    • MEMORY.md -> memory-root
    • memory/ -> memory-dir

So at least one code path in the tree still models lowercase memory.md as a default managed collection, while another does not.

Relevant lines from this checkout:

// packages/memory-host-sdk/src/host/backend-config.ts
const entries = [
  { path: workspaceDir, pattern: "MEMORY.md", base: "memory-root" },
  { path: workspaceDir, pattern: "memory.md", base: "memory-alt" },
  { path: path.join(workspaceDir, "memory"), pattern: "**/*.md", base: "memory-dir" },
];

but:

// src/memory-host-sdk/host/backend-config.ts
const entries = [
  { path: workspaceDir, pattern: "MEMORY.md", base: "memory-root" },
  { path: path.join(workspaceDir, "memory"), pattern: "**/*.md", base: "memory-dir" },
];

There is also a matching test expectation in packages/memory-host-sdk/src/host/backend-config.test.ts:39-42 that still expects memory-alt-main to exist by default.

That matches the failure seen in a real install: published/runtime code can still end up generating or searching memory-alt-* even when lowercase memory.md is absent.

Environment

  • OpenClaw: 2026.4.11 on macOS
  • QMD: 2.1.0
  • install style: global install / gateway restart
  • workspace has MEMORY.md
  • workspace does not have lowercase memory.md
  • memory backend: qmd

Relevant config shape

{
  "memory": {
    "backend": "qmd",
    "qmd": {
      "command": "/opt/homebrew/bin/qmd",
      "includeDefaultMemory": true,
      "sessions": { "enabled": true },
      "limits": { "timeoutMs": 10000 }
    }
  }
}

Repro

  1. Use a workspace containing MEMORY.md and memory/, but no lowercase memory.md
  2. Configure memory.backend = "qmd"
  3. Leave memory.qmd.includeDefaultMemory = true
  4. Restart OpenClaw
  5. Trigger QMD-backed recall or status paths

Actual behavior

OpenClaw can try to use a managed collection named like:

memory-alt-main

for lowercase memory.md, even though that file does not exist.

Observed failure:

Collection not found: memory-alt-main

At the same time, the actual QMD index can still be healthy. In my case the live QMD collections were the expected real ones only:

  • memory-root-main
  • memory-dir-main
  • sessions-main
  • basecamp

with no valid reason for a memory-alt-main lookup.

Expected behavior

If the workspace has MEMORY.md but not lowercase memory.md, OpenClaw should not create, repair, or search a managed memory-alt-* default collection.

More generally, default managed collections should only be generated for paths that are actually part of the active default set.

Current workaround

Disable default-memory auto-generation and declare explicit QMD paths instead:

{
  "memory": {
    "backend": "qmd",
    "qmd": {
      "includeDefaultMemory": false,
      "paths": [
        { "name": "memory-root", "path": "/path/to/workspace", "pattern": "MEMORY.md" },
        { "name": "memory-dir", "path": "/path/to/workspace/memory", "pattern": "**/*.md" }
      ]
    }
  }
}

That avoided the bad default collection resolution and restored working recall on the real path.

Suggested fix direction

The smallest fix seems to be:

  • remove lowercase memory.md from the default QMD collection set wherever it still exists, or
  • at minimum only emit/search memory-alt-* when that file actually exists

But the bigger thing to fix is the duplication drift: the source tree should not have one default-collection definition that includes memory-alt and another that does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions