Skip to content

Auto-recall hardcodes maxResults: 10, ignoring recall.maxResultsDefault config #1514

@Z710210920

Description

@Z710210920

Problem

The auto-recall feature in the before_prompt_build hook currently hardcodes maxResults: 10 for both local and Hub memory searches:

https://github.com/MemTensor/MemOS/blob/main/apps/memos-local-openclaw/index.ts#L1893-L1896

This means the recall.maxResultsDefault configuration option is effectively ignored during automatic recall, even though users may set it to a lower value (e.g., 3 or 5) to reduce token consumption.

Current Behavior

  • memory_search tool correctly respects maxResultsDefault (default 6)
  • Auto-recall always fetches 10 results from local + 10 from Hub, regardless of config
  • After LLM filtering and deduplication, this still injects ~5-10 memory entries into every system prompt
  • At ~300-500 tokens per entry, this adds ~2,000-5,000 tokens per turn

Expected Behavior

Auto-recall should either:

  1. Read from recall.maxResultsDefault config instead of hardcoding 10, OR
  2. Support a separate recall.autoRecallMaxResults config key for independent control

Suggested Fix

// index.ts ~1893
const recallCfg = ctx.config.recall ?? {};
const autoRecallMax = recallCfg.maxResultsDefault ?? 10;

const arLocalP = engine.search({
  query,
  maxResults: autoRecallMax,
  minScore: 0.45,
  ownerFilter: recallOwnerFilter
});

Environment

  • Plugin version: 1.0.8
  • OpenClaw version: 2026.4.x

Thank you for the excellent plugin!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions