DEV Community

Biagio
Biagio

Posted on

I built a "smart Spotlight" for macOS that sees your screen and executes tasks, here a couple of takeaways

I was sick of constantly jumping between Spotlight, the terminal, and an AI chatbot just to run simple tasks. So I built Castor.

It’s a Spotlight-style overlay for macOS, but instead of just finding files, it actually executes commands using context from whatever you currently have open. It's free and open-source.

How it looks

How it works

Spotlight’s UI is great because it’s completely frictionless. I wanted that same UX for automation—hitting a hotkey and typing "rename all selected files to lowercase" or "summarize this Safari tab."

To make it seamless, Castor grabs your context before sending the prompt. It silently pulls:

  • Active Finder paths and selected files
  • Browser tabs and URLs (Safari and Chrome)
  • Clipboard text
  • A screenshot of the current screen (via ScreenCaptureKit)

You just ask for what you want without explaining what you're looking at.

The backend (and fighting Node.js)

I’m using Gemini Flash via gemini-cli. It’s fast and easy to hook into from Swift. The catch is that gemini-cli is Node-based, and the cold start latency was ruining the Spotlight feel.

To fix this, Castor keeps a background process warm. When you dismiss the UI, it spins up a fresh instance for the next run. Only the very first boot feels slow now.

Skipping the AI roundtrip

I realized I was running the same few scripts repeatedly ("resize to 800px", "convert to PDF"). Castor now has a "Script Memory" feature that saves successful shell commands and fuzzy-matches them later. If there’s a strong match, you get an instant suggestion you can trigger with one key, bypassing the AI completely.

Handling concurrency

The first version blocked you from doing anything else while a task was running. Now, you can fire off multiple tasks in parallel. They show up in a vertical stack (like iMessage), each with its own output stream and cancel button. Getting this to play nicely with Swift 6.2’s strict actor isolation was a headache, but the code is much safer for it.

UI & Specs

The overlay is a non-activating NSPanel that floats without stealing focus, using the new native .glassEffect() to feel like a first-party tool. There’s also a menu bar Live Activity to track progress.

What’s next

Still plenty of rough edges since it's a personal project. I'm currently looking into:

  • Better context extraction (Terminal, VS Code, Xcode)
  • Local model support
  • Editable script memory
  • Shortcuts integration

The code is on GitHub. PRs, issues, and feedback are welcome.
GitHub: https://github.com/biagio-incardona/Castor

Built with Swift 6.2, SwiftUI, ScreenCaptureKit, AppKit, and gemini-cli. Requires macOS 26 Tahoe.

Top comments (0)