Skip to content

[Feature]: Add keyword fallback for memory_search when node:sqlite is unavailable #93150

Description

@rrrrrredy

Summary

Fresh follow-up for the stale-closed #59451.

The short-term UX fix is now handled separately by #69199: classify node:sqlite failures and return an actionable unavailable payload. This issue is for the longer-term capability fallback: keep memory_search useful when SQLite-backed search cannot initialize.

Current Reproduction

On a downlevel runtime, node:sqlite is unavailable:

$ node -e "try { require('node:sqlite'); console.log('node:sqlite available'); } catch (error) { console.log(error.code + ': ' + error.message); }"
ERR_UNKNOWN_BUILTIN_MODULE: No such built-in module: node:sqlite

OpenClaw currently requires Node.js >=22.19.0, and Node.js 24 is the recommended path. That is the right primary remediation, but constrained/containerized runtimes can still leave memory recall fully unavailable.

Requested Behavior

When vector memory search cannot initialize because node:sqlite is unavailable, memory_search should fall back to a small file-based keyword search path instead of returning only an unavailable response.

A minimal first scope would be:

  • Search MEMORY.md and memory/*.md / equivalent local memory corpus files.
  • Return bounded snippets with file paths and line ranges when possible.
  • Mark results as fallback keyword results so users/agents do not confuse them with vector search.
  • Respect existing maxResults behavior as closely as practical.
  • Avoid embedding/provider calls and avoid requiring new gateway APIs.

Out of Scope

Acceptance Criteria

  • A missing node:sqlite runtime can still return basic keyword hits from memory files.
  • The response clearly advertises fallback mode in debug/metadata.
  • Existing vector-search behavior remains unchanged when SQLite-backed search is available.
  • Fallback search is bounded and does not scan arbitrary files outside the configured memory corpus.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions