Skip to content

fix: room recall_semantic top-200 cap kills small rooms in large DBs #894

Closed

Description

@ajianaz

Bug

room recall <room> "query" returns 0 results for small rooms (<25 memories) in databases with many memories (2,486+). Semantic search is completely broken for the majority of rooms.

Reproduction

# Production DB: 2,486 memories, 74 rooms
uteke room recall codecora-marketing "positioning"
# → No matching memories found in room codecora-marketing.
# (min_score threshold: 0.30)

uteke room recall codecora-marketing "positioning" --min 0.0
# → No matching memories found in room codecora-marketing.

# But chronological recall shows 14 memories exist:
uteke room recall codecora-marketing
# → Found 14 memory/memories (including literal "POSITIONING" text)

Root Cause

recall_room_semantic in crates/uteke-core/src/rooms.rs:92-104:

// Cap at 200 to prevent unbounded searches for large rooms (#546).
let fetch_limit = (effective_limit * 5).min(200).max(effective_limit);
let results = self.recall_hybrid(query, fetch_limit, ...)?;
// Then post-filter to room member IDs...

Strategy: Global hybrid search → take top 200 → filter to room members.

Problem: In a 2,486-memory DB, 14 room memories almost never appear in the global top 200 for any query. The post-filter discards everything.

Impact Matrix (from E2E test)

Room Memories Semantic Result Why
hermes-skills 272 ✅ 1 result Large enough to appear in top 200
cora-code 20 ❌ 0 Too small
codecora-marketing 14 ❌ 0 Too small
server-infra 3 ❌ 0 Too small
uteke-dev 1 ❌ 0 Too small

5/74 rooms (6.5%) can use semantic recall. The other 93.5% get zero results.

Proposed Fix

Flip strategy: Room-first search instead of global-then-filter.

  1. Get room memory IDs (already cheap — get_room_memory_ids)
  2. Embed query ONCE
  3. Search ONLY within room memory vectors (filter usearch index by ID set)
  4. Score and rank

This is both faster (search smaller set) AND correct (no cap needed).

Alternative: if recall_hybrid cannot accept ID filters, raise the cap from 200 to total_memories (unbounded) for room recall — the room ID set is already bounded. Trade-off: slower for very large DBs, but correct.

Environment

  • Uteke v0.13.0 (develop)
  • 2,486 memories, 74 rooms, 34.8MB DB
  • Oracle ARM (Ampere A1)

Activity

  1. added
    bug
    scope:core
    priority:high
    on Aug 5, 2026
  2. added a commit that references this issue on Aug 5, 2026
  3. added a commit that references this issue on Aug 5, 2026
  4. added 3 commits that reference this issue on Aug 13, 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

    bugpriority:highscope:core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions