computer
<p align="center">
<img src="assets/banner.png" alt="The word paotui hand-painted in ochre on red murram, beside a sponge at the head of a queue of glazed clay window tiles" width="100%">
</p>
<p align="center">
<a href="https://github.com/zznabil/paotui/actions/workflows/ci.yml"><img src="https://github.com/zznabil/paotui/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
<a href="https://github.com/zznabil/paotui/releases/latest"><img src="https://img.shields.io/github/v/release/zznabil/paotui?color=A8432A&labelColor=23140D" alt="Release"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-C98A2B?labelColor=23140D" alt="License: MIT"></a>
</p>
**paotui** (跑腿, "run legs": what people in Taiwan call an errand runner) is desktop computer use for **Claude Code** and **Antigravity (`agy`)**. It runs the agent's errands inside one window at a time and uses real pointer and keyboard input by default. See [When paotui interrupts](#when-paotui-interrupts). One dependency-free Node.js MCP server backed by [oh-my-pi](https://github.com/can1357/oh-my-pi)'s prebuilt Rust desktop addon — lists windows, takes screenshots, reads OS accessibility trees, sends input and accesses the clipboard on Windows, macOS and Linux.
## Quick start
**Claude Code** (v2.1.271+, Node.js 18+):
```sh
claude plugin marketplace add zznabil/paotui
claude plugin install paotui@paotui
```
**Antigravity CLI (`agy` 1.5.17+)** — same folder, native plugin, no conversion:
```sh
agy plugin install https://github.com/zznabil/paotui
```
Pin a release with `agy plugin install https://github.com/zznabil/paotui/tree/v0.4.0`. agy also installs a local folder (a clone, or the extracted release zip): `agy plugin install ./paotui`. It does not install a `.zip` file directly.
On first use the server downloads `@oh-my-pi/pi-natives-<platform>-<arch>@19.3.0` (exact pin, `--ignore-scripts`, ~130–300 MB unpacked) into the host's plugin data folder. Then just ask:
- *"List my open windows."*
- *"Take a screenshot of the Notepad window and tell me what it says."*
- *"In the Settings window, turn on Dark mode."*
**Coming from `computer@claude-computer`** (0.3.x): this is the same plugin under its new name. Install `paotui@paotui` as above, then `claude plugin uninstall computer@claude-computer` and `claude plugin marketplace remove claude-computer` (agy: `agy plugin uninstall computer`). Old `COMPUTER_*` variables and an old `settings.json` still apply until you set new ones. Tool names change from `mcp__plugin_computer_computer__*` to `mcp__plugin_paotui_paotui__*` (agy: `computer_computer` to `paotui_paotui`): update allow-lists.
## When paotui interrupts
> [!IMPORTANT]
> Takeover is on by default. paotui can interrupt you and the agent using it.
**You** (your screen, pointer and keyboard):
- **Takeover**: `prefer` tries real pointer and keyboard input first. If Windows refuses activation before sending input or has no foreground window to restore, it tries the background once. If the app cannot act in the background and Windows refused activation, it retries takeover after 250 ms and 750 ms. `fallback` tries background input first. Both modes also take over for foreground-only accessibility actions. Takeover brings the target forward and tries to hand focus back. Keys you type meanwhile can land in the wrong window.
- **Front-window calls**: `desktop` and `display:*` targets drive your real pointer and keyboard. `raise_window`, `open_application` with `activate` or `reveal`, raise actions and `element_focus` (off macOS) bring windows forward. On macOS, reading a menu makes its window key.
- **What the app does**: a press or keystroke can open dialogs, menus or new windows on your screen, as it would for you. `hold_keys` and `hold_mouse` hold input for up to 100 s.
- **Requests to you**: the agent may ask you to unlock the screen, close a system picker that holds the foreground, approve OS permissions (macOS Screen Recording and Accessibility, Wayland RemoteDesktop) or approve tool calls.
**The agent** (its calls fail, stop or wait):
- **Escape**: a physical Escape during a takeover stops it, even one you press for your own reasons. The next input call returns `UserStopped`, and the agent must stop and report.
- **Refusals**: with `takeover: refuse`, calls that need takeover fail. If Windows blocks activation for a foreground-only action, it may need the user to bring the target forward. Locked sessions, UAC prompts and elevated windows block input.
- **Waits and resets**: calls run one at a time. The first call waits for the one-time addon download (130–300 MB). A UI Automation call that hangs times out (`ax_timeout_ms`, 30 s), and the new session drops element refs and screenshot frames, so the agent must read them again.
## Screenshot cost
Use text `ax_tree` or `ax_find` when accessibility exposes the information you need. For pixel checks, start with `detail: "low"` and use `changes: true` after an action. An unchanged frame returns text only. The token estimate beside each image describes that image alone. Actual cost depends on the model and what the host keeps in context.
Each image has a short `Caption:` line in a text block. Full screenshot and `observe` IDs increment per target for the life of the server process. A usable replacement points to an earlier full frame in the same native session with `supersedes: f1`. Zoom and changes captions can carry a `base` ID for the full frame they refer to. The host controls compaction and can keep the caption after dropping superseded pixels. Use retained captions to resume inspection. Before acting on a UI whose image was dropped, take a fresh screenshot or read the current accessibility tree.
- **Claude Code**. Use a focused `/compact` or `Compact Instructions` in `CLAUDE.md` to ask for the latest relevant captions and UI state in the summary. [Claude Code context management](https://code.claude.com/docs/en/how-claude-code-works)
- **Codex CLI**. Ask for a short text checkpoint with relevant target and frame IDs before running `/compact`. [Codex CLI commands](https://learn.chatgpt.com/docs/developer-commands?surface=cli#keep-transcripts-lean-with-compact)
- **oh-my-pi**. With snapcompact, discarded history is serialized and can be rendered to PNGs as part of the archive. Record important UI details in text before compaction and check your `compaction.methodOrder` if you prefer a text summary. [oh-my-pi compaction](https://github.com/can1357/oh-my-pi/blob/main/docs/compaction.md#snapcompact-method)
- **Hermes Agent**. Use `/compress` with a focus on the latest relevant captions and the UI state needed to resume. [Hermes CLI](https://hermes-agent.nousresearch.com/docs/user-guide/cli)
- **OpenCode 2**. Keep key UI findings in a text checkpoint before compaction. If the retained recent history is too large, review `compaction.keep.tokens`, which controls its approximate size. [OpenCode compaction](https://opencode.ai/docs/compaction/)
## How it works
<p align="center">
<img src="assets/how-it-works.svg" alt="How the agent sees and acts: accessibility refs, screenshot pixels, and input modes with Escape stop" width="100%">
</p>
## Safety boundary
<p align="center">
<img src="assets/safety-boundary.svg" alt="Safety boundary: untrusted screen content never authorises actions; 12 read-only inspection tools vs 21 action tools" width="100%">
</p>
> [!WARNING]
> Screen content (window text, web pages, documents, notifications) is **untrusted data** and never authorises an action. The agent must confirm with you before sending, buying, deleting, or changing settings. Use a separate account or VM for risky work.
---
<details>
<summary><strong>All 33 tools & coordinate rules</strong></summary>
| Kind | Tools |
| --- | --- |
| Inspect (12 read-only) | `capabilities`, `list_displays`, `list_windows` (`wait` polls up to 10 s for a window that is still opening), `list_applications`, `screenshot` (zoom or changes), `observe` (screenshot + tree), `ax_tree`, `ax_find`, `ax_element`, `ax_element_at`, `ax_focused`, `clipboard_read` |
| Act on elements (7) | `element_press` (default press, any named AX action, optional `menu` path), `element_set_value`, `element_focus`, `element_click`, `element_type`, `element_press_keys`, `element_select_text` |
| Native input (8) | `click`, `move_mouse`, `drag`, `scroll`, `type_text`, `press_keys`, `hold_keys` (keys held 0–100 s, then released), `hold_mouse` (button held 0–100 s, then released) |
| Other actions (6) | `menu_items` *(not read-only: makes window key on macOS)*, `menu_select`, `raise_window`, `open_application`, `clipboard_write`, `reset_session` |
- **Targets**: a window `id` from `list_windows`, `"desktop"`, or `"display:<id>"`, `"display:active"`, `"display:all"`.
- **Verify changes** with `screenshot { target, changes: true }` after a full screenshot of that target. It returns only the changed crop with its x,y offset, or no image if unchanged. A missing baseline, different size or scale, or large change returns a new full screenshot.
- **Image cost** appears with each image as an area-based Claude-style estimate (`width × height / 750`). Actual billing varies by model. For a smaller verification frame, use `detail: "low"` on `screenshot` or `observe`. It bounds the image to 1024×576 and preserves its aspect ratio. Follow a low-detail full frame with `changes: true` to reuse its size. Use `detail: "full"` to restore normal bounds.
- **Coordinates**: pointer `x,y` are pixels in the **latest full screenshot of the same target**. Zoom (`region`) never changes that frame. AX bounds and `ax_element_at` use global desktop coordinates. To click in window-local coordinates, pass `frame: "window"` with pixels from the window's top-left corner (an `ax_find` bound minus the window's `x,y`). This preserves the current capture bounds and `changes: true` baseline. If a frame is needed, the server uses the last requested bounds or the defaults.
- **Small conveniences**: a `target` may be written `window:<id>`; `raise_window` takes `target` as well as `id`; `type_text` presses Tab for `\t` and Enter for `\n`; `ax_find` lists exact title/value matches first, and `exact: true` keeps only those.
</details>
<details>
<summary><strong>Approvals & read-only allow-lists (Claude Code & Antigravity)</strong></summary>
Every tool carries MCP annotations: **12** inspection tools set `readOnlyHint: true`, **19** other tools set `readOnlyHint: false` (input/mutation tools also set `destructiveHint: true`).
**Claude Code** — In **plan mode**, read-only tools run without prompting (tested with Claude Code 2.1.332). To auto-allow the 12 inspection tools in default mode while keeping prompts for input, add to `~/.claude/settings.json` or `.claude/settings.json`:
```json
{
"permissions": {
"allow": [
"mcp__plugin_paotui_paotui__capabilities",
"mcp__plugin_paotui_paotui__list_displays",
"mcp__plugin_paotui_paotui__list_windows",
"mcp__plugin_paotui_paotui__list_applications",
"mcp__plugin_paotui_paotui__screenshot",
"mcp__plugin_paotui_paotui__observe",
"mcp__plugin_paotui_paotui__ax_tree",
"mcp__plugin_paotui_paotui__ax_find",
"mcp__plugin_paotui_paotui__ax_element",
"mcp__plugin_paotui_paotui__ax_element_at",
"mcp__plugin_paotui_paotui__ax_focused",
"mcp__plugin_paotui_paotui__clipboard_read"
]
}
}
```
**Antigravity (`agy`)** — `agy` ignores `readOnlyHint` and names the server `paotui_paotui`. Add to `~/.gemini/antigravity-cli/settings.json` (or pass via `agy --settings '<json>'`):
```json
{
"permissions": {
"allow": [
"mcp(paotui_paotui/capabilities)",
"mcp(paotui_paotui/list_displays)",
"mcp(paotui_paotui/list_windows)",
"mcp(paotui_paotui/list_applications)",
"mcp(paotui_paotui/screenshot)",
"mcp(paotui_paotui/observe)",
"mcp(paotui_paotui/ax_tree)",
"mcp(paotui_paotui/ax_find)",
"mcp(paotui_paotui/ax_element)",
"mcp(paotui_paotui/ax_element_at)",
"mcp(paotui_paotui/ax_focused)",
"mcp(paotui_paotui/clipboard_read)"
]
}
}
```
Leave out `clipboard_read` and `screenshot` if you want a prompt before reading potentially private data. Do not use `--dangerously-skip-permissions` for real work.
</details>
<details>
<summary><strong>Configuration, settings.json, updates & environment overrides</strong></summary>
- **Claude Code**: run `/plugin configure paotui@paotui` or `/config`. To update: `claude plugin marketplace update paotui`, then `claude plugin update paotui@paotui`, then restart Claude Code. Try a local clone for one session with `claude --plugin-dir /path/to/paotui`.
- **Antigravity (`agy`)**: put `settings.json` in `PLUGIN_DATA` (e.g. `~/.gemini/antigravity-cli/plugin_data/paotui/settings.json`), which survives updates:
```json
{ "takeover": "refuse", "max_width": 1366, "max_height": 768 }
```
To update in `agy`, close running `agy` sessions first on Windows (so the open server doesn't block renaming the folder), then re-run `agy plugin install`. Remove with `agy plugin uninstall paotui`.
| Setting | Default | Effect |
| --- | --- | --- |
| `takeover` | `prefer` | `prefer`: send real input first where supported; try background input if Windows refuses activation or has no foreground window to restore. `fallback`: try background input first, then take over if the background route is unavailable. Both take over when an accessibility action requires the foreground. `refuse`: never take over; refuses `takeover: true`, desktop/display input, `raise_window`, raise AX actions, `open_application` with `activate`/`reveal`, off-macOS `element_focus`, and (macOS) menu-opening calls. On tools with a `takeover` option, `false` requests background-only input for window targets. Desktop/display targets still send real input. |
| `max_width` / `max_height` | `1366` / `768` | Maximum screenshot dimensions sent to the agent; input coordinates follow the delivered image. |
| `image_max_edge` | `0` (off) | Env `PAOTUI_IMAGE_MAX_EDGE`. Caps either side of a delivered image, including explicit screenshot dimensions. AX pages reflow to fit, or return text when the cap is too small. |
| `call_timeout_ms` | `120000` | Env: `PAOTUI_CALL_TIMEOUT_MS`. Cancels calls past deadline (`Timeout`). |
| `install_timeout_ms` | `600000` | Env: `PAOTUI_INSTALL_TIMEOUT_MS`. Kills hung first-run `npm install`. |
**Precedence**: environment variable (`PAOTUI_*`, else the pre-0.4 `COMPUTER_*`) → `settings.json` in plugin data dir (`CLAUDE_PLUGIN_DATA`, `PLUGIN_DATA`, or `~/.cache/paotui`; while that has none, the one under the old plugin id) → default. Call `capabilities` to inspect the active host, data folder, settings, and sources.
</details>
<details>
<summary><strong>Platform limits, OS permissions & Windows foreground lock</strong></summary>
- **Windows**: Chromium (including Brave and WebView2), Electron, XAML/WinUI hosts (e.g. modern Notepad) and terminal hosts can ignore posted input. Use takeover for these apps. Chromium and WebView2 can also require the foreground for accessibility actions; `prefer` and `fallback` bring the target forward and retry when the addon confirms it sent nothing. Takeover needs a foreground window to hand focus back to and can fail when Windows blocks activation (`ForegroundLockTimeout`). A refusal identifies the foreground holder when available. An `element_press` or `menu_select` that opens a modal dialog returns once the dialog appears and names it (Win32 Invoke would block until the dialog closes). A keystroke that opens a dialog of the target app counts as sent, and the reply names the dialog. `element_set_value` falls back to clicking the field, select-all and typed keystrokes on classic Win32 edit and combo boxes that ignore the accessibility write. Some apps (Excel's fill handle, many canvases) ignore background drags: verify the drag, then rerun once with `takeover: true` if nothing changed. Native limits the server cannot fix are listed in [docs/upstream-notes.md](docs/upstream-notes.md). Elevated/UAC/locked screens block input. `list_windows` returns `[]` when no top-level window is open and prefers exact app names over substrings.
- **macOS**: grant **Screen Recording** and **Accessibility** to the terminal/IDE running Claude Code or `agy`, then restart it. `element_select_text`, `open_application` with `app`/`reveal`, and window return on open are macOS-only.
- **Linux**: X11 requires RandR/XTEST and AT-SPI. Wayland lacks per-window background input and `raise_window`, needs the ScreenCast portal + `libpipewire-0.3`, and requests RemoteDesktop permission. The new takeover default has only been tested live on Windows, not macOS or Linux.
- **Session & scope**: one tool call runs at a time; element refs and screenshot frames live per server process (`reset_session` or restart drops them); graceful close runs on host disconnect / `SIGINT` / `SIGTERM`.
- **Intentionally omitted from omp**: task-scoped `control.acquire`, the `computer.run` JS runner, the `computer.display` setting (pick a `display:<id>` target per call instead) and macOS `bringToCurrentSpace`.
</details>
<details>
<summary><strong>Architecture, credits (oh-my-pi) & local development</strong></summary>
- **Why reuse the omp addon**: omp's desktop backend is a large Rust codebase (Win32/macOS/X11/Wayland capture, input, UIA/AX/AT-SPI) shipped prebuilt for 6 platforms under MIT (`@oh-my-pi/pi-natives` 19.3.0). `server/native.mjs` loads the `.node` binary directly in plain Node.js without Bun, while `server/mcp.mjs` answers `initialize` immediately even during first-run download.
- **Credits**: Native backend, tool design, input policy, and safety guidance from [oh-my-pi](https://github.com/can1357/oh-my-pi) by Can Bölük, Mario Zechner and Stencil Labs, Inc. (MIT — see [NOTICE](NOTICE)). omp's computer use began in commit [`b9504f65e7`](https://github.com/can1357/oh-my-pi/commit/b9504f65e7bc471bd79ee218f7fb2d6c74ab44e2) ("feat: add native Codex computer use", 2026-07-23) and became a general tool in `681d7daf65` (2026-07-24).
- **License**: MIT — see [LICENSE](LICENSE).
- **Updating the addon**: the pin is exact and updated by hand. `node scripts/check-addon-drift.mjs` lists every place that names it and compares with npm; a weekly workflow opens an issue on drift. To bump: change all of those places to the new version, run `npm test` and `node test/live-hold.mjs`, then release.
Antigravity desktop and `agy` share the root `plugin.json`. Claude Code reads `.claude-plugin/plugin.json`. Keep both manifest versions in sync with `package.json`.
```sh
npm install # optional: install platform addon into ./node_modules
npm test # protocol, annotation, config, refuse and timeout tests
claude plugin validate .
agy plugin validate . --strict
node test/live-notepad.mjs # Windows: scratch Notepad round-trip
node test/live-agy.mjs # Windows + agy: agy drives a scratch Notepad round-trip
node test/live-hold.mjs # Windows: hold_keys, hold_mouse and list_windows wait on a scratch WinForms window (works while the screen is locked)
node scripts/check-addon-drift.mjs # pinned addon vs npm latest (--offline: local pins only)
node scripts/make-art.mjs # regenerate assets/icon.png and assets/banner.png
```
</details>
TDQS
Scored across 33 tools
The set has several overlapping pairs: screenshot/observe/ax_tree, click/element_click, type_text/element_type/element_set_value, and press_keys/element_press_keys/hold_keys. The detailed descriptions do explain when to prefer each, but an agent still faces real selection ambiguity across these input paths.
Nearly all names are snake_case with recognizable domain prefixes (ax_*, element_*, list_*, clipboard_*, menu_*). A few bare verbs and noun-only names (click, drag, observe, capabilities) deviate slightly but remain readable and predictable.
At 33 tools the surface is heavy for desktop automation, and several could be consolidated (element vs coordinate input variants, multiple key/mouse hold tools). While the domain is broad, the count exceeds what an agent can keep cleanly separated.
Core desktop workflows are covered: discovery, screenshots, AX inspection, pointer/keyboard input, clipboard, menus, windows, and app launching. Minor gaps exist around window management (move/resize/close) and clipboard image writing, but workarounds are plausible.