Repository navigation
Description
Problem
uteke room recall <room_id> currently returns all memories linked to a room sorted chronologically (by joined_at). This is a sequential dump, not a semantic search.
When a room accumulates memories over time (e.g., a Discord thread discussion spanning days), recalling all memories produces signal-to-noise degradation. An agent joining a room with 500+ linked memories gets everything in chronological order — most of which may be irrelevant to their current question.
Current behavior
uteke room recall discord:1514528701109506199
# Returns ALL memories sorted by joined_at ASC
# No semantic filtering. No relevance scoring.Expected behavior
# Semantic recall within room context — hybrid vector + FTS5
uteke room recall discord:1514528701109506199 --query "deployment strategy for v2"
# Returns room memories ranked by semantic relevance to the query
# Uses same RRF hybrid search as `uteke recall`, but scoped to room
# Still supports full dump when no query given (backward compat)
uteke room recall discord:1514528701109506199
# Returns all memories chronologically (unchanged)Why This Matters
1. Room is the foundation for multi-agent orchestration
Rooms (#286) are designed as collaborative memory spaces where multiple agents share context. For orchestration to work, agents need to query room context efficiently, not dump everything.
Consider this flow:
- Agent Kai researches AI news, stores 50 memories in room
news-daily - Agent Zeko needs only the memories about funding rounds to compile a brief
- Without semantic room recall, Zeko gets all 50 memories and must filter client-side — wasting context window tokens
2. Context window economics
Agents have finite context windows. A room with 1000 memories × ~200 chars each = ~200K chars of noise if dumped sequentially. Semantic recall returns only the top-N relevant memories, keeping context focused and accurate.
3. Consistency with existing search capabilities
Uteke already has hybrid search (FTS5 + vector RRF, #250). Room recall is the only retrieval path that doesn't use it. This inconsistency means:
- Global recall (
uteke recall) → hybrid search ✅ - Room recall (
uteke room recall) → sequential dump ❌ - Text search (
uteke search) → FTS5 ✅
Proposed Implementation
Core change: recall_room → recall_room_semantic
In crates/uteke-core/src/memory/rooms.rs, add a new method alongside the existing recall_room:
/// Semantic recall within a room context.
/// Uses hybrid FTS5 + vector search with RRF, scoped to room-linked memories.
pub fn recall_room_semantic(
&self,
room_id: &str,
query: &str,
limit: usize,
author: Option<&str>,
min_score: Option<f32>,
) -> Result<Vec<Memory>, Error>Algorithm:
- Embed the query using
Embedder::embed(query) - Hybrid search (same as
Store::recall_hybrid) but scoped:- Vector: ANN search on memories table, filter
WHERE id IN (SELECT memory_id FROM room_memories WHERE room_id = ?1) - FTS5: FTS match on memories table, same room filter
- Vector: ANN search on memories table, filter
- RRF merge with configurable k (reuse existing
RecallStrategy::Hybrid) - Post-filter by
authorif provided - Return top-N by RRF score
CLI change
Add --query flag to uteke room recall:
RoomCommands::Recall {
room_id: String,
#[arg(long)]
author: Option<String>,
#[arg(long, default_value = "50")]
limit: usize,
// NEW: semantic query
#[arg(long)]
query: Option<String>,
}When --query is provided → use recall_room_semantic. When omitted → use existing recall_room (backward compatible).
MCP server update
Add query parameter to uteke_room_recall MCP tool:
{
"name": "uteke_room_recall",
"input_schema": {
"room_id": {"type": "string"},
"query": {"type": "string", "description": "Semantic search query (optional)"},
"author": {"type": "string", "optional": true},
"limit": {"type": "number", "default": 50}
}
}Dependencies
- None. Uses existing
Embedder, FTS5 infrastructure, and RRF merge from feat: FTS5 hybrid search with Reciprocal Rank Fusion (RRF) #250. - Requires ONNX model to be loaded (same lazy-load pattern as
uteke recall).
Testing
- Unit test: create room with 10 memories, query for specific topic, verify top results are semantically relevant
- Edge case: empty room, room with no matching memories, query with typos
- Performance: room with 1000+ memories should return in <100ms (same as global recall)
Closes
None (new feature)
Activity
feat(#304,#305): semantic room recall + LLM-free room summary
feat(#304,#305): semantic room recall + LLM-free room summary (#309)
ajianaz commentedon Jun 13, 2026
Implemented in PR #314, merged to develop.
sync: main → v0.1.0 (#323)
feat(#304,#305): semantic room recall + LLM-free room summary (#309)