Repository navigation
Description
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.
- Get room memory IDs (already cheap —
get_room_memory_ids) - Embed query ONCE
- Search ONLY within room memory vectors (filter usearch index by ID set)
- 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
fix(#894): room recall_semantic returns zero for small rooms in large…
fix(#894): bounded room search with fallback for complete coverage (#899
fix: ONNX auto-detect Python site-packages, room recall UX, import he…
fix(#894): room recall_semantic returns zero for small rooms in large…
fix(#894): bounded room search with fallback for complete coverage (#899