SCUA

How it works

What SCUA does differently, in twelve diagrams.

Most of SCUA reads like the scripting languages you know. These are the parts that work differently underneath. Each diagram plays once when it scrolls into view, and can be replayed.

1. State that moves

Running state is one block of bytes

A SCUA program is made of partitions. Each keeps everything it owns in one region of memory, and the references inside that region are relative, so they stay valid wherever the region is placed. Saving a partition is copying those bytes. Loading one on another machine is copying them back.

Server A Server B the session has left its memory is free again the bytes, as they are no save code, no load code player 4821 running frozen hp80 position(12, 4) quest"the keep" same script, same state 1Freeze between two messages 2Send the bytes 3Load them and carry on
Server A the session has left its memory is free again the bytes, as they are no save or load code Server B player 4821 running frozen hp80 position(12, 4) same script, same state 1Freeze between two messages 2Send the bytes 3Load them and carry on
A session is frozen between two messages, its bytes are sent, and the other server loads them and carries on.

There is no save code to write and none to forget to update. For data that must outlive the code that made it, a separate typed save carries a version number, is checked as it loads, and is upgraded by the migrate hooks you write.

Persist and migrate →

2. Sessions that sleep

While a session waits, it can be a stored object

Because a session is one block of bytes, a host can freeze it, drop it from memory and keep the blob in object storage. When a message arrives the host loads it again. The script does not know it happened.

One session, over an afternoon time → messages in memory awake awake awake in storage asleep: one stored object asleep: one stored object While it sleeps there is no process and no memory held for it. The script never learns it was frozen, and carries on from where it was.
One session over an afternoon: three short bursts in memory, and the rest of the time asleep as a stored object.

The manual's measurements, on Apple silicon: a session holding 16 records freezes to about 7 KB in a few thousandths of a millisecond. One holding 32,768 records is about 8 MB and takes about 3 ms each way.

Hibernate a session →

3. Access by grant

A script starts with nothing, and is given what it needs

Files, the network, the environment, the terminal, running other programs, opening a port: each is a separate capability, and none is on by default. A grant can be narrow. One folder, a list of host names, one address to bind.

A script code you did not write read a file open a connection read the environment run a command starts with nothing Files ./scratch the rest Networkany host, any port Environmentkeys, tokens, paths Other programsrunning a command --allow-fs=./scratch not grantednot grantednot granted the boundary: only a grant passes
A script starts with nothing a file a socket env vars a command stopped at the boundary: not granted Files --allow-fs=./scratch ./scratch everything else: not reachable Network Environment Programs Each refusal names the grant that is missing.
The host granted one folder. The script's other three requests stop at the boundary, and each error names the grant that is missing.

Grants come from command-line flags, from a permissions file, or from the host program when SCUA is embedded. In the file, false is a refusal that --allow-all cannot override. A project's own manifest never grants anything.

The grants, in the CLI reference →

4. Budgets

Untrusted code runs on a work and memory budget

A sandbox compiles source at run time into a partition with no capabilities. It also gets a count of operations it may run each turn and a cap on memory. When either runs out the code is stopped from outside, and the caller receives an error value whose kind says which limit was hit: out_of_fuel or out_of_memory.

code a player or a model wrote fn main(input) while true do input = input + 1 end end stopped here, between two operations Operations this turn 200,000 allowed 0 of 200,000 left Memory 4 MiB allowed Error(e) e.kind == "out_of_fuel" Your program gets a value back and carries on. The code inside cannot catch the stop, and it held no capability to begin with.
The default sandbox allows 200,000 operations a turn and 4 MiB of memory. Both are yours to set.

The same limits exist for whole programs: --max-ops for one turn, --max-total-ops for the run, and --max-mem for the memory of the program and all its actors.

Run untrusted code →

5. Actors

No shared state, so no locks

A partition's state is private and its handlers run one message at a time. Messages are copied, so two partitions never hold the same mutable value. That is what lets the runtime put partitions on different cores without your code taking a lock.

thread 1 thread 2 thread 3 thread 4 reply Room 12 Player Ana Scores Shop Player Ben Room 13, idle Room 14, idle tell room.Move(3, 1) ask shop.Buy("sword") tell scores.Add Each partition owns its state and handles one message at a time. Nothing is shared, so nothing is locked.
Players, rooms and a shop as partitions spread over threads. The runtime chooses where each one runs, up to eight threads by default.

tell sends and moves on. ask waits for the reply and takes a timeout. A new partition costs about 2.3 KB, and one that has handled a message about 12 KB.

Partitions and actors →

6. Requests that wait

A handler that waits does not hold the thread

The HTTP server runs each request with its own state, as if in a partition of its own. When a handler waits on a database, a file or another service, it steps aside and the server answers other requests. The handler is an ordinary function, with no async or await.

requests time → 1GET /profile waiting on the database 2GET /health 3POST /score waiting on a service the thread 1 2 3 1 3 A handler that waits steps aside, and the next request runs. Each request has its own state, so they cannot see each other half-way through.
Three requests on one thread. While one waits on a database, the others are answered.

