clank — computer use with inbuilt messages
clank.py wraps the open-source cua-driver binary (cua-driver call <tool>),
a background engine using UIA (Windows), AX (macOS), AT-SPI
(Linux). overlay.py is a Tk overlay: blue arrow cursor,
click tilt + ripple, message pill, typewriter reveal.
Run from this skill's own directory. python3 on macOS/Linux, py -3 or
python on Windows.
Setup — cua-driver (install if missing)
Check first — if this prints a version, skip to verify:
cua-driver --version
Install only when that fails.
Windows (PowerShell):
irm https://cua.ai/driver/install.ps1 | iex
cua-driver autostart kick
Requires Windows 10/11 with an interactive desktop session. autostart kick
registers start-at-sign-in and starts the daemon now — no reboot.
macOS / Linux:
/bin/bash -c "$(curl -fsSL https://cua.ai/driver/install.sh)"
macOS requires 14 (Sonoma) or later. Then:
open -n -g -a CuaDriver --args serve
cua-driver permissions grant
Grant Accessibility + Screen Recording when prompted (the TCC grant sticks to
CuaDriver.app only when started via the app bundle).
Linux requires an x86_64 desktop session with X11 or XWayland plus AT-SPI 2.
Raw background input on Wayland has compositor-specific limits — prefer
X11/XWayland.
Verify:
cua-driver --version
cua-driver doctor
cua-driver call list_apps
Expect version output, a clean doctor, and an app-list JSON.
Where clank finds it (clank.py probes in order):
CUA_DRIVER_CMD env override, then cua-driver on PATH
- Windows:
%LOCALAPPDATA%\Programs\Cua\cua-driver\bin\cua-driver.exe,
~/.local/bin/cua-driver.exe
- macOS:
~/Library/Cua/bin/cua-driver, ~/.local/bin/cua-driver,
/opt/homebrew/bin/cua-driver, /usr/local/bin/cua-driver
- Linux:
~/.local/bin/cua-driver, ~/.local/share/cua/bin/cua-driver
Override example: $env:CUA_DRIVER_CMD="C:\path\to\cua-driver.exe" (PowerShell)
or export CUA_DRIVER_CMD=/path/to/cua-driver (sh).
Python check (3.10+, Tk, no extra deps):
python3 --version
python3 -c "import tkinter; print('tk ok')"
Windows: py -3 --version and py -3 -c "import tkinter; print('tk ok')".
Troubleshooting:
cua-driver not found after install → reopen the shell (stale PATH),
then re-run --version.
- Windows daemon not running → re-run
cua-driver autostart kick in an
interactive session.
- macOS permission denied → re-run the daemon via
open -n -g -a CuaDriver --args serve, then cua-driver permissions grant.
- Linux input fails on Wayland → switch to an X11/XWayland session,
confirm AT-SPI 2 is installed.
- Still broken →
cua-driver check-update / cua-driver update --apply,
or re-run the installer over the top (manual fallback: releases at
github.com/trycua/cua).
Modes
One-shot: python3 clank.py <cmd> [--flags]
Pipe (JSON lines, any harness): stdin one object per line
{"id":1,"action":"click","params":{"pid":P,"x":100,"y":200}} →
stdout {"id":1,"ok":true,"result":{...}}. Errors keep the request id.
A parse failure answers {"id":null,...}.
Actions (both modes, params in pipe params)
| Action |
Params |
Notes |
apps |
— |
running + installed apps (pid, name, launch_path) |
windows |
— |
top-level windows (pid, window_id, title, bounds) |
capture |
pid, window_id? |
UIA/AX tree + element_token + frame per element |
shot |
out? |
full desktop PNG, returns saved path |
click |
pid, window_id?, element?|token?|x+y, mode? |
background default; mode:"foreground" only if driver refuses |
type |
pid, window_id?, element?|token?, text |
also feeds overlay typewriter |
key |
pid, key |
e.g. Return, Escape, Tab |
hotkey |
pid, keys ("ctrl+l" or ["ctrl","l"]) |
XAML/UWP targets may refuse — use element click instead |
launch |
path, args? |
hidden launch, no focus steal |
front |
pid |
bring to foreground (visible — user sees it) |
cursor |
sub: show|hide|state|move, x?, y?, session? |
driver overlay control; move also glides clank cursor |
pill |
text, ms? |
message pill, agent-chosen duration (default 2500) |
busy |
on: on|off |
spinner while model thinks/responds; off restores triangle |
sharp |
on: on|off |
hide bulky driver cursor, use clank arrow |
One-shot flags mirror params: --pid --wid --element --token --x --y --text --key --keys --path --args --out --sub --on --ms.
Rules that bite
- Coordinates are NATIVE desktop pixels = element
frame space. Never scale.
- Capture fresh per
(pid, window_id) before element/token actions. Tokens go
stale after any re-render (stale_element_token → capture again, retry).
- Direct
cua-driver call needs element_token, never bare index.
- Overlay glide/ripple on clicks: pass the element's frame center as
x,y
alongside element/token (driver ignores it, overlay uses it).
- Background first. Foreground only after a
background_unavailable refusal.
Overlay (overlay.py, pythonw — no console)
- Sharp blue arrow, eased glide toward state
{x,y}.
- Click: 18° forward tilt + single blue ripple, 12→80px, 600ms fade.
- Pill: squircle, bottom-right of cursor, word-wrapped, max 200×300px,
left-aligned, shadow-grounded.
pill --text T --ms N shows T for N ms.
- Typing: letter-by-letter reveal at 100wpm +
▍ caret, holds 2s.
- State: OS temp dir (
.../clank/overlay-state.json), never the install dir;
heartbeat .alive (5s TTL).
clank.py auto-starts the overlay when stale. Single instance only —
extras exit at startup; idle overlay quits after 60s with no state writes.
Kill strays with python3 kill_overlay.py.
- Transparency/color degrade gracefully off-Windows (font stack:
Segoe UI → SF Pro → Helvetica Neue → DejaVu Sans).
Requirements
See Setup above: cua-driver resolvable (PATH, standard location, or
CUA_DRIVER_CMD), Python 3.10+ with Tk, no extra deps.
1---2name: clank3description: Computer use with inbuilt messages. Drive the desktop via the clank CLI (any harness, Windows/macOS/Linux). Background control plus sharp blue cursor, click tilt + ripple, typewriter reveal, and message pill with agent-chosen duration.4---56# clank — computer use with inbuilt messages78`clank.py` wraps the open-source `cua-driver` binary (`cua-driver call <tool>`),9a background engine using UIA (Windows), AX (macOS), AT-SPI10(Linux). `overlay.py` is a Tk overlay: blue arrow cursor,11click tilt + ripple, message pill, typewriter reveal.1213Run from this skill's own directory. `python3` on macOS/Linux, `py -3` or14`python` on Windows.1516## Setup — cua-driver (install if missing)1718Check first — if this prints a version, skip to verify:1920`cua-driver --version`2122Install only when that fails.2324Windows (PowerShell):2526```powershell27irm https://cua.ai/driver/install.ps1 | iex28cua-driver autostart kick29```3031Requires Windows 10/11 with an interactive desktop session. `autostart kick`32registers start-at-sign-in and starts the daemon now — no reboot.3334macOS / Linux:3536```sh37/bin/bash -c "$(curl -fsSL https://cua.ai/driver/install.sh)"38```3940macOS requires 14 (Sonoma) or later. Then:4142```sh43open -n -g -a CuaDriver --args serve44cua-driver permissions grant45```4647Grant Accessibility + Screen Recording when prompted (the TCC grant sticks to48CuaDriver.app only when started via the app bundle).49Linux requires an x86_64 desktop session with X11 or XWayland plus AT-SPI 2.50Raw background input on Wayland has compositor-specific limits — prefer51X11/XWayland.5253Verify:5455```sh56cua-driver --version57cua-driver doctor58cua-driver call list_apps59```6061Expect version output, a clean doctor, and an app-list JSON.6263Where clank finds it (`clank.py` probes in order):6465- `CUA_DRIVER_CMD` env override, then `cua-driver` on PATH66- Windows: `%LOCALAPPDATA%\Programs\Cua\cua-driver\bin\cua-driver.exe`,67 `~/.local/bin/cua-driver.exe`68- macOS: `~/Library/Cua/bin/cua-driver`, `~/.local/bin/cua-driver`,69 `/opt/homebrew/bin/cua-driver`, `/usr/local/bin/cua-driver`70- Linux: `~/.local/bin/cua-driver`, `~/.local/share/cua/bin/cua-driver`7172Override example: `$env:CUA_DRIVER_CMD="C:\path\to\cua-driver.exe"` (PowerShell)73or `export CUA_DRIVER_CMD=/path/to/cua-driver` (sh).7475Python check (3.10+, Tk, no extra deps):7677```sh78python3 --version79python3 -c "import tkinter; print('tk ok')"80```8182Windows: `py -3 --version` and `py -3 -c "import tkinter; print('tk ok')"`.8384Troubleshooting:8586- `cua-driver` not found after install → reopen the shell (stale PATH),87 then re-run `--version`.88- Windows daemon not running → re-run `cua-driver autostart kick` in an89 interactive session.90- macOS permission denied → re-run the daemon via91 `open -n -g -a CuaDriver --args serve`, then `cua-driver permissions grant`.92- Linux input fails on Wayland → switch to an X11/XWayland session,93 confirm AT-SPI 2 is installed.94- Still broken → `cua-driver check-update` / `cua-driver update --apply`,95 or re-run the installer over the top (manual fallback: releases at96 github.com/trycua/cua).9798## Modes99100One-shot: `python3 clank.py <cmd> [--flags]`101Pipe (JSON lines, any harness): stdin one object per line102`{"id":1,"action":"click","params":{"pid":P,"x":100,"y":200}}` →103stdout `{"id":1,"ok":true,"result":{...}}`. Errors keep the request `id`.104A parse failure answers `{"id":null,...}`.105106## Actions (both modes, params in pipe `params`)107108| Action | Params | Notes |109|---|---|---|110| `apps` | — | running + installed apps (pid, name, launch_path) |111| `windows` | — | top-level windows (pid, window_id, title, bounds) |112| `capture` | `pid`, `window_id?` | UIA/AX tree + `element_token` + frame per element |113| `shot` | `out?` | full desktop PNG, returns `saved` path |114| `click` | `pid`, `window_id?`, `element?`\|`token?`\|`x`+`y`, `mode?` | background default; `mode:"foreground"` only if driver refuses |115| `type` | `pid`, `window_id?`, `element?`\|`token?`, `text` | also feeds overlay typewriter |116| `key` | `pid`, `key` | e.g. `Return`, `Escape`, `Tab` |117| `hotkey` | `pid`, `keys` (`"ctrl+l"` or `["ctrl","l"]`) | XAML/UWP targets may refuse — use element click instead |118| `launch` | `path`, `args?` | hidden launch, no focus steal |119| `front` | `pid` | bring to foreground (visible — user sees it) |120| `cursor` | `sub: show\|hide\|state\|move`, `x?`, `y?`, `session?` | driver overlay control; `move` also glides clank cursor |121| `pill` | `text`, `ms?` | message pill, agent-chosen duration (default 2500) |122| `busy` | `on: on\|off` | spinner while model thinks/responds; off restores triangle |123| `sharp` | `on: on\|off` | hide bulky driver cursor, use clank arrow |124125One-shot flags mirror params: `--pid --wid --element --token --x --y --text126--key --keys --path --args --out --sub --on --ms`.127128## Rules that bite129130- Coordinates are NATIVE desktop pixels = element `frame` space. Never scale.131- Capture fresh per `(pid, window_id)` before element/token actions. Tokens go132 stale after any re-render (`stale_element_token` → capture again, retry).133- Direct `cua-driver call` needs `element_token`, never bare index.134- Overlay glide/ripple on clicks: pass the element's frame center as `x,y`135 alongside `element`/`token` (driver ignores it, overlay uses it).136- Background first. Foreground only after a `background_unavailable` refusal.137138## Overlay (`overlay.py`, pythonw — no console)139140- Sharp blue arrow, eased glide toward state `{x,y}`.141- Click: 18° forward tilt + single blue ripple, 12→80px, 600ms fade.142- Pill: squircle, bottom-right of cursor, word-wrapped, max 200×300px,143 left-aligned, shadow-grounded. `pill --text T --ms N` shows T for N ms.144- Typing: letter-by-letter reveal at 100wpm + `▍` caret, holds 2s.145- State: OS temp dir (`.../clank/overlay-state.json`), never the install dir;146 heartbeat `.alive` (5s TTL).147 `clank.py` auto-starts the overlay when stale. Single instance only —148 extras exit at startup; idle overlay quits after 60s with no state writes.149 Kill strays with `python3 kill_overlay.py`.150- Transparency/color degrade gracefully off-Windows (font stack:151 Segoe UI → SF Pro → Helvetica Neue → DejaVu Sans).152153## Requirements154155See Setup above: `cua-driver` resolvable (PATH, standard location, or156`CUA_DRIVER_CMD`), Python 3.10+ with Tk, no extra deps.