Privacy-focused Chrome extension that detects and highlights manipulative interface patterns while you browse.
The extension is a Manifest V3 prototype built around a local-first detection pipeline:
- Regex matching against configurable phrases in
patterns.txt - 13 text categories, including urgency, scarcity, social proof, hidden costs, forced action, trick questions, click bait, and curiosity gaps
- Optional visual-interference detection for weakly presented opposing actions such as a faint “Reject” button beside a prominent “Accept” button
- Optional on-device Gemini Nano verification through Chrome’s Prompt API
- Automatic scanning on page load and incremental scanning of dynamically added page content
- Popup dashboard with counts, category details, pause/resume, and detection-mode status
When Gemini Nano is unavailable, the extension continues to work in regex-only mode. Website text is not sent to a project-operated cloud service.
Clone the repository:
git clone https://github.com/GamePointAnalytics/dark-pattern-detector.git
Open
chrome://extensionsin Chrome.Enable Developer mode.
Select Load unpacked.
Choose the
dark-pattern-detector-chrome-extensiondirectory.Refresh any already-open tabs you want to scan.
The extension works without Gemini Nano. Experimental Chrome AI features must be enabled separately if you want optional AI verification; see the extension README for current setup notes.
dark-pattern-detector-chrome-extension/
├── content.js DOM scanning, highlighting, heuristics, and AI requests
├── patterns.txt Detection categories and regex fragments
├── popup.html/js Extension dashboard and controls
├── background.js Service-worker router and offscreen lifecycle
├── offscreen.js Optional Gemini Nano integration
├── styles.css Highlight styles
├── test_*.html Manual test fixtures
└── report/ Design and implementation notes
There is currently no build step. The pure detector and popup feedback paths have lightweight Node regression tests. For basic validation:
- Run
node --checkon the JavaScript files after edits. - Run
node dark-pattern-detector-chrome-extension/test_detector_core.jsto verify the pure text-detection module. - Run
node dark-pattern-detector-chrome-extension/test_popup_feedback_persistence.jsto verify feedback survives popup reopening. - Run
node dark-pattern-detector-chrome-extension/test_active_tab_capture.jsto verify the consent-gated, one-shot active-tab capture boundary without retaining an image. - Run
node dark-pattern-detector-chrome-extension/test_image_signal_core.jsto verify that only approved image-signal categories and confidence values can be retained. - Run
node dark-pattern-detector-chrome-extension/evaluate_detector.jsto print category-level development-fixture precision and recall. - Load the extension unpacked in Chrome.
- Use
test_page.htmlandtest_context.htmlto exercise regex detection and context handling. - Use
test_active_tab.htmlto exercise the explicit active-tab screenshot and on-device image-analysis flow with safe visual examples. - Use
test_nano.htmlonly when testing Chrome’s optional built-in AI capability.
Detection patterns can be edited directly in dark-pattern-detector-chrome-extension/patterns.txt; reload the extension and refresh the test page after changing them.
- English-language patterns only
- Regex matching can produce false positives for benign text
- Visual analysis currently focuses on selected opposing-action button pairs
- Rapidly changing single-page applications may not be scanned immediately
- Gemini Nano availability depends on the Chrome version, device, flags, and model state
- This is a prototype and should not be treated as a complete accessibility, safety, or legal compliance tool
- Product direction research
- Capture modes and consent spec
- Legal and research readiness
- Product frames
- Threat model
- Data inventory
- Local event schema
- Product consent and local data view
- Active-tab analysis beta
- Secure AI analysis options
- Classifier evaluation plan
- MVP quality checklist
- Product roadmap
- Research backlog
- Domain context
- Architecture decision: local-first analysis
- Architecture decision: user-controlled capture modes
- Extension documentation
- Walkthrough
- Implementation report
- Resources and references
The repository currently does not include a license file. Licensing should be added before distributing the project publicly.