Skip to content

feat(conversations): search conversations shows the owner's own conversations in a block of their own - #3119

Open
leemour wants to merge 5 commits into
mainfrom
feat/owner-block
Open

leemour wants to merge 5 commits into
mainfrom
feat/owner-block

Conversation

@leemour

@leemour leemour commented Nov 18, 2026

Copy link
Copy Markdown
Member

Task

search conversations misses what the owner said. "What did I advise about X" is answered by one of the owner's
messages in a busy group, and a group with tens of thousands of chunks ranks it far below the top 20.

Why

On a test store (about 220,000 conversation chunks, OpenAI text-embedding-3-small, 768 dims) and 40 questions with
a known answer, the answer was in the top 20 for 24 of them. Searching the owner's own chunks on their own
(3,900 of 220,000) found most of the rest. Tried first and dropped:

  • Fusing a second query "<owner's name>: " (RRF) found more answers, but 10 other questions lost places,
    some by 26.
  • Inserting the owner's chunks into the list pushed other answers out of the top 20.
    A block of its own changes nothing in the hits, so nothing can lose.

What

  • nearestConversations takes fromOwner: only chunks that hold one of the owner's own (outgoing) messages. It
    finds their ids through those messages and scores only them, not the whole account.
  • search conversations returns own: up to 5 of the owner's conversations nearest in meaning that the hits left
    out. JSON items follow the hits with from_owner: true; text output lists them under "your own messages".
  • Changelog fragment changes/feat-owner-block.md.

Testing

  • Measured with tg built on this change against the same tg without it, back to back per question, --limit 20:
    • answer visible in the top 20 plus the block: 24 → 31 of 40 (top 5 plus the block: 15 → 25);
    • the hits were the same in both builds for all 40 questions;
    • time: median +0.24 s per query, 90th percentile +0.57 s (median before about 2.3 s, load about 2 to 5).
    • Not measured: questions whose answer is someone else's message beyond the 10 in the set. The set leans toward
      the owner's messages, so the gain on everyday questions is likely smaller.
  • src/services/embeddings.test.ts: the block holds the owner's conversation the hits left out, and none when the
    hits already hold it.
  • Local: pnpm ci:quick, Biome on the changed files, pnpm docs:check, vitest over src/cli/messenger, src/mcp,
    src/store vector tests and src/services search tests.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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