Skip to main content

lux

A visual output surface for AI agents.

License CI PyPI Python Working Backwards

Lux gives agents and apps a shared visual surface. The intended architecture is a hub/display split: clients send UI descriptions to luxd, the Hub owns authoritative element state and behavior, and the Display renders a replica of the current scene while forwarding user interactions back to the Hub.

The design draws on X11's client/server split and Smalltalk-style live introspection. MCP is one gateway into Lux, not the whole architecture. If you want the short version of the rewrite target, start with docs/architecture/target/target.md. If you need help navigating the docs, use docs/README.md. For the product direction, positioning, and risk assessment — the Working Backwards PR/FAQ — see prfaq.pdf.

Platforms: macOS, Linux

Stage: alpha --- protocol is stable, published on PyPI as punt-lux

A Claude Code plugin displaying a project issue board --- the agent fetches live data from DoltDB via bd list --json, builds a filterable table with detail panel, and renders it in a single tool call. Filters and row selection run at 60fps with zero MCP round-trips.

Beads issue board with filterable table and detail panel

The same list/detail pattern generalizes to any tabular data. Search, combo filters, pagination, and a detail panel --- all driven by a single show_table() call.

Filterable data explorer with detail panel

Dashboards compose metric cards, charts, and tables. show_dashboard() builds the layout from structured data --- no manual element positioning needed.

Dashboard with metrics, charts, and data table

Quick Start

curl -fsSL https://raw.githubusercontent.com/punt-labs/lux/78c46e79/install.sh | sh

Restart Claude Code twice. The Lux display window opens automatically when agents send visual output.

Manual install (if you already have uv)
uv tool install 'punt-lux[display]'

Then install the plugin via the marketplace:

claude plugin marketplace add punt-labs/claude-plugins
claude plugin install lux@punt-labs
Lightweight install (CLI and protocol types, no renderer)

If you only need the lux CLI and the JSON protocol element types --- enough to drive a running luxd over its REST API and to build element trees in Python --- install the base package:

uv add punt-lux

This pulls ~2 MB of lightweight deps. The 66 MB display stack (imgui-bundle, numpy, Pillow, PyOpenGL) is only needed to run the renderer (lux display) and is available via punt-lux[display].

Verify before running
curl -fsSL https://raw.githubusercontent.com/punt-labs/lux/78c46e79/install.sh -o install.sh
shasum -a 256 install.sh
cat install.sh
sh install.sh
Homebrew (Apple Silicon macOS)

macOS only for now, arm64 only. The formula pins a single macOS arm64 wheel for imgui-bundle, lux's ImGui binding — there is no Linux stanza yet, so a Linux build would hand pip a macOS wheel and fail. Intel macOS is unsupported for the same reason: imgui-bundle publishes no Intel macOS wheel at the version lux pins. Linux support is tracked as a follow-up.

brew install puts all four of lux's executables on PATH: lux (CLI), luxd-hub (Hub daemon), luxd-display (Display renderer), and lux-beads (the bundled beads applet).

brew install punt-labs/tap/lux

Use the fully qualified name. Homebrew Core already ships an unrelated formula also named lux (a Go video downloader) — brew install lux without the punt-labs/tap/ prefix silently installs that one instead of this project, since Homebrew resolves unqualified names against Homebrew Core first even with the tap tapped. brew install punt-labs/tap/lux is unambiguous.

Use one distribution channel per machine — mixing Homebrew with the curl | sh installer puts two copies of lux on PATH in different locations, and whichever comes first wins. Run which lux (or command -v lux) to see which one that is.

Run a demo
lux display install       # register the display as a launchd/systemd service
uv run python demos/dashboard.py

The install.sh bootstrap already runs lux display install for you; run it yourself only when driving Lux from a source checkout that did not use the bootstrap. Foreground lux display serve also works and stays attached to the terminal (Ctrl-C stops it) — that is the exact command the supervisor invokes.

Demos are in demos/ --- each connects as a client and drives the display:

Demo What it shows
interactive.py Sliders, checkboxes, combos, text inputs, color pickers
containers.py Windows, tab bars, collapsing headers, groups
dashboard.py Multi-window layout with draw canvases and live controls
data_viz.py Tables, plots, progress bars, spinners, markdown
menu_bar.py Custom menus, event handling, periodic refresh

