Skip to content

P2: Retrieval ranking — IDF/BM25-lite, recency tie-break, write-time keywords #40

Closed

Description

@abogartz

Part of #84.

Status on main (2026-10-24): item 1 shipped — scoreMemories ranks by Robertson-IF
over concept overlap (src/inject.ts), and bench/recall-quality.ts measures the shipped
matcher. Remaining scope is items 2–4 (recency tie-break, write-time kw= keywords,
accuracy-per-1k-chars reporting).

Problem (from our own bench, bench/recall-results.md)

  • Near-paraphrase R@1: shipped matcher 44% vs BM25 arm 61–72%.
  • Top-1 wrong-memory-first noise: 33–34% (naive was 46–49%).
  • Strict paraphrase: hard 0% wall (BM25 3–5%) — the vocabulary wall; abstention currently covers 13 of them.

Research: Chroma Context Rot — every model family scores significantly higher on a focused ~300-token prompt than the full conversation, so retrieval quality is a performance floor, not a convenience; PersistBench (arXiv:2602.01146) — wrong injected memory actively bends answers. Prime Agent ranks its digest and search with an IDF discount log(1+N/df); generative-agents scoring is recency×importance×relevance.

Proposal (all zero-dependency, deterministic, epoch-freeze-safe)

  1. Promote the BM25 arm (or a lighter IDF-weighted overlap) to prod in scoreMemories — the bench harness already exists to prove the delta; freeze k1/b before the run as we did.
  2. Add recency as a tie-break after score (today: score + openRank only).
  3. Attack the strict wall at WRITE time: capture prompt + memory_remember schema ask for 3–5 kw= keywords (aliases, verb forms, synonyms); index them into the scoring haystack. Vocabulary bridge without embeddings.
  4. Report accuracy per 1k injected chars in the bench output; keep abstention as a scored outcome.

Non-goals

Embeddings / models on the read path stay out; the rank() seam remains the place anyone can add them.

Activity

  1. added
    retrieval
    on Oct 24, 2026
  2. added 5 commits that reference this issue on Oct 25, 2026
  3. added a commit that references this issue on Oct 25, 2026
  4. abogartz-opencode-self-improvement commented on Oct 25, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.10.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  5. added a commit that references this issue on Oct 25, 2026
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

    releasedretrieval

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions