Decide whether local search indexes compaction-preserved rows #34
Labels
No labels
delivered
outstanding
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
kayg/hermternal-apple#34
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Decision needed
Decide whether local SQLite FTS5 search should index compaction-preserved rows that the transcript does not display. No decision has been made. This is the remaining compaction policy question after today's history investigation; it is distinct from the REST retrieval cap tracked in #28.
What was measured
Local search's corpus is exactly what the client downloads. The client currently requests
GET /api/sessions/{id}/messages?limit=500; the gateway hard-clampslimitto 500. An explicitlimitimpliesorder=oldest, so the newest messages are the ones missing.offsetis honored, whilecursoris silently ignored. Because the response has no total or has-more flag, termination isreturned < limit. The cap is being fixed separately by paging withoffset, active rows only; #28 tracks that work.Measured row counts on the two truncated sessions (verbatim):
Precisely, session
20260819_103056_d3d63dreturns 556 either way. Session20260816_100129_456b45d6returns 896 active rows and 4,743 withinclude_compacted=true, so 3,847 rows exist that the transcript does not show.Source evidence
hermes_cli/web_routers/sessions.py:601-648— the dashboardGET /api/sessions/{session_id}/messagesroute declaresinclude_compactedand passes it toSessionDB.get_messages.hermes_cli/web_routers/sessions.py:722-757— the/api/sessions/{session_id}/exporthandler callsget_messagesat:754-757with keyset pagination (limit/after_id) but does not setinclude_compacted; export therefore omits compacted rows too.gateway/platforms/api_server.py:3626-3683.Tradeoff
Indexing compacted rows would make those 3,847 messages searchable, but they are pre-compaction originals that the transcript deliberately does not render. A hit on one would be a search result that cannot scroll to its own message because that message is not in the displayed transcript. This is a real tradeoff between corpus completeness and a coherent result-to-transcript relationship, not an obvious win.
The transcript display must remain active-rows-only either way. This issue is only deciding the search corpus and result behavior; it must not make hidden compacted rows appear in the transcript.
Concrete options
Option A: Index compacted rows and mark them archived/unscrollable
Index active and compaction-preserved rows, and carry provenance in each search result so a compacted hit is visibly marked
Archived — not in transcript(or equivalent). Selecting it must not pretend to scroll to a displayed message; it may offer the result snippet/metadata as context. Consequence: corpus completeness improves, but users must understand that some hits cannot navigate to a transcript row.Option B: Exclude compacted rows from local search
Index active rows only, matching the displayed transcript. Consequence: every result retains a coherent result-to-transcript relationship, but compaction-preserved history is intentionally unsearchable. This is the simpler and less surprising behavior.
No decision has been made between these options.
Acceptance criteria for the eventual choice
Duplicate check
I searched the open issue list (24 open issues) and read the bodies of #8, #11, #23, #28, #29, #32, and #33. #8 covers the local BM25 search feature; #11 covers Spotlight indexing; #23 covers find within the current displayed conversation; #28 covers the REST history cap and is related but distinct; #29 covers Modules; #32 covers accounts/profiles; and #33 covers sidebar account display. None decides whether local search should index compaction-preserved, transcript-hidden rows. This issue is not a duplicate.