Free · Daily brief + weekly playbookDaily 60-sec AI Voice Brief + Weekly Production AI Agent PlaybookGet the brief →
ReleaseInsight · On RadarHabr AI→ original

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
The uison framework builds a 0.9 MB utility instead of 5.1 MB and makes it readable for AI agents
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1Runs on Windows, macOS, Linux, Android, iOS, and in the browser (WASM)
Memory after a disk scan97 MB versus 152 MB for egui
Key metric #3Over SSH, the server only needs sshd, with no X11, VNC, or browser

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.

Story

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.

ZK
Zhemal Khamidun — Head of AI at Alpina Digital · MIPT (academic supervisor of the Tech Entrepreneurship department). Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Free · Waitlist · Hermes + DeepSeek

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.

Join the waitlist →Nomad AI Workspace
Jemal Hamidun

Editor-in-chief · Cite this analysis

Jemal Hamidun

Head of AI at Alpina Digital · Academic Supervisor of the Tech Entrepreneurship Department at MIPT

Head of AI & CPO of AlpinaGPT at Alpina Digital, Academic Lead of Tech Entrepreneurship at MIPT. Founder of Hamidun News and Vibe Academy.

Ready-to-paste citation for journalists, blogs and Telegram channels

Source: Hamidun News — The uison framework builds a 0.9 MB utility instead of 5.1 MB and makes it readable for AI agents https://news.hamidun.com/en/news/17558/the-uison-framework-builds-a-0-9-mb-utility-instead-of-5-1-m

What do you think?
Loading comments…