TabPilot: Intelligent Tab Search Assistant

Inspiration

As a knowledge worker, I often need to search for specific information among 20+ or even 50+ browser tabs. Traditional tab management requires visual scanning, which is not only inefficient but also disrupts workflow. I realized that the real problem is cognitive burden caused by information overload—we need not just to find tabs, but to quickly locate information through "intent-based navigation".

I noticed that Chrome browser has built-in Gemini AI API that runs completely locally, which gave me a great inspiration: why not create a tool that allows AI to understand user query intent and semantically search all open tabs? This would both protect user privacy (100% local processing) and provide an intelligent search experience.

What it does

TabPilot is a Chrome extension based on Chrome's built-in AI API, providing a floating search box triggered by the keyboard shortcut Ctrl+Shift+F. Users can search for tabs using natural language queries.

Core Features:

  1. Semantic Search: Understands user intent, not just keyword matching. For example, typing "that GitHub page that fixed bug #123" can accurately find the relevant tab
  2. Background Intelligent Summarization: Automatically generates AI summaries for each open tab, providing rich context for search
  3. Layered Search Strategy:
    • First layer: Fast search of open tabs (returns coarse results in 100-300ms)
    • Second layer: If results are insufficient, searches user bookmarks
    • Re-ranking: Uses LLM to precisely re-rank top candidates
  4. Hybrid Retrieval Algorithm: Combines n-gram BM25 pre-search, semantic matching, and keyword matching to ensure both speed and accuracy
  5. Two-Phase Return Optimization: First returns fast keyword search results, then asynchronously performs AI re-ranking, greatly improving user experience

Key Highlights:

  • ✅ 100% Privacy Protection: All AI processing is done locally, no data uploaded to cloud
  • ✅ Zero Cost: Completely free, no subscription services required
  • ✅ Instant Response: Local processing, no network latency
  • ✅ Intelligent Fallback: If AI API is unavailable, automatically falls back to basic keyword search mode

How we built it

Technical Architecture

We adopted a React + TypeScript + Vite tech stack to build a Chrome Extension Manifest V3 application.

Core Components

1. Dual API Collaboration Strategy

  • Summarizer API: Used for background pre-generation of page summaries

    • Triggers 5 seconds after tab opens or refreshes
    • Automatically extracts page body content
    • Generates medium-length TLDR summaries and caches them
  • Prompt API (LanguageModel): Used for real-time semantic search and re-ranking

    • Understands user natural language queries
    • Scores and sorts candidate results by relevance
    • Supports query expansion and synonym matching

2. Layered Search Architecture

User Input Query
    ↓
English Query Expansion (LLM) → 2-5 related phrases
    ↓
n-gram BM25 Pre-search → Top-60 candidates (millisecond-level)
    ↓
Layer 1: Semantic Search Open Tabs → Top-10 results
    ↓
LLM Re-ranking → Final Top-8 results (if candidates >= 3)
    ↓
[If insufficient results] → Layer 2: Search Bookmarks

3. Performance Optimization Techniques

  • Memory Mirror System: Mirrors chrome.storage.local data to memory, avoiding storage reads on every search
  • Session Caching: Reuses AI sessions, automatically cleans up after 60 seconds of inactivity
  • Result Caching: Same queries within 3 minutes directly return cached results
  • Two-Phase Return Mechanism:
    • Phase 1 (100-300ms): Fast keyword search returns
    • Phase 2 (1-3s): AI re-ranking results update asynchronously
  • n-gram Inverted Index: Fast text matching based on BM25 algorithm

4. Intelligent Summary Generation Flow

Tab Opens/Refreshes → 5s Delay → Extract Page Content → 
Summarizer.summarize() → Cache to chrome.storage.local

5. Search Flow

User Input → Query Expansion → n-gram BM25 Pre-filtering → 
Semantic Search (Prompt API) → LLM Re-ranking → Return Results

