Comprehensive guide for ActivityWatch setup, configuration, watchers, integrations, API usage, and automation.
Complete reference for working with ActivityWatch, its ecosystem of tools, watchers, client libraries, and integrations. Provides guidance for setup, configuration, custom watcher development, data analysis, and automation.
Activate this skill when:
Status: ✅ Installed and Running
Details:
/Applications/ActivityWatch.appbrew install --cask activitywatch)Active Components:
aw-qt - System tray application (menu bar)aw-server - API serveraw-watcher-afk - AFK detectionaw-watcher-window - Window trackingData Location: ~/Library/Application Support/activitywatch/
Access:
The main desktop tray app that manages everything.
Key Features:
Access: Menu bar icon (look for ActivityWatch icon)
REST API server for data storage and querying.
Endpoints:
/api/0/info - Server information/api/0/buckets - List data buckets/api/0/buckets/{id}/events - Get/create events/api/0/query - Execute AQL queriesSee: API_REFERENCE.md for complete API documentation
Watchers are "agents" that track specific activities:
Built-in:
aw-watcher-window - Active window/app trackingaw-watcher-afk - Keyboard/mouse activity (AFK detection)Optional:
aw-watcher-web - Browser tabs (install browser extension)aw-watcher-vscode - VS Code activityaw-watcher-vim - Vim/Neovim sessionsCreating Custom Watchers: See "Custom Watcher Development" section below
Official SDKs for programmatic access:
Available:
pip install aw-clientaw-client-jsaw-client-goaw-client-rustUse Cases:
See: API_REFERENCE.md for Python client examples
# Check if running
ps aux | grep activitywatch
# Test API
curl http://localhost:5600/api/0/info
# List buckets
curl http://localhost:5600/api/0/buckets
# Install
pip install aw-client
# Test
python3 -c "from aw_client import ActivityWatchClient; print(ActivityWatchClient().get_buckets())"
Purpose: Sync data across multiple devices via shared folder
Installation:
git clone https://github.com/ActivityWatch/aw-sync.git
cd aw-sync
pip install .
Usage:
# Sync to Dropbox
aw-sync --folder ~/Dropbox/ActivityWatch
# Automated sync (add to cron)
0 * * * * aw-sync --folder ~/sync/aw
Cloud Options:
Purpose: Export data to InfluxDB for Grafana dashboards
Installation:
pip install activitywatch-exporter
Usage:
activitywatch-exporter \
--aw-url http://localhost:5600 \
--influx-url http://localhost:8086 \
--influx-db activitywatch
See: INTEGRATIONS.md for Grafana setup
Purpose: AI agent interface for LLMs (Claude, Cursor)
Installation:
git clone https://github.com/Auriora/activitywatch-mcp.git
cd activitywatch-mcp
npm install
Configuration for Claude Code:
{
"mcpServers": {
"activitywatch": {
"command": "node",
"args": ["/path/to/activitywatch-mcp/dist/index.js"],
"env": {
"AW_URL": "http://localhost:5600"
}
}
}
}
Example Queries:
Purpose: IDE-specific tracking with Git integration
Features:
Installation: Download from GitHub releases
from aw_client import ActivityWatchClient
from datetime import datetime, timedelta
client = ActivityWatchClient()
# Get today's window events
today = datetime.now().replace(hour=0, minute=0, second=0)
bucket_id = f"aw-watcher-window_{client.client_hostname}"
events = client.get_events(bucket_id, start=today)
# Calculate time per app
by_app = {}
for e in events:
app = e["data"].get("app", "Unknown")
by_app[app] = by_app.get(app, 0) + e["duration"]
# Print results
for app, duration in sorted(by_app.items(), key=lambda x: x[1], reverse=True):
print(f"{app}: {duration/3600:.1f}h")
See: API_REFERENCE.md for more examples
from aw_client import ActivityWatchClient
from datetime import datetime
import time
# Initialize
client = ActivityWatchClient("my-custom-watcher")
bucket_id = f"{client.client_name}_{client.client_hostname}"
# Create bucket
client.create_bucket(bucket_id, event_type="custom.activity")
# Send events
while True:
event = {
"timestamp": datetime.now(),
"duration": 0,
"data": {
"label": "Custom activity",
"value": get_custom_data()
}
}
client.heartbeat(bucket_id, event, pulsetime=60)
time.sleep(30)
import pandas as pd
from aw_client import ActivityWatchClient
client = ActivityWatchClient()
bucket_id = f"aw-watcher-window_{client.client_hostname}"
events = client.get_events(bucket_id, limit=10000)
# Convert to DataFrame
df = pd.DataFrame([
{
"timestamp": e["timestamp"],
"duration": e["duration"],
"app": e["data"].get("app"),
"title": e["data"].get("title")
}
for e in events
])
# Export
df.to_csv("activitywatch_export.csv", index=False)
print(f"✅ Exported {len(df)} events")
#!/bin/bash
# backup-activitywatch.sh
DATE=$(date +%Y%m%d)
BACKUP_DIR=~/backups/activitywatch
mkdir -p $BACKUP_DIR
# Stop server
pkill -f aw-server
# Backup
tar -czf $BACKUP_DIR/aw-backup-$DATE.tar.gz \
~/Library/Application\ Support/activitywatch/
# Restart
/Applications/ActivityWatch.app/Contents/MacOS/aw-server &
echo "✅ Backup created: aw-backup-$DATE.tar.gz"
Daily Summary (cron):
# Run at 6 PM daily
0 18 * * * /usr/bin/python3 /path/to/daily_summary.py
Weekly Report (cron):
# Run Sunday at 8 PM
0 20 * * 0 /usr/bin/python3 /path/to/weekly_report.py
See: INTEGRATIONS.md for Slack, email, and calendar integration examples
# Check if port in use
lsof -i :5600
# Kill existing process
pkill -f aw-server
# Start manually with debug
/Applications/ActivityWatch.app/Contents/MacOS/aw-server --verbose
# Check logs
tail -f ~/Library/Application\ Support/activitywatch/aw-server/aw-server.log
# Check watcher status
curl http://localhost:5600/api/0/buckets
# Restart watchers
pkill -f aw-watcher
/Applications/ActivityWatch.app/Contents/MacOS/aw-watcher-afk &
/Applications/ActivityWatch.app/Contents/MacOS/aw-watcher-window &
# Location
cd ~/Library/Application\ Support/activitywatch/aw-server/
# Check integrity
sqlite3 peewee-sqlite.v2.db "PRAGMA integrity_check;"
# Vacuum (reduce size)
sqlite3 peewee-sqlite.v2.db "VACUUM;"
# Fix permissions
chmod -R 755 ~/Library/Application\ Support/activitywatch/
Location: ~/.config/activitywatch/aw-server/config.toml
[server]
host = "127.0.0.1" # Localhost only (recommended)
port = 5600 # Default port
cors_origins = "*" # CORS settings
aw-watcher-afk:
# ~/.config/activitywatch/aw-watcher-afk/config.toml
[aw-watcher-afk]
timeout = 180 # AFK timeout (seconds)
poll_time = 5 # Check interval
aw-watcher-window:
# ~/.config/activitywatch/aw-watcher-window/config.toml
[aw-watcher-window]
poll_time = 1 # Update interval
exclude_title = false # Privacy: hide window titles
Access via: http://localhost:5600/#/settings
Categories:
Example:
{
"name": "Programming",
"rule": {
"$type": "regex",
"regex": "VSCode|Terminal|vim"
}
}
Installation Status: ✅ v0.13.2 via Homebrew Server: ✅ http://localhost:5600 Watchers: ✅ afk, window active