Skip to content

feat(recall,search,mcp): return the rooms a memory belongs to with each hit - #1706

Merged
ajianaz merged 2 commits into
developfrom
feat/rooms-in-recall-results
Nov 10, 2026
Merged

ajianaz merged 2 commits into
developfrom
feat/rooms-in-recall-results

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

What

Each memory hit of recall, search and room recall (with a query) now carries an optional rooms list of {room_id, room_name}: the rooms its memory belongs to, sorted by room id, omitted when the memory is in no room. It is on POST /recall, POST /search, POST /room/recall, the MCP tools uteke_recall, uteke_search and uteke_room_recall, and the CLI (JSON, plus a Rooms: line in the human output), in the plain, unified, --pack and --explain forms.

Why

A hit did not say which room(s) its memory lives in, so an agent that found a memory through a global recall could not follow up with room recall. A memory can be in several rooms (room link), so it is a list. Closes #1703.

Blocked on the contract: /recall, /search and /room/recall are CORE. The change is an additive response field, but AGENTS.md requires a uteke-cloud contract issue first (the tracker is Gitea). The owner posts it; a draft is in the uteke document uteke-contract-draft-rooms-in-recall-1703 (room uteke). Do not merge before it is answered.

How

  • uteke-core: RoomRef; rooms on SearchResult and UnifiedSearchResult (omitted from the JSON when empty); an id-scoped Store::room_refs_for_memories (one query per 400 ids, unlike room_ids_by_memory, which reads the whole table); Uteke::attach_rooms*.
  • run_recall, search and the room semantic recall attach the rooms to the FINAL list, after the ranking, the cut to limit and the recall cache. Order and scores are unchanged, and a cached hit never reports an old membership. The Memory struct is not touched (it is constructed in about 30 files).
  • A room recall without a query (the chronological list) is unchanged: every item is in the room asked for.
  • MCP text output gets a (rooms: ...) line and the CLI human output a Rooms: line, only for a memory in a room, so existing output is unchanged.
  • docs/api-reference.md and docs/core-contract.json regenerate without a diff (responses are not in the registry).

Testing

  • cargo test --workspace passes (1661 passed, 0 failed locally; CI green on this head after one re-run of the Test job, whose only failure was a stdin write race in the unrelated connect_hooks test)
  • cargo fmt --all -- --check passes
  • cargo clippy --workspace --all-targets -- -D warnings passes
  • Cora review run locally (the cora binary is not available in this environment; the CI Cora Review covers it: no issues found)
  • Manual smoke-test of the affected feature (not done: needs the embedding model; covered by the tests below)

New tests: rooms on plain, unified, pack and explain hits; order and scores identical to a recall without the lookup; the field omitted when empty and listed otherwise; a cached recall reports the new membership; blank-title fallback and sort by id; more ids than one query holds; keyword search, room recall and room pack; and an isolation test that a scoped hit never shows the other namespace's room.

Not run: the fast50 benchmark (it needs the LongMemEval dataset). The ranking code is not touched, and the lookup is one indexed query for the returned ids only.

Related Issues

Closes #1703. Related: #1702, #1704 (stacked on this).

Checklist

  • Branch name follows convention (fix/, feat/, docs/, chore/, refactor/, test/, perf/, security/)
  • Branch is from develop
  • Commit messages follow Conventional Commits
  • No secrets or credentials committed
  • One logical change per PR (no mixed concerns)

@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

…ch hit (#1703)

A hit did not say which room(s) its memory lives in, so an agent that found a
memory through a global recall could not follow up with `room recall`. Each
memory hit of recall, search and room recall (with a query) now carries an
optional `rooms` list of `{room_id, room_name}` (the room title, or the id when
it has none), sorted by room id and omitted when the memory is in no room. A
memory can be in several rooms, so it is a list.

- uteke-core: `RoomRef`, `rooms` on `SearchResult` and `UnifiedSearchResult`,
  an id-scoped `Store::room_refs_for_memories` (chunked, one query per 400 ids,
  unlike `room_ids_by_memory` which reads the whole table) and
  `Uteke::attach_rooms*`. `run_recall`, `search` and the room semantic recall
  attach them to the final list, after the ranking, the cut to `limit` and the
  recall cache, so order and scores are unchanged and a cached hit never
  reports an old membership.
- MCP and CLI: a `(rooms: ...)` line under a hit in the MCP text output and a
  `Rooms:` line in the human CLI output; the JSON carries the field.
- Tests: rooms per variant (plain, unified, pack, explain), unchanged order and
  scores, omitted when empty, blank-title fallback, more ids than one query
  holds, room recall and pack, and an isolation test that a scoped hit never
  shows the room of the other namespace.
- docs/rooms.md and the CHANGELOG describe the field. It is an additive
  response field on CORE endpoints; the uteke-cloud contract issue must be
  answered before this merges.
The finding-the-right-room section said a recall hit does not say which room
it came from. It now does: step 1 notes the rooms field, and the closing
paragraph only keeps the missing room search (#1704).
@ajianaz
ajianaz force-pushed the feat/rooms-in-recall-results branch from bb47168 to 08f1cf2 Compare November 10, 2026 01:39
@ajianaz
ajianaz merged commit 3bcaa53 into develop Nov 10, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(recall,search,mcp): return the rooms a memory belongs to in recall, search and room recall results

2 participants