Earn Break is an adaptive productivity system that changes how time feels based on how focused you actually are.
Instead of rigid rules like “work 25 minutes → rest 5 minutes”, Earn Break dynamically speeds up or slows down time depending on your real behavior:
- Focused → time moves faster (you earn breaks sooner)
- Distracted → time slows down
- Idle → time slows down even more
- Neutral → normal speed
The result is a system that rewards real focus and penalizes fake productivity.
Step 1 — Data Collection (Training Phase)
- Collect raw signals
- Aggregate features
- Ask user for labels
- Train the model
Step 2 — Inference (Prediction Phase)
- Load the trained model
- Aggregate features
- Predict focus state
- Adjust time speed automatically
Most productivity tools measure time spent, not quality of attention.
People often:
-
Keep a timer running while scrolling
-
Move the mouse to look “busy”
-
Wait for the break instead of earning it Earn Break solves this by:
-
Observing real signals (window usage, browser behavior, camera cues)
-
Learning your focus patterns
-
Adapting time dynamically using machine learning
This makes productivity behavior-driven, not time-driven.
- Collects system, browser, and camera signals
- Aggregates features into time windows
- Trains and runs the ML model
- Streams live state via WebSockets
- Displays adaptive time progress
- Shows focus state, speed, and remaining time
- Allows labeling during training phase
- Runs as a desktop app
Focus is not a simple rule.
For example:
- Being in a browser can mean research or doomscrolling
- Looking away briefly doesn’t always mean distraction
- Low mouse activity can mean deep thinking or being idle
- Hard-coded rules fail here.
Machine learning allows the system to:
- Combine many weak signals
- Learn non-linear patterns
- Adapt to individual behavior
- Improve over time as more data is collected
The system uses a Random Forest classifier for focus detection.
Reasons:
- Works well with small to medium datasets
- Handles non-linear interactions between signals
- Requires minimal preprocessing
- Robust to noisy, real-world data
- Provides feature importance (great for debugging and explainability)
The model is trained on 60-second aggregated time windows.
Each row represents one minute of behavior, labeled as:
- focused
- neutral
- distracted
- idle
Example features:
- Time spent on primary app
- Context switching frequency
- Browser usage and doomscroll probability
- Face presence and gaze direction
- Head motion, blink rate, fatigue signals
- Time since last break
The dataset starts with manual labeling (human-in-the-loop), then transitions into fully automatic inference once a model is trained.
📈 Model Training Results
After collecting labeled behavioral data and training the focus classifier, the following evaluation was obtained on a held-out test set:
precision recall f1-score
distracted 1.00 1.00 1.00
focused 0.86 1.00 0.92
idle 1.00 1.00 1.00
neutral 1.00 0.83 0.91
accuracy 0.96
macro avg 0.96 0.96 0.96
weighted avg 0.97 0.96 0.96 - Overall accuracy: 96%
- Slight overlap between focused and neutral, which is expected in real human behavior
- No class collapse or bias toward a single state
🔍 Feature Importance
=== Feature Importance ===
percent_time_on_primary 0.233
gaze_on_screen_ratio 0.153
percent_browser_time 0.138
doomscroll_prob_mean 0.134
time_away_from_primary 0.092
head_motion_mean 0.092
face_present_ratio 0.065
doomscroll_duration 0.049
num_context_switches 0.022
blink_per_min 0.012
yawn_prob_mean 0.008
time_since_last_break 0.0021️⃣ Backend setup (Python)
Install dependencies:
pip install -r requirements.txtRun the backend:
uvicorn main:app --reload --port 80002️⃣ Train the ML model
After collecting labeled data:
python -m ml.training.train_focus_modelThis will:
- Load the dataset
- Train the focus classifier
- Print evaluation metrics
- Save the trained model
3️⃣ Frontend setup (Vue)
Install dependencies:
npm installRun the dev server:
npm run dev4️⃣ Tauri (Desktop App) setup
Install Rust:
winget install Rustlang.RustupVerify installation:
rustc --version
cargo --versionInstall Tauri CLI:
npm install -D @tauri-apps/cliInitialize Tauri:
npx tauri init




