On-device AI assistant for Chrome leveraging Built-in AI APIs for summarization, rewriting, translation, proofreading, and image understanding.
- π Simplify & Summarize: TLDR summaries for paragraphs with adjustable length and reading level
- πΌοΈ Explain Images: AI-generated alt text and chart/diagram explanations using multimodal Prompt API
- βοΈ Proofread Forms: Real-time grammar and spelling suggestions with categorized, plain-language fixes
- π Translate Pages: In-page translation with language detection, hover-to-view original, and per-site preferences
- βΏ WCAG 2.2 Compliant: Strong focus rings, reduced motion support, screen reader announcements, and accessible controls
- π Tech Overlay: Real-time API status, latency metrics, and on-device indicators
- Chrome Canary or Dev (version 127+)
- Enable Built-in AI flags in
chrome://flags:#optimization-guide-on-device-model#prompt-api-for-gemini-nano#summarization-api-for-gemini-nano#rewriter-api-for-gemini-nano#translation-api
- Restart Chrome
- Visit
chrome://componentsand update "Optimization Guide On Device Model"
# Clone repository
git clone https://github.com/stealthwhizz/ClarityLens.git
cd ClarityLens
# Install dependencies
npm install
# Build extension
npm run build
# Package for distribution
npm run zip- Open
chrome://extensions - Enable "Developer mode"
- Click "Load unpacked"
- Select the
distfolder
# Watch mode for development
npm run watch
# Clean build artifacts
npm run clean
# Build for production
npm run buildClarityLens/
βββ manifest.json # Chrome extension manifest (MV3)
βββ package.json # Dependencies and scripts
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite bundler configuration
βββ public/
β βββ icons/ # Extension icons (16, 48, 128px)
βββ src/
β βββ background/
β β βββ service-worker.ts # Background script for context menus, messaging
β βββ content/
β β βββ content.ts # Main content script bootstrap
β β βββ capabilities.ts # API detection and fallbacks
β β βββ simplify.ts # Summarizer + Rewriter integration
β β βββ images.ts # Prompt API multimodal for images
β β βββ forms.ts # Proofreader integration
β β βββ translate.ts # Translator + Language Detector
β β βββ wcag.ts # Accessibility utilities
β βββ lib/
β β βββ ai/ # AI API wrappers
β β β βββ summarizer.ts
β β β βββ rewriter.ts
β β β βββ prompt.ts
β β β βββ proofreader.ts
β β β βββ translator.ts
β β βββ dom.ts # Safe DOM manipulation
β β βββ storage.ts # Chrome storage wrapper
β β βββ telemetry.ts # API status overlay
β βββ ui/
β βββ popup.html/ts/css # Extension popup
β βββ options.html/ts # Settings page
βββ scripts/
β βββ zip.mjs # Packaging script
βββ dist/ # Build output (load as unpacked extension)
/* Colors */
--cl-primary: #2563eb;
--cl-success: #10b981;
--cl-error: #ef4444;
--cl-warning: #f59e0b;
/* Spacing */
--cl-space-xs: 4px;
--cl-space-sm: 8px;
--cl-space-md: 16px;
--cl-space-lg: 24px;
/* Typography */
--cl-font-size-base: 14px;
--cl-line-height-normal: 1.5;
/* Transitions (respects prefers-reduced-motion) */
--cl-transition-fast: 150ms;
--cl-transition-base: 200ms;- Keyboard navigation: All controls reachable via Tab, activated with Enter/Space
- Focus indicators: 3px outline with 2px offset for clear visibility
- Screen reader support: ARIA live regions, labels, and announcements
- Reduced motion: Animations disabled when
prefers-reduced-motion: reduce - Target size: Minimum 36Γ36px for touch targets (WCAG 2.2 Level AA)
- Color contrast: 4.5:1 minimum for text, 3:1 for UI components
import { summarizerAPI } from './lib/ai/summarizer.js';
await summarizerAPI.initialize();
const result = await summarizerAPI.summarize(text, {
type: 'tl;dr',
length: 'medium',
});import { rewriterAPI } from './lib/ai/rewriter.js';
await rewriterAPI.initialize();
const result = await rewriterAPI.rewrite(text, {
tone: 'more-casual',
length: 'shorter',
});import { promptAPI } from './lib/ai/prompt.js';
await promptAPI.initialize();
const result = await promptAPI.describeImage(imageElement);
const chartExplanation = await promptAPI.explainChart(imageElement);import { proofreaderAPI } from './lib/ai/proofreader.js';
await proofreaderAPI.initialize();
const result = await proofreaderAPI.proofread(text);
// result.issues: Array<{ type, start, end, suggestions, message }>import { translatorAPI } from './lib/ai/translator.js';
await translatorAPI.initialize();
const langResult = await translatorAPI.detectLanguage(text);
const translation = await translatorAPI.translate(text, {
sourceLanguage: 'en',
targetLanguage: 'es',
});- activeTab: Access page content for AI processing (only on user action)
- scripting: Inject content scripts for on-page features
- storage: Save user preferences and per-site settings
- contextMenus: "Explain image" right-click menu
No host permissions or network requests β all processing is on-device.
Test: On a dense article, click "Add TLDRs to Page"
- Per-paragraph TLDR panels appear without layout shift
- Summaries are concise and relevant
- "Undo" button restores original text
- Reading level slider updates summaries instantly
- Keyboard navigation reaches all controls
Test: On a page with charts, right-click an image β "Explain this image"
- AI-generated description appears as
altattribute - Charts get
<figcaption>with explanation - Screen reader announces new description
- Explanation panel shows detailed analysis
Test: Type text with errors into a textarea
- Suggestions appear below input with categorized issues (spelling, grammar, punctuation, style)
- Clicking suggestion replaces text
- Screen reader announces number of suggestions
- Plain-language explanations (e.g., "This word may be misspelled")
Test: On an English page, select "Hindi" or "Kannada" and click "Translate Page"
- Content translates in place without layout shift
- Hovering over translated text shows original
- Language preference persists on page refresh
- "Restore Original" button reverts changes
Test: Navigate extension with keyboard only
- All controls reachable via Tab
- Focus indicators visible (3px blue outline)
- Enter/Space activates buttons
- Screen reader announces state changes
- Reduced motion honored (check
prefers-reduced-motion) - Target sizes β₯ 36Γ36px for all interactive elements
Test: Enable "Show Tech Overlay" in popup
- Overlay displays API names (Summarizer, Rewriter, Prompt API, etc.)
- Shows "On-device" or "Unavailable" status
- Displays latency in milliseconds after each API call
- Updates in real-time during operations
- Verify Chrome version:
chrome://version(must be 127+) - Check flags:
chrome://flags(all 5 flags enabled?) - Update model:
chrome://componentsβ "Optimization Guide On Device Model" β "Check for update" - Restart Chrome completely (quit, not just close window)
- After-download status: Model is downloading in background. Wait 1-2 minutes and retry.
- Network issues: Check internet connection for initial model download.
- Reload extension:
chrome://extensionsβ Click reload icon - Check console: Right-click extension icon β "Inspect popup" β Console tab
- Verify permissions: Manifest must include
activeTabandscripting
- Chrome Built-in AI Documentation
- Early Preview Program
- WCAG 2.2 Guidelines
- Manifest V3 Migration Guide
MIT License - see LICENSE file
Contributions welcome! Please:
- Fork the repository
- Create 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 Pull Request
Built with Chrome's Built-in AI APIs (Early Preview). All AI processing runs on-device using Gemini Nano models.
Made with β€οΈ by the ClarityLens Team
For issues, feature requests, or questions, please open an issue
Understand any page, instantly.
ClarityLens is an on-device Chrome extension that simplifies dense paragraphs, explains images with multimodal AI, fixes form inputs with plain-language guidance, and translates pages in placeβpowered by Chrome's built-in AI APIs (Summarizer, Rewriter, Prompt, Proofreader, Translator) and Gemini Nano.
Many users struggle to read dense web content, understand unlabeled images, fix form errors, and browse in their preferred language. Existing tools rarely address text, images, forms, and translation together while preserving privacy and working offline. ClarityLens solves this by unifying five Chrome built-in AI APIs in one seamless, on-device workflow.
- APIs Used: Summarizer API, Rewriter API
- Generate TLDRs for long paragraphs
- Adjust reading level and tone (concise/neutral/detailed)
- Preserve original layout with quick undo
- Reduces cognitive load for ADHD, dyslexia, and ESL users
- API Used: Prompt API (multimodal)
- Generate descriptive alt-text for unlabeled images
- "Explain this chart/diagram" for complex visuals
- Inject ARIA-friendly labels for screen readers
- Improves perceivability for visually impaired users
- API Used: Proofreader API
- Detect grammar and spelling errors in form inputs
- Provide categorized, plain-language explanations
- Accessible error messages for assistive technologies
- Increases successful form submissions
- APIs Used: Translator API, Language Detector API
- Detect page language automatically
- One-click translation to preferred language (English, Hindi, Kannada, etc.)
- Hover to view original text
- Per-site language preference persistence
- Clear keyboard focus indicators
- Predictable interactions on focus/hover
- Reduced motion support
- Adequate target sizes for motor-impaired users
ClarityLens/
βββ manifest.json # Manifest V3 configuration
βββ package.json # Build dependencies
βββ LICENSE # MIT License
βββ README.md # This file
βββ public/
β βββ icons/ # Extension icons (16, 48, 128px)
βββ src/
β βββ background/
β β βββ service-worker.ts # Background service worker
β βββ content/
β β βββ content.ts # Main content script bootstrap
β β βββ simplify.ts # Summarizer/Rewriter integration
β β βββ images.ts # Prompt API multimodal
β β βββ forms.ts # Proofreader integration
β β βββ translate.ts # Translator + Language Detector
β β βββ wcag.ts # WCAG 2.2 UX enhancements
β β βββ capabilities.ts # API detection & fallbacks
β βββ lib/
β β βββ ai/ # AI API wrappers
β β βββ dom.ts # DOM utilities
β β βββ storage.ts # Chrome storage API
β β βββ telemetry.ts # Performance overlay
β βββ ui/
β βββ popup.html # Extension popup
β βββ popup.ts # Popup logic
β βββ options.html # Options page
β βββ options.ts # Options logic
β βββ styles.css # Global styles
βββ scripts/
β βββ build.mjs # TypeScript build script
β βββ zip.mjs # Package for submission
βββ dist/ # Build output
- Chrome 127+ (Dev/Canary channel recommended for Early Preview APIs)
- Node.js 18+ and npm/yarn (for building from source)
- Enable Chrome AI flags (see below)
ClarityLens requires Chrome's built-in AI APIs. Enable these flags in chrome://flags:
- Prompt API for Gemini Nano:
#prompt-api-for-gemini-nanoβ Enabled - Summarization API:
#summarization-apiβ Enabled - Writer API:
#writer-apiβ Enabled - Rewriter API:
#rewriter-apiβ Enabled - Translation API:
#translation-apiβ Enabled - Proofreader API:
#proofreader-apiβ Enabled (if available) - Prompt API for Gemini Nano Multimodal:
#prompt-api-for-gemini-nano-multimodalβ Enabled
Restart Chrome after enabling flags.
# Clone the repository
git clone https://github.com/YOUR_USERNAME/claritylens.git
cd claritylens
# Install dependencies
npm install
# Build the extension
npm run build
# For development with hot reload
npm run watch- 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 - ClarityLens icon should appear in your extensions toolbar
- Open any dense article (e.g., Wikipedia, academic paper, news site)
- Click the ClarityLens icon β Simplify Text
- Observe paragraph-level TLDRs and adjustable reading level
- Toggle Undo to restore original text
- Expected: Simplified text appears inline without layout shift
- Navigate to a page with charts/diagrams (e.g., data visualization, infographic)
- Right-click an image β Explain Image (context menu)
- Expected: Alt-text generated and "Explain this chart" summary displayed
- Test with screen reader (NVDA/JAWS) to verify ARIA labels
- Open any web form (e.g., contact form, comment box)
- Type text with intentional grammar/spelling errors
- Focus on input β ClarityLens auto-detects errors
- Expected: Plain-language error explanations with suggestions
- Open a page in English
- Click ClarityLens icon β Translate β Select Hindi/Kannada
- Expected: Page content translates in-place within 1-2 seconds
- Hover over translated text to view original
- Refresh page β language preference persists
- Navigate using Tab key only (no mouse)
- Trigger each feature via keyboard shortcuts (see Options)
- Expected: All features accessible, clear focus indicators visible
ClarityLens gracefully handles API availability:
- Summarizer/Rewriter: Check
ai.summarizerandai.rewriteravailability - Prompt API (multimodal): Check
ai.languageModelwith image support - Proofreader: Check
ai.proofreader(Early Preview API) - Translator: Check
translation.canTranslate()
If an API is unavailable, the extension:
- Displays a feature unavailable tooltip in the popup
- Shows a link to the Chrome flags setup guide
- Continues functioning with available APIs
- All AI processing runs locally using Gemini Nano
- No data sent to external servers
- Works offline for core features (summarization, rewriting)
- Translation may require network for language model downloads
| Feature | Average Response Time | On-Device |
|---|---|---|
| Text Simplification | ~200ms | β |
| Image Alt-Text | ~400ms | β |
| Form Proofreading | ~150ms | β |
| In-Page Translation | ~300ms | β * |
*Initial language model download may take 1-2 minutes
| API | Purpose | Status |
|---|---|---|
| Summarizer API | Generate TLDRs for paragraphs | Stable |
| Rewriter API | Adjust reading level and tone | Stable |
| Prompt API (multimodal) | Image understanding & alt-text | Early Preview |
| Proofreader API | Grammar/spelling detection | Early Preview |
| Translator API | In-page language translation | Stable |
| Language Detector API | Auto-detect page language | Stable |
Watch the 3-minute demo: YouTube Link
Demo Script:
- Simplify a dense Wikipedia article with TLDR
- Generate alt-text for an unlabeled chart
- Proofread a form with errors and fix them
- Translate page to Hindi and back
- Navigate all features with keyboard only
This project was built for the Google Chrome Built-in AI Challenge 2025.
| Criterion | How ClarityLens Scores |
|---|---|
| Functionality | Works across articles, forms, and multilingual pages; scales to global audiences |
| Purpose | Meaningfully improves reading, image understanding, form completion, and multilingual browsing |
| Content | Clean UI with consistent design tokens, subtle animations, and minimal chrome |
| User Experience | 3-step onboarding, keyboard shortcuts, WCAG 2.2 compliance, accessible to all users |
| Technological Execution | Showcases 6 built-in AI APIs in one cohesive workflow with explicit on-device indicators |
- Solution: Ensure Chrome flags are enabled (see Installation)
- Restart Chrome after enabling flags
- Use Chrome Dev/Canary channel for Early Preview APIs
- Solution: Enable
#prompt-api-for-gemini-nano-multimodalflag - Ensure image size < 5MB and supported formats (JPG, PNG, WebP)
- Solution: Wait 1-2 minutes for initial language model download
- Check network connection for model fetch
- Solution: Verify
dist/folder contains manifest.json - Check browser console for error messages
- Reload extension in
chrome://extensions/
Contributions welcome! Please:
- 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
This project is licensed under the MIT License - see LICENSE file for details.
- Chrome Built-in AI team for APIs and documentation
- WCAG 2.2 guidelines for accessibility standards
- Google Chrome Built-in AI Challenge 2025 organizers
- Devpost community for feedback and support
Developer: [Your Name]
Email: your.email@example.com
GitHub: @your-username
Project Link: https://github.com/your-username/claritylens
Built with β€οΈ using Chrome's Built-in AI APIs and Gemini Nano