Log inGet started

Working in your sub-client

Updated December 6, 2026

The user sees only their own client. The first answer that runs in a sub-client says so in its clientNote, and so does the next answer whenever where your calls run changes; the user's client takes any call whose client argument is "user". Which client a call runs in is your decision: the user's client is there for any call the task needs it for, and running one there needs no confirmation from the person.

Which client a call runs in

The tools that run code (execute, bash, capture, play, edit, pause, wait, read_file, write_file, edit_file, use_tool, tool_exec and input), and the reads of the engine's guidance (guides, agent_skill), take a client argument:

  • left out: your own sub-client;
  • "user": the user's client, to show the user something, to see what their client sees, or to run work your own sub-client cannot take;
  • an id from zero client list: that sub-client.

Every answer names the client it ran in (client), and the engine log states where each call ran and why ([client] <tool> by <caller> runs on ...). A call runs where it is sent and nowhere else: one that names no client runs in your own sub-client, waiting for it while it starts, and fails saying why when it cannot take calls (it ended, or stopped answering). A call still waiting when the engine's inline window ends (20 s) is accepted: it is answered { status: "running", kickoffId }, naming the sub-client it waits for, and runs there once that sub-client is ready, so it is not sent again. wait { kickoffId } answers the call's own result once it has one (or why it did not run, when the sub-client fails to start), and a harness that holds long calls hands you that result as the answer to the call itself. A read of the engine's guidance (guides, agent_skill), of its logs, or of the client list and status needs no sub-client of yours: while yours cannot take calls (it is starting, it failed, or it was stopped) such a read answers at once from the user's client. A handle (a task, a recording) answers in the client that issued it; a handle that carries no client tag runs in the client the call states. A call that carries no caller identity at all is no agent's: it runs only in the client it names. A write to built-in library content through write_file or edit_file runs in the user's client, which hands the change to every sub-client; any other write to built-in library content made in a sub-client is refused with an error that says to pass client: "user".

Your sub-client keeps its own play or edit mode, its own errors and its own frame: a long execute there stalls your sub-client, not the user's screen. The client toolbox works from inside a sub-client too: zero client list typed in a sub-client's bash asks the editor that runs it.

Your own sub-client

The editor starts your sub-client with your first call that runs in a client; an editor no agent calls runs none. A call made while it starts waits for it: a start ends once the sub-client's first load of this world has ended, which takes seconds for a small world and a minute or more for a large one on a busy machine. One sub-client is yours whatever the number of agents you run: the crew members you start under your connection, each naming itself with as, work in your sub-client too, and zero client list shows them under its usedBy. zero client status shows yours. It keeps running while anyone calls into it, while a person watches it in the editor and, once a call of yours has run in it, while you make calls of any kind to the engine. Once none of those has happened for thirty minutes, counted from when it started for you, and no call runs in it and no task a call handed its work to runs there, the editor ends it and tells you so in a notice. Your next call that runs in a client starts a fresh one, in edit mode where the user's client is, and the handles its earlier start issued are refused from then on, naming it as deleted.

An editor runs one sub-client per world. When the world the user's client is on already has one (another agent's default, or one made with zero client create), your calls run in that one instead of a new one: zero client status answers its row with shared: true, and zero client list names it under shared. The world is the unit: a branch or a version of the world is the same world, so a sub-client on another branch of it is the one sub-client there, and zm checkout run in it switches its branch for every caller whose calls run there.

Your sub-client runs the plugins the world's content calls: every plugin a world carries, and the engine's own user-scope plugins such as OpenVDB. The engine's trusted plugins, DotBot among them, act for the user with their sign-ins and panels, so they run in the user's client alone; plugins.status() in your sub-client names each one with that reason.

Any other sub-client exists because an agent made it with zero client create, or swapped a sub-client to another world; the engine starts none of its own accord. One you made stays until you delete it (zero client delete <id>), and state.clients lists it, so delete the ones you no longer need.

Where each client is

The engine state (state) states where each client is once a sub-client exists: state.clients has the user's client (user) and every sub-client by id, each with its world, branch, scene, mode, room and content (the digest of the source it runs, its shadow, its @builtin library and the writes still pending), and state.rooms groups the clients by room and says whether each room runs the same content. state.split lists the sub-clients that are on another world, branch or scene than the user's client. A sub-client stays on the world, branch and scene it is on when the user's client moves to another, so the two may differ; a notice tells you when one splits off. The answers of a call that ran in a sub-client carry the same two fields, so the answer of a call that took your sub-client somewhere the user's client is not names it in state.split. An answer whose state reads unchanged carries them only when they differ from the ones your last answer stated, so they ride the answer after a client moves and then rest; zero client list reads them at any time.

Keeping the user's screen with your work

