CLI reference
niri-computer-use serve | status [--check] | stop | resume | recover | watch, each but stop and resume with an optional --desk <name> | desk start [--windowed] [--size WIDTHxHEIGHT] <name> | desk stop <name> | desk list | engine | guard <server-pid> | paste-keeper | --versionIt takes exactly one subcommand, or --version, and no other options except status --check, --desk <name> last and the desk subcommands’ own. Anything else prints that usage line to stderr and exits 1. With --desk <name>, serve, status, watch and recover work on that background desk instead, and fail when it isn’t ready. Every subcommand works on the niri instance in NIRI_SOCKET, or, without it, the one running niri of yours the server finds. A niri bind passes NIRI_SOCKET on.
niri-computer-use serveSpeaks MCP over stdin and stdout until the client closes stdin. Your MCP client runs it; see Client setup. Stdout carries only MCP messages. It reads its environment once at startup (see Configuration) and, unless it hands the client to the shared engine, starts the crash guardian before anything else.
status
Section titled “status”niri-computer-use statusPrints the readiness report as JSON and exits 0, whatever the report says. It is the same report as the status tool, except that niri.event_stream is null, because the subcommand opens no event stream, and lease.held_by_me is false. The fields are described under status.
It asks niri for its version, its outputs and whether its last config load failed, logind for the lock state and, when it finds noctalia, Noctalia for its status. It reads niri’s config files for the stop key. It changes nothing.
niri-computer-use status --checkPrints the same report as one line per prerequisite, ✓ or ✗, with a fix: line under each ✗, then Ready. or Not ready: N blockers., and exits 1 while there is a blocker. The lines are niri and its version, the Wayland display, the lock state, the pointer on niri’s outputs, grim, the accessibility bus, the stop key, the stop flag and the input-dirty marker while set, the policy file, the lease notification while notify-send is missing, and any server setting a variable got wrong. A ✗ marked (optional) turns one feature off and isn’t a blocker: the pointer, the accessibility bus, a stop key it can’t tell about, the lease notification, a refused variable. Without niri, the lines that need niri are left out. It doesn’t check the shared engine, which runs only while agents are connected; an agent’s own status says, under engine.fallback, why it is served standalone. On a desktop with everything in place:
✓ niri 26.04 (8ed0da4): supported✓ lock state: unlocked, read from logind✓ pointer: supported on these outputs✓ grim: found✓ accessibility bus: found✓ stop key: /home/you/.config/niri/config.kdl: Mod+Shift+Escape runs `/home/you/.local/bin/niri-computer-use stop`✓ policy file: loaded, 0 presets
Ready.niri-computer-use stopSets the stop flag for this niri instance, and the one every background desk’s server checks, prints nothing and exits 0. A running action is cancelled: it ends with stopped, or uncertain once what it sent may have taken effect (see Safety). The lease holder gives the lease up, and acquire_desktop and every action refuse with stopped until resume. Bind it to a key: see First session.
It never connects to niri, so it works while niri hangs. Without NIRI_SOCKET, it takes the one socket in the runtime directory that niri names, owned by you, whose PID is a running niri, without checking that this niri still listens on it. It fails, exiting 1, when there is no such socket or several, when niri’s socket doesn’t resolve to a socket of yours, with no hard link, in a directory only you can use, or when the flag can’t be written.
resume
Section titled “resume”niri-computer-use resumeClears the stop flag, then the desks’ one, prints nothing and exits 0, also when no flag was set. It finds niri’s socket the way stop does. It refuses while the input-dirty marker exists, and doesn’t clear it; recover does. It never clears a desk’s marker; recover --desk <name> does.
niri-computer-use watchPrints what agents are doing on this niri instance, one JSON object per line, until its reader closes stdout; then it exits 0. The Noctalia plugin runs it. It finds niri’s socket the way stop does and never connects to niri. Each line has an event:
hello, once, first:format(1), the server’sversion, theinstance, niri’s socket name, andoverlay, the path of the file where the plugin publishes the area its overlay may change between actions, which this server’s settled screenshots leave out (absent from 0.1.7 and earlier, and for a path that isn’t UTF-8)state, at the start and whenever it changes:lease, null or the holder’ssession(such asclaude-code/4711),since,pending(true while the user is asked to allow it) andproject, the last part of the agent’s working directory or null; thenstopped;input_dirty, true when the input-dirty marker says input may be stuck because the server that wrote it is gone, was released, or gave up on its input (the marker also exists while each input goes out; a marker from a server of 0.1.6 or before counts once it is a minute old, and any marker once it is five minutes old); andclients, every agent’sserveon this instance bypid, withagent, the name of the process that started it (such asclaude),projectas inlease, andreplaced, true when an update replaced its binary since it started, so it runs the old build until its agent restarts itaction, for each tool call the audit log records on this instance, the last 20 first: the audit line withoutinstance, plusprojectas inlease, andbacklog: trueon those 20, made beforewatchstarted. A call whose line would be longer than 64 KiB is skipped, as Noctalia cuts longer lineslive, for the action in progress, as the Noctalia plugin’s overlay draws it: one line for each phase the server records,startonce the desk admits an action,aimonce it knows where it acts and before its input goes out,lookright before its evidence is captured, andendwith its outcome. Each line has the whole record so far:pidandcall, which name the call together,session,tool,tsandargsas in its audit line,phase,aim(theoutput, its logicalarea, and thepointsor theboxit acts on, in that output’s logical pixels),window(theidof the window it is about and theapp_idniri reports for it) andoutcome(accepted,observedanderror, as in its audit line). The first one hasbacklog: truewhen the record was there beforewatchstarted. Read-only tools, refused calls,acquire_desktopandrelease_desktophave nonealive, every five seconds
A reader should skip an event it doesn’t know: new kinds are added without a new format.
{"event":"hello","format":1,"version":"0.1.2","instance":"niri.wayland-1.1819.sock"}{"event":"state","lease":null,"stopped":false,"input_dirty":false,"clients":[{"pid":395505,"agent":"claude","project":"niri-computer-use","replaced":false}]}It wakes as soon as something is added to, removed from or renamed in the runtime directory, so the lease, the stop flag, the input-dirty marker and the action in progress show at once. It looks at the audit log and the agents’ servers every 250 ms, and at the runtime directory too, which covers a directory made or replaced after watch started. The lines hold only what the audit log and the lease record already hold, plus, in live, the app_id niri reports for the window an action is about; never typed text or window titles. It fails, exiting 1, when there is no niri socket, or when a line can’t be written within five seconds.
recover
Section titled “recover”niri-computer-use recoverClears the input-dirty marker that blocks every action with recovery_required. It takes the lease while it works, so it fails while a server holds it:
niri-computer-use: a server holds the lease: PID … (…); end that agent or its server firstWithout a marker it prints No input-dirty marker: nothing to recover. and exits 0. With one, it prints the marker, then, depending on what the marker names:
- held pointer buttons: sends their release from a fresh virtual pointer, or, if it can’t, asks you to press and release each of them
- native keys: sends their release and zero modifiers from a fresh virtual keyboard, which also makes niri send the compositor’s keymap again. The modifiers go out in the layout niri has active; if niri doesn’t say which that is, they go out in the layout the call started in, and
recoversays the focused application may show another layout until the next key - the
wtypechild a 0.1.0 server’s marker names: ends it, if it is still the process the marker names, and waits up to five seconds for it to exit. It holds the child by a pidfd opened before that check and kills it only through that pidfd, never its process group, so a process that took the child’s PID afterwards is never ended.wtypestarts no processes, so ending it ends the typing. A child that already exited is reported as such, and so is a marker naming PID 1, init, which is never the child. Then it sends zero modifiers from a fresh virtual keyboard, in the layout niri has active or else its first, since a physical key doesn’t always release a modifierwtypepressed. If it can’t send them, it says so and leaves the release to the check below - none of these, or a marker it can’t read: nothing to release, so only the check below
Then it asks you to check by hand:
Check that no input is held: press and release Shift, Ctrl, Alt and Super, click once in an empty area, and check the application the input went to.Is all input released? Type yes to confirm:Only yes clears the marker, and it prints:
Marker cleared. `niri-computer-use resume` clears the stop flag if it is set.Any other answer exits 1 with not confirmed; the marker stays.
niri-computer-use desk start webniri-computer-use desk listniri-computer-use desk stop webStart, list and stop background desks. desk start prints each step to stderr and the desk’s record as JSON once it is ready, and exits 1 with the failed step when it isn’t, after stopping what it started. desk list prints every desk as JSON. desk stop stops a desk, its systemd scope included, and removes its directory once the scope is empty. It exits 1 when there is no such desk, and when something of the desk is left, which it names, keeping the directory.
--version
Section titled “--version”niri-computer-use --versionPrints niri-computer-use and the version, such as niri-computer-use 0.1.0, and exits 0. It reads nothing from the session.
Internal subcommands
Section titled “Internal subcommands”You don’t run these yourself.
engineis the shared engineservestarts in shared mode when its niri instance has none. It serves every shared-mode client of the instance overengine.sockin the runtime directory, writes its errors toengine.logthere, and exits two seconds after its last connection, lease and pending input cleanup have ended. A bridge passes it--unscoped <reason>when it couldn’t start the engine in a scope of its own, and--runtime-dir-discoveredwhen it foundXDG_RUNTIME_DIRitself; both only change whatstatusreports.guard <server-pid>is the crash guardian a standaloneserveor the shared engine starts. It waits for that server to end, and if the server’s marker names native keys or pointer buttons it still held, releases them at once. As it starts, it does the same for a marker a dead server left that nothing released.paste-keeperis the clipboard keeper a paste throughtype_textstarts. It holds the pasted text on the clipboard, then puts the saved clipboard back.desk supervise <name> <mode> <size> <generation>is the supervisordesk startstarts in the desk’s systemd scope, which runs the desk until it stops.desk exec <supervisor-pid> <KILL|TERM> -- <program> <args>asks the kernel to send that signal to the process when the supervisor dies, then becomes the program.desk holdis cage’s one client, which keeps cage running until it stops.
Exit status and errors
Section titled “Exit status and errors”Every subcommand exits 0 on success and 1 on failure, printing niri-computer-use: <message> to stderr.
niri-computer-use 0.2.02026-11-26CLI(1)