Inspiration
We’ve all been there: you sit down at your desk with full determination to study for an upcoming exam or finish a complex coding sprint. But within 15 minutes, a single notification pulls you into a rabbit hole of YouTube Shorts, Instagram Reels, or casual WhatsApp banter. An hour slips away, replaced by guilt and mental fatigue.
When we looked at existing website blockers and productivity extensions, we found they suffered from three fatal flaws:
They are rigidly punitive and binary: They block YouTube entirely, ignoring that a 2-hour Data Structures & Algorithms lecture or Coursera module is productive, while algorithmic Shorts feeds are the real trap. They treat humans like machines: They rely on sudden lockouts, harsh buzzer sounds, and guilt-tripping screens that cause psychological reactance—leading users to simply uninstall or disable the extension. They have zero awareness of physical context: If you step away from your desk to grab a glass of water, a timer still runs and penalizes you. If a friend or family member borrows your laptop for 2 minutes, your strict blockers lock them out. We asked ourselves: What if an assistant didn’t just blindly block distractions, but understood the gap between what you intended to do and what you are actually doing?
This gave birth to Focus Guard 2.0: an adaptive, context-aware digital wellbeing assistant that detects Attention Drift, intervenes empathetically, respects your physical presence through local biometrics, and helps you recover your flow state.
What it does
Focus Guard 2.0 replaces binary blockers with an adaptive, closed-loop attention recovery system: Declared Intent ➔ Real-time Trajectory ➔ Attention Drift Detection ➔ Explainable Risk Scorer ➔ Mind Mirror AI ➔ 5-Tier Adaptive Escalation ➔ Behavioral Learning
User Intent Declaration & Smart Workspace Teleportation Before a session starts, users declare their objective (e.g., Category: 📚 Study, Goal: "Master Binary Trees & Graphs", Resource URL: LeetCode or a YouTube DSA Lecture). This target URL acts as a smart productive anchor.
Contextual Classification vs. Brainrot Traps Instead of blacklisting entire domains, Focus Guard 2.0 performs contextual content evaluation:
ALIGNED: Long-form educational lectures (YouTube /watch?v=..., Coursera, edX, LeetCode, Wikipedia, Docs). NEUTRAL: Background Lo-Fi study beats and ambient noise. ACUTE MISMATCH: Algorithmic short-form video feeds (youtube.com/shorts/, instagram.com/reels/, TikTok) and social messaging apps (web.whatsapp.com, Discord) during study/deep work sessions.
- Transparent & Explainable Distraction Risk Scorer (0–100%)
Focus Guard 2.0 eliminates black-box AI decisions. Distraction risk is computed via a transparent mathematical formula:
$$ \text{Risk} = \min\left(100, \max\left(0, (P_{\text{duration}} + P_{\text{mismatch}} + P_{\text{switching}} + P_{\text{repetition}} + C_{\text{recovery}}) \times \gamma\right)\right) $$
Where:
P_duration(0 to 40 pts): Points scaled proportionally by the duration of the off-intent streak.P_mismatch(0, 4, 18, or 30 pts): Context severity penalty (30 pts for acute brainrot feeds like Reels/Shorts, 0 pts for aligned lectures/work).P_switching(0 to 18 pts): Context-thrashing penalty based on rapid app/tab switches in the preceding 5 minutes.P_repetition(0 to 35 pts): Escalation penalty for returning to distractions repeatedly within the same session.C_recovery(-25 pts): Instant recovery credit awarded upon returning to the declared focus goal.γ(gamma): User personalization sensitivity coefficient.
- "Mind Mirror" AI Recommendations (Groq LLM + Instant Offline Fallback) When distraction occurs, Focus Guard doesn't shout. It speaks as the user's rational inner conscience:
On Instagram Reels: "Deep down you know 1 reel turns into 45 minutes of regret. Let’s switch back now." On WhatsApp Web: "Replying right now breaks your flow state. These messages will still be here when you wrap up." Powered by Groq Llama 3.3 70B with a deterministic offline heuristic generator that guarantees 100% uptime with zero latency even without internet.
- The 5-Tier Graduated Escalation Hierarchy Level 0 (Flow State): Ambient emerald glow, zero interruptions. Level 1 (In-Page Awareness): A subtle, glassmorphic floating pill banner reminding you of your goal. Level 2 (Mind Mirror Suggestion): Actionable recovery card offering one-click teleportation. Level 3 (Focus Reset): An interactive 3-minute breath reset modal with an expanding/contracting orb timed to a 4s inhale / 4s exhale rhythm. Level 4 (🥶 1-Minute Tab Freeze Penalty): When distractions persist, the distracting tab is completely frozen for 60 seconds with an active countdown timer. Escape Hatch: Users can immediately unlock their screen by clicking "🚀 Teleport to Goal Workspace", instantly loading their declared study/work tab.
- Local Biometric Presence & "Who's Watching" Guard Focus Guard 2.0 features on-device facial presence verification:
Continuous Background Tracking: Uses your webcam to detect facial presence without saving raw video. Owner Present: FocusGuard policies and distraction monitors run at full strength. User Away (⚪ Away (Paused)): If you stand up to take a break or grab water, restrictions and freeze penalties automatically pause. Guest Sitting Down (👥 Guest Mode): If an unrecognized face sits in front of the laptop, Focus Guard switches to Guest Mode with zero restrictions.
How we built it
🧩 Testing the Browser Extension Companion (Chrome / Edge / Brave)
Since our video highlights the desktop engine, here is how you can test the in-page extension experience:
- Install in 2 clicks: Open
chrome://extensions➔ Enable Developer mode ➔ Click Load unpacked ➔ Select theextension/folder. - Open Companion Popup: Click the pinned shield icon to view your live Biometric state, 0–100% Distraction Risk Meter, and session mode.
- Experience In-Page Interventions: Open Instagram Reels, YouTube Shorts, Reddit, or WhatsApp Web during a focus session:
- Glassmorphic Awareness Banner: Real-time drift feedback over the screen.
- "Mind Mirror" AI Conscience: Empathetic, platform-aware intervention prompts.
- 🚀 Instant Teleportation: 1-click action closes the distraction and launches your target learning resource.
- 🧘 Guided Breath Reset: In-page 3-minute animated breathing orb to recalibrate focus.
- 🥶 1-Min Tab Freeze Penalty: Locks interaction during chronic distraction loops with an emergency escape back to your goal.
- 🔇 100% Silent & Peaceful: Zero annoying buzzers or loud alarms.
Focus Guard 2.0 is built across three tightly integrated layers: Focus Guard 2.0 is built across three tightly integrated layers:
┌─────────────────────────────────────────────────────────────────────────────┐ CLIENT TIER
│ Glassmorphic Web Dashboard + Chrome Extension MV3 │
│ (HTML5, Vanilla CSS Tokens, Canvas Gauges, Off-Screen Cam) │
└──────────────────────────────────────┬──────────────────────────────────────┘
│ REST / JSON Bridge
▼
┌─────────────────────────────────────────────────────────────────────────────┐ CORE ENGINE TIER
│ Python REST Control Plane + WSGI Serverless Router │
│ • Trajectory Tracker & Attention Drift Evaluator │
│ • Explainable Distraction Risk Scorer │
│ • Groq Llama-3.3-70B Provider + Offline Fallback Engine │
└──────────────────────────────────────┬──────────────────────────────────────┘
│ OS & Hardware Bindings
▼
┌─────────────────────────────────────────────────────────────────────────────┐ BIOMETRICS & OS TIER
│ • OpenCV YuNet (Face Detection) + SFace (128-d Embeddings) │
│ • Windows DPAPI Hardware-Backed Encryption │
│ • Win32 API Window Polling (GetForegroundWindow) │
└─────────────────────────────────────────────────────────────────────────────┘
- Dashboard & Frontend: Built with high-performance Vanilla CSS and JavaScript. Implements custom animated SVG progress rings, interactive glassmorphic cards, webcam reticles, and real-time state synchronizers.
- Browser Extension (Manifest V3): Content scripts injected into active tabs communicate with the local daemon via background service workers, rendering in-page awareness pills, breath reset orbs, and the 60-second tab freeze overlay.
- Local Biometric Engine: YuNet ONNX detects faces and aligns 5 facial landmarks. SFace ONNX extracts a 128-dimensional biometric embedding vector e.
Embeddings are unit-normalized and compared using Cosine Similarity:
$$ S_C(\mathbf{u}, \mathbf{v}) = \frac{\mathbf{u} \cdot \mathbf{v}}{|\mathbf{u}|_2 |\mathbf{v}|_2} \ge 0.40 $$
Templates are encrypted locally using Windows DPAPI (CryptProtectData), binding biometric keys directly to the logged-in OS user with zero cloud transmission.
Backend Daemon: Python control plane (http://127.0.0.1:8000) integrated with Win32 window APIs (ctypes.windll.user32.GetForegroundWindow) and a unified serverless WSGI dispatcher for cloud deployments.
Challenges we ran into
Differentiating Educational YouTube from Algorithmic Brainrot: Blocking YouTube breaks students' ability to learn. We had to parse dynamic URL parameters, video titles, and DOM hierarchies in real time to treat educational playlists and tutorials as ALIGNED, while treating /shorts/* routes as instant ACUTE_MISMATCH. Chromium Video Decoding Optimization: Modern browsers completely suspend video rendering and report videoWidth = 0 when a tag is hidden using display: none. This caused background biometric polling to stall. We resolved this by engineering an off-screen fixed video rendering technique (opacity: 0; pointer-events: none; z-index: -999;) that keeps hardware video decoding active without affecting the visual interface. Local Privacy vs. Cloud Convenience: We strictly refused to send webcam video feeds or facial imagery to cloud AI APIs. Implementing local OpenCV DNN models (YuNet and SFace) on-device with sub-50ms inference times and Windows DPAPI encryption was technically challenging, but preserved 100% user privacy. Zero-Latency Resilience: Network lag can ruin real-time interventions. We designed a dual-tier AI system where Groq's high-speed cloud LLM handles deep contextual recommendations, backed by an instant offline deterministic heuristic engine if the user is offline or experiencing latency.
Accomplishments that we're proud of
The "Mind Mirror" Paradigm: Transforming a frustrating, punitive screen blocker into an empathetic mental health and focus companion. The "Teleport to Goal Workspace" Escape Hatch: Instead of trapping users behind a dead-end blocked screen, giving them an immediate, one-click teleportation bridge straight to their productive goal. True Multi-Context Biometrics: Implementing dynamic user enrollment and automatic state switching—protecting the owner, pausing when the user steps away, and granting full freedom to guests. 100% Explainable Scoring: Delivering a fully auditable 5-factor risk score with zero black-box obscurity. 100% Silent, Respectful Interventions: Eliminating loud, jarring audio sirens in favor of calming, ambient glassmorphism and guided mindfulness breathing.
What we learned
Psychology of Digital Habits: Punitive locks trigger psychological reactance, pushing users to find workarounds. Empathetic nudges, cognitive reframing, and easy recovery pathways yield significantly higher long-term focus retention. Browser Sandbox Realities: Designing Manifest V3 extensions requires strict asynchronous communication and graceful handling of cross-origin isolation. Applied Edge Computer Vision: How to balance biometric verification confidence thresholds ($S_C \ge 0.40$) against real-world webcam conditions such as poor lighting, head tilt, and low-resolution laptop cameras. Local-First Security: Leveraging OS-level primitives like Windows DPAPI to ensure sensitive biometric data never leaves the user's physical machine.
What's next for Focus Guard 2.0
Cross-Device Focus Synchronization: Extending Focus Guard to iOS and Android so that locking down desktop distractions doesn't simply push the user onto their phone. Audio-Stream Contextual AI: Analyzing ambient tab audio to differentiate spoken educational lecture tracks from viral music and entertainment background tracks. Circadian Energy & Flow Scheduling: Using historical post-intervention recovery data to predict a user's peak cognitive hours and suggest personalized deep-work blocks throughout the day. Cross-Platform Biometrics: Bringing the hardware-backed biometric security layer to macOS (via Apple Keychain / Secure Enclave) and Linux (via Secret Service API).
Built With
- artificial-intelligence
- biometrics
- chrome
- computer-vision
- css3
- cybersecurity
- dpapi
- edge-ai
- groq
- html5
- javascript
- llama-3
- machine-learning
- manifest-v3
- numpy
- onnx
- opencv
- python
- rest-api
- ui-ux
- vercel
- webrtc
- windows-api
Log in or sign up for Devpost to join the conversation.