Why stop at Emacs? Native apps you or an AI reprogram in Clojure while they run
Hacker News

Why stop at Emacs? Native apps you or an AI reprogram in Clojure while they run

Vision

Any application, defined in one format and rendered natively. Its users reshape it live, just by asking an AI.

Vision · Applications · Architecture · Lisp (Clojure) · How it works · Quick start · Documentation

affrescoui-demo-final-web.mp4

The demo: an image editor given a 3D modeller's and a presentation app's features by asking its assistant, a new app made from a name and a description, a small change to a home app, and the Launcher with its apps.

Warning: The v2.0.0 downloads are not code-signed yet, so macOS and Windows warn that they can't verify the developer when you first open them. Signed builds will come in a later release.

Best today: build from source. It's one command, gives an optimised build for your machine, and never shows that warning (you need CMake 3.25+ and a C++23 compiler):

cmake -S . -B build && cmake --build build && ./build/affrescoui_launcher

How It Works

AffrescoUI is a native UI engine whose applications are defined in Lisp. AffrescoUI Lisp, a sandboxed dialect of Clojure, is the standard: an application's window, views, state, behaviour, commands, keys, settings and text are all named Lisp definitions, which the engine builds into one document, draws in C++ and OpenGL, and keeps running.

If you write Clojure, you can already read and write these apps. JSON is supported too: the same document can be written directly in JSON, and every example ships both.

People and AI agents change an application while it runs: each change is checked against the app's permissions, previewed if it needs approval, and applied in place in milliseconds, with no rebuild, no restart and nothing lost.

Software is frozen at build time: it does what its makers shipped, and every change waits for the next release. AffrescoUI applications keep evolving while they are used, shaped by the people who use them.

  • One format for every application. A to-do list and a professional design tool are written the same way and rendered by the same native engine. A feature built for one application can move into another.
  • Complex applications, built by anyone. No programming needed: describe what you want, and an AI agent builds it with you, step by step, from a simple board to a full workbench.
  • The people who use an app can change it. Ask the app itself, in plain words: "add a Blocked column", "dim the lights at sunset", "warn me when a streak breaks", or point at the part to change and ask. You see the change live, then keep it or undo it, even after later changes. Nothing changes without your approval.
  • Prototyping without stopping. Every idea is tried in the running application: no rebuilding, no restarting, no reloading, and your work stays where it was. When the prototype is right, it is already the app.

An application starts from a document, then grows by being talked to: "add a filter to this list", "make the sidebar collapsible", "show the total in red when it's negative". Each request becomes a reviewed revision.

A run of revisions becomes a change set, a portable file that works like a plugin, and whole features move between applications: the planetarium below reuses the presentation editor's slide sorter.

A person's own version of an app is shared as one file too, and every install is a proposal they review before it lands.

flowchart LR app["📦 An application one live document"] ask["💬 You ask 'add a filter to this list'"] propose["🤖 An agent proposes a revision"] approve["✅ You preview, accept or reject"] plugin[("🧩 Change set or feature")] catalogue[("🌍 Shared others can install")] app --> ask --> propose --> approve --> plugin --> catalogue catalogue -. "install" .-> app classDef step fill:#EEF2FF,stroke:#6366F1,color:#312E81 classDef win fill:#10B981,stroke:#047857,color:#fff class app,ask,propose,approve step class plugin,catalogue win

The direction: applications as complex as the professional tools people use every day, in one format, rendered natively, and shaped by the people who use them while they run.

Applications

Thirteen applications, from everyday apps to professional tools, all in the same format. They are examples (examples/), not part of the library, and each carries the AI assistant in its bottom right corner: ask for a change in plain words, or point at the part to change first, then review the proposal it becomes.

Each is a Lisp program (examples/<name>/lisp/) in the dialect's idiomatic style, small named views and functions with their text in English, Spanish and French, and keeps the same app as a JSON document beside it (examples/<name>/json/): choose which opens in the Launcher's Settings.

Calamaio, the text editor reprogrammed from inside, is Lisp only.

The AffrescoUI Launcher, itself one live document: every application one click away, your own apps, a new app made blank, from an example or from a description, a catalogue of apps and features to install after review, and the AI provider every app's assistant uses.

Open them from the Launcher (./build/affrescoui_launcher), or run one with ./build/affrescoui_launcher <name>. None has native code of its own: files, the terminal and pixels are the library's.

