Skip to content

feat(mcp): hybrid conversation search and literal transcript search - #25527

Merged
Git-on-my-level merged 26 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/mcp-search
Nov 16, 2026
Merged

Git-on-my-level merged 26 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/mcp-search

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Why

Agents (ChatGPT, Claude, assistants that sync Omi into their own knowledge repositories) often ask about something said in passing: a name, a number, a phrase. Hosted MCP search could not find these:

  • search_conversations read summary vectors only. The keyword index (titles, overviews) ran only when the vectors returned nothing, so one semantic hit hid every exact keyword match.
  • Nothing searched transcript text. Conversations v3's two-hour windows make summaries leave out more detail.
  • In-app chat already has a bounded literal transcript scan. MCP did not.

What changes

search_conversations:

  • Hybrid. Summary vectors and the keyword index are asked on every call. Ids both found rank first, then the two alternate, so neither crowds the other out. Stale index ids get one bounded second hydration, which uses at most two batch reads.
  • match_basis on every card lists which of summary, keyword and transcript matched. Only match_snippets quote the transcript.
  • segment_index on every snippet is the get_conversation_by_id offset to read around it (feat(mcp): outline-first, offset and lines reads, and conversation state on cards #25497).
  • Truthful coverage. search_coverage is summary_vectors_and_keyword, summary_vectors_only or keyword_only, and unavailable_indexes names what could not be asked. With one index down, search still answers. No hits with the keyword index down stays the existing actionable 503.

search_transcripts (new tool, conversations.read):

  • Finds literal words or a short phrase in saved transcripts. It reuses the owner- and query-bound scan that chat transcript recall uses (database.transcript_search): no derived index, at most 50 records and 4 seconds per call, newest first, and a signed cursor that resumes after the last record examined.
  • conversation_id scopes the search to one conversation, to find where something was said in a long one.
  • Each hit carries segment_index, segment_id, speaker and time. A conversation shows at most 5 hits, with more_hits when there are more.
  • Locked, discarded, deferred and unreadable records are never quoted. A miss is never presented as absence, and partial coverage says so (complete, examined, unreadable, search_coverage).

The developer search route reports the same truthful coverage. The server instructions mention search_transcripts, and the tools docs and introduction table are updated.

Tests

New backend/tests/unit/test_mcp_search_hybrid.py, 15 cases:

  • merge order;
  • a semantic hit no longer hides title matches;
  • one index down, and no hits with keyword down;
  • a snippet segment_index round-trips into an offset read;
  • a passing mention in a 1,300-segment conversation is located to its segment;
  • the cursor resumes after the last examined record;
  • locked, discarded, deferred and unreadable records are never quoted;
  • the hit cap;
  • the single-conversation scope;
  • argument errors;
  • a bad cursor versus a scan outage.

New backend/tests/unit/test_mcp_agent_journeys.py chains real tool calls over a synthetic store the way an agent would, and checks every response against its advertised output schema and the 120,000-character response budget:

  • "what did we decide about the budget": search, outline, then read only the cited section in lines;
  • "when was the Series A mentioned": search_transcripts finds a phrase said once in a 1,400-segment conversation, then an offset read around it;
  • every segment of a long conversation is reached exactly once by following next_cursor;
  • a day listing tells background media from conversations before reading, and the batch read lists what does not fit in next_ids instead of shrinking it.

If a tool stops leading to the next one (an id, a section, a segment index, a cursor), a journey breaks even when each tool's own tests pass.

Existing recall tests are updated for always-on keyword search. All 55 backend unit files matching mcp, developer_read or transcript_search pass one process per file on the merged branch.

UI-Evidence: none -- backend MCP tools and docs only; no rendered UI changes.

Release

Default-on. The change is additive:

  • the response fields are new;
  • the new tool is read-only;
  • ranking now adds keyword hits alongside semantic ones.

Cost: one keyword-index query per search, which in-app chat already makes on every search. Its timeout is bounded at 5 seconds, and it runs sequentially after the vector query. search_transcripts reads up to 50 conversations per call under a 4-second budget, the same budget chat uses.

Rollback is reverting this PR.

Not verified:

  • live ranking quality;
  • keyword latency in production.

The per-tool metrics in #25514 measure both.

Failure-Class: none

🤖 Generated with Claude Code

View guided diff

Git-on-my-level and others added 15 commits November 16, 2026 21:47
…ate on cards

Builds on transcript paging (BasedHardware#25491) so an agent can read a long conversation
the way a person skims one, without loading the whole transcript first.

- view=outline returns the card plus the stored note sections, each anchored
  to the segment range it cites (first_segment, segment_count, start, end),
  and no transcript.
- offset starts a transcript read at a segment index, such as a section's
  first_segment; the cursor then continues it (a resent offset is ignored).
- format=lines renders a page as one "[h:mm:ss] Speaker: text" line per speaker
  turn with transcript_range, about a third of the size of the per-segment JSON;
  the cursor is bound to the format. Also on get_conversations_by_ids.
- Cards carry status and duration_seconds, plus kind, shown_on_home and
  summary_covers_through where stored, so agents can tell live conversations,
  media and other people's background talk from the user's own.
- Tool descriptions and server instructions say to start long conversations
  with the outline, prefer lines, and treat transcript text as quoted content,
  never instructions.
- omi_mcp_transcript_pages_total counts detail pages by tool, view, format,
  position and whether more remain, so paging can be measured.

Defaults are unchanged: transcript view, JSON segments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…il read

Review follow-ups on the progressive-reads commit:

- view=outline returns at most 100 sections, reports sections_truncated, and
  checks the 120k serialized budget like transcript pages.
- duration_seconds is the transcript's speech span: null on list and search
  cards, which load no transcript, instead of the wall window, which can start
  long before speech.
- summary_covers_through is localized like the other card timestamps.
- The default format adds nothing to the detail cursor fingerprint, so cursors
  minted before format existed still decode during a rolling deploy.
- offset is ignored, not parsed, when a cursor is given; negative, malformed or
  oversized offsets are argument errors rather than clamped.
- The page counter's position=first means "no cursor sent", so an offset read
  from the outline counts as a first page.
- The detail card is built once per request rather than on every
  budget-fitting retry. The 1,200-segment walk test uses about 0.27s of CPU
  instead of 0.43s, well inside the 1.0s per-test limit that CI shard 5 hit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…l outline windows

Codex review follow-ups on BasedHardware#25497:

- format=lines pages over text only. original_text is not rendered, so a page
  boundary inside it produced continuation pages with no speech.
- Lines join turns on speaker_key, not the display label, so two people who
  share a name (or two unresolved speakers) stay on separate lines.
- An outline section's start/end span every cited segment (min start, max end),
  since cited segments can overlap or be stored out of time order.
- transcript_range is always present on lines pages and null when the page is
  empty, so fields=[transcript, transcript_range] works at the end of a read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…earch_transcripts

Agents asking about something said in passing found nothing: MCP search read
summary vectors only, and the keyword index ran only when vectors returned
zero rows, so one semantic hit hid every exact title or overview match.
Two-hour v3 conversations make summaries leave out more detail.

search_conversations:
- asks summary vectors and the keyword index (titles, overviews) on every
  call; shared hits rank first, then the two indexes alternate, so neither
  crowds the other out. Stale ids get one bounded second hydration.
- each card carries match_basis (summary, keyword, transcript); only
  match_snippets quote the transcript, and each snippet carries segment_index,
  the get_conversation_by_id offset to read around it.
- search_coverage names what actually ran (summary_vectors_and_keyword,
  summary_vectors_only, keyword_only) plus unavailable_indexes; one index
  down still answers. No hits with the keyword index down stays a 503.

search_transcripts (new, conversations.read):
- literal words or a short phrase in saved transcripts, newest first, over
  the bounded owner/query-bound scan chat transcript recall already uses (no
  derived index, 50 records and 4s per call, signed cursor resuming after the
  last record examined).
- optional conversation_id finds where something was said in one long
  conversation; hits carry segment_index, speaker and time.
- locked, discarded, deferred and unreadable records are never quoted;
  misses are never presented as absence.

The developer search route reports the same truthful coverage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A segment-only speaker correction leaves adjacent rows with one diarization
key but different resolved labels; joining on the key alone attributed an
unassigned speaker's words to the user.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A loaded detail with no transcript (a photo-only capture) reported a null
duration; use the shared conversation_duration_seconds wherever the
transcript is loaded, and keep list cards null.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Four journeys chain real tool calls the way an agent would (search ->
outline -> section in lines; literal transcript hit -> read around it; a
whole long conversation by cursor; a day listing that tells media from
conversation, then a batch read) and validate every response against its
output schema and the serialized budget, so a tool that stops leading to the
next one breaks a journey.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	backend/utils/mcp_context.py
#	backend/utils/mcp_server/registry.py
@mintlify

mintlify Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit d321ef3.

Approve preview

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T22:32:15.739403Z d321ef3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

# Conflicts:
#	backend/tests/unit/test_mcp_streamable_http.py
#	backend/utils/mcp_server/registry.py
#	docs/doc/developer/mcp/introduction.mdx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 463734319a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Git-on-my-level and others added 2 commits November 17, 2026 02:53
A summary-vector index still building is one index down: keyword search
still answers, and the index error returns only when both are down.
search_transcripts rejects dates with conversation_id (it searches the whole
conversation). A one-letter query word must appear as a word in the segment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…down fallbacks

A page of large (or escaped CJK) hits stops before the 120000-character
serialized budget and resumes at the first conversation it left out.
Keyword or vector index loss now records the degraded fallback even when
other hits survive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f514763e11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ef964c3bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38d4a90315

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/doc/developer/mcp/introduction.mdx Resolved
Git-on-my-level and others added 2 commits November 17, 2026 04:35
…snippet window

Matching gets 2s after the 4s scan (chat's 6s overall) and resumes after the
last finished record; unreadable records record a degraded fallback; a long
segment is clipped around the shortest stretch holding every query word.
Developer changelog entries for BasedHardware#25497, BasedHardware#25524 and this PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6335bedb83

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Git-on-my-level
Git-on-my-level merged commit 61f6684 into BasedHardware:main Nov 16, 2026
53 of 54 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.

1 participant