A local-only macOS app that monitors your behavior during focus sessions, detects distraction in real-time, and nudges you back on track.
Website (Coming Soon)
Report Bug
·
Request Feature
Table of Contents
Most productivity tools just block websites. Anchor takes a different approach — it watches how you work and intervenes only when you're actually drifting.
It tracks your foreground apps, browser tabs, idle state, and window titles to build a real-time picture of your focus quality. When it detects you're slipping — bouncing between apps, lingering on Twitter, passively scrolling — it sends escalating nudges to pull you back.
Key features:
- Real-time focus scoring — continuously evaluates your work state (deep focus, productive switching, novelty seeking, passive drift, etc.)
- Smart distraction detection — tracks app switching rates, browser domain hopping, idle time, and off-task dwell with compound signal analysis
- AI-powered task classification — optionally uses Anthropic, OpenAI, or local Ollama models to classify apps/domains as on-task or off-task for your specific session
- Works without AI too — ships with 100+ built-in heuristic rules for common apps and domains
- Escalating interventions — gentle nudges that get firmer the longer you stay off-task, with smart cooldowns and recovery detection
- Pomodoro & freeform modes — structured timed sessions or flexible open-ended focus blocks with manual breaks
- Adaptive learning — builds a user profile over time and tunes thresholds to your work style
- Session analytics — post-session summaries and historical analytics to track your focus trends
- 100% local — all data stays on your machine. No accounts, no telemetry, no cloud sync.
This is a personal project I built as a student to solve my own focus problems. I'm open-sourcing it because I think others might find it useful too.
Observers → EventStore → BehaviorAnalyzer → DriftEngine → InterventionEngine → Notifications
- Observers monitor your foreground app, browser tabs, idle state, and window titles
- EventStore buffers events in a ring buffer (10k max)
- BehaviorAnalyzer consumes events and builds behavioral snapshots (switch rates, dwell times, bouncing patterns)
- DriftEngine ticks every 2 seconds, classifying your work state and computing a focus score (0–1)
- InterventionEngine applies cooldowns and escalation logic, sending nudges via macOS notifications when you drift
The engine doesn't just look at what app you're in — it tracks how you're using it. Rapidly bouncing between apps? That's stuckCycling. Lingering on Reddit? That's passiveDrift. A quick glance at Discord then back to Xcode? That's fine.
- macOS 15.0 or later
- Xcode 16.0 or later
- Clone the repo
git clone https://github.com/KrushedKnight/Anchor.git
- Open the project in Xcode
cd Anchor open Anchor.xcodeproj - Build and run (
Cmd + R)
No external dependencies, no package managers, no configuration files. Just clone and build.
Anchor needs a few macOS permissions to function — it asks on first launch:
| Permission | Why |
|---|---|
| Accessibility | Reading window titles via the Accessibility API |
| Automation (Chrome) | Reading the active tab URL from Chrome via AppleScript |
| Notifications | Delivering focus nudges |
Anchor's App Sandbox is disabled because
CGEventSource(idle detection) and the Accessibility API require it. All data stays local.
- Start a session — give it a task name (e.g., "Finish the auth module") and optionally mark specific apps/domains as on-task or off-task
- Work normally — Anchor watches silently, scoring your focus in the floating widget
- Get nudged — if you drift, you'll get a gentle notification that escalates if you stay off-task
- Review your session — when you end the session, you'll see a summary of your focus score, time on-task, distractions, and more
Modes:
- Freeform — open-ended session, take manual breaks whenever
- Pomodoro — timed work/break cycles (configurable durations)
AI classification (optional):
Go to Settings → API and add a key for Anthropic, OpenAI, or configure a local Ollama instance. The app will then classify unfamiliar apps and domains for your specific task context. Without AI, it falls back to 100+ built-in heuristic rules.
┌─────────────┐ ┌────────────┐ ┌──────────────────┐ ┌─────────────┐ ┌────────────────────┐
│ Observers │────▶│ EventStore │────▶│ BehaviorAnalyzer │────▶│ DriftEngine │────▶│ InterventionEngine │
│ │ │ │ │ │ │ │ │ │
│ • App │ │ Ring buffer│ │ Switch rates │ │ WorkState │ │ Cooldowns │
│ • Browser │ │ (10k max) │ │ Dwell times │ │ Focus score │ │ Escalation │
│ • Idle │ │ │ │ Idle ratio │ │ Risk level │ │ Recovery detection │
│ • Window │ │ │ │ Bounce detection │ │ │ │ │
└─────────────┘ └────────────┘ └──────────────────┘ └─────────────┘ └────────┬───────────┘
│
┌─────────────────────┘
▼
┌──────────────────┐
│ Notifications │
│ (macOS native) │
└──────────────────┘
Anchor/
├── Core/ # Event store, sessions, task classification, user profiles, break/pomodoro
├── Observers/ # App monitor, Chrome tab tracker, idle detector, window title reader
├── Engine/ # Drift detection, behavior analysis, work state machine, risk assessment
├── Intervention/ # Escalation logic, cooldowns, notification delivery, nudge templates
└── Views/ # SwiftUI tabs (Home/Analytics/Settings), floating widget, session summary
The engine classifies your behavior into one of six states every 2 seconds:
| State | What it means |
|---|---|
| Deep Focus | Sustained on-task, low switching |
| Productive Switching | On-task with healthy context switching |
| Stuck Cycling | Rapidly bouncing between apps |
| Novelty Seeking | High tab switching, off-task browsing |
| Passive Drift | Lingering off-task without switching |
| Idle | User away |
- Real-time focus scoring and work state detection
- Escalating intervention pipeline with smart cooldowns
- AI-powered task classification (Anthropic, OpenAI, Ollama)
- Heuristic fallback for 100+ apps and domains
- Pomodoro timer with configurable cycles
- Session analytics and historical tracking
- Adaptive user profile tuning
- Safari and Arc browser support
- Session tagging and filtering
- Focus score trends and weekly reports
- Keyboard shortcut for quick break/resume
- Exportable session data
See the open issues for a full list of proposed features and known issues.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Krishiv Manyam - krishivmanyam@gmail.com
Project Link: https://github.com/KrushedKnight/Anchor