# Cursor Companion **A native, screen-aware AI assistant for macOS.** Press `⌥ Space`, ask about whatever is under your cursor, or hand the screen to an Agent that works visibly after you approve its plan. [![CI](https://github.com/pradyut-das/MacScreenCompanion/actions/workflows/ci.yml/badge.svg)](https://github.com/pradyut-das/MacScreenCompanion/actions/workflows/ci.yml) [![Release](https://img.shields.io/github/v/release/pradyut-das/MacScreenCompanion?display_name=tag)](https://github.com/pradyut-das/MacScreenCompanion/releases) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![macOS 14+](https://img.shields.io/badge/macOS-14%2B-black?logo=apple)](#requirements) [![Swift 6](https://img.shields.io/badge/Swift-6-F05138?logo=swift&logoColor=white)](Package.swift) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md) ![Cursor Companion demo](assets/demo.gif)
--- ## Table of contents - [Why](#why) - [Features](#features) - [Screenshots](#screenshots) - [Install](#install) - [Setup](#setup) - [Usage](#usage) - [How it works](#how-it-works) - [Privacy](#privacy) - [Agent safety boundary](#agent-safety-boundary) - [Known limits](#known-limits) - [Roadmap](#roadmap) - [Contributing](#contributing) - [License](#license) ## Why Most AI assistants make you describe what you're looking at. Cursor Companion already sees it. It captures the untouched screen the instant you press the shortcut, records the exact cursor position, and resolves "this", "that", and "here" to the semantic object under the pointer — a button, an error, a layout, a line of code. Two deliberate modes: - **Chat** explains, critiques, compares, and remembers whatever is under your cursor. - **Agent** turns the same context into a plan, shows it to you, and after one explicit approval visibly operates the Mac — clicking, typing, scrolling, opening apps, and searching the live web. Everything runs as a small native menu-bar app. No Electron, no background recording, no cloud account. ## Features ### Screen-aware Chat - Global `⌥ Space` clean-capture → prompt shortcut. The screenshot is taken **before** the textbox appears, so the prompt never pollutes what the model sees. - Compact prompt appears beside the cursor, follows it, freezes as you approach, and can be pinned. - Full-screen capture plus a high-detail crop around the cursor hotspot, supplied with the exact coordinates so the model targets the object, not the marker. - Multi-turn conversation with in-session history. - Up to six screenshots per question for comparisons and multi-screen context; camera button hides the panel, captures, and restores. - Screenshot thumbnails travel with each message and open in a full-frame lightbox. - Native Markdown rendering: headings, lists, quotes, links, dividers, copyable fenced code. - Spoken answers via macOS speech synthesis with persistent Pause / Resume / Stop. - Optional voice questions with an immediate Stop Listening control. - **Remember** button (and spoken "remember this") saves the moment to the local Today dashboard. - Intent-first prompt contract with explicit ambiguity handling: nearest-object inference when strong, one focused clarification otherwise. See [PROMPTS.md](PROMPTS.md). ### Agent mode - One-click switch from any Chat question to an Agent task with the same screen and conversation context. - Concise plan shown first; nothing happens until you press **Run Agent**. - Visible click, double-click, typing, common keys, scrolling, app/URL opening, and waits via Accessibility. - Real `web_search` tool calls through Vercel AI Gateway with source URLs returned to the Agent. - Fresh screen observation after every action; the panel hides itself so the Agent never sees or clicks its own UI. - Live action timeline with success / error details. - Pause, resume, and stop at any time. 24-action cap and automatic halt after repeated failures. - Local run history in the Today dashboard. ### Today dashboard - Remembered moments with original full-size screenshot, question, tags, and Markdown answer. - Daily thread insight summarizing what kept your attention. - Agent run history. ### Native polish - SwiftUI + AppKit menu-bar app, ~4k lines of Swift, zero third-party dependencies. - Draggable, resizable floating panel that remembers position and size, with screen-edge correction. - Close with **×** or **Esc**; reopen from `⌥ Space` or the menu bar. - Real Settings window with one-click permission enablement and live status. ## Screenshots | Menu bar | Chat mode | Agent mode | | --- | --- | --- | | ![Menu bar](assets/menu-bar.png) | ![Chat mode](assets/chat-mode.png) | ![Agent mode](assets/agent-mode.png) | | Settings — AI & Voice | Settings — Permissions | Today dashboard | | --- | --- | --- | | ![Settings AI and voice](assets/settings-ai-voice.png) | ![Settings permissions](assets/settings-permissions.png) | ![Today dashboard](assets/today-dashboard.png) | ## Install ### Requirements - macOS 14 Sonoma or newer (Apple Silicon or Intel) - A [Vercel AI Gateway](https://vercel.com/docs/ai-gateway) API key - To build from source: Xcode 16+ (Swift 6 toolchain) ### Download a release Grab the latest `Cursor-Companion-vX.Y.Z.zip` from [Releases](https://github.com/pradyut-das/MacScreenCompanion/releases), unzip, and move the app to `/Applications`. Builds are ad-hoc signed, not notarized. On first launch macOS will warn; right-click the app → **Open**, or: ```bash xattr -dr com.apple.quarantine "/Applications/Cursor Companion.app" ``` ### Build from source ```bash git clone https://github.com/pradyut-das/MacScreenCompanion.git cd MacScreenCompanion ./build-app.sh open "dist/Cursor Companion.app" ``` ## Setup ### 1. Add your AI Gateway key Click the sparkle in the menu bar → **Settings…** and paste your Vercel `AI_GATEWAY_API_KEY`. It is stored in the macOS Keychain. Set a vision-capable model that supports Responses tool calling. Default: `openai/gpt-5.4-mini`. The app calls: ```text https://ai-gateway.vercel.sh/v1/responses ``` ### 2. Grant permissions macOS will ask on first use: | Permission | Used for | When | | --- | --- | --- | | Screen & System Audio Recording | Seeing your screen | Only at `⌥ Space` and during approved Agent runs | | Accessibility | Agent clicks, typing, keys, scrolling | Only when an approved Agent needs to act | | Microphone | Voice questions | Only while you invoke voice input | | Speech Recognition | Transcribing voice questions | Only while you invoke voice input | Screen Recording and Accessibility changes usually require quitting and reopening the app. **Settings → Screen access** and **Agent access** show live status with an **Enable** button. > **Seeing only your wallpaper?** That is macOS privacy redaction: the app can list windows but not see their pixels. Cursor Companion detects this and refuses to send the redacted image. Enable it under **System Settings → Privacy & Security → Screen & System Audio Recording**, then fully quit and reopen. If an older entry exists from a previous build, toggle it off and on once. ## Usage ### Quick start 1. Hover over anything — a design, an error, a chart — and press `⌥ Space`. 2. Type your question and press Return. 3. Read the Markdown answer, listen to it, or ask a follow-up. 4. Press **Remember** to save the moment, or **Agent** to turn the request into a task. ### Chat examples - "What is this?" — identifies the control under the cursor and explains how to use it. - "Why does this feel premium, and would it convert?" — design critique with evidence. - "What does this error mean and how do I fix it?" — likely cause → ordered fix steps. - Attach a second screenshot with the camera button: "Which of these two layouts is clearer?" ### Agent examples - "Search the web for this product's official site and open it." - "Open System Settings and go to Displays." - "Scroll to the pricing section on this page." Press **Agent**, read the plan, press **Run Agent**, and watch the timeline. Pause or stop at any time. Closing the panel does **not** stop a running Agent — reopen it from the menu bar or `⌥ Space`. Quitting the app stops it. ### Menu bar | Item | Action | | --- | --- | | Show Companion | Open the floating panel | | Ask at Cursor `⌥ Space` | Capture and prompt | | New Chat | Clear the session conversation | | Open Today | Remembered moments and Agent runs | | Settings… | Key, model, voice, permissions | | Stop Agent | Halt an active run | ## How it works ``` ⌥ Space │ ├─ 1. Hide every companion window ├─ 2. ScreenCaptureKit capture of the display under the cursor │ (companion process excluded at the content-filter level) ├─ 3. Record cursor hotspot; build full frame + high-detail crop ├─ 4. Preflight: reject wallpaper-only redacted captures ├─ 5. Show compact prompt beside the cursor │ ▼ Return AIService ──► Vercel AI Gateway (/v1/responses) ──► model │ │ │ └─ Agent mode: web_search tool + action plan ▼ Markdown answer · speech · Remember ──► MemoryStore (local) ComputerActionService (Accessibility) ``` Key files: | File | Responsibility | | --- | --- | | [AppStore.swift](Sources/CursorCompanion/AppStore.swift) | Central observable state and orchestration | | [CompanionPanel.swift](Sources/CursorCompanion/CompanionPanel.swift) | Floating panel: compact prompt and expanded chat | | [AIService.swift](Sources/CursorCompanion/AIService.swift) | Gateway client, prompt contract, tool calls | | [ScreenCaptureService.swift](Sources/CursorCompanion/ScreenCaptureService.swift) | ScreenCaptureKit capture and cursor crop | | [ComputerActionService.swift](Sources/CursorCompanion/ComputerActionService.swift) | Accessibility-driven actions | | [AgentModels.swift](Sources/CursorCompanion/AgentModels.swift) | Plan / action / run models | | [MemoryStore.swift](Sources/CursorCompanion/MemoryStore.swift) | Local persistence | | [KeychainStore.swift](Sources/CursorCompanion/KeychainStore.swift) | API key storage | The grounding and response contract the prompt must preserve is documented in [PROMPTS.md](PROMPTS.md), including regression cases. ## Privacy - **No continuous recording.** Chat captures once at shortcut invocation, before the textbox exists. Agent captures only during an approved run. - **Fail closed.** If Screen Recording is unavailable or redacted, nothing is sent to the AI. - **Typed text is never in the screenshot.** The question travels as text alongside the image. - **Self-exclusion.** Every companion window is removed before capture and excluded from app/window metadata. - **Local memory.** Remembered screenshots, moments, and Agent runs live in `~/Library/Application Support/CursorCompanion`. There is no backend. - **Key in Keychain.** The API key is never written to plist, UserDefaults, or logs. - Images pass through Vercel AI Gateway to the model provider you select. Review their data policies. ## Agent safety boundary Agent mode is intentionally visible and reversible where possible. It does **not** silently: - purchase or submit financial transactions - send or publish messages, posts, or comments - delete data - change account or security settings - enter passwords, API keys, payment data, or other credentials - accept legal terms or bypass CAPTCHAs It stops at those boundaries and tells you what requires human takeover. Contributions that weaken this boundary will not be merged. ## Known limits - One Mac, one local user; no account or cloud sync. - Agent control is vision-driven on the display containing the cursor. - No browser DOM, terminal, filesystem, email, or calendar tools yet — only live public web retrieval. - Session chat is cleared on quit; remembered moments and Agent runs persist. - Today's cross-moment insight is heuristic, not a scheduled AI synthesis. - Builds are ad-hoc signed, not notarized. ## Roadmap Ideas under consideration. Open an issue to discuss or claim one. - [ ] Notarized, Homebrew-installable releases - [ ] Bring-your-own-endpoint: OpenAI / Anthropic / local models without the Gateway - [ ] Browser DOM tool for the Agent - [ ] Clipboard and selected-text context - [ ] Multi-display Agent runs - [ ] Scheduled AI synthesis for the Today thread - [ ] Localization ## Contributing Contributions are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) for setup, project layout, and the PR checklist, and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for community expectations. Security issues go to [SECURITY.md](SECURITY.md), not public issues. ## License [MIT](LICENSE) © 2026 Pradyut Das