# 006: Reverse RAG: cross-page context via encrypted localStorage **Reporter:** fxhp **Date:** 2026-03-03 **Priority:** medium **Status:** open **Affects:** Browser extension, embedded widget ## Description When a user browses multiple pages on the same site, the machine learning model should be able to reference content from previously visited pages. Currently each page is isolated: the model only knows the current page's content. ## Goal Build a reverse RAG system where page summaries are stored in encrypted localStorage (per-domain), and automatically included in the system prompt for new pages. This gives the model a growing knowledge base about the site as the user browses. ## Architecture 1. After generating the intro message for a page, extract a brief summary (title, key topics, 2-3 sentences) 2. Store summaries per-domain in vault-encrypted localStorage: `uncloseai-pageknowledge-{domain}` 3. On new pages, include the last N page summaries in the system prompt as context 4. Summaries should be compact (under 200 tokens each) to avoid context overflow 5. Use the existing `fitPageContent()` budget system to allocate space for cross-page context ## Privacy All cross-page data must be encrypted via the vault, same as chat history. The user controls their data. No data leaves the device except through explicit LLM requests. ## Dependencies - Site journey tracking (implemented in storage.js) - Vault encryption (already working) - `fitPageContent()` context budgeting (already working) ## 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.