Repository navigation
Description
Outcome
Search results should carry enough evidence by default for a user to confirm whether a hit is the conversation they meant, without immediately opening the full conversation.
At minimum, the result contract should be able to expose:
- matched snippet or excerpt
- matched message id when relevant
- match surface or provenance such as title hit, message FTS hit, action hit, attachment hit, hybrid fusion, or semantic lane
- the retrieval lane used when it materially affects interpretation
Problem or opportunity
The archive substrate already knows more than the public search surfaces expose.
polylogue/storage/search_query_builders.py and polylogue/storage/search_runtime.py already support snippet-producing ranked search over message FTS. polylogue/operations/archive.py can also adapt hydrated conversations into SearchHit records with snippets.
The main discovery surfaces currently discard that evidence:
- CLI summary-list routing prefers
list_summaries()inpolylogue/cli/query.py - summary rendering in
polylogue/cli/query_output.pyshows only id/date/provider/title/message count - MCP
searchinpolylogue/mcp/server_tools.pyreturnsMCPConversationSummaryPayload, which has no snippet or match provenance
This makes Polylogue strong once a conversation is already identified, but weaker at fuzzy confirmation when several conversations have similar titles or nearby dates.
Expected scope
polylogue/cli/query.pypolylogue/cli/query_output.pypolylogue/mcp/server_tools.pypolylogue/mcp/payloads.pypolylogue/operations/archive.pypolylogue/storage/search_runtime.pypolylogue/storage/search_query_builders.py- tests under
tests/unit/cli/,tests/unit/mcp/, andtests/unit/storage/
Constraints and invariants
- Keep exact-id retrieval behavior unchanged.
- Preserve a lightweight summary-list mode for workflows that want compact browsing rather than evidence-bearing hits.
- Do not force full conversation hydration for every search if the evidence can be sourced from cheaper ranked-hit paths.
- Keep CLI and MCP result semantics aligned enough that they do not drift into unrelated search contracts.
Acceptance criteria
- Polylogue defines a first-class search-hit result contract separate from bare conversation summaries.
- CLI search can show a matched excerpt by default or via a clearly documented evidence-bearing mode.
- MCP search exposes snippet or excerpt evidence and match provenance, not only summary rows.
- Search-hit payloads can identify the matched message when relevant.
- Tests cover snippet-bearing hits and match-provenance fields across CLI and MCP surfaces.
Verification plan
- add storage-level tests for ranked hit payload fields
- add CLI output tests for evidence-bearing search rendering
- add MCP contract tests for search-hit payload shape
- run
devtools verify
Context and evidence
Relevant files:
polylogue/storage/search_query_builders.pypolylogue/storage/search_runtime.pypolylogue/operations/archive.pypolylogue/cli/query.pypolylogue/cli/query_output.pypolylogue/mcp/server_tools.pypolylogue/mcp/payloads.py
Non-goals or explicitly deferred work
- Full absence diagnosis; that belongs in a separate issue.
- Attachment-id indexing; that belongs in a separate issue.
- Near-duplicate discovery; that belongs in a separate issue.
Activity
Sinity commentedon Apr 22, 2026
Starting #216.
Tactic:
Sinity commentedon Apr 22, 2026
Progress update for #216:
Implemented the shared evidence-bearing search-hit path across the main surfaces:
ConversationSearchHitas the canonical archive/CLI/MCP hit contract.ConversationSearchEvidenceHitso simple message FTS searches preserve rank, score, message id, snippet, match surface, and retrieval lane without full hydration.search_summary_hits()andsearch_conversation_hits().matchevidence for machine/plain/rich output.searchto return evidence-bearing hit payloads while keepinglist_conversationson compact summaries.Focused verification so far:
Next: run
devtools verify, then commit/push/open PR if the baseline is clean.