A Chrome extension that transforms your browsing history into an intelligent, searchable knowledge base using AI embeddings and RAG (Retrieval-Augmented Generation).
TabMind automatically indexes the content of web pages you visit, creating vector embeddings that enable semantic search and AI-powered chat interactions. Instead of relying on exact keyword matches, you can ask natural language questions and get relevant results from your browsing history.
Semantic search interface for natural language queries
Timeline view of all indexed pages organized by project
- Search your browsing history using natural language queries
- Vector similarity matching powered by OpenAI embeddings
- Results ranked by relevance, not just keyword matches
- Example: "machine learning tutorials" finds relevant pages even without exact text match
- Ask questions about pages you've visited and get AI-powered answers
- RAG-based context retrieval from your browsing history
- Relevance filtering prevents off-topic queries (won't act as a general ChatGPT gateway)
- Chat history persisted per project
- Clickable URLs in AI responses
- Create separate workspaces for different browsing contexts (e.g., "Research", "Work", "Hobbies")
- Each project maintains its own indexed pages and chat history
- Rename, switch, and manage projects via dropdown interface
- Chronological view of all indexed pages
- Organized by project
- Shows titles, URLs, and timestamps
- OpenAI API key management
- Simple setup with environment variables
Architecture
- Manifest V3 Chrome extension
- React-based popup UI (400px width) with tab navigation
- IndexedDB storage via Dexie (3 tables: entries, projects, messages)
- Vite build system with multi-entry bundling
AI Models
- Embeddings: OpenAI
text-embedding-3-small(1536-dimensional vectors) - Chat: OpenAI
gpt-4o-mini - Cosine similarity for relevance scoring
RAG Implementation
- Top-5 most relevant pages retrieved for each query
- Relevance threshold (0.5) filters out unrelated queries
- Context formatted with title, URL, and 200-character excerpts
Data Flow
- Content script extracts text from visited pages (first 5000 chars)
- Background worker generates embeddings via OpenAI API
- Pages stored in IndexedDB with vectors
- Search/chat queries converted to embeddings and compared via cosine similarity
As you browse the web, TabMind automatically:
- Extracts page content (title, URL, and text content)
- Generates a 1536-dimensional vector embedding via OpenAI
- Stores the page data and embedding in your browser's local IndexedDB
- All processing happens locally - your browsing data never leaves your machine except for the OpenAI API calls
When you search:
- Your query is converted to a vector embedding
- Cosine similarity is calculated between your query and all stored page embeddings
- Top 6 most relevant results are returned, ranked by similarity score
- No need for exact keyword matches - "ML tutorials" finds "machine learning guides"
When you ask a question:
- Your question is converted to a vector embedding
- Top 5 most relevant pages are retrieved from your history (RAG)
- Relevance score is checked (must be β₯ 0.5 to proceed)
- Context from relevant pages is sent to GPT-4o-mini along with your question
- AI responds using only information from your browsing history
- Conversation is saved to IndexedDB for later reference
- All browsing data stored locally in your browser's IndexedDB
- No data sent to external servers except OpenAI API calls for embeddings and chat
- Your API key is stored locally and never shared
- You control which pages are indexed (system pages like
chrome://are filtered out)
- Summary View: Generate markdown summaries of browsing sessions
- Node.js and npm installed
- OpenAI API key (get one here)
- Google Chrome browser
- Clone the repository
git clone https://github.com/yourusername/TabMind.git
cd TabMind- Install dependencies
npm install- Configure OpenAI API key
Create a .env file in the root directory:
VITE_OPENAI_API_KEY=your_openai_api_key_here- Build the extension
npm run build- Load in Chrome
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in top-right)
- Click "Load unpacked"
- Select the
dist/folder from the project directory
- Start browsing!
- Visit web pages to build your indexed history
- Click the TabMind extension icon to search, chat, or view memories
TabMind/
βββ background.js # Service worker for embedding generation
βββ content/ # Page content extraction
β βββ index.js # Content script entry point
β βββ utils.js # Text extraction & page filtering
β βββ messenger.js # Chrome messaging wrapper
βββ ui/
β βββ src/
β β βββ App.jsx # Main popup component with tab navigation
β β βββ db.js # IndexedDB schema (Dexie wrapper)
β β βββ embeddings.js # OpenAI embeddings API + similarity search
β β βββ chat.js # RAG implementation & Chat Completions API
β β βββ storage.js # Chrome storage utilities
β β βββ components/
β β βββ views/
β β β βββ SearchView.jsx # Semantic search interface
β β β βββ MemoriesView.jsx # Timeline view
β β β βββ ChatView.jsx # AI chat interface
β β β βββ SettingsView.jsx # API key configuration
β β βββ ProjectSelector.jsx # Project dropdown & switcher
β β βββ CreateProjectModal.jsx
β β βββ ManageProjectsModal.jsx
β βββ style/ # CSS files for all components
β βββ index.html # Popup HTML entry point
βββ manifest.json # Extension manifest (Manifest V3)
βββ vite.config.js # Build configuration
βββ dist/ # Build output (load this in Chrome)
Key Files
- background.js - Listens for page content, generates embeddings, stores in IndexedDB
- ui/src/db.js - Database schema with 3 tables: entries, projects, messages
- ui/src/embeddings.js - OpenAI embedding generation & cosine similarity
- ui/src/chat.js - RAG context retrieval & Chat Completions API integration
- ui/src/components/views/ChatView.jsx - Chat UI with relevance filtering
# Rebuild after code changes
npm run build
# Development mode with hot reload
npm run dev
# Lint the UI code
cd ui && npm run lintAfter building, reload the extension:
- Go to
chrome://extensions/ - Click the reload icon on the TabMind extension card
Changing the embedding model
- Edit
MODELconstant in ui/src/embeddings.js
Adjusting search result count
- Modify
topNparameter insearchHistory()call in SearchView.jsx
Changing relevance threshold for chat
- Edit
RELEVANCE_THRESHOLDin ui/src/chat.js (default: 0.5)
Modifying content extraction limits
- Page text limit: content/utils.js (currently 5000 chars)
- API input limit: ui/src/embeddings.js (currently 8000 chars)
IndexedDB stores three tables via Dexie:
entries - Indexed web pages
id,url,title,text,timestamp,projectId,vector(1536-dim array)
projects - Workspace organization
id,name,createdAt
messages - Chat conversation history
id,projectId,role(user/assistant),content,timestamp
- Content scripts run on all web pages (
<all_urls>) - Background service worker handles embedding generation
- Popup UI is a React SPA with tab-based navigation
- Vite bundles three entry points: background, content, and popup
- Manifest is copied and modified during build to adjust paths for dist/
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT License - see LICENSE file for details
- Built with React
- Powered by OpenAI APIs
- Database via Dexie.js
- Bundled with Vite

