# Agent Cursor β—§ + GroundSight πŸ‘ **An accuracy engine for AI computer-use agents**, built from two modules: - **The hand β€” Agent Cursor**: a vision-optimized cursor. A large cyan/magenta square that follows the mouse, passes every click straight through, and β€” unlike the real cursor β€” actually shows up in screenshots. The agent always sees exactly where its hand is and what it just did. - **The eyes β€” GroundSight**: a perception layer with *priors*. Given a raw screenshot it reports the basics a human knows instantly β€” mac or windows, light or dark, where the chrome is, where the marker sits β€” **locally, deterministically, zero LLM calls**. Every verdict comes with named, auditable cues, and every capability is held to a benchmark gate. The loop this enables: *see hand β†’ see target β†’ act β†’ verify.* Full plan: [ROADMAP.md](ROADMAP.md). ```bash pip install ".[sight]" groundsight parse screenshot.png ``` ```json { "os": "mac", "os_confidence": 1.0, "theme": "dark", "cues": ["mac: 2 traffic-light triad(s), scaleβ‰ˆ[2.0]", "..."], "cursor": {"x": 1200.5, "y": 800.0, "samples": 118, "click_state": "left-click"}, "image_size": [2880, 1800] } ``` Run the Basics Test (no image leaves your machine, no API is called): ```bash python tools/make_fixtures.py # synthetic seed corpus groundsight bench # scorecard with accuracy gates ``` --- ``` pip install agent-cursor # (PyPI release pending β€” see Install below) agent-cursor ``` ## The problem AI agents that control a computer through screenshots have a blind spot most people don't know about: **the mouse cursor usually isn't in the screenshot at all.** Programmatic capture (`screencapture` on macOS, GDI/PIL/mss on Windows) omits the hardware cursor by default. And even when it is captured, the human cursor is a terrible target for machine vision: - tiny (~16 px), and the *tip* of the arrow is the hotspot, not the center - changes shape constantly (arrow, I-beam, hand, spinner) - blends into light and dark backgrounds - inconsistent across Retina scaling, multiple monitors, and remote desktops Humans always know where their hand is. Agents mostly don't. They click, miss by 30 pixels, and never find out why. ## What this does Agent Cursor draws a **machine-readable marker** at the exact mouse position: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ CYAN β”‚ MAGENTA β”‚ ← this exact color pair side-by-side β”‚ ●───┼── white β”‚ virtually never occurs in real UIs β”‚ β”‚ center β”‚ β”‚ β”‚ dot β”‚ ● = the exact cursor hotspot β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ black border ``` - **Square, not arrow** β€” the hotspot is simply the geometric center. No "which pixel is the tip?" ambiguity. - **Unique color signature** β€” a vertical cyan|magenta edge is a fingerprint. A vision model spots it instantly, and even a 20-line pixel scan finds it with zero AI (see [examples/detect_marker.py](examples/detect_marker.py)). - **Appears in screenshots** β€” it's a real window, so every capture method sees it. The hardware cursor doesn't need to be captured at all. - **Click-through** β€” the overlay ignores all mouse events. It never blocks a click, drag, or scroll. - **Zero system modification** β€” the real cursor is never replaced, no admin rights, no registry, no private APIs. Kill the process (however you like) and your machine is instantly, guaranteed back to normal. - Works across multiple monitors and Spaces, floats above full-screen apps. The human still sees the normal arrow drawn on top by the OS. The human gets the cursor designed for humans; the agent gets the cursor designed for machines. Same mouse. ## Click visibility (v0.2) Position is half the story β€” agents also need proof that an action *happened*. Agent Cursor makes clicks physically visible: - **Border flash** β€” while a button is down, the marker border turns **yellow** (left) or **blue** (right), and stays lit ~0.4 s after release so the next screenshot still catches it. The cyan/magenta identity signal is untouched, so position and click state read independently. - **Click ghosts** β€” a ring is dropped at the exact press point for ~0.8 s. If the mouse moved before release (a drag), a second ring marks the release point too. A screenshot proves where the click or drag landed, even if the cursor has already moved on. Button state comes from polling (`NSEvent.pressedMouseButtons` / `GetAsyncKeyState`) β€” no event hooks, no Accessibility permission. Disable with `--no-click-flash`. `detect_marker.py` reads the click channel too: ``` marker hotspot: x=1200.5 y=800.0 (from 118 boundary samples) click state: left-click ``` ## Install Until the PyPI release lands: ```bash git clone https://github.com/dwstar79/agent-cursor.git cd agent-cursor python3 -m pip install . ``` macOS pulls in `pyobjc-framework-Cocoa`; Windows needs nothing beyond the standard library. ## Usage ```bash agent-cursor # run until stopped agent-cursor --size 48 # bigger marker (points; default 32) agent-cursor --opacity 0.8 # slightly see-through agent-cursor --duration 10 # auto-stop after 10 s (handy for testing) agent-cursor --no-click-flash # position marker only, no click visibility ``` Or without installing the entry point: `python3 -m agent_cursor` ### Off buttons Multiple, by design β€” you can always get out: | How | Where | |---|---| | `Ctrl+C` | the terminal running the script | | β—§ menu bar icon β†’ *Quit Agent Cursor* | macOS menu bar | | `--duration N` | auto-stop timer | | kill the process, close the terminal, anything | the overlay cannot outlive the script | There is nothing to restore. The system cursor was never touched. ## Using it from an agent The intended loop for a computer-use agent: 1. Start `agent-cursor` alongside the agent session. 2. **Global view** β€” take a full screenshot: understand the scene, pick the target, and locate the marker (your hand). 3. Move the mouse *toward* the target with your usual automation (pyautogui, CGEvent, SendInput…). 4. **Local view** β€” screenshot a crop around the target: now marker vs. target offset is measured in a zoomed view, not guessed. 5. Micro-correct, click, then screenshot again to **verify the state actually changed**. Step 2's "locate the marker" is trivial now: ```bash python examples/detect_marker.py screenshot.png # marker hotspot: x=1200.5 y=800.0 (from 118 boundary samples) ``` That turns "move to x,y and hope" into a closed loop: *see hand β†’ see target β†’ close the gap β†’ verify.* ## Why an overlay instead of replacing the system cursor? Because replacing the cursor doesn't solve the problem. Screenshots omit the hardware cursor no matter how it looks, so a redesigned real cursor would still be invisible to the agent. Replacing it also requires private APIs (macOS) or system-wide settings (Windows) that can survive a crash and leave the machine broken. The overlay is captured in every screenshot, needs no permissions, and dies with the process. Safer *and* more visible. ## Platform status | Platform | Status | |---|---| | macOS | βœ… tested (macOS 14, Retina, multi-monitor) | | Windows 10/11 | ⚠️ implemented, needs testers β€” please open an issue with results | | Linux | planned (X11 first) | ## Roadmap This repo is growing into a full **accuracy engine for computer-use agents** β€” make the environment measurable instead of hoping the model guesses right. The hand (Agent Cursor, M0) and the first slice of the eyes (GroundSight M1: OS classifier + benchmark harness) are done; next come chrome anatomy, Finder/Explorer window recognition, and a top-50 app icon library. **The full milestone plan lives in [ROADMAP.md](ROADMAP.md).** ## License [MIT](LICENSE). Use it, ship it, build agents with it.