docs: record BM25 relevance ranking in tickets 006/009, reconcile statuses

This commit is contained in:
russell@unturf.com 2026-05-22 11:54:22 -04:00
parent 2834e990bd
commit a4818b2afb
No known key found for this signature in database
3 changed files with 42 additions and 4 deletions

View file

@ -3,7 +3,7 @@
**Reporter:** fxhp
**Date:** 2026-03-03
**Priority:** medium
**Status:** open
**Status:** fixed
**Affects:** Browser extension, embedded widget
## Description
@ -35,3 +35,13 @@ All cross-page data must be encrypted via the vault, same as chat history. The u
## Notes
This is the foundation for making uncloseai "unstoppable" on any site. The model gets smarter the more pages you visit, building a personal knowledge graph of the site, all stored locally and encrypted.
## Resolution
Page-summary storage (per-domain, vault-encrypted via `savePageSummary` /
`loadPageSummaries` in `storage.js`) and prompt backfill landed per the
architecture above. Step 3's "include the last N page summaries" was
later sharpened from recency selection to BM25 relevance ranking against
the current page: see #009 Resolution (commit `2834e99`). Summaries now
included are the ones *similar* to the page in view, not just the most
recent.

View file

@ -3,7 +3,7 @@
**Reporter:** fxhp
**Date:** 2026-03-03
**Priority:** medium
**Status:** open
**Status:** fixed
**Affects:** Browser extension, embedded widget
## Description
@ -36,3 +36,31 @@ backfill = min(spare * 0.5, 10000) // never use more than half of spare
- Reverse RAG page knowledge (#006)
- Journey tracking (implemented)
- fitPageContent() budget system (implemented)
## Resolution (2026-05-22)
Backfill shipped in two stages.
**Stage 1 (initial):** spare budget (30% of `maxTokens - usedEstimate`,
gated at `> 500` tokens) packed with indexed page summaries, sorted by
recency only. This satisfied steps 1, 2, 4, 5 but **not step 3**: the
ranking. `getRelevantPageSummaries()` carried a docstring claiming
"keyword overlap with current page" but the code only sorted by
`indexedAt`, so the prompt was backfilled with recently-visited pages
regardless of relevance.
**Stage 2 (commit `2834e99`):** implemented step 3 with BM25 relevance
ranking in `storage.js`:
- Query = current page (`document.title` + first 2000 chars of content),
passed from the call site in `uncloseai-embed-modal.js`.
- Each candidate summary (title + topics + summary) is tokenized
(lowercased, stopwords + single chars dropped) and scored with BM25
(`k1=1.5`, `b=0.75`, IDF over the candidate corpus).
- Only summaries scoring `>= 2.0` are kept, best-first, then packed to
budget. Verified separation: related docs score 5-8, unrelated 0.
- Recency ordering retained as a fallback when no query is supplied
(backward compatible).
Net effect: cross-page context now pulls *similar* pages, not merely
recent ones.

View file

@ -14,10 +14,10 @@
| 001 | [Extension fails to load (CSP)](001-extension-fails-to-load.md) | high | Three-tier injection via chrome.scripting.executeScript |
| 004 | [Working/spinning indicators](004-working-indicators.md) | medium | .working class wired to send button during async ops |
| 005 | [Context overflow silent failure](005-context-overflow-silent-failure.md) | high | Smart content collapsing in fitPageContent() |
| 006 | [Reverse RAG: cross-page context](006-reverse-rag-cross-page-context.md) | medium | Page summaries in encrypted localStorage, backfilled into prompts |
| 006 | [Reverse RAG: cross-page context](006-reverse-rag-cross-page-context.md) | medium | Page summaries in encrypted localStorage, BM25-ranked backfill into prompts |
| 007 | [Journey-aware conversation persistence](007-journey-aware-conversation-persistence.md) | medium | Conversation summaries stored in journey data per-page |
| 008 | [Site knowledge graph](008-site-knowledge-graph.md) | low | Internal link extraction + adjacency graph in vault |
| 009 | [Smart context backfill](009-smart-context-backfill.md) | medium | Spare context budget fills with indexed page summaries |
| 009 | [Smart context backfill](009-smart-context-backfill.md) | medium | Spare context budget fills with BM25-ranked indexed page summaries |
| 010 | [Ethical crawl mode](010-ethical-crawl-mode.md) | medium | robots.txt parser, BFS crawler, rate-limited, API key gated |
| 011 | [Vault viewer dashboard](011-vault-viewer-dashboard.md) | medium | Site intelligence panel with metrics, topics, indexed pages list |
| 012 | [Unfirehose opt-in sharing](012-unfirehose-opt-in-sharing.md) | low | Share button with access level selector, JSONL ingest to unfirehose.org |