How reginacas/sense-ui works
1. What this repository is
SenseUI is a Chromium extension, not a server-backed app. The runtime boundary is the browser itself plus an external AI provider configured by the user. There is no backend service in this repo.
2. Top-level runtime shape
The extension is organized around a background script and several HTML-based UI surfaces. The key runtime files are src/background.js and the bundled page scripts: script-bundled.js, settings-bundled.js, projects-bundled.js, and about-bundled.js.
3. Main user-facing surface
src/index.html is the primary chat interface. It is the place where users ask questions about the current webpage, trigger quick prompts, and read structured feedback. src/styles.css provides the shared visual layer across these pages.
4. Extension entry and navigation
src/manifest.json defines the extension’s entry points and browser integration, including the popup/page wiring and the keyboard shortcut mentioned in the README (Ctrl + Shift + S). The manifest is the boundary that connects the browser’s extension lifecycle to the extension’s pages and background logic.
5. Background orchestration
src/background.js is the coordination layer. It is where extension-wide events are handled: lifecycle events, shortcut/command handling, and message passing between UI pages and the browser APIs. This script is the natural place for tab capture and any privileged browser interactions.
6. AI feedback pipeline
The core data flow is: user prompt + current tab context → request to AI provider → response returned to the UI. The README says SenseUI uses the active tab’s HTML/CSS and screenshots to generate feedback, so the extension’s job is to collect page context, package it into a request, and render the returned guidance in the chat UI.
7. Page context capture
A major architectural concern is current-page inspection. The roadmap states the extension moved from viewport-only screenshots to full-page screenshots, configurable from settings. That means the capture subsystem likely needs browser permissions, tab access, and screenshot APIs, and it must balance fidelity with accessibility/performance.
8. Settings as a control plane
src/settings.html and src/settings-bundled.js manage user configuration. This includes AI credentials, feedback/detail preferences, shortcut customization, screenshot mode, and reset behavior. Settings are a key boundary because they control how the rest of the extension behaves without changing the main chat UI.
9. Secondary UI surfaces
src/help.html, src/welcome.html, and src/projects.html are separate extension pages with their own bundled scripts. Based on the README and filenames, these are supporting surfaces for onboarding/help, project or context management, and potentially future workflow organization. They are not the primary chat runtime, but they extend the product around it.
10. State and persistence
The extension is designed around local browser persistence for settings and session state. The README also calls out future/ongoing support for chat persistence across restarts and download/export behavior. That means the architecture likely centers on browser storage rather than a remote database.
11. Accessibility-first design
Accessibility is not just a feature; it is a core architectural constraint. The repo emphasizes keyboard navigation, semantic headings, screen-reader-friendly interaction, quick action prompts, and structured responses. The UI layer therefore needs to be navigable without sight and should preserve meaningful reading order and focus behavior.
12. Operational/documentation layer
The repository includes extensive policy and process docs: privacy/data handling, contribution rules, setup, quickstart, and sprint retrospectives. These don’t change runtime behavior, but they matter for architecture because they reflect the project’s privacy-sensitive research context and its user-testing workflow with blind and low-vision contributors.
13. Tooling and packaging
The presence of *-bundled.js files suggests the source is built into browser-ready bundles before release. The repo also uses linting/formatting and Git hooks, but those are supporting engineering controls rather than runtime components.
14. How to draw the diagram
A good architecture diagram should show:
- the browser extension shell as the main system,
- background.js as the coordinator,
- index/settings/help/projects/welcome as separate extension pages,
- the active webpage as the source of page context,
- the external AI API as the only external service boundary,
- and browser storage as the persistence layer for settings and conversation state.
Main entry points: background.js Background · manifest.json Manifest · styles.css Styles · index.html Chat UI
Components 17
Extension runtime
Browser extension shell, background coordination, and UI surfaces.
- Manifest · Declares extension entry points, permissions, and commands.
src/manifest.json - Background · Handles extension lifecycle, commands, messaging, and privileged browser work.
src/background.js - Chat UI · Primary user interface for prompts, feedback, and page-aware chat.
src/index.html - Chat Script · Runs the main chat experience and renders returned guidance.
src/script-bundled.js - Settings · Configuration surface for credentials, preferences, shortcuts, and reset behavior.
src/settings.html - Settings Logic · Applies user preferences and stores extension configuration.
src/settings-bundled.js - Projects · Project or context management surface for organizing work.
src/projects.html - Projects Logic · Implements project-related page behavior.
src/projects-bundled.js - Help · Onboarding and help surface.
src/help.html - Welcome · First-run or introductory extension page.
src/welcome.html - About Logic · Implements the about page behavior.
src/about-bundled.js - Styles · Shared visual layer across extension pages.
src/styles.css
Browser + AI
External boundaries the extension talks to at runtime.
- Active Tab · Current webpage inspected for HTML, CSS, and screenshots.
- Browser APIs · Tabs, commands, screenshots, storage, and messaging primitives.
- Local Storage · Browser-local persistence for settings and session state.
- AI Provider · User-configured external model or API endpoint.
Support files
Shared presentation and non-runtime supporting pages.
- Docs & Policy · Setup, privacy, contribution, and project documentation.
README.md
Connections 24
- Manifest → Background: registers · Wires lifecycle, commands, and privileged entry points.
- Manifest → Chat UI: opens · Defines the primary extension surface.
- Manifest → Settings: opens · Exposes settings as a separate page.
- Manifest → Projects: opens · Exposes project management page.
- Manifest → Help: opens · Exposes help page.
- Manifest → Welcome: opens · Exposes onboarding page.
- Background → Browser APIs: uses · Performs extension-wide browser interactions.
- Background → Active Tab: captures · Reads the current page context for feedback generation.
- Background → AI Provider: requests · Sends prompt plus page context to the configured model.
- Background → Local Storage: reads/writes · Persists settings and session state.
- Chat UI → Chat Script: runs · HTML shell loads the main chat logic.
- Chat UI → Styles: uses · Shares the common visual layer.
- Chat Script → Background: messages · Sends user prompts and receives generated feedback.
- Chat Script → Local Storage: reads/writes · Uses local persistence for chat state.
- Settings → Settings Logic: runs · HTML shell loads settings logic.
- Settings → Styles: uses · Shares the common visual layer.
- Settings Logic → Local Storage: updates · Stores preferences, credentials, and shortcuts.
- Projects → Projects Logic: runs · HTML shell loads project logic.
- Projects → Styles: uses · Shares the common visual layer.
- Projects Logic → Local Storage: updates · Persists project-related state.
- Help → Styles: uses · Shares the common visual layer.
- Welcome → Styles: uses · Shares the common visual layer.
- About Logic → Styles: uses · Shares the common visual layer.
- Background → Chat UI: notifies · Pushes results and state changes back to the chat interface.