We lose about 68 days a year to our phones:

$$ 4.5 \text{ hrs/day} \times 365 \text{ days} \approx 1{,}640 \text{ hrs} \approx 68 \text{ days} $$

As students, we know this too well. You sit down to study, pick up your phone "for a second," and suddenly 40 minutes are gone. Screen-time apps don't fix this — they only tell you at the end of the week, when it's already too late. I wanted something that catches you in the moment and actually helps you understand why you lose focus.

What it does

Lock In is an AI focus coach that runs on your laptop.

  • Real-time distraction detection: Using your webcam, Lock In detects when you pick up your phone, look down for too long, or drift onto a distracting site, and nudges you back before two minutes turns into forty.
  • Focus timeline: Every slip is logged, so after each session you get a summary with your focus score, longest streak, time lost, and a visual timeline of when you were locked in versus distracted.
  • AI coach: An LLM reads your session patterns (never your video) and gives you a short, personalized plan, like "Your focus drops after ~25 minutes, try 20-minute sprints" or "Instagram after 9pm is your weak spot."
  • Accountability buddy: Optionally ping a friend on Discord when you slip three times in one session.
  • Privacy first: All computer vision runs locally. No video or images ever leave your device.

How I built it

  • Computer vision: [Python + OpenCV + MediaPipe] for face and head-pose tracking, plus [a YOLO object-detection model] to detect a phone in the frame. I debounced detections (about 3 seconds of continuous detection plus a cooldown) so one slip isn't logged dozens of times.
  • Backend: [Flask/FastAPI] serves detection events and session data, stored locally in [SQLite].
  • Frontend: [React] dashboard with the live session view, summary screen, focus timeline, and history insights.
  • AI coach: Aggregated session stats are sent to [Claude/OpenAI API] to generate coaching messages, with a rule-based fallback so it works even offline.
  • Accountability: Discord webhooks for buddy notifications.

Challenges I ran into

  • False positives: Early versions flagged us for glancing at notes or scratching our faces. Tuning thresholds and adding debounce logic took a lot of iteration.
  • Lighting and camera angles: Detection accuracy dropped in low light and at odd laptop angles, so I had to test in different environments around the venue.
  • Making the AI useful, not generic: Our first coaching messages were vague ("try to focus more!"). Feeding the model structured stats (slip times, durations, sources) made the advice specific and actionable.
  • 24 hours: Scoping was hard. I prioritized detection → logging → insights → AI coach, and only added accountability once the core was solid.

Accomplishments that I'm proud of

  • A detection pipeline that runs in real time, entirely on-device.
  • Turning raw slip events into insights people actually care about.
  • An app I genuinely want to use myself after this hackathon.

What I learned

  • Real-time CV is much harder outside of tutorials: lighting, angles, and edge cases matter a lot.
  • How to design LLM prompts around structured data to get specific, useful output.
  • Privacy has to be a design decision from the start, especially for anything using a webcam.

What's next for Lock In

  • A browser extension for more accurate distracting-site detection.
  • Weekly focus reports and long-term trend tracking.
  • Study-group mode, where friends lock in together and share streaks.
  • A mobile companion app that detects phone pickups from the phone side.t it

Built With

Share this project:

Updates

Submission history