Features

  • 25 element kinds --- text, buttons (arrow, small), images, sliders, checkboxes, combos, inputs (text, number), radios, color pickers (alpha, full picker), selectables, trees, tables, plots, progress bars, spinners, markdown, draw canvases, modals, dialogs, groups, tab bars, collapsing headers, windows, separators
  • Frames --- scenes target named frames (inner windows) via frame_id. Frames persist after disconnect, can be adopted by new clients, and support initial sizing (frame_size) and ImGui window flags (frame_flags)
  • Layout nesting --- windows contain tab bars contain groups contain any element, arbitrarily deep
  • Incremental updates --- update patches individual elements by ID without replacing the scene
  • Session menus --- the menu bar shows one submenu per live session. A session registers a menu entry via register_callback from the connection it holds open to the Hub, and a click on that entry is pushed straight down that connection for the session to service from its own shell. The "Beads" entry each lux-enabled session's lux-beads applet registers is how the beads board reopens from the menu
  • Agent menus --- menu_set gives the calling session its own menus on the bar, keyed by that session so two sessions never clobber one another even when they name a menu the same. An item may carry a frame_id: clicking it raises that session's frame of that name (the same name scene_show targets). An item with no frame_id delivers its click back to the setting session as a reserved lux.menu event on topic_recv() (payload {"menu": <label>, "item": <item_id>}) --- an agent-in-the-loop notification, not a Hub-side handler --- so the agent learns which item the user chose and acts on it
  • Interaction handling --- button clicks, slider changes, and menu clicks fire their handlers on the Hub (D21 remote dispatch); the raw event log is readable via list_recent_events. Hub handlers can publish app events that the agent reads via recv
  • A push is a notification, not a window-raise --- a scene arriving where no frame exists yet gets one, on screen, and that is all it does. It takes no focus and disturbs no other frame; a docked frame stays docked, a frame the user closed stays closed, and the selected tab stays selected. Where a window sits is the user's decision, and no update overrides it
  • Closed is a place, not an erasure --- the close button puts a frame away with its scenes, widget state and active tab intact. The dock pill, Expand All and the Windows menu's closed-frame list all bring it back as it was --- raising a frame is the user's own gesture at the Display (DES-088), never a client operation; only the client taking its content away disposes of it
  • Persistent tabs --- each show() call opens a dismissable tab; same scene_id replaces content in-place. Users can close individual tabs
  • Themes --- 11 built-in themes, chosen by the user from the display's Settings menu (agents read the active theme via display_theme_get but never set it, per DES-088): imgui_colors_dark, imgui_colors_light, imgui_colors_classic, darcula, darcula_darker, material_flat, photoshop_style, grey_flat, cherry, light_rounded, microsoft_style
  • Hold and reconcile, never control --- the Hub never starts, stops, or spawns the display renderer; that is the user's own gesture (lux display start/stop) or the OS service supervisor's, and soon the display need not even share a machine with the Hub (DES-093). When no display is connected, the Hub holds the content it cannot deliver and retries reaching a display at an exponential backoff that slows to a minute-plus, reconciling everything held the moment a display (re)connects. display_link_get / lux display link report whether a display is linked, how many scenes are held, the current retry delay, and which Hub (host + pid) holds them
  • Unix socket IPC --- length-prefixed JSON frames, no HTTP overhead, no threads

MCP Tools

Agents interact with Lux through the MCP tools luxd serves over its streamable-HTTP /mcp endpoint (the authoritative roster is pinned by a test; this table mirrors it):

