Repository navigation
Description
Problem
On OpenCode v2 (Desktop 2.2.5) the ⌘K command palette finds sessions by title only, and so does the API behind it — session.list({ search }) pushes like(SessionTable.title, …) (packages/core/src/session/store.ts:155). Message content is never searched.
On this machine that is 1,440 sessions in a 12 GB opencode.db. When I remember "we decided X a month ago" I cannot find the session unless its title happens to contain the words. Ctrl+F only searches the session I already have open, which is the opposite problem.
What I measured (stopgap implementation, not a guess)
I scanned the DB once and built a small local digest: user messages capped at 4,000 chars, the first 1,500 chars of each assistant reply, no tool output or reasoning, plus one folded copy per session (lowercase, Vietnamese diacritics stripped so hoa don matches hóa đơn) for substring search. The palette then queries the digest instead of the DB.
direct scan of opencode.db |
digest | |
|---|---|---|
| data read per query | 12 GB | 28 MB |
| first build | — | 7.5 s |
| query latency | tens of seconds | 30–100 ms (incl. process start) |
| incremental refresh | — | under 1 s (only rows whose time_updated changed) |
With that, typing in ⌘K finds sessions by what was said, across every project, at typing latency, and a separate "Projects" group can list folders that were never opened as projects.
The stopgap requires patching packages/app and running a sidecar HTTP service, which users should not have to do. This is the part I would like to see upstream.
Proposal (happy to implement whichever you prefer)
- Palette source API for plugins. The palette already accepts extra async sources internally —
createCommandPaletteSearch({ sources: ((query, signal) => Promise<CommandPaletteEntry[]>)[] })inpackages/app/src/shell/commands/search.ts, used by the session and file sources. Expose the same thing in the GUI plugin SDK (ctx.add(PaletteSource, …)or similar) so a plugin can contribute{ id, type, title, description, sessionID, server }rows. Small surface, no new persistence in core. - Built-in content search. Index message text into a small table (or FTS5) and let
session.list({ search })— or a dedicated endpoint — match content as well, newest first, returning a snippet. Diacritic folding matters for non-English users;hoa don→hóa đơnis a real case here.
Either way the index is derived data: local-only, safe to delete and rebuild, never telemetry.
Related
- [FEATURE]: Search across my message history to quickly locate past conversations/content ("find what I told opencode before") #41354 — search across message history. Closed as not planned because it was filed against v1; the closing comment asked for a new request on v2.
- feat: Add search within session content #49659 — search within session content (closed).
- plugin: expose session listing and search in the plugin context #56230 — plugin: expose session listing and search in the plugin context (closed).
Activity
opencodejr commentedon Nov 1, 2026
Thanks for the detailed write-up, and for measuring a working stopgap, @nguyenngothuong!
To restate the request: you'd like the v2 ⌘K palette to find sessions by what was said in them, not only by title. That could come from a plugin API for adding palette search sources, or from a built-in local content index (with diacritic folding) behind
session.list({ search })or a dedicated endpoint. You're right that search today only matches session titles. Maintainers will consider it.I didn't put together a plugin for this. The GUI plugin SDK can register palette commands and open a separate picker dialog, but it has no way to add results to the palette's own search. Without a server-side content index, a plugin would also have to page through every session's messages, which is far too slow at your scale. Something like
ctx.add(PaletteSource, …), feeding thesourcesthatcreateCommandPaletteSearchalready accepts, would close that gap.Related issues:
session.searchendpoint in the v2 SDK. It covers the backend half of your proposal 2.opencode-local-searchTUI plugin (SQLite session history search) to the ecosystem docs.nguyenngothuong commentedon Nov 1, 2026
Thanks for the pointers — #54863 covers the backend half, #57938 the TUI counterpart, and this one is the Desktop palette half.
If it helps, I can open the Desktop-side PR independently of the storage decision: a palette source registry in the GUI plugin SDK (
ctx.add(PaletteSource, …)) that feeds thesourcesarraycreateCommandPaletteSearchalready accepts inpackages/app/src/shell/commands/search.ts.Scope I'd propose:
Command/Panelinpackages/plugin/src/gui/registries.tsshell/commands/dialog.tsx,home/start/command-palette.tsx)This stays orthogonal to #54863: a plugin can supply its own index today, and a built-in
session.searchcan register the same source later. If you would rather see #54863 land first and do content search natively, I'm happy to pick that up instead — just say which half you want a PR for.nguyenngothuong commentedon Nov 1, 2026
Opened the Desktop-side PR discussed above: #61000 — a
PaletteSourceregistry in the GUI plugin SDK, wired into both palettes (⌘K home and the in-session palette).It stays orthogonal to #54863: a plugin can supply its own index today, and a built-in
session.searchcan register the same source later. With no source registered the palettes behave exactly as now.