The uison framework builds a 0.9 MB utility instead of 5.1 MB and makes it readable for AI agents
Agents like Claude Code struggle with graphical programs: they need a screenshot and have to guess button coordinates. The uison framework in Rust describes the screen as JSON built from 9 shapes, and with the --mcp flag the app hands the agent the screen as text. The Disk Usage utility for macOS built on uison weighs 0.9 MB, while the egui version weighs 5.1 MB. For internal tools, this means not having to build two interfaces.
AI-processed from Habr AI; edited by Hamidun News
Agents like Claude Code can write code, but they are still clumsy with graphical programs. To press a button, they have to take a screenshot, guess the coordinates, and hope nothing has shifted. The author of the uison project, which was published on Habr, proposes a different approach: the interface is described from the start as data in JSON format, so the same program can be shown to both a human and an agent.
The bottom layer of the framework can draw only 9 simple shapes (rectangle, line, text, and so on), which keeps the code compact. In a test on the Disk Usage utility for macOS, the uison version takes up 0.9 MB, while the same program built on the popular Rust library egui takes 5.
1 MB. MCP mode (the standard protocol through which Claude Code, Cursor, and other AI clients call external tools) turns the app into a set of commands for an agent, and WASM lets it run directly in the browser.
How it works: 9 primitives and JSON
The lowest level renders only a JSON frame made of nine primitives: rectangle, line, circle, triangle, polygon, text string, image, clipping region (needed for scrolling), and an invisible zone for mouse and touch input. Everything above that level, including rows, buttons, icons, and your own elements, is reduced to these nine shapes on the way down.
This simplifies porting to new platforms: you only need to implement nine drawing methods and event handling. Windows (x64 and ARM), macOS, Linux, Android, iOS/iPadOS, and the browser via WASM are currently supported. On macOS, the framework uses AppKit and CoreGraphics; on Windows, Direct2D; on Linux, its own code for the Wayland and X11 protocols with dynamic library loading, so the binary depends only on libc. The Android APK builds without Gradle.
To avoid redrawing unnecessary parts, each new frame is compared with the previous one element by element, and the backend updates only the areas that changed. Lists are virtualized: a frame for a mailbox with 2,000 emails contains just a couple dozen rows. You can describe your own elements in Rust, C, C++, or directly in JSON, and the repository includes examples even in assembly.
Modes for people, SSH, and agents
The same application runs in different modes without changing the source code. Launching it without flags opens a regular window. With the --console flag, the program writes JSON frames to stdout and reads events from stdin, so it can run on a server and be operated over SSH as if it were local. The server only needs sshd, and the player itself loads and starts the program. The player can also be built for Android to control a remote utility from a phone.
For agents, there are the --agent and --mcp modes. In them, the program exposes not coordinates and colors but the meaning of the screen: element roles, names, and states. With --mcp, it connects to Claude Code with a single command, `claude mcp add todo -- .
/todo --mcp. The agent calls snapshot, receives the screen as text, and acts using the click, type, and choose` tools. The response contains only the difference: for example, after entering "Milk" into a to-do list, the agent sees that an item and a delete button were added, and the counter changed from "1 of 3" to "1 of 4".
The agent cannot press an inactive button, just as a human cannot; the program reports that it is inactive.
The author showed that the idea extends beyond utilities: HTML and CSS can be converted into the same JSON to produce a simple browser, while uison itself knows nothing about the web.
Size, memory, and limitations
The comparison was made on the open-source Disk Usage program for macOS in two versions: one on egui and one on uison, both in Rust.
- Size on macOS arm64: 5.1 MB for egui and 0.9 MB for uison (82% smaller). With
opt-level = "s", egui is 4.5 MB, so the difference is about fivefold. - External dependencies in Cargo.lock: 362 for egui, none for uison, only the project's own crates.
- Memory of an empty window: 122 MB versus 55 MB.
- Memory after scanning: 152 MB versus 97 MB, which is 36% less.
- Peak memory during scanning is slightly higher for uison: 183–184 MB versus 167–176 MB.
- Lines of code: 3,198 for egui and 3,547 plus 479 lines of JSON screen description for uison.
This is a comparison of a single utility written by the author himself, so the figures cannot be transferred to arbitrary applications. The author states directly that uison does not replace Qt or other full-featured GUI frameworks. It is intended for utilities, developer tools, and applications with buttons, lists, tables, and forms. Games and complex graphics need other solutions, and JSON at the lowest level was deliberately placed above render speed.
What to do with this
If you build internal tools that both people and agents will use, this approach is worth a look. One interface without a separate API and without screenshot recognition saves development time and reduces errors in automation. The project is open: there is the uisonlab/uison repository, an SSH player, a WASM demo on GitHub Pages, and lessons in Russian for Rust, C, and C++. To get started, cargo add uison and a couple dozen lines of code are enough.
- Dec 2, 2026Ai2 Releases MolmoWeb2 Web Agents: 27B Model Solves 75.3% of Tasks
- Dec 2, 202650 AI Models Beat 62 Teams at 'Zakovat': 48.3% Correct Answers vs 39.8%
- Dec 2, 2026Claude Fable 5.2 ran 1,000 agents for eight days and built an operating system
- Dec 2, 2026Amazon Releases Ergo Open Weights for Coding: 1.1 Trillion Parameters and 2,200 Tokens per Second
Key Questions Answered
How it works: 9 primitives and JSON?
The lowest level renders only a JSON frame made of nine primitives: rectangle, line, circle, triangle, polygon, text string, image, clipping region (needed for scrolling), and an invisible zone for mouse and touch input. Everything above that level, including rows, buttons, icons, and your own elements, is reduced to these nine shapes on the way down. This simplifies porting to new platforms: you only need to implement nine drawing methods and event handling.
What are the key details on Modes for people, SSH, and agents?
The same application runs in different modes without changing the source code. Launching it without flags opens a regular window. With the --console flag, the program writes JSON frames to stdout and reads events from stdin, so it can run on a server and be operated over SSH as if it were local. The server only needs sshd, and the player itself loads and starts the program. The player can also be built for Android to control a remote utility from a phone. For agents, there are the --agent and --mcp modes.
What are the key details on Size, memory, and limitations?
The comparison was made on the open-source Disk Usage program for macOS in two versions: one on egui and one on uison, both in Rust. Size on macOS arm64: 5.1 MB for egui and 0.9 MB for uison (82% smaller). With opt-level = "s", egui is 4.5 MB, so the difference is about fivefold. External dependencies in Cargo.lock: 362 for egui, none for uison, only the project's own crates. Memory of an empty window: 122 MB versus 55 MB. Memory after scanning: 152 MB versus 97 MB, which is 36% less.
Free 2-Day Vibecoding & AI Agents Intensive
Day 1: the autonomous Hermes + DeepSeek AI agent — vibecoding and development on par with Claude Code / Codex / Gemini. Led by Jemal Hamidun, Head of AI at Alpina Digital and academic supervisor at MIPT. Right after you register with our bot Nika: the recording + 11 materials from the previous intensive.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