In Lisp, every app speaks English, Spanish and French (Sign in: English, Italian and Arabic, right to left).

Architecture

AffrescoUI renders what it is told to: an application is a folder of documents (and, in a program that embeds the library, any native code it registers), and the engine knows nothing else about it. It is built in three layers, each made only of the one below:

  • Apps: folders of files (screen documents, data, assets) that the Launcher opens, with nothing compiled for them.
  • Themes (modules/themes): the kits' components (toolbars, menus, docks, dialogs) and the themes' design tokens, as JSON files built into the library.
  • Engine (every other module): mechanisms only. It looks a component or token a document doesn't define up in the installed kits and themes, and knows none of them by name; a document's own components win over the kits'.

A change travels down a stack of layers, each with one job.

%%{init: {"theme": "base", "flowchart": {"nodeSpacing": 30, "rankSpacing": 34, "padding": 14, "wrappingWidth": 400}, "themeVariables": {"fontFamily": "Helvetica, Arial, sans-serif", "fontSize": "14px", "lineColor": "#94A3B8", "primaryTextColor": "#0F172A", "edgeLabelBackground": "#FFFFFF"}}}%% flowchart TB studio([" You · the app's assistant or a script"]) agent([" AI agent · Claude Code"]) mcp["🤖 MCP server · mcp/ connects AI agents, both ways"] channel["🔌 Channel · modules/channel, modules/net local sockets · processes · WebSocket · one session per peer"] vcs["🛡️ Version control · modules/vcs allow / ask / deny · proposals · commits · history"] format["📄 Screen format · modules/format checks the document · evaluates it · reconciles in place"] lisp["λ Lisp language · modules/lisp builds a program's tree · runs its functions"] render["🎨 Renderer · modules/render layout · shaped text · input · accessibility · OpenGL"] themes["🧩 Kits and themes · modules/themes components · design tokens · JSON"] agent --> mcp mcp --> channel studio --> channel channel -- "revision" --> vcs vcs -- "accepted commit" --> format format -- "panels" --> render themes -. "components, tokens" .-> format lisp -. "programs" .-> format classDef peer fill:#FFFFFF,stroke:#CBD5E1,color:#0F172A classDef c_mcp fill:#F3E8FF,stroke:#9333EA,stroke-width:1.5px,color:#3B0764 classDef c_channel fill:#E0F2FE,stroke:#0284C7,stroke-width:1.5px,color:#0C4A6E classDef c_vcs fill:#FEF3C7,stroke:#D97706,stroke-width:1.5px,color:#78350F classDef c_format fill:#D1FAE5,stroke:#059669,stroke-width:1.5px,color:#064E3B classDef c_render fill:#EDE9FE,stroke:#7C3AED,stroke-width:1.5px,color:#4C1D95 class studio,agent peer class mcp c_mcp class channel c_channel class vcs c_vcs class format c_format class themes c_format class lisp c_format class render c_render

  • Written in Lisp. An app is a program in AffrescoUI Lisp (LISP.md, modules/lisp): named definitions (defscreen, defview, defstate, defn, defcommand, defkey, defcustom, add-hook, advice), run by the library's own interpreter. Each definition is versioned on its own, so a diff names the view or function that changed, and a proposal is rebuilt and judged by the tree it builds. The language can't reach files, processes or the network. Its only ways out are the steps a host grants, each checked against who wrote the code that is running.
  • One document, drawn natively. What a program builds is a screen document (SCREEN_FORMAT.md, with a JSON Schema): layout, components, themes, state, bindings, events, timers, services and permissions. It can also be written directly in JSON, for data and tools. Behaviour that usually needs code (wiring a button to a list, validating a form, filtering, drag and drop, shortcuts, navigation, calls to services) is declared, so an agent changes it as safely as a colour.
  • Compact for agents. Edits address nodes by id ({"set": {"#title/text": "Q4"}}, stored as JSON Patch) and re-reads return only what changed: a typical edit is 28 tokens, a re-read after one commit 27 (BENCHMARKS.md). When the person points at a part, the agent reads only the definition that built it.
  • Apps that agents can use. An app's commands are tools: an agent lists them, runs one under its own name and the app's run rules, never the person's, and can undo its runs (VERSION_CONTROL.md).
  • Swappable layers. Modules talk only through the interfaces in modules/core, and affresco::Screen plugs them together. No public header exposes OpenGL or GLFW, and each module links on its own (affrescoui::render, affrescoui::vcs, ...) or all together (affrescoui::affrescoui).
  • Features travel. A part declares the contribution points and contracts it needs, so one application installs another's feature, checked before it lands. A feature can hold Lisp code, which runs with its author's authority, and a person's version of an app is shared as one file (VERSION_CONTROL.md).

modules/core/ the interfaces between modules: Executor, Channel, VersionControl, Services, Network

modules/render/ windows, panels, layout, shaped text, input, accessibility; OpenGL 4.1 core or ES 3.0

modules/format/ the screen format: rules, checker, {{expressions}}, the runtime that reconciles in place

modules/themes/ the kits' components and the themes' design tokens, as JSON built into the library

modules/notation/ documents read and written in JSON or in the Lisp notation

modules/lisp/ the Lisp language, a Clojure dialect: reader, interpreter, programs built purely into a document

modules/data/ an app's records in SQLite, kept apart from its document: models and migrations

modules/audio/ sound: voices of files, streams and generators, mixed to the system's output

modules/vcs/ version control: commits, proposals, permissions, history

modules/channel/ peers and the live protocol over local sockets and processes

modules/net/ HTTP(S), server-sent events, WebSocket, remote peers

modules/services/ language servers, local programs and folders the host grants

modules/intelligence/ the providers an app's assistant asks (APIs or a command line), behind the assistant capability

modules/screen/ affresco::Screen, the composition root, and the umbrella header affresco/affresco.hpp

modules/automation/ scenarios: scripted input, expectations, golden images

modules/imaging/ layered images on copy-on-write tiles

modules/scene3d/ 3D scenes, glTF 2.0 in and out

modules/export/ panel trees as vector PDF

modules/capi/ the C API, affresco/affresco.h

mcp/ the MCP server for AI agents

apps/server/ the document server: shared, persistent documents over WebSocket

apps/host/ the stock host, affrescoui_launcher: it opens an app's folder and asks for what the app uses

examples/ the apps (each with a lisp/ and a json/ folder), the Launcher among them, the assistant add-on

catalogue/ the apps' versions and features the Launcher's Catalogue lists and installs

editors/ a VS Code extension, and a clj-kondo configuration for the Lisp programs

web/ the WebAssembly build

The layers, the path of a revision and of an event, and the security boundary: ARCHITECTURE.md.

Lisp (Clojure)

An AffrescoUI app is a program in AffrescoUI Lisp, a sandboxed dialect of Clojure with its own runtime, built into the library (LISP.md has every definition and rule in tables; modules/lisp, RFC 0005, RFC 0006). Its forms, functions and reader forms are Clojure's: of 186 everyday Clojure forms, 163 give Clojure's own value and the other 23 are left out or differ on purpose (everyday.lisp, checked on every test run).

It is measured against Clojure's cross-dialect test suite too (CONFORMANCE.md), every difference is written down with what to write instead (differences.md), and clj-kondo lints the programs with its configuration. Every example is written in its idiomatic style (style.md).

The program is a folder of small, named definitions. Building it gives the document the engine draws, and its functions run whenever a button is pressed, a key is typed or a bound value changes.

From Flow's own code (examples/flow/lisp/flow.lisp):

(ns flow.flow)
(defn cards-of "A column's cards, in their order." [c] (:cards (column c)))
(defn next-order "The order that puts a card at the end of a column." [c] (->> (cards-of c) (map :order) (reduce max -1) inc))
(defn column-of "The column that holds a card, or -1." [ref] (or (first (keep-indexed (fn [c col] (when (some #(= (:ref %) ref) (:cards col)) c)) computed.columns)) -1))
You define In AffrescoUI Lisp
The window, as an outline of its parts defscreen main
Its parts, small and named defview, defcomponent
Its data defstate, defcomputed
Its looks deftokens, defstyle, defmenu
What it does defn, defcommand
Shortcuts and settings defkey, defcustom
Extension points defhook, add-hook, advice
Its text, in every language (t "key") and locales/ .lisp
Its files (ns board.index (:require "toolbar.lisp" ...))

The document a program builds can

Read on Hacker News ↗ ← Back to News

Comments

No comments yet. Start the discussion.