Key Technical Decisions

  1. Why use dual API strategy?

    • Summarizer API is optimized specifically for summarization tasks, offering better performance and power efficiency
    • Prompt API is more suitable for flexible semantic understanding tasks
    • Clear division of labor, each API serves its purpose
  2. Why n-gram BM25 pre-search?

    • In scenarios with 50+ tabs, directly using LLM to search all tabs is too slow
    • BM25 pre-search can filter out top-60 candidates in milliseconds
    • Significantly reduces data sent to LLM, improving response speed
  3. Why implement two-phase return?

    • Display results immediately after user input, even if quality is slightly lower
    • Background continues re-ranking, results update asynchronously
    • Significantly improves perceived performance (users feel it's faster)

Challenges we ran into

1. Complexity of AI API Availability Detection

Challenge: Chrome AI API requires model download on first use, and different Chrome versions have varying support.

Solution:

  • Implemented API availability detection mechanism with exponential backoff
  • Cache detection results for 15 minutes to avoid frequent checks
  • Designed comprehensive fallback strategy: automatically switches to keyword search when AI is unavailable

2. Performance Issues with Large Numbers of Tabs

Challenge: When users have 50+ tabs, directly sending all data to LLM causes:

  • Response time too long (5-10 seconds)
  • Huge token consumption
  • Poor user experience

Solution:

  • Introduced n-gram BM25 pre-search algorithm to reduce candidate set to 60 first
  • Implemented two-phase return mechanism, returning fast results first
  • Used memory mirror system to avoid repeated storage reads
  • Implemented intelligent caching, same queries return directly

3. Stability Issues with JSON Parsing

Challenge: LLM-returned JSON format is unstable, sometimes including markdown code block markers, sometimes with non-standard formats.

Solution:

  • Implemented robust JSON parser that automatically cleans markdown markers
  • Supports fault-tolerant handling of various JSON formats
  • If parsing fails, automatically falls back to original candidate results

4. Compatibility Issues with Page Content Extraction

Challenge: Different websites have vastly different structures, requiring compatibility with various page formats, including:

  • Single Page Applications (SPA)
  • Dynamically loaded content
  • Special pages (chrome://, etc., where scripts cannot be injected)

Solution:

  • Used Readability.js to extract main content
  • Implemented fallback chain with multiple content retrieval methods
  • For special pages, uses basic information (title + URL) as summary

5. Complexity of Session Management

Challenge: AI sessions need proper management—avoiding frequent creation (performance overhead) while timely cleanup (resource usage).

Solution:

  • Implemented session caching system, caching sessions based on configuration parameters (temperature, topK)
  • Automatically cleans up after 60 seconds of inactivity
  • Periodically checks and destroys timed-out sessions

6. Chinese Query Support

Challenge: Initially only supported English query expansion, Chinese users couldn't enjoy the convenience of query expansion.

Solution:

  • Maintains original form of Chinese queries
  • English queries use LLM expansion, Chinese queries use rule-based expansion
  • Unified use of semantic search in the search phase, ensuring Chinese queries also get good support

Accomplishments that we're proud of

  1. Implemented industry-leading two-phase return mechanism:

    • Phase 1 returns results within 100-300ms, excellent user experience
    • Phase 2 AI re-ranking updates asynchronously, ensuring result quality
  2. Built efficient hybrid retrieval system:

    • n-gram BM25 pre-search (millisecond-level)
    • Semantic search (understands intent)
    • LLM re-ranking (precise sorting)
    • Three algorithms work together, fast and accurate
  3. Designed comprehensive fallback strategy:

    • Multi-layer fallback mechanisms ensure it works in all situations
    • Automatically falls back to basic search when AI is unavailable
    • Uses title + URL when summary generation fails
  4. Implemented intelligent caching system:

    • Memory mirroring avoids storage I/O
    • Result caching improves repeated query performance
    • Session caching reduces AI session creation overhead
  5. User Experience Optimization:

    • Supports keyboard shortcut triggering (Ctrl+Shift+F)
    • Search box auto-focus
    • Keyboard navigation support (arrow keys + enter)
    • Search history memory (preserves last query)
  6. Code Quality:

    • Complete TypeScript type definitions
    • Detailed logging system for easy debugging
    • Modular design, easy to maintain and extend

What we learned

Technical Level

  1. Chrome Extension Development Best Practices:

    • Manifest V3 Service Worker features
    • Design patterns for message passing mechanisms
    • Permission management and security considerations
  2. AI Integration Experience:

    • Importance of prompt engineering: clear instructions, examples, format requirements
    • How to handle uncertainty in AI responses
    • How to balance AI capabilities and performance overhead
  3. Search Algorithm Understanding:

    • Practical applications of BM25 algorithm
    • Trade-offs between semantic search vs keyword search
    • Design of multi-strategy fused search systems
  4. Performance Optimization Techniques:

    • Choices between memory caching vs persistent storage
    • Trade-offs between asynchronous vs synchronous processing
    • User experience design of two-phase return

Product Level

  1. User Need Insights:

    • Users truly need "intent-based navigation", not just simple keyword matching
    • Fast response is more important than perfect results (two-phase return design philosophy)
  2. Balance between Privacy and Experience:

    • Local AI processing protects privacy while providing intelligent experience
    • Completely free but with high-quality AI capabilities
  3. Progressive Feature Design:

    • MVP first implements core features (search)
    • Gradually adds advanced features (bookmark search, re-ranking, etc.)
    • Keep features simple but powerful

What's next for TabPilot

Short-term Plans (1-3 months)

  1. Smart Grouping Feature:

    • Use AI to analyze tab themes and automatically suggest groupings
    • Support one-click grouping execution
  2. Search Experience Enhancement:

    • Add search history records
    • Implement fuzzy search and spelling correction
    • Support shortcuts for common searches
  3. Continuous Performance Optimization:

    • Performance testing and optimization in 100+ tab scenarios
    • Optimize BM25 index construction efficiency
    • Further optimize caching strategies

Mid-term Plans (3-6 months)

  1. Personalization Features:

    • User preference settings (keyboard shortcut customization, UI themes)
    • Tab usage frequency statistics and intelligent recommendations
    • Learning optimization based on usage patterns
  2. Precise Content Positioning:

    • Display matching text snippet previews in search results
    • Automatically scroll to relevant content position after clicking result
  3. Cross-device Sync (optional):

    • Use Chrome Sync API to sync search history and preferences
    • Support summary sync across multiple devices

Long-term Vision

  1. Become a "Brain Peripheral" for Knowledge Workers:

    • Not just search tabs, but also search browsing history
    • Provide intelligent recommendations and knowledge connections
    • Help users build personal knowledge networks
  2. Community Ecosystem:

    • Open plugin system, allowing third-party extensions
    • Support custom search strategies and AI prompts
    • Build user community, share usage tips
  3. Enterprise Features:

    • Team tab sharing and collaboration
    • Search analytics and team insights
    • Enterprise knowledge base integration

Built With

  • an-event-driven-model-for-tab-lifecycle
  • and-damerau-levenshtein-distance.-state-management-is-handled-by-zustand.-the-codebase-uses-eslint-with-typescript-rules-and-follows-a-service-worker-architecture-for-background-processing
  • and-in-memory-caching-for-performance.-content-extraction-uses-readability.js-via-content-scripts.-the-search-system-implements-bm25
  • bm25
  • chrome-ai-api
  • chrome-apis
  • chrome-extension-manifest-v3
  • chrome-storage-api
  • chrome-storage-api-for-persistence
  • chrome.alarms
  • chrome.bookmarks)-for-extension-functionality
  • chrome.scripting
  • chrome.storage.local
  • content-scripts
  • css
  • damerau-levenshtein-distance
  • eslint
  • gemini
  • html
  • including-the-summarizer-api-for-page-summaries-and-the-languagemodel/prompt-api-for-semantic-search;-all-ai-runs-on-device.-we-use-chrome-apis-(chrome.tabs
  • javascript
  • languagemodel-api
  • n-gram-indexing
  • prompt-api
  • react
  • readability.js
  • service-worker
  • summarizer-api
  • targeting-chrome-extension-manifest-v3.-it-relies-on-chrome-ai-api-(gemini)
  • tf-idf
  • typescript
  • vite
  • zustand
Share this project:

Updates

Submission history