Lock In is a privacy-first focus coach that runs entirely in your browser. It uses your webcam to detect micro-distractions and bad habits—like hair touching, eye/nose rubbing, nail biting, and phone pick-ups—and gives gentle, real-time nudges. You get a session timer, smart breaks, a dashboard of focus metrics—all on-device—plus an in-app coach powered by Gemini with ElevenLabs voice.
- About the Project
- Inspiration
- Why These “Bad Habits” Matter
- How We Built It
- In-App Coach — Gemini Chatbot
- What We Learned
- Challenges & Fixes
- Early Results
- What’s Next
- Privacy First
- Built With
- Quick Start (Local Dev)
Lock In is a browser-native, privacy-first focus coach. It uses your webcam to detect micro-distractions and bad habits—like hair touching, eye/nose rubbing, nail biting, and phone pick-ups—and gives gentle, real-time nudges. You get a session timer, smart breaks, and a dashboard of focus metrics—all on-device—plus an in-app coach powered by Gemini + ElevenLabs voice.
I was losing study time to tiny bad habits I barely noticed: fixing hair, rubbing eyes, checking my phone “for a second.” App blockers don’t address physical habits. I wanted a coach that:
- runs in the browser (no installs),
- respects privacy (no video leaves the device),
- provides real-time feedback that helps unlearn bad habits, not just track them.
- Stress signal: Face/hand self-touching spikes under cognitive stress—these are measurable self-soothing behaviors.
- They’re frequent: Students touch their faces dozens of times per hour, especially around eyes and nose—prime pathways for irritation and germs.
- Eye health risk: Habitual eye rubbing is linked to corneal issues (e.g., keratoconus) when forceful or prolonged.
- Mental health link: Nail biting (onychophagia) is a recognized BFRB (body-focused repetitive behavior) with physical and psychosocial impacts.
- Real campus prevalence: College samples show meaningful rates of nail biting (e.g., ~29% men, 19% women).
Takeaway: These “small” actions are stress markers, hygiene/health risks, and attention drains—perfect targets for timely, on-device nudges.
- Frontend: React + TypeScript, HTML5 Canvas overlays
- CV Models: MediaPipe-style face & hand landmarks (web-friendly)
- Habit Engine: Lightweight detector with latching + hysteresis to avoid flicker
- In-App Coach: Gemini chatbot with ElevenLabs TTS voiceover; minimal REST for session logs/aggregates
- Webcam →
getUserMedia - Face + hand landmark models at ~15–30 FPS
- Habit engine classifies: hair touch, nail biting, eye/nose rubbing, phone pick-up → updates focus state (
FOCUSED/NOT_FOCUSED/PAUSED) - Overlay UI draws banners, timers, and micro-nudges
- Metrics aggregate client-side; optional anonymized sync
- Sign up/ log into our platform
- Select a total study session time (30 mins, 60 mins, 120 mins, or custom)
- Select a work interval length
- Click 'Start Your Focus Session'
- Begin Studying! You can take a break by clicking 'Take A Break Now' and then resume the session. You also have access to the chatbot on the bottom right for any questions you have.
- Click 'End Session' once study session is done. You will get to see a quick summary of the recent study session stats.
- Click 'Start Another Session' to start another study session.
- Navigate to 'Profile' to change account credentials, see stats of recent sessions, activity log for the past year, all time metrics, and an interactive map! You can filter through the interactive map by selecting an option from the drop down menu.
To complement real-time nudges, Lock In includes a Gemini-powered study coach embedded in the app:
- Voice mode: Responses are spoken via ElevenLabs for hands-free study; users can switch between text-only and voice at any time.
- Boundaries & privacy: Prompts are stripped of PII; the model never receives or stores images. Users can disable context sharing or use the coach as a generic study chatbot.
git clone https://github.com/your-org/your-repo.git
cd your-repo
cd client
npm install
npm run dev
cd ../server
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python app.py