activitywatch-analysis-skill
npx skills add https://github.com/bayramannakov/activitywatch-analysis-skill --skill activitywatch-analysis-skill
Agent 安装分布
Skill 文档
ActivityWatch Analysis Skill
Analyze ActivityWatch exports to identify focus problems, track productivity, and generate actionable weekly insights.
Features
- Smart Auto-Categorization: Classifies activities into productive/neutral/distracting
- AI Agent Detection: Recognizes Claude Code, Codex, Aider, and other AI coding agents
- Dual Scoring: Productivity score (what you worked on) + Focus score (attention quality)
- Deep Browser Analysis: Site-level breakdown with productivity ratios (Netflix, GitHub, ChatGPT, etc.)
- Death Loop Detection: Identifies repetitive app switching patterns with fix suggestions
- Actionable Insights: Specific recommendations based on your data
- Customizable Categories: JSON config to tune for your workflow
Quick Start
Option 1: Direct API Fetch (Recommended)
If you have aw-client installed (pip install aw-client), you can fetch data directly:
# Analyze today's productivity
python scripts/analyze_aw.py --fetch --from today --report --timezone America/Los_Angeles
# Analyze yesterday
python scripts/analyze_aw.py --fetch --from yesterday --report
# Analyze the past week
python scripts/analyze_aw.py --fetch --from week --report
# Analyze specific date range
python scripts/analyze_aw.py --fetch --from 2025-12-20 --to 2025-12-26 --report
# Analyze last 7 days
python scripts/analyze_aw.py --fetch --from 7d --report
Date formats supported:
today,yesterday,week(last 7 days)- Relative:
7d(7 days ago),2w(2 weeks ago) - Absolute:
YYYY-MM-DD(e.g.,2025-12-26)
Option 2: CSV Export (Fallback)
If you prefer manual export or don’t have aw-client:
- Open ActivityWatch (
http://localhost:5600) â Raw Data â Export â CSV - Run analysis:
# Basic analysis (uses system timezone)
python scripts/analyze_aw.py export.csv --report
# Specify timezone explicitly
python scripts/analyze_aw.py export.csv --timezone America/Los_Angeles --report
# With custom categories
python scripts/analyze_aw.py export.csv --config scripts/category_config.json --report
# JSON output for automation
python scripts/analyze_aw.py export.csv > summary.json
Recommended Workflow
Before trusting a weekly report, spot-check with a single day’s data:
-
Spot-check first (5 min): Analyze yesterday’s data
- Verify timezone is correct (timestamps match your memory)
- Verify idle time makes sense (screen lock duration)
- Check if top apps/categories match your experience
-
Fix issues if found:
- Wrong timezone? Use
--timezone America/Los_Angeles(or your zone) - Missing apps? Add them to
scripts/category_config.json - Wrong categories? Adjust weights in config
- Wrong timezone? Use
-
Run full analysis: Once spot-check passes, trust the weekly report
Timezone Handling
ActivityWatch stores timestamps in UTC. The analyzer converts them to your local timezone for accurate hourly analysis.
# Common timezone examples:
--timezone America/Los_Angeles # Pacific Time
--timezone America/New_York # Eastern Time
--timezone Europe/London # UK
--timezone Asia/Tokyo # Japan
If not specified, the system’s local timezone is used.
Time Breakdown
The report shows three time metrics:
| Metric | Meaning |
|---|---|
| Active | Time spent in apps (excluding idle) |
| Idle | Screen locked / loginwindow time |
| Tracked | Total time computer was on (active + idle) |
Understanding Your Scores
Combined Score (0-100)
| Range | Interpretation |
|---|---|
| 80-100 | Excellent – Deep work patterns, minimal distractions |
| 60-79 | Good – Solid productivity with room to improve |
| 40-59 | Moderate – Attention fragmented, review death loops |
| 0-39 | Needs work – High distraction, consider app blockers |
Productivity vs Focus
- Productivity Score: Measures what you spent time on (deep work vs. entertainment)
- Focus Score: Measures how you worked (sustained attention vs. constant switching)
You can have high productivity but low focus (doing good work but constantly interrupted) or vice versa.
Category Weights
| Weight | Type | Examples |
|---|---|---|
| 1.0 | Deep work | Terminal, IDE, coding |
| 0.7-0.9 | Productive | AI tools, writing, design, learning |
| 0.5 | Mixed | Meetings, presentations |
| 0.3 | Shallow | Email, work chat |
| 0.0 | Neutral | System utilities |
| -0.2 to -0.5 | Distracting | Entertainment, social media |
Death Loops
Death loops are repetitive AâB app switches that fragment your attention.
| Verdict | Meaning | Action |
|---|---|---|
| ð¤ ai_assisted | AI coding agent active (Claude Code, Codex) | Productive workflow |
| ð¢ productive | Normal workflow (IDE â Terminal) | Consider split screen |
| ð¡ mixed | Could go either way | Batch these activities |
| ð´ distracting | Attention leak | Block during focus hours |
Common patterns:
- Slack â IDE: Waiting for responses â Batch check times
- Browser â IDE: Testing/debugging â Use split screen
- Email â Work: Anxiety/FOMO â Close email, check 2x/day
- Social â Anything: Procrastination â Block during focus hours
Browser Analysis
Browser time is often 30-50% of screen time. The analyzer extracts sites from window titles and categorizes them:
Site Categories
| Category | Examples | Weight |
|---|---|---|
| AI Tools | ChatGPT, Claude.ai, Perplexity | ð¢ 0.8 |
| Development | GitHub, Supabase, localhost | ð¢ 0.8-1.0 |
| Design | Figma, Webflow, Canva | ð¢ 0.9 |
| Entertainment | Netflix, Prime Video, Twitch | ð´ -0.5 |
| Social Media | Twitter/X, LinkedIn, Reddit | ð´ -0.3 |
| Video | YouTube (neutral – could be either) | ð¡ 0.0 |
Report Output
## ð Browser Activity
**Total browser time:** 66.1h
| Type | Hours | % |
|------|-------|---|
| ð¢ Productive | 11.9h | 18% |
| ð¡ Neutral | 25.9h | 41% |
| ð´ Distracting | 27.0h | 41% |
### Top Sites
| Site | Hours | Category | Type |
|------|-------|----------|------|
| Netflix | 11.9h | entertainment | ð´ |
| YouTube | 7.8h | video | ð¡ |
| ChatGPT | 1.9h | ai_tools | ð¢ |
Customizing Site Categories
Add sites to KNOWN_SITES in analyze_aw.py:
'mysite.com': ('MySite', 'development', 0.8),
AI Agent Detection
The analyzer recognizes when you’re using AI coding agents and adjusts scoring accordingly.
Supported Agents
| Agent | Detection Pattern |
|---|---|
| Claude Code | Window title with â³ prefix or claude command |
| OpenAI Codex | codex in terminal title |
| Aider | aider in terminal title |
| GitHub Copilot CLI | gh copilot in terminal title |
How It Works
When you use AI coding agents, frequent Browser â Terminal switching is expected and productive (reviewing docs, checking dashboards, supervising AI output). The analyzer:
- Detects AI agent running in Terminal by window title
- Marks Browser â Terminal switches as “ai_assisted” instead of “distracting”
- Excludes productive AI switches from Focus Score penalty
- Still flags distracting switches (Telegram â Terminal) even during AI sessions
Report Section
The report includes an “AI-Assisted Development” section showing:
| Agent | Hours | Switches |
|-------|-------|----------|
| claude_code | 25.6h | ~6700 |
| codex | 24.2h | ~6700 |
Customizing Categories
Edit scripts/category_config.json to match your workflow:
{
"my_product": {
"weight": 0.8,
"description": "My SaaS product work",
"apps": [],
"titles": ["MyApp", "myapp.com", "MyApp Dashboard"]
}
}
Fields:
weight: Productivity impact (-0.5 to 1.0)apps: Match by application name (exact)titles: Match by window title (case-insensitive, partial match)description: Human-readable explanation
Weekly Review Ritual
Every Sunday (15 min):
- Export week’s data from ActivityWatch (CSV)
- Run:
python scripts/analyze_aw.py export.csv --report - Review the “One Change” recommendation
- Implement one intervention
- Track score improvement next week
Integration Ideas
n8n Automation
Weekly trigger â Export AW data â Run analyzer â Send to Telegram/Slack
Claude Memory
Ask Claude to remember your patterns:
- “My peak productive hours are 11am-1pm”
- “My main death loop is Telegram â Terminal”
Focus Apps
Use insights to configure blocking tools. See references/blocking_guides.md for step-by-step setup:
- macOS Focus Mode
- Cold Turkey (cross-platform)
- iOS Screen Time / Android Digital Wellbeing
- Browser extensions (LeechBlock, StayFocusd)
Focus Guard – App Blocker
Focus Guard is an open-source app blocker for macOS that prevents distracting apps from running during focus hours.
Quick Start
# Start blocking (runs until you stop it)
python scripts/focus_guard.py --start
# Quick 2-hour focus session
python scripts/focus_guard.py --start --duration 2
# Block specific apps
python scripts/focus_guard.py --start --block Telegram Slack Discord
# Check status
python scripts/focus_guard.py --status
# Stop blocking
python scripts/focus_guard.py --stop
How It Works
- Monitors running apps every 2 seconds
- When a blocked app is detected:
- Shows macOS notification with warning
- Gives 5-second grace period to save work
- Quits the app automatically
- Logs all violations for weekly review
Configuration
Edit scripts/focus_config.json:
{
"blocked_apps": ["Telegram", "Slack", "Discord"],
"schedule": {
"enabled": true,
"start_hour": 9,
"end_hour": 17,
"days": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
},
"settings": {
"grace_period_seconds": 5,
"show_notifications": true
}
}
Integration with Analyzer
After a focus session, run the analyzer to see your productivity:
python scripts/focus_guard.py --stop
python scripts/analyze_aw.py --fetch --from today --report
Files
activitywatch-analysis/
âââ SKILL.md # This file
âââ scripts/
â âââ analyze_aw.py # Main analyzer
â âââ focus_guard.py # App blocker for focus sessions
â âââ category_config.json # Customizable categories
â âââ focus_config.json # Focus Guard configuration
âââ references/
âââ analysis_prompts.md # Prompts for deeper analysis
âââ blocking_guides.md # How to implement blocking recommendations
Privacy
All analysis runs locally. No data leaves your machine unless you choose to share it.
Requirements
- Python 3.8+
- ActivityWatch installed and running
- No external dependencies (uses only stdlib)