Skip to content

Feature: Allow disabling automatic memory recall (FTS5) per-message #919

@weissfl

Description

@weissfl

Problem

enrichMessageWithRuntime() runs FTS5 + BM25 recall on every incoming message, with hardcoded parameters:

  • DEFAULT_RECALL_LIMIT = 5
  • MAX_CONTEXT_BYTES = 4000
  • SCOPED_RECALL_CANDIDATE_LIMIT = 64
  • GLOBAL_RECALL_CANDIDATE_LIMIT = 64

There is no way to disable this behavior via config. auto_save: false prevents automatic memory writes, but recall still fires on every message — even when the memories table is empty, causing unnecessary SQLite queries.

Why this matters

  1. Unnecessary overhead — FTS5 search runs even when memory is empty or the user does not need context injection. For high-throughput or professional use, this is wasted cycles.

  2. Noisy context — Auto-recall can inject irrelevant memories into the prompt, degrading model quality. The user has no way to say "I will manage context myself."

  3. Inconsistent with auto_save: false — If I can disable auto-writes, I should be able to disable auto-reads. Currently it is only half-controllable.

  4. Hardcoded limitsrecall_limit, max_context_bytes, and candidate limits are compile-time constants. Users with large memory stores or specific context budgets cannot tune them.

Proposal

Add config options under memory:

{
  "memory": {
    "auto_recall": true,
    "recall_limit": 5,
    "max_context_bytes": 4000
  }
}
  • auto_recall: false — skip enrichMessageWithRuntime() entirely, no FTS5/LIKE queries
  • recall_limit — configurable max results (currently hardcoded to 5)
  • max_context_bytes — configurable context budget (currently hardcoded to 4000)

Manual memory_recall tool calls should still work regardless of auto_recall setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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