1.4 KiB
1.4 KiB
009: Smart context backfill from indexed pages
Reporter: fxhp Date: 2026-03-03 Priority: medium Status: open Affects: Browser extension, embedded widget
Description
When the user opens the chatbot on a page and there is room left in the context window, backfill with content from previously indexed pages on the same site. "Indexed" means any page where the chatbot was opened and page intelligence was computed.
Goal
Use spare context budget to pull in relevant cross-page knowledge automatically. If the user asks a question about something on a different page they already visited, the model can answer without the user navigating back.
Architecture
- After computing page content and journey context, calculate remaining context budget
- If remaining budget > 2000 tokens, pull from the page knowledge store (#006)
- Rank stored pages by relevance (keyword overlap with current page, recency)
- Pack as many page summaries as fit within the remaining budget
- Include in system prompt as "INDEXED SITE KNOWLEDGE" section
Budget Calculation
total = model max tokens (e.g. 82000)
used = system prompt + page content + journey context + overhead
spare = total - used
backfill = min(spare * 0.5, 10000) // never use more than half of spare
Dependencies
- Reverse RAG page knowledge (#006)
- Journey tracking (implemented)
- fitPageContent() budget system (implemented)