Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎯 AI Focus Tracker

A face-powered productivity tracker that measures actual focus time and generates AI-powered productivity reports.

Instead of tracking applications or screen activity, this tracker monitors whether you are physically present and working using real-time face detection.


🚀 Features

👁️ Face-Based Productivity Tracking

  • Detects your presence using MediaPipe Face Detection
  • Automatically starts productivity timer when you are present
  • Automatically pauses when you leave

⏸️ Smart Pause System

Auto Pause

When no face is detected for a configurable amount of time:

  • Productivity timer pauses automatically
  • Junk time begins tracking

Manual Breaks

Keyboard shortcuts allow manual breaks:

  • Pause session
  • Resume session
  • Track total break duration
  • Count total breaks

📊 Productivity Analytics

Tracks:

  • Total Productivity Time
  • Total Junk Time
  • Total Break Time
  • Number of Breaks
  • Session Start Time
  • Session End Time

💾 Persistent Session Storage

Every completed session is saved to:

  • TXT file
  • JSON database

The JSON database automatically keeps only the latest 10 sessions:

  • Oldest session removed
  • Newest session added

This creates a rolling productivity history for AI analysis.


🤖 AI Productivity Coach

Using OpenRouter API:

The tracker sends recent session history to an AI model which:

  • Detects productivity patterns
  • Finds weaknesses
  • Identifies improvements
  • Generates personalized recommendations
  • Compares recent performance with older sessions

🌐 Automatic HTML Reports

After analysis, the AI generates a complete productivity report in HTML format.

Reports include:

  • Productivity Score
  • Trend Analysis
  • Performance Summary
  • Positive Improvements
  • Problems Detected
  • Actionable Suggestions
  • Behavioral Insights

⚙️ Configuration

All settings are managed through:

{
  "stopwatch_starts_after": 2,
  "stopwatch_pause_after": 10,
  "session_storage_path_txt": "",
  "session_storage_path_html": ""
}

Settings

Setting Description
stopwatch_starts_after Seconds face must remain visible before timer starts
stopwatch_pause_after Seconds face can disappear before auto-pause
session_storage_path_txt Location of session log file
session_storage_path_html Location of generated HTML reports

⌨️ Keyboard Shortcuts

Shortcut Action
CTRL + SHIFT + ALT + P Manual Pause
CTRL + SHIFT + ALT + R Resume
CTRL + SHIFT + ALT + S Reset Session
CTRL + SHIFT + ALT + Q End Session

🛠️ Installation

Clone repository:

git clone https://github.com/raghav-mendiratta/Focus-Tracker

cd Focus-Tracker

Install dependencies:

pip install -r requirements.txt

Create environment file:

OPENROUTER_API_KEY=your_api_key_here
AI_MODEL=your_ai_model_name

Run:

python focus_tracker.py

OR

start.bat

📁 Project Structure

focus-tracker/
│
├── main.py
├── settings.json
├── sessions.json
├── requirements.txt
├── README.md
├── .env
│
├── Generated Reports/
│   └── *.html
│
└── Session Logs/
    └── track.txt

🧠 Why I Built This

I originally built this project for myself.

I used to track my work sessions using a normal stopwatch, but there was a problem:

  • Sometimes I would take an unexpected break and forget to pause the timer.
  • Sometimes I would leave my desk for a few minutes and the stopwatch would keep running.
  • At the end of the day, my productivity numbers looked good, but they weren't always accurate.

In short, I was measuring time, not actual focus.

To solve that problem, I built Focus Tracker.

Instead of relying on manual tracking, it automatically detects whether I'm physically present and working. If I leave my desk, the timer pauses. If I return, it resumes automatically.

After using it myself, I realized that many people struggle with the same issue: fake productivity caused by inaccurate tracking.

So I kept improving it and turned it into a complete productivity analysis tool with session history, AI-powered insights, and automated reports.


🔮 Future Improvements

  • Productivity charts
  • Weekly reports
  • Monthly reports
  • PDF export
  • Productivity scoring engine
  • GUI dashboard (PySide6)
  • Cloud synchronization
  • Multi-user support

🏗️ Built With

  • Python
  • MediaPipe
  • OpenCV
  • OpenRouter API
  • Requests
  • JSON
  • HTML/CSS

📜 License

MIT License


Built by Raghav Mendiratta

About

Face-based productivity tracker that measures real focus by detecting your presence — not just screen time.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages