Skip to content

feat: search the chats - #134

Merged
httpsphl merged 4 commits into
mainfrom
feat/chat-search
Oct 3, 2026
Merged

httpsphl merged 4 commits into
mainfrom
feat/chat-search

Conversation

@httpsphl

@httpsphl httpsphl commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Search across the chats (spec 8.8, roadmap item 18.4).

Store and daemon

  • Migration 0016: chat_search, an FTS5 index that reads text through a chat_text view over chat_items, so no text is stored twice. Triggers keep it in step on insert, update and delete (a deleted bot takes its entries along), and the migration indexes existing chats. It covers what bots were told (the owner, other bots, Botloft), their replies and their questions with answers; tool calls, approvals and notices are left out. The unicode61 tokenizer ignores accents and case.
  • chat.search {query, botId?, crewId?, before?, limit?}: every word must match, the last one may be a prefix, and FTS5 syntax in the query is taken literally. Results come newest first with a snippet that marks the words found, from active bots only. The request is answered outside the queue, like files.list.
  • chat.history {botId, until} returns everything from an item to the newest (up to 1,000), to open a chat at a result.

App

  • Search at the top of the sidebar (Ctrl+K) opens a page that searches as the owner types, in all crews or one. Each result shows the bot, crew, time, who wrote it and the snippet with the words highlighted (markdown marks removed).
  • Clicking a result opens that bot's chat at the item and marks it for a moment. With less motion the mark stays still for the same time.
  • The query is kept while the app is open, and comes back selected.
  • Texts in en, pt-BR and es. The Questions and Search entries moved to SidebarPages.tsx so Sidebar.tsx stays near 300 lines.

Checks

  • cargo fmt, clippy -D warnings, cargo test --workspace and pnpm check (306 tests) pass.
  • New tests: store search, filters, paging, the index following updates and deletes, an FTS5 integrity check, and migrating a database that already has chats. Also daemon RPC (tests/search.rs) and app (features/search/search.test.tsx).
  • Checked in the pnpm dev preview: Ctrl+K, results as you type, opening a result in Writer's chat with the mark.

Still to check by hand

  • pnpm local on a real database: the migration indexes existing chats (time on a large history), and a search finds old messages.

Migration 0016 adds chat_search, an FTS5 index read through the
chat_text view, so no text is stored twice; triggers keep it in step with
chat_items and the migration indexes what was there. It covers what bots
were told, their replies and their questions, without accents. Spec 8.8.
chat.search finds items with every word, the last one as a prefix, each
taken literally, newest first with a marked snippet, and answers outside
the queue. chat.history {until} returns from an item to the newest, to
open a chat at a result.
Search on the left (Ctrl+K) opens a page that finds words as the owner
types, in all crews or one, with the words highlighted. A result opens
its bot's chat at that point and marks the item for a moment.
@httpsphl
httpsphl merged commit f93ddc6 into main Oct 3, 2026
4 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