dsh-session-search-warmup
Warms the official DSH session-search index during the quiet boot window, so
the official search surface works on first query.
Why
The search engine (@deepseek-ai/dsh-session-query-sqlite) builds its index
on the first search call. Its observation loop requires every persisted
session log to stay byte-stable across two consecutive snapshots (two
attempts). With a large corpus one pass takes tens of seconds, and any event
appended to a live session log during that window aborts the build with
SESSION_QUERY_PERSISTENCE_FAILED. Because no rows were ever committed,
every later search repeats the same doomed full build.
At boot no live sessions exist, so the corpus is naturally quiet: one search
right after activation commits the index, and all later searches are
incremental (milliseconds).
What it does
- On activation (host plane, after
sessionQuery is available) it fires one
searchSessions({ query: 'warmup', … }, {}) call.
- If that attempt fails with
SESSION_QUERY_PERSISTENCE_FAILED or
SESSION_QUERY_ABORTED (transient "not quiet yet" conditions) it retries
every 15 s, up to 20 attempts (~5 min), then gives up until the next boot.
- Non-retryable errors stop the chain and are logged with the
[session-search-warmup] prefix.
Related plugins
This plugin is fully independent: with or without
dsh-session-search-plus installed, the official search surface (the
stock sidebar search box, rail mode, fallback paths) is fast from the first
query, because the warmup call commits the corpus-wide index that every
official query then reuses. dsh-session-search-plus only replaces the
sidebar search-box UI (private in-memory content index, /api/search-plus
route, filter bar / dropdown / jump-highlight); the two compose but neither
requires the other.
Requirements
- The profile must mount
@deepseek-ai/dsh-session-query-sqlite with
openAt: first-search (or startup) and a durable path — otherwise the
warmed index cannot survive a restart. On a profile with openAt: never
(the base default) there is nothing to warm: the plugin stops quietly and
logs an actionable [session-search-warmup] hint at boot.
- Node >= 22 (
node:sqlite).
Install
From the profile directory:
dsh plugin --profile web add dsh-session-search-warmup
Do not also insert the session-search-warmup row into the profile's own
cordis.patch.yml — the loader refuses duplicate insert ids.
Verify
dsh --profile web --dump-config
After boot, watch the host log for:
[session-search-warmup] full-text index warmed on attempt 1
and confirm the durable index has rows:
sqlite3 ~/.dsh/session-search.sqlite 'select count(*) from persisted_sessions;'
Development
pnpm install
pnpm run bundle
pnpm test