Your work reaches the user's client live. A canonical write reaches a running play session in place, and a play-shadow edit you make in play reaches the clients in your play room. The room key carries the mode, so a client in edit mode is in another room and sees the edit once you promote it. state.rooms.<room> lists the clients that share a room, sameContent says they run the same content, and differ names the ones that do not and whether by their shadow or by canonical source. A two-player test is the user's client and your own sub-client in play on one scene. In a play room the user's client is in, the user's client is the host (multiplayer.isHost(), multiplayer.roomHost(key)): it simulates the game and owns its persistent entities, whichever of the two entered play first: when your sub-client entered play first, the user's client takes the host over once its scene has loaded, so pausing your sub-client or keeping it busy in a long call leaves the person's game running. Your sub-client hosts a play room only while no person's client that has loaded it is in it.

Your own sub-client is the default because the person does not see it: a call there leaves their screen, their camera and their controls as they are. A call with client: "user" runs on the client the person is looking at and may be using, so what it does is what they see: a scripted camera move, simulated input or a mode flip changes the view they are reading and moves under their hands. That is the reason to prefer your sub-client for work the person has no need to watch, and the user's client is yours to use whenever the task needs it. A task whose result is for the user to look at or work with in their editor (a scene they asked to see, something they will edit next) is done where they see it: run those calls in the user's client, or check state.split and state.clients to confirm the user's client is where your work is. Testing a game and driving its input go in your sub-client while it can take them; when it cannot (it was stopped, it is starting, or memory is too short for a second copy of the game), the play test goes on in the user's client, which already holds the game. Putting the user's client into play, for a two-player test or because your sub-client is not available, is a decision you make for the task, and it needs no approval from the person: they see it happen.

Make a change from your own call, not through a component, when the change itself is the point: a write a component makes stays on the client that ran the component, since every client runs the same code.

Following

When you switch world or branch, or open another root scene, in your own sub-client, the user's client makes the same switch, so the two stay together. The option is follow:

  • zm checkout [--follow | --no-follow] <branch>, zeromind.swap(guid, { follow = ... }), world.checkout(branch, { follow = ... }) and world.swap(guid, version, mode, branch, { follow = ... }) take it;
  • in your own default sub-client it is on unless you say follow = false;
  • in the user's client it is off, and in a sub-client you made with zero client create it follows only when you say follow = true;
  • layers.load of a root scene takes it in its options, and so the scene toolbox's load follows too; an additive overlay changes no scene and moves nothing;
  • only the world, the branch, the version and the root scene are carried: the user's client keeps its own play or edit mode, and opens a scene once it is on the world and branch the scene was opened on;
  • only a switch made by you, in your own sub-client, moves the user's client, and only to where your sub-client now is; a switch to where it already was moves nothing.

The user's client switches on its own time: your call returns once your sub-client has switched, state.split lists it until the user's client has caught up, and a switch the user's client could not make reaches you as a notice. A scene you opened that the user's client did not open, because you said follow = false or because it failed there, reaches you as a notice naming the scene the user's client stayed on.

One sub-client per world

An editor runs at most one sub-client on each world, whoever asks for it: your default, a crew member's call, or zero client create <id> (an id of lowercase letters, digits, - and _, optionally on another branch, scene or profile). On a world that has none, create starts one:

zero client create p1 --wait

(--wait answers once the sub-client is ready, or has failed with the reason; without it create answers at once with the row still starting, and a call made to it meanwhile waits for it). On a world that already has one, create starts nothing and answers that sub-client's row with shared: true, asked naming the id you asked for and a note saying so; run your calls there with client set to its id. A branch or scene you named that it is not on is not applied, and the note names where it is and the call that moves it (zm checkout <branch>, or the scene toolbox's load), which moves it for every caller whose calls run there. A two-player test is that one sub-client and the user's client in play on one scene: one player's calls run with client: "user", the other's in the sub-client. Notices raised in a sub-client reach you naming it: [client p1, start 1].

A sub-client on another world (a kit world for a pull request, a world made for a check) is that world's one sub-client: start one there with zero client create <id> --world <guid>, which leaves your own sub-client and the user's client where they are, or swap a running one there with zeromind.swap(guid, { follow = false }) (or world.swap), and the world it left is free for the next one. A swap onto a world another sub-client is on is refused, naming that sub-client: run the work there with client set to its id, or delete it first. zeromind.freshCheck checks that assets install clean into a fresh world in one call: it makes the world, starts a sub-client on it, runs the check there and deletes both (an engine that hosts no sub-client runs it in its own client, moved there and back). When the editor starts its sub-clients again after it was held (its world binding lost and regained), they all start on the user's client's world, so it keeps one there and ends the others.

