Skip to content

Add importance-weighted and recency-boosted recall scoring #8

Description

@hd719

Problem

Recall ranking is purely based on vector similarity (L2 distance → inverse similarity). This means:

  • A low-importance auto-captured message can outrank a high-importance explicitly stored memory
  • A 6-month-old fact ranks equally with yesterday's preference update
  • No way to prioritize recent or important memories

Proposal

Implement a composite scoring function:

finalScore = (similarityWeight * similarity) + (importanceWeight * importance) + (recencyWeight * recencyDecay)

Where:

  • recencyDecay = exponential decay based on age (e.g., half-life of 30 days)
  • Weights are configurable with sensible defaults (e.g., 0.6 / 0.2 / 0.2)

Implementation

  • Compute composite score after LanceDB vector search returns candidates
  • Re-sort by composite score before returning
  • Add config for weights and recency half-life
  • Keep pure similarity as a fallback mode

Impact

Significantly improves recall quality for long-running assistants where memory accumulates over weeks/months.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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