Serve HTTP requests →

7. Views by audience

Each field says who may see it

A record field can carry a gate, which names the audiences allowed to see it. project builds the view for one audience, through nested records and lists. A field the audience may not see is left out of the result, so it is not in what you send.

Player on the server name"Aria" health80Visible inventory[3, 7, 12]Owner bonus_timer4213Internal each field says who may see it project(aria, Player, audience) Audience.Client the owner name"Aria" health80 inventory[3, 7, 12] bonus_timernot sent Audience.Spectator name"Aria" health80 inventorynot sent bonus_timernot sent
project(aria, Player, audience) Player on the server name"Aria" health80Visible inventory[3, 7, 12]Owner bonus_timer4213Internal Audience.Clientthe owner name"Aria" health80 inventory[3, 7, 12] bonus_timernot sent Audience.Spectator name"Aria" health80 inventorynot sent bonus_timernot sent
The same record, projected for the owning client and for a spectator.

Audience gates →

8. Inside a frame

The host program stays in charge of time

Embedded in a C or C++ program, SCUA does nothing until it is called. The host loads a script once, calls into it when it wants, and decides when the scripts' pending turns run. Scripts reach the host through the functions it chose to expose.

Your engine C or C++, owns the clock read input call the script run its turns draw every frame SCUA scripts loaded once, kept between frames your updategameplay code actors' turnswithin a budget calls the functions your engine exposes
One frame of a game. The engine calls into the script, then runs the scripts' pending turns when it chooses.

Drive scripts from an engine →

9. One record per tool

The schema and the checks come from one declaration

A command-line tool declares its arguments as a record. scua schema turns that record into the JSON Schema a model reads, and sys.parse_args checks what arrives against the same record before the tool's own code runs.

One record record Args { a: int where a in 0:10, b: int where b in 0:10, } schema JSON Schema what the model reads The model decides to call the tool {"a": 2, "b": 12} checks sys.parse_args(Args) runs every rule before the tool body starts … args.b violates Args's where rule (got 12) one JSON error on stderr, exit code 2, the body never ran the model reads the error and tries again
The record is the single description of the tool, so the schema and the checks cannot disagree.

Write tools for AI agents →

10. Layered files

Patches and mods override files by name

Paths that start with res: are the program's shipped data: levels, templates, schemas. They are read from a stack of layers, a folder in development and pack files in a release, and each layer mounted later sits above the ones before it.

your code reads res:maps/keep.json res:sprites/hero.png res:sprites/tree.png winter.paka mod, mounted last hero.png patch1.paka later patch keep.json base.pakwhat you shipped keep.json hero.png tree.png user:saves/slot1.json The player's own folder, for saves and settings. Every res: layer is read-only.
Each read takes the file from the highest layer that has one. Lower copies are still there, and are used again if the mod is removed.

Resources are read-only and are kept apart from the user's files, so a user's folder can never replace what the program shipped.

Ship data in packs →

11. Speed

An interpreter at Lua's pace, and a JIT on top

Every program starts on the interpreter. Loops and functions that run often are compiled to native code while the program runs, on x86-64 and ARM64. The JIT is on by default, and --jit=off turns it off.

Time to run three workloadsshorter is better; each group is scaled to its longest bar
PathfindingLua 5.4175 msSCUA, JIT off143 msLuaJIT57.4 msSCUA45.2 msGame loopLua 5.458.1 msSCUA, JIT off61.7 msLuaJIT8.2 msSCUA7.2 msPhysics stepLua 5.4252 msSCUA, JIT off232 msLuaJIT14.7 msSCUA16.6 ms
Our benchmark suite, 23 November 2026, a SCUA build compiled for the host CPU on x86-64 Linux: whole-process wall-clock, the best of at least five runs, every runtime's answer checked equal. On the same three workloads CPython 3.14 took 847, 323 and 1,367 ms.

The three rows above come from the ten-row "realistic" tier of our suite. Across all ten, SCUA with the JIT took 0.64 times as long as LuaJIT on this machine, and the interpreter 0.85 times as long as Lua 5.4. In the tier of everyday shapes the other tiers missed, SCUA took 1.15 times as long as LuaJIT.

Make scripts fast →

12. Packages

Installing a package cannot run code on your machine

In many languages a package can run its own script the moment you install it. SCUA's package manager only downloads files and checks them. It records a hash for every file, and the runtime checks the files against that record each time the program runs.

scua.toml what you asked for @scua/jwt >= 0.8.0 Resolve no floating versions the highest minimum that any package in the tree asks for scua.lock exact, and hashed jwt 0.8.0 sha256:41d2… deps/ checked each run jwt hmac jwt needs it Installing only downloads and checks. No package code runs. No install scripts, no plugins, no code in a manifest. A registry is a folder of files, so it can be a directory on a share, a bucket or a CDN, and a mirror cannot change what you get.
From the package you asked for to files on disk: each step is a download or a check.

The packages →

See it run

The playground runs the real compiler in your browser.