hn.today

Typesafe-computer-use drives a Mac toward a goal for 1/50th of a cent per step

github.com4 points0 comments
Screenshot of Typesafe-computer-use drives a Mac toward a goal for 1/50th of a cent per step

A Mac automation project that steers the GUI toward a user-specified goal by using a small, fast decision model instead of sending screenshots to a large frontier model for every step. It reads the screen deterministically (screencapture → Vision OCR, plus the accessibility tree and AppleScript metadata), extracts structured items and focused fields, annotates dates, then asks a TypeSafe classifier to choose one action from up to 255 options with a calibrated confidence. Free-text entry or final-answer extraction are the only times a larger writer model is invoked. The code runs on macOS 14+ with Python 3.12+, requires screen-recording and accessibility permissions, uses environment keys for TypeSafe and optional Anthropic models, and provides CLI commands to dry-run or actuate multi-step runs with stopping rules based on confidence, no-ops, or step limits.

The implementation focuses on cost and latency: measured per-decision cost is $0.0002 and latency 0.13-0.38 s versus a baseline large model run at $0.032 and 5.2 s (roughly 155× cheaper and 14-40× faster), with an end-to-end step of about 1.5 s. OCR cost is reduced by smart cropping and reuse: captures are compared at 1/8 scale in 256 px tiles, changed tiles become rectangles that are re-read, and thresholds force full reads on large changes or app switches. The accessibility walk supplements OCR but is pruned aggressively (skip off-screen or tiny nodes, limit time and node count). Off-screen controls, deterministic action mapping, a three-way decision split to avoid noisy overlaps, and a deterministic date parser are notable design choices; some reasoning the big model handled had to be rebuilt deterministically.

Read on github.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Science

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.