๐ก Inspiration
In today's digital environment, willpower is no longer enough to stay focused. We are constantly battling applications that are engineered to hijack our attention. Traditional app blockers are fundamentally flawed: they rely on easily bypassed self-imposed timers, and they use static blocklists. For example, standard blockers assume "YouTube" is always a distraction, completely ignoring the fact that you might be watching a 10-hour C++ programming tutorial.
We asked ourselves: What if your operating system could actually understand the context of your work, and physically step in to protect your focus when you get distracted?
โ๏ธ What it does
AuraLock is a context-aware, AI-powered cognitive firewall that lives natively in your macOS Menu Bar. It physically suspends distracting applications the moment your focus slips.
Instead of static blocking, AuraLock uses Google Gemini AI as a real-time cognitive referee. It continuously reads your active window titles. If you are reading documentation or watching a coding tutorial on YouTube, Gemini allows it. But the second you switch to a "Funny Cat Compilation" or start scrolling X/Twitter, Gemini flags the distraction.
AuraLock triggers a 10-second warning. If you don't return to work, it triggers a low-level C daemon operating in the background to send POSIX SIGSTOP commands to the operating system kernel. This literally freezes the application's execution threads in memory. The app cannot be clicked, typed in, or used. Once you return to a productive task, the system sends a SIGCONT signal, instantly unfreezing your apps exactly as you left them.
๐ ๏ธ How we built it
AuraLock bridges the gap between high-level Generative AI and low-level Unix systems programming through a two-part hybrid architecture:
- The Brain (Python & Gemini API): A native macOS Menu Bar app built with
rumps. It uses AppleScript to extract the active application name and window title. It constructs a prompt and queries the Gemini 1.5 Flash API to determine if the context is productive. It also manages a strict Pomodoro timer and dynamic user blocklists. - The Muscle (C Daemon): A background process written entirely in C to satisfy CMPSC 311 requirements. It maps application names to Process IDs (PIDs) using
popen()andpgrep, and executes low-level kernel signals (SIGSTOP/SIGCONT) via thekill()system call. - The Bridge (IPC via Named Pipes): To allow the Python UI to communicate securely and instantly with the C daemon, we implemented Inter-Process Communication (IPC) using a POSIX Named Pipe (FIFO). The C program safely reads from this pipe in the background, utilizing 0% CPU while waiting for focus state changes.
โ ๏ธ Challenges we ran into
- API Rate Limiting: Checking the active window every 3 seconds immediately exhausted Google Gemini's free-tier rate limits. We solved this by building a local Python dictionary cache (
GEMINI_CACHE). Once Gemini evaluates a specific window title (e.g., "React Tutorial"), AuraLock remembers the verdict and never queries the API for that specific title again. - The "Two Brains" Synchronization: Ensuring our Python multi-threaded UI didn't accidentally override the Pomodoro timer or send conflicting signals to the C Daemon required careful implementation of
threading.Lock()to prevent race conditions. - macOS Sandbox Restrictions: macOS heavily restricts AppleScript window tracking. We had to carefully navigate macOS Accessibility Permissions to allow our terminal to read the system state without being blocked by Apple's security protocols.
๐ Accomplishments that we're proud of
We successfully combined a core Intro to Systems Programming concept (C, IPC, POSIX process scheduling) with modern Generative AI into a polished, native-feeling macOS application in under 24 hours. We built a product that actually works and solves a real problem we face as students.
๐ What we learned
- How to implement Inter-Process Communication (IPC) using FIFOs.
- OS-level process management and signal handling in C.
- Prompt engineering for binary classification using Large Language Models.
- Thread safety and state management in Python UI applications.
๐ What's next for AuraLock
- Expanding the daemon compatibility to Linux and Windows (
kernel32.dll). - Re-integrating wearable biometric APIs (like Presage) to cross-reference the Gemini AI context score with the user's actual physical heart rate and stress levels.
- "Stake to Focus": Integrating the Solana blockchain to allow users to stake real crypto on their Pomodoro sessionsโif they get distracted, their money is donated to charity!
Log in or sign up for Devpost to join the conversation.