This repository has been archived on 2026-07-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
KnowledgeBase/.taskmaster/tasks/tasks.json
T
chaim 50a60c13b3 feat(kb): ask survives view switch + search query expansion (server-side)
Two recurring frustrations from the v0.1.8 demo:

1. Searching "מהי תקנה 37" only returned the תקנה 37 חוזר and the law —
   ספר הליקויים, the canonical medical reference, was crowded out by the
   document whose title literally contained the query terms. Fixed in
   shira-hermes 1441a41 by adding an LLM-driven query-expansion path to
   /kb/search (default expand=true). Same query now also returns 2 hits
   from src 29 (ספר הליקויים).
2. Asking Shira a question and clicking another EspoCRM view dropped the
   in-flight request — coming back rendered a blank kb-results pane, even
   though the request had completed in the background. Fixed here:
   {question, promise, startedAt} are now stored at module scope (closure
   shared across remounts of this view). afterRender re-binds handlers
   for any active ask, resumes the progress panel with the original start
   time so the elapsed counter doesn't reset, and replays the most recent
   completed answer from sessionStorage so the user sees their result
   even after a hard reload. State is intentionally session-scoped — no
   answers persist across browser sessions.

Refs Task Master #3, #4
2026-04-25 10:23:49 +00:00

60 lines
5.4 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"master": {
"tasks": [
{
"id": 1,
"title": "feat: search-mode split-view with PDF + page jump",
"description": "Render /kb/search results as a two-column split view: left column is the stack of ranked hit cards (kind, title, section, page label), right column is an iframe viewing the selected hit's PDF scrolled to page_number. Clicking any hit swaps the iframe. Text-only sources (law from Wikisource) fall back to a chunk/text panel with a Wikisource link so the right column never 404s.",
"status": "done",
"priority": "high",
"details": "Before this change renderSearchResults produced plain vertical text cards — users got the chunk body and had to open the Wikisource link (or track down the PDF manually) to verify context. With 5 of 5 PDFs now carrying accurate page_number (shira-hermes e534709 + 1ca1cc0), the search UI can finally deep-link to the right page. Mirrors the ask-mode split view (v0.1.7 uncommitted).",
"testStrategy": "Search 'תקנה 37' → first hit should be a regulation/circular → right pane loads the PDF at page ~N where the section appears. Click a lower-ranked law hit → right pane swaps to a Wikisource link view. Search 'הגדרות' → hits span multiple sources → each click swaps iframe source.",
"subtasks": [],
"dependencies": [],
"createdAt": "2026-04-24T15:47:00Z"
},
{
"id": 2,
"title": "fix(kb/chunker): page_number propagation through split + packing (shira-hermes)",
"description": "Applied in shira-hermes commits e534709 + 1ca1cc0: (1) _split_oversized now re-derives page_number per piece from markers embedded in parent content + a virtual (offset 0, parent.page_number) anchor, (2) chunk_circular tracks absolute paragraph offsets in the original text so each packed sub-chunk reports its real starting page, (3) _as_dicts strips stray \\x00 bytes left behind when _split_oversized slices through a marker sentinel. Reference data: ספר הליקויים now 211 chunks × 210 pages (1-413) vs 209 × 1 before. Not work for this repo, but the search split-view in task #1 depends on it.",
"status": "done",
"priority": "high",
"details": "Lives in espocrm-extensions/shira-hermes. Logged here for traceability because task #1 can't demonstrate correct page jumps without it.",
"testStrategy": "Query DB: SELECT source_id, MIN/MAX(page_number), COUNT(DISTINCT page_number) FROM kb_chunk GROUP BY source_id — every PDF source should span multiple distinct pages.",
"subtasks": [],
"dependencies": [],
"createdAt": "2026-04-24T15:47:00Z"
},
{
"id": 3,
"title": "feat(kb/search): LLM query expansion so ranked-by-title docs don't crowd everything else out (shira-hermes)",
"description": "User reports searching 'מהי תקנה 37' returns only the תקנה 37 circular and the law — never ספר הליקויים, even though that's where the underlying medical content lives. Root cause is a single-shot retrieval where any document whose title contains the query terms wins by a huge margin. Fix: ask the LLM (via ai-gateway) for up to 3 alternative phrasings, retrieve candidates for the original + each variant in parallel, merge by chunk_id keeping best RRF score, then rerank the union against the ORIGINAL query. After fix: src 29 (ספר הליקויים) shows up with 2 hits in the same query.",
"status": "done",
"priority": "high",
"details": "Lives in espocrm-extensions/shira-hermes commit 1441a41. /kb/search now has expand=true by default, agent path (search_insurance_kb tool) keeps expand=false because the agent already does multi-query via tool calls.",
"testStrategy": "POST /kb/search {query:'מהי תקנה 37', top_k:8} should return hits from at least 2 distinct source_ids, including src 29 (ספר הליקויים) and src 26 (תקנה 37 חוזר).",
"subtasks": [],
"dependencies": [],
"createdAt": "2026-04-25T10:00:00Z"
},
{
"id": 4,
"title": "fix: ask survives view switch via module-level promise + sessionStorage",
"description": "User reports asking Shira a question and switching to a different EspoCRM view loses the in-flight request — coming back shows a blank screen as if nothing was asked. Cause: the Espo.Ajax promise was view-bound, so handlers fired against a detached DOM after re-mount. Fix: hoist {question, promise, startedAt} to a module-level _activeAsk; afterRender re-attaches handlers and resumes the progress UI with the original startedAt; completed answers persist to sessionStorage and replay on remount or a hard reload.",
"status": "done",
"priority": "high",
"details": "All client-side, files/client/custom/modules/knowledge-base/src/views/kb/index.js. State is intentionally session-scoped — kept in sessionStorage so the next browser session starts clean.",
"testStrategy": "Ask a question; while the spinner shows, click Contacts (or any other navbar item); wait until the request would have finished; click back to בסיס ידע — the answer (or active spinner with correct elapsed-time) should be there.",
"subtasks": [],
"dependencies": [],
"createdAt": "2026-04-25T10:00:00Z"
}
],
"metadata": {
"created": "2026-04-24T15:47:00Z",
"updated": "2026-04-25T10:30:00Z",
"description": "KnowledgeBase extension tasks"
}
}
}