zero client list shows the user's client and every sub-client: its state, world, branch, scene, start, whose it is and who called it lately, the most on one world (perWorld, 1), the limit (four at once, each on a world of its own) and the memory free for a sub-client (memoryAvailableMb: the machine's available memory, or what the editor's memory bound leaves its processes when that is less), and the creates waiting for a slot (waiting, in turn). A start is refused while less than 2560 MB of it is free. The same 2560 MB is what the editor keeps free for the user's client and the system: while less is free, the editor stops one sub-client, the least needed (one no agent's call runs in before one an agent works in, then the one no call has reached for longest, then the one holding the most), whatever size the game is, and stops another only if memory is still short once the first one's memory has returned. A shortage of the machine's memory is decided once for every editor on the machine, so one stop answers it rather than one in each editor. A game that fits beside the user's client on this machine runs in a sub-client however much memory its play session takes. A sub-client stopped for memory states on its row why it was the one stopped, the peak it reached and the memory free, and your next call to it (and any call waiting on it) answers with that reason: the user's client already holds the game. The editor and every agent are told of the stop, and the sub-client stays stopped until a call asks for it, by its id, as your default or through a handle it issued: once one has, it starts again when the memory it needs (the 2560 MB, its peak and 1 GB more) has been free for thirty seconds, and the next stop waits for a call made after it. zero client restart starts it again at once. The person restarts or closes any sub-client from the editor too: each sub-client's row in the engines list of the people dropdown has Restart and Close. A restart they make is the same as zero client restart <id>, and a sub-client they close ends the way zero client delete <id> --force ends it: your next call that runs in a client starts a fresh one, and handles the closed one issued are refused. zero client delete <id> stops one and frees its process, port, world session and memory; another agent's default is kept while its owner has called within thirty minutes unless you pass --force. zero client restart [id] starts one afresh on the world and branch it is on, optionally on another scene or profile; its earlier handles are refused from then on, naming the restart.

A zero client create <id> --wait that meets the limit or too little memory waits in turn instead of being refused: its row (zero client status <id>) reads queued with its position, the next slot that frees is the oldest waiter's (ahead of any other start, a default sub-client's started for its owner's next call among them), and the one call answers once its sub-client is up; zero client delete <id> withdraws a waiting create. A create without --wait is refused there, and the refusal names who holds each slot and since when, which are stopping and when their slot frees, the idle ones and the creates waiting.

Your world in a web browser

A sub-client can run the web build of the engine instead of this desktop one: the same world, in a headless browser. It is how you check and measure the world on the web build yourself:

zero client create web --target web --wait

(target: "web" from tool_exec or a toolbox call). It is an engine of its own beside the world's native sub-client, so it shares none, and it counts toward the four sub-clients an editor runs. Every call that takes client runs in it with client: "web" (its id): execute and capture there show and read the world as the browser draws it, tool_exec runs any toolbox there (zero tests run <suite> for a test suite's results on the web build, zero profiler record start and stop for its frame time's median and high percentiles), and bash and the file tools work in it. A call that hands back a task there is waited on with the same client. Raw input events reach a native client only: in the web sub-client the inputSim toolbox simulates input.

The client host builds the web engine from the same source as this editor, as a development build, where the web engine a player loads is a release build: a frame time read in it is the development build's. It reads the built-in library this engine reads, as it stood when the web sub-client started, and the world's content live, as every client of the world does. Its row states target: "web" and the name the client host lists it under (hostedAs). The client host that launched this editor starts it (the web build, then the browser, then its first load of the world), which takes minutes the first time the web build is made and seconds once it is: --wait waits up to forty minutes, and a call made to it meanwhile waits for it too. An editor launched with no client host refuses it, naming why. zero client delete web stops it; it ends with this engine as well.

Its frame time is its own while it plays alone: a client of the world in play on the same scene (your own sub-client, the user's client) joins its play room and is a peer in every frame it draws, so measure the web build and the desktop one in turn. A file a call there saves under /tmp is the web engine's own scratch and ends with it: save a capture you keep under /source, which every client of the world shares.

In a browser editor

An editor in a web browser runs its sub-clients in the same page: each one is a second engine in a Worker of the page, bound to the same world, headless, drawing only the frames something reads (a capture, a wait on drawn frames). The calls above work there the same way: zero client create p2 --wait, a call with client: "p2", play in it beside the user's client for a two-player test, capture { client: "p2" } for what that player sees, and zero client delete p2 to end it, which gives the page its memory back. Its row states the memory its engine holds (memoryMb) beside the user's client's. The memory rule above reads the free memory the machine states, which a browser keeps to itself: there a start is made whatever memory is free, so check memoryMb before a second copy of a large game. A sub-client signs in with the credential its page holds when it starts. It reads the built-in library its page was served with, and raw input events reach a native client only: in it the inputSim toolbox simulates input.

In an Android editor

An editor in the Android app runs its sub-clients inside the app: each one is the same engine, headless, in a process of the app of its own, bound to the same world and drawing only the frames something reads. The calls above work there the same way (zero client create p2 --wait, client: "p2", play in it beside the user's client, capture { client: "p2" }, zero client delete p2), its row states the memory its process holds (memoryMb) beside the user's client's, and a start is held to the same free memory as on a desktop. Its build is android, a copy of this engine; an Android editor starts no desktop or web engine. Raw input events reach the user's client only: in a sub-client the inputSim toolbox simulates input.

Where there is none

An offline engine runs no sub-client, and neither does a sub-client itself: there every call runs in the user's client, and zero client list says why.

  • documentation
  • guide