4.8 KiB
4.8 KiB
name, description
| name | description |
|---|---|
| clickthrough-http-control | Control a local computer through the Clickthrough HTTP server using screenshot grids, OCR, zoomed grids, and pointer/keyboard actions. Use when an agent must operate GUI apps by repeatedly capturing the screen, reading visible text, refining target coordinates, and executing precise interactions (click/right-click/double-click/scroll/type/hotkey) with verification. |
Clickthrough HTTP Control
Use a strict observe-decide-act-verify loop.
Getting a computer instance (user-owned setup)
The user/operator is responsible for provisioning and exposing the target machine. The agent should not assume it can self-install this stack.
What the user must do
- Install dependencies and run Clickthrough on the target computer (default bind:
127.0.0.1:8123). - Expose access path to the agent (LAN/Tailscale/reverse proxy) and provide the base URL.
- Configure secrets on target machine:
CLICKTHROUGH_TOKENfor general API authCLICKTHROUGH_EXEC_SECRETfor/execcalls
- Share connection details with the agent through a secure channel:
base_urlx-clickthrough-tokenx-clickthrough-exec-secret(only when/execis needed)
What the agent should do
- Validate connection with
GET /healthusing provided headers. - Refuse
/execattempts when exec secret is missing/invalid. - Ask user for missing setup inputs instead of guessing infrastructure.
Mini API map
GET /health→ server status + safety flagsGET /screen→ full screenshot (JSON with base64 by default, or raw image withasImage=true)POST /zoom→ cropped screenshot around point/region (also supportsasImage=true)POST /ocr→ text extraction with bounding boxes from full screen, region, or provided image bytesPOST /action→ single interaction (move,click,scroll,type,hotkey, ...)POST /batch→ sequential action listPOST /exec→ PowerShell/Bash/CMD command execution (requires configured exec secret + header)
OCR usage
- Prefer
POST /ocrwhen targeting text-heavy UI (menus, labels, buttons, dialogs). - Use
mode=screenfor discovery, thenmode=regionfor precision and speed. - Use
language_hintwhen known (for exampleeng) to improve consistency. - Filter noise with
min_confidence(start around0.4and tune per app). - Treat OCR as one signal, not the only signal, before high-impact clicks.
Header requirements
- Always send
x-clickthrough-tokenwhen token auth is enabled. - For
/exec, also sendx-clickthrough-exec-secret.
Core workflow (mandatory)
- Call
GET /screenwith coarse grid (e.g., 12x12). - Identify likely target region and compute an initial confidence score.
- If confidence < 0.85, call
POST /zoomwith denser grid (e.g., 20x20) and re-evaluate. - Before any click, verify target identity (OCR text/icon/location consistency).
- Execute one minimal action via
POST /action. - Re-capture with
GET /screenand verify the expected state change. - Repeat until objective is complete.
Verify-before-click rules
- Never click if target identity is ambiguous.
- Require at least two matching signals before click (example: OCR text + expected UI region).
- If confidence is low, do not "test click"; zoom and re-localize first.
- For high-impact actions (close/delete/send/purchase), use two-phase flow:
- preview intended coordinate + reason
- execute only after explicit confirmation.
Precision rules
- Prefer grid targets first, then use
dx/dyfor subcell precision. - Keep
dx/dyin[-1,1]; start at0,0and only offset when needed. - Use zoom before guessing offsets.
- Avoid stale coordinates: re-capture before action if UI moved/scrolled.
Safety rules
- Respect
dry_runandallowed_regionrestrictions from/health. - Respect
/execsecurity requirements (CLICKTHROUGH_EXEC_SECRET+x-clickthrough-exec-secret). - Avoid destructive shortcuts unless explicitly requested.
- Send one action at a time unless deterministic; then use
/batch.
Reliability rules
- After every meaningful action, verify with a fresh screenshot.
- On mismatch, do not spam clicks: zoom, re-localize, and retry once.
- Prefer short, reversible actions over long macros.
- If two retries fail, switch strategy (hotkey/window focus/search) instead of repeating the same click.
App-specific playbooks (recommended)
Build per-app routines for repetitive tasks instead of generic clicking.
Spotify playbook
- Focus app window before search/navigation.
- Prefer keyboard-first flow for song start:
Ctrl+L(search)- type exact query
- Enter
- verify exact song+artist text
- click/double-click row
- verify now-playing bar
- If now-playing does not match target track, stop and re-localize; do not keep clicking nearby rows.