How 2coderok/ai-buddy works
AI Buddy is a local desktop productivity coach. The main workflow is: the app starts a tracker and coaching loop; the tracker samples foreground-window activity into SQLite; the coach periodically reads summaries, prompts a local GGUF model, and sends a notification. The tray also exposes pause/resume controls, and the tracker supports standalone screen-time statistics. The graph covers the documented daily-goal coaching capability, though its prompt file is not in the provided tree. Relationships are limited to calls shown in excerpts or documented in the README/source index.
Main entry points: buddy.py Analysis Loop · main.py App & Tray · tracker.py Window Tracker & Stats · config.py App Configuration
Components 11
App Control
- App & Tray
src/main.py - Pause State
src/pause_state.py
Activity Tracking
- Window Tracker & Stats
src/tracker.py - Activity Database
src/db.py
Coaching
- Analysis Loop
src/buddy.py - Coaching Instructions
src/buddy.py - Local GGUF Model
- Notification Dispatcher
src/notifier.py
Shared Services
- App Configuration
src/config.py
Other components
- User
- Platform Notifications
Connections 16
- User → App & Tray: starts app
README.md - App & Tray → Window Tracker & Stats: starts thread
src/main.py - App & Tray → Analysis Loop: starts thread
src/main.py - App & Tray → Pause State: controls pause
src/main.py - Window Tracker & Stats → Activity Database: writes activity
src/tracker.py - Window Tracker & Stats → Activity Database: reads statistics
src/tracker.py - Analysis Loop → Activity Database: reads summaries
src/buddy.py - Analysis Loop → Pause State: checks pause
src/buddy.py - Analysis Loop → Coaching Instructions: loads instructions
src/buddy.py - Analysis Loop → Local GGUF Model: runs inference
src/buddy.py - Analysis Loop → Notification Dispatcher: sends coaching
src/buddy.py - Notification Dispatcher → Platform Notifications: dispatches alert
src/notifier.py - Window Tracker & Stats → App Configuration: reads settings
src/tracker.py - Analysis Loop → App Configuration: reads settings
src/buddy.py - Notification Dispatcher → App Configuration: reads settings
src/notifier.py - App & Tray → App Configuration: reads settings
src/main.py