Skip to content

Bug: CLI memory search returns empty results despite embedding model and vector data being correct #30587

@StarMatrixSky

Description

@StarMatrixSky

Bug: CLI memory search returns empty results despite embedding model and vector data being correct

Environment

  • macOS 15.3 (arm64)
  • Node.js 23.11.1 (via nvm)
  • OpenClaw 2026.2.26
  • Memory provider: local (embeddinggemma-300m-qat-Q8_0.gguf)
  • Plugin slot: memory-core

Summary

The CLI command openclaw memory search <query> returns "No matches" even though:

  • ✅ Embedding model loads successfully (768 dimensions)
  • ✅ Vector data is correctly stored (4 chunks indexed)
  • ✅ Vector search works when tested directly via Node.js
  • ❌ CLI search returns empty

Steps to Reproduce

  1. Configure local embedding model:

    {
      "agents": {
        "defaults": {
          "memorySearch": {
            "provider": "local",
            "local": {
              "modelPath": "/path/to/embeddinggemma-300m-qat-Q8_0.gguf"
            }
          }
        }
      }
    }
  2. Index memory files:

    npx openclaw memory index --force
    # Output: Memory index updated (main).
  3. Check status:

    npx openclaw memory status
    # Shows: Indexed: 2/2 files · 4 chunks
    # Vector: ready, Vector dims: 768
    # Batch: disabled (failures 0/2)  ← Problem indicator
  4. Search:

    npx openclaw memory search "test"
    # Output: No matches

Expected Behavior

Should return matching chunks from indexed memory files.

Actual Behavior

Returns "No matches" even for keywords that exist in indexed files.

Diagnosis

I've verified the embedding model works correctly:

// Direct test via Node.js
const { getLlama, resolveModelFile } = await import('node-llama-cpp');
const llama = await getLlama();
const model = await llama.loadModel({ modelPath: resolvedPath });
const context = await model.createEmbeddingContext();
const embedding = await context.getEmbeddingFor('智谱');
console.log(embedding.vector.length);  // 768 ✅

Vector search also works when tested directly with sqlite-vec:

SELECT c.id, c.text, vec_distance_cosine(v.embedding, ?) as distance
FROM chunks_vec v JOIN chunks c ON c.id = v.id
ORDER BY distance ASC
-- Returns correct results ✅

The issue appears to be in the CLI's MemoryManager.search() method:

  • this.provider is not being initialized correctly for CLI commands
  • The code falls into FTS-only mode, but FTS5 is unavailable in Node.js built-in SQLite
  • Result: empty array returned

Workaround

Using memory-lancedb-pro plugin works correctly (different embedding provider).

Related

  • Node.js SQLite doesn't include FTS5 extension (by design)
  • The Batch: disabled (failures 0/2) in status suggests embedding provider initialization failed silently

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions