Search Your Browser History with AI
SmritiAI is a Firefox browser extension that uses AI-powered semantic search to help you find web pages from your browsing history. Instead of remembering exact keywords, you can search using natural language descriptions and find relevant pages based on their content.
- π AI-Powered Semantic Search: Search your browsing history using natural language queries
- π Domain Filtering: Filter search results by specific domains or exclude unwanted sites
- π Content Analysis: Automatically extracts and analyzes webpage content using Mozilla's Readability
- β‘ Fast Vector Search: Uses HNSW (Hierarchical Navigable Small World) algorithm for efficient similarity search
- π¨ Modern UI: Clean, responsive sidebar interface with dark/light theme support
- π Index Management: Tools to rebuild, export, and manage your search index
- π Browser History Processing: Process your existing browser history to make it searchable with AI
- βοΈ Customizable Settings: Adjust search parameters and indexing behavior
- π Privacy-First: All processing happens locally in your browser
-
Background Script (
src/background/)- background.js: Main entry point and AI pipeline management
- handlers/: Specialized message handlers for different operations
message-router.js: Routes messages to appropriate handlerssearch-handler.js: Processes search queries and returns resultspage-processor.js: Handles new page indexing and content processinghistory-processor.js: Batch processes browser historydata-handler.js: Manages data export/import operationssettings-handler.js: Handles settings updates and retrieval
- services/: Core business logic services
embedding-service.js: AI model management and embedding generation- utils/: Shared utility functions
message-helpers.js: Async message handling wrappersdomain-filter.js: Domain filtering logic and utilities
-
User Interface (
src/sidebar/)- sidebar.js: Main UI entry point and initialization
- components/: Modular UI components
chat-interface.js: Search interface and message displaycommand-system.js: Slash command processingdomain-filter.js: Domain filtering UI and functionalitysettings-modal.js: Settings configuration UIconfirmation-modal.js: Action confirmation dialogsheader-dropdown.js: Main navigation dropdowntheme-manager.js: Dark/light theme management
- handlers/: UI-specific handlers
first-time-handler.js: Welcome experience for new usersstats-handler.js: Index statistics displaydata-handler.js: Data export/import UI logic
- services/: UI services
message-service.js: Communication with background script
- utils/: UI utility functions for DOM and storage operations
-
Content Script (
src/content.js)- Extracts readable content from web pages using Mozilla Readability
- Sends processed content to background script for indexing
-
Database Layer (
src/db.js)- Uses Dexie (IndexedDB wrapper) for local data storage
- Stores page metadata and embeddings
- Handles unique URL constraints and updates
-
Search Engine (
src/search.js)- Implements HNSW vector search algorithm
- Provides semantic similarity search capabilities
- Handles index management and rebuilding
- AI/ML: @xenova/transformers (Transformer.js) with all-MiniLM-L6-v2 model
- Vector Search: hnswlib-wasm for efficient similarity search
- Database: Dexie (IndexedDB) for local storage
- Content Extraction: @mozilla/readability
- Build Tool: Vite with web extension plugin
- UI: Vanilla JavaScript with modern CSS
- Architecture: Modular ES6 modules with clear separation of concerns
- Maintainability: Each module has a single responsibility and clear interface
- Testability: Components can be tested in isolation
- Scalability: Easy to add new features without touching existing code
- Code Organization: Related functionality grouped together
- Performance: Only load required modules when needed
- Node.js (v16 or higher)
- npm or yarn
- Firefox browser
-
Clone the repository
git clone https://github.com/PranavInani/SmritiAI.git cd SmritiAI -
Install dependencies
npm install
-
Build the extension
npm run build
-
Load in Firefox
- Open Firefox
- Go to
about:debugging - Click "This Firefox"
- Click "Load Temporary Add-on"
- Select the
manifest.jsonfile from thedistfolder
For development with hot reload:
npm run dev- Click the SmritiAI icon in your browser toolbar or use
Ctrl+E - Type your search query in natural language
- View results with clickable links to your previously visited pages
When you first install SmritiAI, you'll see a welcome message offering to process your existing browser history. This will:
- Generate AI embeddings for your past browsing history
- Make your entire browsing history searchable with semantic search
- Allow you to choose how far back to process (last week, month, year, etc.)
You can skip this step and process your history later from the settings.
/clear- Clear chat history/stats- Show index statistics/settings- Open settings panel/domain- Show current domain filter status/domain:example.com- Filter results to specific domain/domain:clear- Clear domain filters
SmritiAI supports powerful domain filtering to help you focus on specific websites or exclude unwanted results:
- Include domains:
github.com,stackoverflow.com - Exclude domains:
-ads.com,-tracker.com - Mixed filtering:
github.com,wikipedia.org,-ads.com,-spam.com
1. UI Method:
- Click the "π Domain Filter" button in the sidebar
- Enter your filter criteria in the input field
- Click "Apply" to activate the filter
2. Slash Commands:
/domain:github.com # Include only GitHub
/domain:github.com,stackoverflow.com # Include GitHub and StackOverflow
/domain:-ads.com,-tracker.com # Exclude ads and trackers
/domain:github.com,-ads.com # Include GitHub, exclude ads
/domain:clear # Clear all filters
- Research without distractions:
/domain:-ads.com,-marketing.com,-spam.com - Academic sources only:
/domain:wikipedia.org,arxiv.org,scholar.google.com - Development resources:
/domain:github.com,stackoverflow.com,developer.mozilla.org
- Auto-complete: Suggests domains from your browsing history
- Visual feedback: Button highlights when filters are active
- Smart search: Automatically searches 3x more results when filtering to ensure relevant matches
- Session-based: Filters persist during your session but reset on reload
Access settings through the dropdown menu or /settings command:
- Search Results: Configure number of results returned
- HNSW Parameters: Adjust search quality and performance
- Index Management: Rebuild search index
- Browser History Processing: Process existing browser history to make it searchable
- Data Export/Import: Backup and restore your data
- ef (200): Search quality parameter (higher = better accuracy, slower search)
- M (16): Number of connections (higher = better accuracy, more memory)
- maxElements (10000): Maximum pages that can be indexed
- searchResultCount (5): Number of search results to return
- autoIndex (true): Automatically index new pages
SmritiAI/
βββ src/
β βββ background/ # Background script modules
β β βββ background.js # Main entry point and AI pipeline
β β βββ handlers/ # Message handlers
β β β βββ message-router.js
β β β βββ search-handler.js
β β β βββ page-processor.js
β β β βββ history-processor.js
β β β βββ data-handler.js
β β β βββ settings-handler.js
β β βββ services/ # Core services
β β β βββ embedding-service.js
β β βββ utils/ # Utility functions
β β βββ message-helpers.js
β βββ sidebar/ # UI modules
β β βββ sidebar.js # Main UI entry point
β β βββ components/ # UI components
β β β βββ chat-interface.js
β β β βββ command-system.js
β β β βββ settings-modal.js
β β β βββ confirmation-modal.js
β β β βββ header-dropdown.js
β β β βββ theme-manager.js
β β βββ handlers/ # UI handlers
β β β βββ first-time-handler.js
β β β βββ stats-handler.js
β β β βββ data-handler.js
β β βββ services/ # UI services
β β β βββ message-service.js
β β βββ utils/ # UI utilities
β β βββ dom-helpers.js
β β βββ storage-helpers.js
β βββ content.js # Content extraction script
β βββ db.js # Database layer with Dexie
β βββ search.js # HNSW search implementation
β βββ sidebar.html # Main UI HTML
β βββ sidebar.css # Styling and themes
βββ public/
β βββ icon/ # Extension icons
βββ manifest.json # Extension manifest
βββ package.json # Dependencies and scripts
βββ vite.config.ts # Build configuration
- Development build:
npm run dev - Production build:
npm run build - Package for store:
npm run package- Creates a zip file ready for Firefox Add-ons store upload
The codebase follows a modular architecture with clear separation of concerns:
- Background modules: Handle AI processing, message routing, and data management
- Sidebar modules: Manage UI components, user interactions, and state
- Shared modules: Provide common functionality for database and search operations
- ES6 modules: All code uses modern JavaScript import/export syntax
- Single responsibility: Each module has one clear purpose and well-defined interface
- Keep modules focused and small (< 100 lines when possible)
- Use clear naming conventions for files and functions
- Document public interfaces and complex logic
- Test modules independently before integration
- Follow the established patterns for message passing and error handling
- @xenova/transformers: Transformer.js for AI embeddings
- hnswlib-wasm: WebAssembly HNSW implementation
- dexie: IndexedDB wrapper for data storage
- @mozilla/readability: Content extraction
- vite-plugin-web-extension: Build tool for extensions
- All data processing happens locally in your browser
- No data is sent to external servers
- Embeddings and search index are stored locally
- Browser history access is limited to extension functionality
- Large pages may take longer to process
- Initial model loading requires internet connection
- Maximum index size is limited by browser storage
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
- Mozilla Readability for content extraction
- Xenova for Transformer.js
- HNSW algorithm implementation
- Vite ecosystem for build tools
Note: This extension requires Firefox and uses Manifest V2. Future versions may include Chrome support with Manifest V3.