# codex-computer-use **OpenAI Codex's Computer Use (`@oai/sky`), ported to Cursor.** The agent takes a screenshot, looks at it, then moves the mouse / types / clicks, and screenshots again to verify — the same observe→act→verify loop, but for the real desktop instead of the codebase. ![License](https://img.shields.io/badge/license-Apache--2.0-blue) ![Works with](https://img.shields.io/badge/works%20with-Cursor-000000) ![Ported from](https://img.shields.io/badge/ported%20from-openai%2Fcodex-412991) ![Executor](https://img.shields.io/badge/executor-Windows-0078D6) ```text /cua Open Notepad, type today's shopping list, and save it to the desktop. ``` > Companion skill: [codex-goal](https://github.com/wangye520/codex-goal) — autonomous `/goal` mode. Wrap computer use in `/codex-goal` for GUI tasks that must run to a verified end state. ## Highlights - **Zero install** — one PowerShell + .NET script (`computer-use/scripts/cua.ps1`), no Python, no pip, no extra binaries. - **Same coordinate space** — per-monitor DPI aware, so a pixel you see in the screenshot is exactly where a click lands. - **Full Codex action set** — `screenshot`, `click` (with double-click / held chord), `move`, `type`, `paste`, `key` chords, `scroll`, `drag`, plus `find-window` / `framehash` / `resize-window` / `hittest` helpers. - **Resident server mode** — one long-lived PowerShell process handles every action in ~30–100 ms instead of paying ~0.8 s process startup each time. - **Blue AI cursor** — a click-through, always-on-top blue pointer glides to each target and ripples on click so you can watch what the agent does live. It auto-hides during screenshots so the agent never sees its own cursor. ## The loop ```text 0. overlay-start show the blue AI cursor (once per session) 1. screenshot -> Read the PNG observe 2. locate the target's (x, y) decide 3. one cua.ps1 action act 4. screenshot again -> verify confirm the expected change; if not, diagnose 5. repeat until the goal is met, then overlay-stop ``` ## Quick start **Windows (PowerShell)** ```powershell git clone https://github.com/wangye520/codex-computer-use.git cd codex-computer-use .\install.ps1 ``` **macOS / Linux** (installs the skill; the executor itself is Windows-only for now) ```bash git clone https://github.com/wangye520/codex-computer-use.git cd codex-computer-use bash install.sh ``` Then in any Cursor chat: `/cua `. ## Direct executor use ```powershell $cua = "$env:USERPROFILE\.cursor\skills\computer-use\scripts\cua.ps1" powershell -NoProfile -ExecutionPolicy Bypass -File $cua screenshot -Path shot.png powershell -NoProfile -ExecutionPolicy Bypass -File $cua click -X 100 -Y 200 powershell -NoProfile -ExecutionPolicy Bypass -File $cua overlay-start # blue cursor ``` Resident server (one process, one command per stdin line, replies end with `##end `): ```powershell powershell -NoProfile -ExecutionPolicy Bypass -File $cua server ``` ## What's in the box | Path | What it is | |---|---| | `computer-use/SKILL.md` | The Agent Skill — observe→act→verify loop and full action reference | | `computer-use/scripts/cua.ps1` | The zero-dependency Windows executor (screenshot + mouse/keyboard + window helpers + resident server) | | `computer-use/scripts/overlay.ps1` | The blue AI cursor overlay (click-through, top-most, per-pixel alpha) | | `extracted/computer-use-architecture.md` | Reverse-engineered notes on Codex CUA (`@oai/sky`): action space, transport, port mapping | | `install.ps1` / `install.sh` | Copy the skill into `~/.cursor/skills/computer-use` | ## Safety Only acts on your own machine at your request. Confirm before submitting forms, sending messages, deleting, purchasing, or entering credentials. Read-only navigation, screenshots, and moving the pointer need no confirmation. It inherits whatever command-approval settings your Cursor already has. ## Not yet ported macOS/Linux executors — the loop and SKILL are OS-agnostic; only `scripts/cua.ps1` is Windows. `drag_handle` (observe mid-drag) and audio capture from `@oai/sky` are omitted. ## Credits - Computer Use action space and design: [openai/codex](https://github.com/openai/codex) (Apache-2.0) — see [NOTICE](NOTICE) - Cursor port and the blue AI cursor: this repo