A Python-based focus monitoring tool that uses Claude to analyze your screen activity and determine if you're staying on task.
- Takes periodic screenshots of your work environment
- Uses Claude AI to analyze screen content
- Intelligently determines if you're focused on your stated task
- Considers main content vs active distractions with 80/20 weighting
- Ignores non-disruptive elements like inactive tabs or UI elements
- Python 3.11 or higher
- An Anthropic API key (for Claude)
- macOS (currently tested on macOS, may work on other platforms)
- Clone the repository:
git clone [your-repo-url]
cd [repo-name]- Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows, use: venv\Scripts\activate- Install required packages:
pip install anthropic mss python-dotenv Pillow- Create a
.envfile in the project root:
echo "ANTHROPIC_API_KEY=your-api-key-here" > .envReplace your-api-key-here with your actual Anthropic API key.
- Edit your current task in
main.py:
CURRENT_TASK = "Working on a math project - solving calculus problems"Change this to match what you're working on.
- Run the monitor:
python main.py-
The program will:
- Take screenshots every 2 seconds
- Analyze them using Claude
- Print whether you're focused or distracted
- Show what content is on screen and any active distractions
-
Press Ctrl+C to stop monitoring.
The tool uses a sophisticated analysis system:
- Main Content (80% weight): What dominates your screen
- Active Distractions (20% weight): Things actively competing for attention
Something is only counted as a distraction if it's:
- Actively playing (video/audio)
- Taking up significant screen space
- Clearly engaging attention (e.g., open chat with new messages)
UI elements, inactive tabs, and small windows are NOT counted as distractions.
Starting distraction monitor for task: Working on a math project
Press Ctrl+C to stop...
Claude's Analysis:
FOCUSED: yes
MAIN CONTENT: Math equations and graphs visible on screen
ACTIVE DISTRACTIONS: none
REASONING: Screen dominated by calculus content with no major competing elements.
Screenshots are saved temporarily in the screenshots directory and are overwritten each time you run the program. They are only used for Claude's analysis and are not stored permanently or sent anywhere except to Claude's API for analysis.
You can modify:
- Screenshot interval (default: 2 seconds)
- Task description
- Analysis weights
- What counts as a distraction
Edit these in main.py as needed.
If you see "No module named 'xxx'":
pip install xxxIf screenshots aren't capturing properly:
- Ensure you have screen recording permissions enabled for your terminal/IDE
- Try running the program with elevated privileges
Feel free to open issues or submit pull requests!