Operate desktop applications on macOS, Windows and Linux through native accessibility trees, using the agent-desktop CLI. Use when an AI agent must see or act on a desktop GUI: click buttons, fill forms, read UI state, navigate menus, toggle checkboxes, scroll, drag, type text, press shortcuts, take screenshots, manage windows, use the clipboard, launch or close apps, read notifications. Triggers on: "click button", "fill form", "open app", "read UI", "computer use", "operate desktop", "accessibility tree", "snapshot app", "type into field", "navigate menu", "toggle checkbox", "take screenshot", "desktop automation", "agent-desktop", or any desktop GUI task on macOS, Windows or Linux.
--- name: agent-desktop version: 0.11.1 tags: computer-use, desktop-automation, accessibility, ai-agent, gui-automation, cli requirements: - agent-desktop description: > Operate desktop applications on macOS, Windows and Linux through native accessibility trees, using the agent-desktop CLI. Use when an AI agent must see or act on a desktop GUI: click buttons, fill forms, read UI state, navigate menus, toggle checkboxes, scroll, drag, type text, press shortcuts, take screenshots, manage windows, use the clipboard, launch or close apps, read notifications. Triggers on: "click button", "fill form", "open app", "read UI", "computer use", "operate desktop", "accessibility tree", "snapshot app", "type into field", "navigate menu", "toggle checkbox", "take screenshot", "desktop automation", "agent-desktop", or any desktop GUI task on macOS, Windows or Linux. --- # agent-desktop agent-desktop is a CLI that lets an AI agent observe and operate desktop apps through the OS accessibility tree. It is a tool, not an agent. Every command prints one JSON envelope (`ok`, `data` or `error`). The observe, act and verify loop runs in you. ## Shell syntax Examples use a POSIX shell. In PowerShell, quote every ref (`'@s8f3k2p9:e1'`), because a bare `@token` is the splatting operator. Use `$env:NAME = 'value'` instead of `export`, and `| ConvertFrom-Json` instead of `$(...)` and `jq`. The Windows skill has the PowerShell forms. ## First run 1. Run `agent-desktop status`. It reports the platform, permissions and `supported_surfaces`. 2. Run `agent-desktop skills get platform`. It loads the skill for the OS the binary runs on (macOS, Windows or Linux). 3. For flags and syntax, run `agent-desktop <command> --help`. This skill does not repeat flag lists. ## The loop Use `find` when you know the role or exact name. Otherwise map the app first and drill into one region. ``` agent-desktop snapshot --skeleton --app "Notes" -i --compact # shallow map, children_count on cut branches agent-desktop snapshot --root @s8f3k2p9:e3 -i --compact # drill into one region agent-desktop click @s8f3k2p9:e12 # act on a qualified ref agent-desktop snapshot --root @s8f3k2p9:e3 -i --compact # verify: re-read the same region ``` - A small app needs no skeleton. Take a full `snapshot -i`. - Never skeleton a surface (`--surface menu`, `sheet`, `alert`). A surface is already focused. - An action that opens a menu, sheet or alert lists it in `data.surfaces`. Target that overlay next. - After an async step, use `wait` (see `commands-system.md`). A fixed sleep is a race. ## Refs - Output refs are qualified: `@<snapshot_id>:e<N>`, for example `@s8f3k2p9:e1`. Pass them to later commands as they are. - Refs are valid for one snapshot. After any UI change, re-drill the affected region or take a new snapshot. - Only addressable elements get refs. Static text and inert containers do not. - `STALE_REF`: the ref no longer matches the live UI. Take a fresh snapshot and use the new ref. - `AMBIGUOUS_TARGET`: more than one live element matches. Narrow the target with `find --role --name --exact` or `--root`, then use the new ref. - `SNAPSHOT_NOT_FOUND`: the snapshot id expired. Snapshot again. ## Delivery and retry Action results carry `data.disposition` and errors carry `error.disposition`, each with `delivery` and `retry`. Observation commands such as `snapshot` have none on success; their errors, and every `INVALID_ARGS` refusal, carry `not_delivered` and `retry: safe`. - Retry or substitute an action only when `disposition.retry` is `safe`. Only `not_delivered` is safe. - Any other delivery value means the action may have landed. A repeat can click, type or submit twice, and `toggle` can undo itself. - On a result that is not safe, read the live state (`get`, `is`, or a fresh snapshot) and decide from that. `details.post_state` helps when present. - Branch on `error.code` and `error.disposition`. Message and suggestion text can change. - `details.retryable: false` means waiting cannot change the outcome. Try a different approach. ## Headless and headed Ref actions are headless by default. They use semantic accessibility calls and do not take focus, move the cursor, synthesize keys or use the clipboard. If no semantic path exists, the action fails closed. Use the global `--headed` flag only when the user explicitly permits physical input, such as double-click, hover, drag, or focus. Never switch to headed mode to recover from a headless failure. Raw coordinates (`--xy`) never imply focus. Which actions need `--headed` differs by OS: read the platform skill. ## References Load one only when you need it: `agent-desktop skills get desktop <reference>`. | Reference | Open it when | |-----------|--------------| | `commands-observation` | You need `snapshot`, `find`, `get`, `is`, `screenshot`, `list-surfaces` semantics, partial trees, or the `--root` rules | | `commands-interaction` | You choose between click, type, set-value, select, toggle, scroll, press and mouse commands, or you debug an action error | | `commands-system` | You launch or close apps, manage windows, use the clipboard, `wait`, `batch`, sessions, multi-agent cursors, tracing, or load skills | | `workflows` | You want worked patterns (forms, menus, dialogs, waiting for a new window, scroll-find, drag) and the anti-patterns list |
don't have the plugin yet? install it then click "run inline in claude" again.
extracted implicit decision logic into explicit branches (skeleton vs snapshot, headless vs headed, ref staleness handling), documented all inputs including edge cases and OS-specific setup, reorganized procedure into atomic numbered steps with explicit inputs and outputs, added outcome signal and output contract sections detailing JSON format and retry logic.
agent-desktop is a CLI that lets an AI agent observe and operate desktop apps through the OS accessibility tree. it is a tool, not an agent. every command prints one JSON envelope (ok, data or error). the observe, act and verify loop runs in you.
use agent-desktop when an AI agent must interact with a desktop GUI on macOS, Windows or Linux. triggers on any request to click, type, fill forms, navigate menus, toggle controls, read UI state, take screenshots, open/close apps, manage windows, access the clipboard, or read notifications. the skill wraps the agent-desktop CLI to map accessibility trees, execute semantic actions (headless by default), and verify state changes through JSON responses.
required:
$PATH (platform-specific: macOS, Windows x64, Linux x64)optional:
--headed flag: only when user explicitly permits physical input (double-click, hover, drag, focus). requires headless action to have failed first; never use to recover from headless failure--xy for raw coordinate actions: does not imply focus or cursor movementagent-desktop status to verifyedge cases:
find with no matches returns data: []; take a fresh snapshot to confirm UI stateinput: shell access, agent-desktop binary
agent-desktop statussupported_surfaces listinput: platform name (macOS, Windows, Linux)
agent-desktop skills get platforminput: application name or identifier (e.g. "Notes", "TextEdit", "Notepad")
snapshot_id, element tree with children_count on cut branches, element refs in format @<snapshot_id>:e<N>input: app name, -i flag for inline all children, --compact to strip verbose metadata
agent-desktop snapshot --app "AppName" -i --compact
output: complete element tree, all refs valid for this snapshot_idinput: app name, --skeleton flag, -i flag, --compact flag
agent-desktop snapshot --skeleton --app "AppName" -i --compact@s8f3k2p9:e3)
output: shallow tree showing app structure; identifies which region to drill intoinput: region ref from step 4b output (e.g. @s8f3k2p9:e3), -i and --compact flags
agent-desktop snapshot --root @s8f3k2p9:e3 -i --compact--root to focus on that subtree only--skeleton on a surface (menu, sheet, alert); surfaces are already focused
output: full tree under that region, new refs valid for the same snapshot_idinput: element ref (e.g. @s8f3k2p9:e12), action verb (click, type, toggle, scroll, etc.)
commands-interaction for decision tree)agent-desktop <action> <ref> [options]agent-desktop click @s8f3k2p9:e12agent-desktop type @s8f3k2p9:e5 "text to enter"agent-desktop toggle @s8f3k2p9:e7
output: JSON envelope with ok or error, action disposition (delivery and retry flags on error only)input: same region ref from step 5, or new snapshot if region may have changed
agent-desert snapshot --root @s8f3k2p9:e3 -i --compactinput: action result that lists data.surfaces (overlay opened), or action that is async
agent-desert wait --event <event-name> to block instead of fixed sleep
output: command returns when condition is met or timeout expiresmapping phase: should i skeleton or snapshot?
snapshot -i --compact, skip skeletonsnapshot --skeleton --app "AppName" first to identify region of interestwhen to use --headed:
--xy) do not require headed modeaction retry decision:
error.disposition.retry is safe (only on not_delivered): retry or substitute the same actionerror.disposition.retry is not safe (delivery = delivered, partially_delivered, uncertain): do not retry; read live state and decide from thatget, is, or a fresh snapshot to confirm current state before deciding next stepref staleness:
STALE_REF or SNAPSHOT_NOT_FOUND: take a fresh snapshot and re-derive refs; old refs are invalidAMBIGUOUS_TARGET: use find --role <role> --name <name> --exact to narrow to one element, then use the new refheadless vs headed by platform (see platform skill for full matrix):
success (ok):
{"ok": true, "data": {...}} with element tree, refs, and state values{"ok": true, "data": {"disposition": {"delivery": "delivered", "retry": "none"}}} with optional details.post_state@<snapshot_id>:e<N> (string, quoted in JSON)errors:
{"error": {"code": "STALE_REF|SNAPSHOT_NOT_FOUND|INVALID_ARGS|...", "disposition": {"delivery": "not_delivered", "retry": "safe"}}, "details": {...}}{"error": {"code": "STALE_REF|AMBIGUOUS_TARGET|...", "disposition": {"delivery": "delivered|uncertain|...", "retry": "none|unsafe"}}, "details": {"post_state": {...}}}details.retryable: false means waiting or retrying will not change outcome; take a different approacherror.code and error.disposition only; do not rely on message text (it can change)file locations:
screenshot command to capture visual state to a file if neededdisposition.delivery is delivered and retry is noneagent-desktop wait returns without timeouterror.code: "STALE_REF"; take a fresh snapshotdata.surfaces listing the new overlay; target that surface nexterror.disposition.retry is safe (only on not_delivered); retry the same commandAMBIGUOUS_TARGET; use find --exact to narrow scope, then use new ref