Tool What it does
Scene management
scene_show(scene_id, elements) Replace the display with a new element tree. Supports frame_id, frame_size, frame_flags for windowed frames
scene_table(scene_id, columns, rows) Display a filterable data table with optional detail panel
scene_dashboard(scene_id, ...) Display a dashboard with metric cards, charts, and a table
scene_update(scene_id, patches) Patch elements by ID (set fields or remove)
scene_clear(scene_id) Clear one scene and blank its frame; unknown or unowned scenes are named errors, never a false "cleared"
scene_clear_all() Remove all of the caller's scenes from the display
Frames & menus
frame_close(frame_id) Close a frame and tear down its scenes on the Hub; a foreign or nonexistent frame_id is a named not_found error, never a false "closed", and a malformed frame_id is invalid_request
menu_set(menus) Replace the caller's agent-defined menus on the menu bar. An item's frame_id raises the caller's frame of that name on click; an item without one delivers a reserved lux.menu event to the caller's topic_recv()
menu_ls() List the Hub-owned menu bar and its items
callback_register(callback_id, label) Register a menu entry the calling connection owns; refused unless that connection holds luxd's listen leg, since clicks are delivered by push
callback_pending() Peek at the caller's held callback invocations without draining them
Display --- read-only (the user owns the display's visual state, per DES-088)
display_info() Backend, resolution, frame rate, PID, uptime
display_theme_get() Current theme name (set from the display's Settings menu, not by a client)
display_window_get() Current window settings (opacity, font scale, decoration, idle FPS)
display_mode_get(repo) Read the display mode (y/n) for the caller's project --- pass the absolute project path (set it via the lux display mode on|off CLI)
display_screenshot() Capture the display framebuffer
display_link_get() Whether a display is linked and, when not, how many scenes the Hub is holding, the current retry delay, and the Hub's host + pid --- Hub-side, answerable with no display connected
Introspection
scene_inspect(scene_id) Return the element tree for a scene the caller owns
scene_ls() List active scenes and frames from the Hub's store
session_ls() The Hub's sessions --- connections and their scopes
event_ls(count) Recent display interaction events
error_ls(count) Recent display errors and warnings
Session & pub/sub
ping() Round-trip latency check
session_identify(kind, name, repo, agent) Declare who this session is so the Hub attributes the UI it installs
topic_subscribe(topic) Subscribe to a Hub-scoped app topic; delivered via topic_recv
topic_unsubscribe(topic) Stop receiving a topic
topic_publish(topic, payload) Publish an app event to a Hub topic (separate from the UI observer mechanism)
topic_recv() Take the next queued app event for this session without blocking; returns event:<topic>:<payload> or none. UI interactions are handled Hub-side, not delivered here

What It Looks Like

Show text and a button

{"tool": "scene_show", "input": {
  "scene_id": "hello",
  "elements": [
    {"kind": "text", "id": "t1", "content": "Hello from the agent"},
    {"kind": "button", "id": "b1", "label": "Click me"}
  ]
}}

Returns "shown:hello" immediately — the Hub has accepted the scene and its background replicator paints it; no tool call ever waits on the display. A button click fires its handler on the Hub (the agent does not poll for it). To observe interactions, read the introspection log:

{"tool": "event_ls", "input": {"count": 5}}

A Hub-side handler can topic_publish an app event that the agent then reads with topic_recv (see the Communication tools above). An element that declares "publish": ["my.topic"] publishes what the user did — the event's kind, the scene and element it landed on, and its own fields, such as a table selection's row_ids and anchor. The full shape is in the library guide.

Multi-window dashboard

{"tool": "scene_show", "input": {
  "scene_id": "dash",
  "elements": [
    {"kind": "window", "id": "w1", "title": "Controls", "x": 10, "y": 10,
     "children": [
       {"kind": "slider", "id": "vol", "label": "Volume", "value": 50}
     ]},
    {"kind": "window", "id": "w2", "title": "Chart", "x": 320, "y": 10,
     "children": [
       {"kind": "plot", "id": "p1", "title": "Trend",
        "series": [{"label": "y", "type": "line",
          "x": [1,2,3,4], "y": [10,20,15,25]}]}
     ]}
  ]
}}

Update a single element

{"tool": "update", "input": {
  "scene_id": "dash",
  "patches": [
    {"id": "vol", "set": {"value": 75}}
  ]
}}

Element Kinds

Category Kinds
Display text, button (arrow, small variants), image, separator
Interactive slider, checkbox, combo, input_text, input_number, radio, color_picker (alpha, picker modes)
Lists selectable, tree
Data table, plot, progress, spinner, markdown
Canvas draw (line, rect, circle, triangle, polyline, text, bezier)
Layout group, tab_bar, collapsing_header, window, modal, dialog (modal confirm dialog with Hub-side handler dispatch)

All elements with an id support an optional tooltip field (string shown on hover).

CLI Commands

Noun-grouped: every operation is lux <noun> <verb>, matching the same vocabulary the MCP tools and REST routes use. Every write accepts --as/--kind/--name/--repo/--agent (per-invocation identity) and every command accepts --json/--verbose/--quiet.

Noun group Verbs
lux scene show, update, clear, clear-all, inspect, ls, table, dashboard
lux frame set-state
lux menu ls, set
lux session ls, inspect, identify
lux display info, theme, mode, window, screenshot, link (linkage + held-scene count + retry delay + Hub host/pid), serve (raw render-loop entry point, invoked by the supervisor), install, uninstall, start, stop, status (admin — window process supervision, CLI-only)
lux event ls
lux error ls
lux callback register
lux hub install, uninstall, start, stop, restart, status (admin — luxd process supervision, CLI-only)
Top-level singleton What it does
lux ping Ping the display through luxd; print round-trip time
lux doctor Check installation health (Python, fonts, plugin)
lux version Print version
lux enable Enable visual output for this project and allow the lux CLI, lux's MCP tools and commands in the repo's .claude/settings.json (lux disable removes them)
lux disable Disable visual output for this project
lux status Check if the display server is running
lux install Install the Claude Code plugin via the marketplace
lux uninstall Uninstall the Claude Code plugin
lux beads Display the beads issue board via luxd's REST API (no LLM needed) — a bespoke app-specific convenience, not part of the noun-grouped vocabulary
lux-beads The Beads applet: owns this session's Beads menu entry and services its clicks (launched by the plugin's session-start hook)

Display window management

The display window runs as its own supervised service, symmetric to the hub. lux display install registers a launchd LaunchAgent (macOS) or systemd user unit (Linux) that spawns lux display serve at login and restarts it on crash; lux display start / stop toggle the running process; lux display status reports supervisor and window state; lux display uninstall reverses the registration. This is the reliable path for the window to appear on macOS — a child of the graphical login session gets the GUI bootstrap the OS needs to draw. Foreground lux display serve is the same entry point; the supervisor invokes it. On macOS the window gets a Dock icon (regular activation policy) so it is visible and switchable; when the menubar-app epic (lux-mxvy.3) ships, the policy flips to accessory and the menubar controls visibility instead.

lux topic * and lux callback pending are not exposed on the CLI: they have no REST route by design (tests/rest/test_app.py's _MCP_ONLY) — delivery for both runs over the listen leg's push/drain, which a stateless CLI request cannot bind to.

Library (Python)

Python applications drive the Hub through LuxClient, the typed async facade over luxd's REST API. It gets the same validation, typing, and identity handling the CLI gets, with no [display] extra required. Long-lived apps add LuxHubClient to receive menu clicks and pub-sub events over a persistent connection; vox's music player is the reference app built this way. The full guide, with working examples, is docs/library.md.

Architecture

Agent or app
  │ MCP or direct Hub API
  ▼
luxd (Hub)
  │ authoritative state + introspection
  │ scene replicas + remote invocations
  ▼
lux display (ImGui + OpenGL)
  │ renders at 60fps
  ▼
Window on screen

The Hub is the single source of truth for element state, ownership, and handler dispatch. The Display is a rendering replica: it paints the current scene and forwards interactions back to the Hub, which runs the real handler and re-pushes updated state. MCP is one entry point, not the only one.

How a session connects, and how its menu entries work

The bundled plugin connects Claude Code straight to luxd, with no per-session process in the path:

{
  "mcpServers": {
    "lux": { "type": "http", "url": "http://127.0.0.1:8430/mcp" }
  }
}

Menu entries are a separate connection, and they belong to the session's applets. An applet is a small program — not a daemon, not part of luxd — that the plugin's session-start hook launches and that runs for the life of that session, in that session's repository and shell. lux-beads is the first.

An applet exists because a menu entry must launch in the time a user reads as instant, so the click has to be answered by something already running and already reachable: not a poll, and never a turn of the model. The applet registers its entry on its own connection, receives clicks pushed down it, and does the work itself — running bd from the repository's own shell and pushing the board to the Hub, which luxd cannot do from launchd with no PATH, no credentials, and no working directory.

It does not make you wait for data it could already have. Reading the issues is a query to a hosted database and it is the whole wait, so the applet loads a board as soon as its entry is registered and holds the board from every click after that. A click puts that board up immediately and reloads behind it; the fresh one replaces it in place, without taking focus. A reload that fails leaves the board standing and says why in the applet's log, because a board a few minutes old is worth more than a red message where the board was. Only a session that has not managed to load one yet sees "Loading issues…".

It leaves when its session does. Handed the session's process id at spawn, it checks every few seconds whether that process still exists and exits when it does not, so an applet cannot outlive its session even when the session is killed rather than closed. The Hub's lease sweeps the menu entry underneath that regardless.

luxd enforces the arrangement rather than trusting it: register_callback is refused unless the calling connection holds a listen leg, because a connection that could never be told its item was clicked must not own one. That is why the tool surface a session talks to owns no entries.

Setup and verification for a hand-configured direct connection are in docs/library.md.

Documentation

Docs Guide | Python Library Guide | Target Architecture | Current Architecture | Design Log | Changelog

Development

uv sync --extra display        # Install dependencies (dev group installs by default)
make check                     # Full gate: lint, format, mypy, pyright, tests, OO ratchet
make test-integration          # Integration tier
make restart                   # Rebuild, reinstall, restart luxd AND the display

make check is the commit gate — it runs ruff, mypy, pyright (via npx), pytest, and the OO ratchet exactly as CI does.

Visual verification (make screenshot)

make screenshot                            # writes .tmp/lux-screenshot.png
SCREENSHOT_OUT=/tmp/out.png make screenshot # override the output path

Captures the running lux-display window to a PNG for agent-driven visual verification at the demo gate (docs/WORKFLOW.md). Linux only, verified on Ubuntu with a Wayland session running XWayland (DISPLAY pointing at the X11 socket). Requires import/convert (ImageMagick), xwininfo/xprop (x11-utils), xdotool, and systemd-inhibit (systemd) on PATH. The script (scripts/screenshot.sh) resolves the real luxd-display client window by _NET_WM_PID match — never by title alone, so a same-titled window manager decoration frame is never mistaken for it — and rejects a captured image whose pixel standard deviation is near zero (a locked or blanked session can still produce a nonempty, uniformly black PNG), so a returned path is always a real, non-blank capture. Not part of make check; CI has no display to capture.

The Claude Code plugin — its plugin.json, the /lux command, the session hooks, and the skills — lives in plugin/, separate from the Python package in src/. A marketplace install fetches only that directory, so load it for local testing with claude --plugin-dir plugin. Installing the CLI (uv tool install, install.sh, or pip) is unaffected: the wheel ships src/punt_lux and never contained the plugin surface.

Acknowledgements

Lux is a thin orchestration layer. The rendering is done by Dear ImGui, Omar Cornut's immediate-mode GUI library. ImGui handles all the hard problems --- text layout, widget state, input handling, GPU rendering --- and does so in a single-pass retained-mode-free architecture that maps naturally to Lux's "send JSON, render this frame" model. The 60fps render loop, the composable widget tree, and the ability to drive a full UI from a socket with no threading are all consequences of ImGui's design.

Python bindings come from imgui-bundle by Pascal Thomet, which packages ImGui, ImPlot, and several other ImGui extensions into a single pip-installable wheel with complete type stubs. imgui-bundle is what makes "install one Python package, get a GPU-accelerated UI" possible.

FastMCP provides the MCP server layer.

License

MIT

Metadata

Release files for punt-lux 0.33.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for punt-lux 0.33.1
File Size Uploaded Provenance Actions
punt_lux-0.33.1.tar.gz 1.3 MB With provenance Details for punt_lux-0.33.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for punt-lux 0.33.1
File Interpreter ABI Platform Actions
punt_lux-0.33.1-py3-none-any.whl Python 3 none any Details for punt_lux-0.33.1-py3-none-any.whl

Total release size: 3.0 MB

Release files / punt_lux-0.33.1.tar.gz

Download URL punt_lux-0.33.1.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
326edae5c57c0678fe38171c128c1b786c3525b505e29587c3dcd5e4cd513a15
BLAKE2b-256 checksum
How to use checksums
298b91d3d1e17a882382b14b4583347d90ca892e4f84524521182befa2f5b498
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / punt_lux-0.33.1-py3-none-any.whl

Download URL punt_lux-0.33.1-py3-none-any.whl
Size 1.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c82be902d67f80c05b5854b2e65b24d3d9ff425d50d3c687be1dddda517e1a5f
BLAKE2b-256 checksum
How to use checksums
a357b54c6c38728b481cb983c778719a275a68af2e6324e6ae8260bf2bc24e63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for punt-lux 0.33.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for punt_lux-0.33.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page