A Chrome Built-in AI Challenge submission that partners Gemini Nano with a Google Mangle compiled to WebAssembly. This partnership allows Gemini Nano to make complex, multi-step deductions about data scattered across all your browser tabs, turning chaos into insight.
The goal of Castor is to transform web browsing from a series of disconnected sessions into a cohesive, intelligent journey. By leveraging the on-device power of Gemini Nano and the Mangle reasoning engine, this extension provides users with deep insights into information gathered across multiple tabs, helping them synthesize data and make complex decisions without manual effort.
See my demo video for the Google Chrome Built-in AI Challenge 2025 here: Castor - The brain for the modern browser - Chrome Extension Demo
- Framework: Vue 3
- On-Device AI: Google Gemini Nano
- Reasoning Engine: Google Mangle (which I compiled to WASM)
- Build Tool: Vite
- State Management: Pinia
- Language: TypeScript
Castor leverages Google's on-device Gemini Nano APIs to integrate AI seamlessly into the browsing experience.
The Prompt API is used for versatile, context-aware text generation tasks:
- Fact Ingestion: Taking unstructured text from webpages and transforming it into structured Datalog facts for the Mangle engine.
- Tab Group Title Generation: Creating short, context-aware titles for new tab groups based on the user's stated research goal.
- Natural Language Query Generation: Translating formal Datalog queries into user-friendly questions, which are presented as clickable chips in the chat interface.
The Writer API is used for refining and formatting text:
- AI Response Formatting: Taking the structured output from a Mangle query and reformatting it into a polished, natural language response for the user.
The Mangle Datalog engine, compiled to WebAssembly, provides the core logic and reasoning capabilities. The engine's flexibility and power are validated by a comprehensive test suite that showcases its ability to handle any fact schema and demonstrates all possible operations. Key validation files include:
realWorldTests.test.tsnewMangleTests.test.tscrossSiteDemo.test.ts
Prerequisites:
- Node.js
- pnpm (This project uses
pnpmfor package management) - Google Chrome (latest version with AI features enabled)
1. Install Dependencies:
pnpm install2. Build the Extension:
pnpm run build3. Load the Extension in Chrome:
- Navigate to
chrome://extensions. - Enable "Developer mode".
- Click "Load unpacked" and select the
distdirectory.
The demos directory contains three static websites for testing the extension's features.
1. Navigate to the demos directory:
cd demos2. Install Demo Dependencies:
pnpm install3. Run all Demos:
pnpm run serve- Hotel Demo:
http://localhost:8081 - Restaurant Demo:
http://localhost:8082 - Bus Tour Demo:
http://localhost:8083