How kee-rti/prod works
Prod is a browser extension that tracks browsing activity, classifies focus locally, explains the classification, and summarizes focused versus distracted time. Its principal runtime path runs from page telemetry through the background service worker and XGBoost inference to an on-page status overlay; the popup reads locally stored session data for its dashboard. The repository also includes the documented synthetic-data training and model-export workflow. Source excerpts do not show every message-handler or model-loading detail, so the graph omits uncertain connections.
Main entry points: model Model assets · background.js Background hub · synthetic_data.csv Synthetic dataset · content.js Page tracker
Components 18
Extension runtime
- Page tracker
extension/content.js - Background hub
extension/background.js - Tab telemetry
extension/background.js - Focus inference
extension/lib/inference.js - Compiled XGBoost
extension/lib/xgb_compiled.js - Status overlay
extension/content.js - Time dashboard
extension/popup/popup.js
Model pipeline
- Scenario data
ml_lab/generate_data.py - Synthetic dataset
synthetic_data.csv - Baseline training
ml_lab/train_model.py - XGBoost training
ml_lab/train_xgb.py - Model evaluation
ml_lab/evaluate_model.py - Threshold tuning
ml_lab/threshold_sweep.py - Tree compiler
ml_lab/compile_xgb_js.py - Model assets
extension/model
Local state
- Extension storage
Other components
- Browser user
- Web page
Connections 23
- Browser user → Web page: browses
README.md - Web page → Page tracker: provides activity
extension/content.js - Page tracker → Background hub: sends heartbeat
extension/content.js - Background hub → Tab telemetry: tracks tab switches
extension/background.js - Background hub → Focus inference: predicts focus
extension/background.js - Focus inference → Compiled XGBoost: uses predictor
extension/lib/inference.js - Background hub → Status overlay: returns status
- Page tracker → Status overlay: updates display
extension/content.js - Background hub → Extension storage: writes session
extension/background.js - Tab telemetry → Extension storage: persists telemetry
extension/background.js - Time dashboard → Extension storage: reads session data
extension/popup/popup.js - Browser user → Time dashboard: opens dashboard
README.md - Scenario data → Synthetic dataset: generates samples
ml_lab/generate_data.py - Synthetic dataset → XGBoost training: trains from
ml_lab/train_xgb.py - Synthetic dataset → Baseline training: trains from
ml_lab/train_model.py - Synthetic dataset → Model evaluation: evaluates on
ml_lab/evaluate_model.py - XGBoost training → Model assets: exports model
ml_lab/train_xgb.py - Model assets → Threshold tuning: loads model
ml_lab/threshold_sweep.py - Threshold tuning → Model assets: exports trees
ml_lab/threshold_sweep.py - Model assets → Tree compiler: loads trees
ml_lab/compile_xgb_js.py - Tree compiler → Compiled XGBoost: writes predictor
ml_lab/compile_xgb_js.py - Baseline training → Model assets: exports weights
ml_lab/train_model.py - Focus inference → Model assets: loads model assets
extension/lib/inference.js