Hybrid AI cognitive extension that turns browsing history into semantic memory
A Chrome extension built for the Google Chrome Built-in AI Challenge 2025 that uses a hybrid AI strategy: Chrome Built-in AI (Gemini Nano) when available, Gemini API as reliable cloud fallback. This creates an intelligent, searchable memory of your browsing history with production-ready reliability.
What makes this extension special:
- π― Production Ready: Works reliably TODAY, even in Chrome builds without AI APIs
- π Automatic Fallback: Tries Chrome Built-in AI first, seamlessly falls back to Gemini API
- π Privacy First: On-device processing when available, secure cloud fallback when needed
- π Future Proof: Gets better as Chrome AI rolls out, never breaks
- β All 6 APIs: Complete implementation of all Chrome Built-in AI capabilities
- π€ Hybrid AI: Chrome Built-in AI (primary) + Gemini API (fallback) for 100% reliability
- π§ Semantic Memory: Convert web pages into searchable semantic memories with AI embeddings
- π AI Summarization: Automatic 2-3 sentence summaries of every page you visit
- π AI Translation: Translate memories to any language
- βοΈ AI Rewriting: Reformat summaries with different tones, lengths, and formats
- π Natural Language Search: Query your history using plain English via omnibox (
lw <query>) - π AES-GCM Encryption: Summaries encrypted locally using Web Crypto API
- β‘ Vector Similarity Search: Find relevant pages using cosine similarity
- π¨ Beautiful UI: Clean, modern interface built with Svelte and TailwindCSS
- π Statistics Dashboard: Track your knowledge base growth
- Architecture
- Tech Stack
- Installation
- Usage
- Project Structure
- Development
- Chrome AI APIs
- Privacy & Security
- Contributing
- License
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Chrome Extension β
β β
β βββββββββββββββββ βββββββββββββββ ββββββββββββββββββ β
β β Content β β AI β β Vector β β
β β Scraper βββββ Summarizer βββββ Search Engine β β
β βββββββββββββββββ βββββββββββββββ ββββββββββββββββββ β
β β β β β
β βΌ βΌ βΌ β
β Page Text Summaries + IndexedDB β
β Embeddings (Encrypted) β
β β β β β
β βββββββββββΊ Query Handler βββββββββββββββ β
β β β
β Omnibox & Popup β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Capture: When you visit a page, content script extracts main text
- Summarize: Background worker uses Chrome AI Summarizer to compress content
- Embed: Text is converted to vector embeddings using Chrome AI
- Encrypt: Summary is encrypted with AES-GCM
- Store: Memory is saved to IndexedDB with embedding
- Query: Use omnibox to search memories semantically
- Answer: AI Writer composes answer from relevant memories
- TypeScript: Type-safe development
- Vite: Lightning-fast build tool
- Svelte: Reactive UI framework
- TailwindCSS: Utility-first styling
chrome.ai.summarizer- Compress page contentchrome.ai.prompt- Generate embeddingschrome.ai.writer- Compose answerschrome.ai.translator- Multilingual supportchrome.ai.proofreader- Clean responseschrome.tabs- Page monitoringchrome.scripting- Content injectionchrome.omnibox- Search interfacechrome.storage- Configuration sync
- Dexie.js: IndexedDB abstraction
- Web Crypto API: AES-GCM encryption
- Vector Search: Cosine similarity
- ESLint + Prettier: Code quality
- Vitest: Unit testing
- web-ext: Development workflow
The extension uses a hybrid AI strategy and works right away:
- Install the extension
- Configure Gemini API key (free from Google AI Studio)
- Start browsing!
Chrome Built-in AI is optional but recommended for privacy.
- Chrome Canary (v143+) or Chrome Stable (when AI APIs launch)
- Node.js (v18+)
- Gemini API Key (free tier available)
No Chrome AI setup needed! This is the fastest way to get started:
- Build extension (see below)
- Load in Chrome
- Open Settings tab
- Get free API key: Google AI Studio
- Paste key and save
- Start browsing!
β
Works in: Chrome Stable, Chrome Canary, any Chrome 120+
β
Setup time: 5 minutes
β
Reliability: 100% (cloud-based)
For maximum privacy and performance:
-
Enable Chrome AI APIs (detailed guide)
- Navigate to
chrome://flags/#optimization-guide-on-device-model - Set to "Enabled BypassPerfRequirement"
- Navigate to
chrome://flags/#prompt-api-for-gemini-nano - Set to "Enabled"
- Restart Chrome
- Navigate to
-
Build & configure extension
-
Extension will automatically use Chrome AI when available
-
Falls back to Gemini API seamlessly
β
Works in: Chrome Canary (143+)
β
Privacy: On-device processing
β
Performance: Instant responses
β
Fallback: Gemini API if Chrome AI unavailable
# Clone repository
git clone https://github.com/Sukhtumur/neurochrome.git
cd neurochrome
# Install dependencies
npm install
# Build for production
npm run build- Open
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked"
- Select the
distfolder - Click extension icon β Settings tab
- Configure Gemini API key
Open Settings tab in extension popup:
- Provider Badge: Shows "Using Chrome AI" (green) or "Using Gemini API" (purple)
- All 6 APIs: Should show green checkmarks β
- Status Message: Confirms active AI provider
See TESTING_GUIDE.md for detailed testing steps.
By default, the extension automatically captures and indexes pages you visit:
- Browse normally
- Extension extracts content in background
- AI generates summary and embedding
- Memory stored locally (encrypted)
Type brain in Chrome's address bar, then your query:
brain what did I read about machine learning yesterday?
brain show me articles about climate change
brain find that recipe I saw last week
Click the extension icon to:
- Search: Manual query with detailed results
- Memories: Browse and manage stored pages
- Statistics: View storage stats and insights
local-web-brain/
βββ src/
β βββ background/ # Service worker
β β βββ background.ts
β βββ content/ # Content scripts
β β βββ content-script.ts
β βββ popup/ # Popup UI
β β βββ App.svelte
β β βββ popup.ts
β β βββ index.html
β βββ components/ # Svelte components
β β βββ SearchBar.svelte
β β βββ MemoryList.svelte
β β βββ Stats.svelte
β βββ lib/ # Core business logic
β β βββ ai/ # Chrome AI services
β β β βββ chrome-ai.ts
β β βββ db/ # Database layer
β β β βββ database.ts
β β β βββ repository.ts
β β βββ vector/ # Vector search
β β β βββ index.ts
β β βββ crypto/ # Encryption
β β β βββ index.ts
β β βββ query/ # Query orchestration
β β βββ index.ts
β βββ types/ # TypeScript definitions
β β βββ index.ts
β β βββ chrome-ai.d.ts
β βββ utils/ # Utilities
β β βββ helpers.ts
β β βββ logger.ts
β βββ tests/ # Unit tests
β βββ setup.ts
β βββ helpers.test.ts
βββ public/
β βββ manifest.json
β βββ icons/
βββ vite.config.ts
βββ tsconfig.json
βββ tailwind.config.js
βββ package.json
- Presentation (
components/,popup/): UI components - Application (
lib/query/): Business logic orchestration - Domain (
types/): Core entities and interfaces - Infrastructure (
lib/ai/,lib/db/,lib/crypto/): External services - Utilities (
utils/): Shared helpers
# Development with hot reload
npm run dev
# Production build
npm run build
# Run tests
npm test
# Lint code
npm run lint
# Format code
npm run format
# Test with web-ext
npm run web-ext- Clean Code: Descriptive names, single responsibility
- SOLID Principles: Dependency injection, interface segregation
- Type Safety: Strict TypeScript, no
any - Error Handling: Custom error types, try-catch blocks
- Documentation: JSDoc comments, inline explanations
# Run all tests
npm test
# Watch mode
npm test -- --watch
# Coverage
npm test -- --coverageThe extension uses an intelligent hybrid approach:
// Automatically tries Chrome AI first, falls back to Gemini
const summary = await hybridAI.summarize(text)
const embedding = await hybridAI.embed(text)
const translated = await hybridAI.translate(text, 'es')β
Summarizer: Compress page content to 2-3 sentences
β
Embeddings: Convert text to semantic vectors (384-dim)
β
Writer: Generate natural language responses
β
Translator: Translate to any language
β
Proofreader: Clean and correct text
β
Rewriter: Reformat with tone/length/format options
Chrome AI Available β Use on-device processing (instant, private)
Chrome AI Unavailable β Use Gemini API (1-2s delay, reliable)
Both Unavailable β Show helpful error message
// Initialize hybrid service
await hybridAI.initialize({
apiKey: userGeminiKey // from Settings
})
// Use any AI function - automatic fallback
const summary = await hybridAI.summarize(pageText)
const embedding = await hybridAI.embed(summary)
const translated = await hybridAI.translate(summary, 'spanish')
const rewritten = await hybridAI.rewrite(summary, {
tone: 'professional',
length: 'short'
})See hybrid-ai.ts for implementation.
β
Chrome AI: 100% offline, on-device processing
β
Gemini API: Only summaries sent (not full page content)
β
Local Storage: All data in IndexedDB on your device
β
No Analytics: Zero tracking or user profiling
β
Open Source: Auditable codebase
- AES-GCM Encryption: Summaries encrypted with 256-bit keys
- Secure Key Storage: Gemini API key in chrome.storage.sync
- Content Security Policy: Strict CSP in manifest
- HTTPS Only: Gemini API calls over secure connection
- Input Validation: Sanitization of all user inputs
- XSS Protection: Svelte's auto-escaping
- Max 10,000 memories (configurable)
- Auto garbage collection when limit reached
- Manual "Clear All" option in popup
| Criterion | Implementation |
|---|---|
| Use of Built-in AI | All 5 Chrome AI APIs used natively |
| Innovation | Semantic browser memory, offline cognitive extension |
| Privacy | Zero network calls, local encryption, no tracking |
| Usability | Omnibox integration, clean UI, natural language queries |
| Technical Depth | Vector search, encryption, repository pattern, clean architecture |
| Scalability | Efficient indexing, cosine similarity, auto GC |
Contributions welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow existing code style
- Add tests for new features
- Update documentation
- Keep commits atomic and descriptive
MIT License - see LICENSE file for details
- Chrome Built-in AI team for Gemini Nano APIs
- Dexie.js for excellent IndexedDB abstraction
- Svelte team for reactive simplicity
- TailwindCSS for utility-first styling
- Author: Sukhtumur N
- Email: haruschatten@gmail.com
- GitHub: @Sukhtumur
- Demo Video: [YouTube Link]
Built with β€οΈ for the Chrome Built-in AI Challenge
Turn your browser into a second brainβprivately and intelligently.