Skip to content

Omni Search: one search for Cmd+K and the @ menu #4095

Open

Description

@sentry-junior

Cmd+K already searches most sources, but each source has its own match rule, and several of these rules cannot use an index. Omni Search is one indexed search, with prefix match while the person types, that Cmd+K and the composer @ menu share. A new source, such as Memories under @, is then added one time for both.

Current behavior

Commit ae8bc50. Cmd+K is CommandPaletteDialog.tsx and paletteDirectories.ts.

Source Cmd+K @ menu Server match
Pages, actions (navPages.ts) Client – –
Conversations Client (feed) + server Server english tsvector, ILIKE '%q%' on title, vector similarity
Inbox items Client (cached list) + server – ILIKE '%q%' on title and body, no text index
Automations Client (first 100) + server – strpos(lower(concat_ws(…))), no index
Memories Server – ILIKE '%term%' on content, no index that it can use
People Client (full directory) Server simple prefix, term:* (people/search.query.ts)
Pull requests (Changes) Open repository page only # menu, server simple prefix (code/search.query.ts)
Locations, Repositories, Runs, Events Client (loaded list or history) Channels in # –
Plugin pages Server, one read for each page – Each page's own rule
Tasks, files of the open Conversation – Client –
To-dos – – No read across Conversations

Gaps:

  • Each debounced query in Cmd+K starts one server read for each source: Conversations, Inbox items, Automations, Memories, the open repository's Conversations, and each plugin page. The count grows with each plugin page.
  • The dashboard memory search uses ILIKE '%term%', which cannot use an index. The indexed search_vector uses english, so it stems words. A half-typed word, such as deplo, does not match deployment.
  • To-dos have no search. The only read is the To-dos of one Conversation (requireConversationTodos). The table has only its primary key (conversation_id, id).
  • People match on the client in Cmd+K, but on the server with prefix match in @. The same text can give different rows.

Proposal

Goal. One server search that Cmd+K and @ share. Each caller names the sources it wants.

Sources. Conversations, Inbox items, Automations, Memories, To-dos, People, and Pull requests. Pages, actions, and the lists of the open page stay on the client.

Access. Each source returns only the rows that its own page shows to the viewer:

  • Conversations: the Conversation access rules (policies/conversation-access.md).
  • Inbox items: the viewer's own Inbox (forViewer).
  • Automations: the Automations that the viewer owns or that are shared to the viewer, as the Automations list does.
  • Memories: public, active memories (activeMemoryPredicate).
  • To-dos: only when the viewer has canViewPrivateContent on the To-do's Conversation. Other viewers get redacted titles today, so a match on a title must not show that the To-do exists.

Server shape. Recommended: one route, such as GET /api/search?q=&sources=.

  • One request for each debounced query. The route runs the sources in parallel (Promise.all over a fixed list) and returns one group for each source, each with a constant cap.
  • While the person types, use prefix match: a simple tsvector and term:* joined with &, as People and Pull requests do now. Each source gets a GIN expression index on its title text, partial where the access rule allows (for example, public, active memories).
  • The existing english full-text and vector searches stay on each page's own search.
  • Budgets (policies/performance.md): expectSqlBudget, expectNoFullScan, and expectResponseBudget on the route. Add an e2e request budget for one typed query in Cmd+K.

Alternative: one prefix route for each source. It is simpler to own, but Cmd+K keeps one request for each source.

Order.

  1. Memories. Its ILIKE '%term%' scan grows with the table, and it is the next source for @.
  2. Inbox items and Automations, which also have no index.
  3. To-dos, the one source that Cmd+K does not search.

Ranking and grouping.

  • In a group: a match at the start of the title, then a word start in the title, then other text. Equal matches sort by most recent activity.
  • Groups: the open page's group comes first, as now. Then the group with the best match. The client keeps quickOpenMatch only for the highlight.
  • Rows that the client already shows, such as feed Conversations, are not shown two times.

Open questions

  • Do plugin pages join through a provider-neutral plugin search contract, or do they keep their own reads?
  • Which To-dos: open ones only, or also the To-dos assigned to the viewer that are closed?
  • Which sources does @ use? Memories and Automations do not have a composer reference type yet.
  • Do Inbox item bodies and Automation instructions get prefix match, or only their titles?

via @BYK.

--

View Session [Sentry]

Activity

  1. sentry-junior commented on Nov 23, 2026

    @sentry-junior
    ContributorAuthor

    Revised direction for step 2 (Inbox items and Automations on /api/search), per BYK:

    • Body text stays. Cmd+K keeps matching what it matches today: Inbox item titles and bodies, and Automation titles, instructions, skills, and event triggers (and a pasted Automation id). Each source gets a simple-config GIN index on a weighted document, so a title match ranks above a body match, and a word prefix matches while the person types.
    • One ranking, shared with memory recall. Each source filters with its index, keeps a capped window of the newest matches, and ranks it with ts_rank_cd, the same way memory recall does. A shared module in packages/junior/src/search/ fuses the ranks of each match leg with reciprocal rank fusion. Memory recall's rankMemoryMatches now uses the same function.
    • Fuzzy matching. pg_trgm adds a typo-tolerant title leg, indexed with gin_trgm_ops, so a missing letter in a longer word still finds the title.
    • Shaped for a future agent tool. The search runs in one function, outside the HTTP route. Each source applies its own page's access rule there, so an Omni Search tool for Junior can call the same function later. This step does not build the tool.

    Embeddings (the vector leg) for Inbox items and Automations stay for a follow-up. They need an embedding pipeline and a backfill for each source.

  2. sentry-junior commented on Nov 23, 2026

    @sentry-junior
    ContributorAuthor

    Step 2 PR: #4106 (Inbox items and Automations on /api/search, with body text, the shared ranking, and fuzzy title matching).

  3. sentry-junior commented on Nov 23, 2026

    @sentry-junior
    ContributorAuthor

    Memories joined #4106 as a third source of /api/search, so Cmd+K now reads Inbox items, Automations, and memories with one request. The memories source reuses memory recall's own search: the lexical ts_rank_cd and pgvector legs fused by rankMemoryMatches, with recall's vector cutoff, plus word-prefix matching for typed text. It reads active public memory only, as the Memories page does. #4099 stays parked; its separate /api/memory/search route and index are not needed.

  4. sentry-junior commented on Nov 23, 2026

    @sentry-junior
    ContributorAuthor

    To-dos step: #4113 adds To-dos as a source of /api/search. Open and in-progress To-dos show in a To-dos group in Cmd+K. Done and dropped ones show under Done, after closed Inbox items. A To-do shows only when the viewer can see its Conversation's private content. It uses the shared prefix + trigram matching and fused ranking, with new title GIN indexes.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions