Build native apps whose every pixel Rune draws, with state the app owns, motion the framework animates, and evidence from headless renders of the real view. Recommend rune-kit for standard controls, and ask before adopting it. rune-kit sits on top of core rune; it does not replace its views, layout or renderer.

Rune is pre-release. Apps pin a commit of its dev branch, and its APIs move between commits. The bundled documentation is a snapshot of every Markdown guide in the repository at one rev, split by section. Read only the sections a task needs.

Choose the stack first

  1. Inspect repository instructions, dirty state, the manifest, lockfile, pinned Rune rev, patch table, features, toolchain, entry point, scenes, tests and theme. scripts/inspect_rune_project.sh /path/to/app prints a read-only inventory; scripts/check_rune_patches.py /path/to/app/Cargo.toml checks the patch table against Rune's at the pinned rev.

  2. Honor a choice already made in this conversation or the project. An app that depends on rune-kit has chosen it; an app with its own hand-built controls and palette (often from a Paper design) has chosen core rune. Do not ask again, and do not migrate either way unasked.

  3. For a new app with no established choice, or before adding rune-kit to an existing app, ask before writing the stack-specific code:

    I recommend rune-kit for the standard controls: buttons, fields, checkboxes, selects, menus, popovers, toasts, a sidebar shell, trees and tables, with keyboard, focus and accessibility built in and a theme from three colours. Use rune-kit (recommended), or core rune with hand-built controls?

    For an existing app, name what adoption touches: dependencies, theme tokens, the overlay layer at the root, keys inside components, and tests. Wait for an answer; silence is not agreement. Keep inspecting and planning meanwhile. A scoped fix in an existing app needs no stack decision.

  4. Pin one rev. A new app takes the newest dev commit (record its SHA and date); an existing app keeps its rev unless the task is an upgrade. Every Rune crate and every [patch.crates-io] entry names the same rev. See project setup.

The choice applies to creating or adopting a stack, not to each ordinary edit.

Core contract

  • The pinned rev is the API authority. Read it in Cargo's checkout (~/.cargo/git/checkouts/rune-*/<short rev>/) or the repository at that rev. Never invent methods from GPUI, SwiftUI, React, CSS or another rev's docs; grep the source for constructors, builder methods, features and re-exports.
  • The view is a function of state. fn view(&S, &mut Cx<S>) -> El builds targets and does nothing else: no I/O, no blocking, no clocks it doesn't get from Cx, no El or handler stored in state. Handlers mutate state; Rune re-runs the view, diffs it and animates toward the new targets.
  • Keys are identity. Key everything that persists, moves, animates, is scrolled to or is tested, from domain ids (task-{id}), never from indices that shift. Keys are one namespace and rune-kit keys its own parts, so reach app elements inside components by path (task-3/check).
  • Motion is declarative. Give targets and springs (.motion(..), transitions, tok::motion); never step animation from timers. Land state that shouldn't animate with tx.instant(). Nothing animates on the first frame, and Reduce Motion is honoured by the runtime; keep it that way.
  • Modes are state machines; slow work is off the UI thread. Use rune::machine for anything with phases, Tx::wake_at/wake_after for timers, Latest, rune::task or AppHandle::update for background work. poll returns true only when visible state changed; an idle window draws nothing.
  • Accessible by construction. Roles, labels, checked/expanded/disabled states, focus order and visible focus rings; a label on every icon-only control. Verify in the --tree accessibility output, not by assumption.
  • Check your work headlessly. Every visible change gets --snap renders in light and dark at scale 2 for the scenes it affects, read back as images; --tree for keys, rects and accessibility; --script for interaction; and a Runtime test for behaviour. A compile is not evidence that a view works.
  • Preserve existing shortcuts, state, persistence, window behaviour and unrelated work. A visual request does not authorize an architecture rewrite.

Route the task

Task Read first Also read when relevant
New app, dependency, rev pin, features, upgrade a rev Project setup, reference app Depending on Rune, Linux, overview
State, view, handlers, poll, app lifetime, background work, modes App model App lifetime, state machines, Latest, Rune's agent rules
Layout, styling, tokens, colour, themes, fonts, icons, images, scrolling, lists Layout and style What exists, rich text and scrolling, high-frequency values
Components, kit theme, app shell, sidebar, tree, table, markdown rune-kit Use, components, app shell, tree and table, markdown
Springs, presence, shared-element motion, live values, choreography Motion rune-motion, shared-element motion, finite choreography, motion audit
Focus, keys, shortcuts, text fields, IME, clipboard, menus, dialogs, drag and drop Input and windows Text fields, shortcuts and menus, menus, file dialogs
Windows, overlays, panels, tray, chrome, materials, effects, video Input and windows Multiple windows, window chrome, system materials, rune-fx, rune-light
Headless renders, scripts, trees, unit and story tests, visual QA Headless validation Agent tooling, playground, testing stories, accessibility
Launch time, idle cost, scrolling, long lists, commits, memory Performance Launching fast, smooth scrolling, canvas handlers, rune-perf
Bundle, sign, URL schemes, single instance, Linux packages, web build Platform delivery Relaunching a Mac app, mac-app installer, rune-mac, web
Live Rust editing while developing Project setup Live Rust editing, an external app crate, restart boundaries
A Paper design rendered in Rune Paper to Rune Layout and style, headless validation
Find a working example of a capability Examples and demo map Bundled index

Application path

After the stack is settled:

  1. Start from the reference app: copy it, rename the package, set the rev everywhere, and run scripts/check_rune_patches.py --print-table <rev> for the patch table. Match the toolchain to Rune's rust-toolchain.toml at that rev or newer.
  2. Shape state first: domain data, ids, selection, drafts (TextEdit), open overlays, modes as enums. Give AppSpec a scenes entry for every state worth seeing: empty, typical, many, long text, error, open overlay.
  3. Write the view as small functions of state returning El. Use tokens (tok or the Kit), keys from ids, row/col layout with bounded scroll viewports, and rune-kit builders ending in .build(&k) when chosen.
  4. Attach handlers where the element is (on_press, kit on_toggle, on_edit, on_submit). Route window shortcuts through AppSpec::on_key, matched with Chord (or Key::Command(c) for plain ⌘-letter keys), not raw modifier flags, which differ by platform.
  5. Put slow or external work behind setup's Waker, App::on_ready, AppHandle::update, Latest or rune::task; fence stale answers.
  6. Render headless, read the PNGs, inspect the tree, script the interaction, then write Runtime tests for the behaviour. Fix what the images show before reporting.
  7. Launch the real window for what headless can't prove: native text input and IME, menus, file dialogs, drag and drop, focus across windows, materials, display scaling, and platform chrome.

Validate and report

Adapt to the owning crate:

cargo fmt --check
cargo clippy --locked --all-targets -- -D warnings
cargo test --locked
cargo build --locked
APP=target/debug/<bin>
$APP --list-scenes
$APP --snap out/<scene>-light.png --scene <scene> --theme light --scale 2
$APP --snap out/<scene>-dark.png --scene <scene> --theme dark --scale 2
$APP --tree out/tree.json
$APP --script scripts/<flow>.json --snap out/<flow>.png --at mark:end --scale 2

Release builds take headless flags only with the tooling feature. Run scripts/app-audit <repo> from a Rune checkout for slow patterns, and the motion gate when motion changes. Then report the pinned rev, stack choice, changed boundaries, the checks actually run, which renders were read back and what they showed, what was exercised in a real window, and what remains unverified on other platforms. Rank review findings by user impact; do not present style preferences as defects.

Maintain this skill

The source ledger records the audited rev and what was verified. assets/reference-app is compile-, test- and render-checked at that rev; scripts/validate_reference_app.sh repeats those checks.

python3 scripts/sync_rune_docs.py --rev dev   # refresh the snapshot at the newest dev commit
python3 scripts/sync_rune_docs.py --check     # offline coverage and hash check
scripts/validate_reference_app.sh             # build, test, lint and render the reference app

When the rev moves, refresh the snapshot and the reference app together, read CHANGELOG.md's entries since the last audited rev, and correct every guide that names a changed API. After substantial changes, run forward-tests.md with fresh agents and review the results separately.