Skip to main content Switch to mobile version nexor-runner 0.8.1 Hosts and runs AI coding agents in tmux sessions
pip install nexor-runner==0.8.1 Copy PIP instructions
Hosts and runs AI coding agents (Claude Code, OpenCode) in tmux sessions on one Linux machine. It owns a dedicated tmux server, keeps a state file so sessions can be restored after a restart, starts every agent with a minimal environment, and exposes a small local HTTP API.
Python 3.11+, no runtime dependencies.
From PyPI, no repository access needed:
pipx install nexor-runner # or: pip install --user nexor-runner nexor-runner --version Install it, do not pipx run it: the systemd units point at the interpreter that runs install-service, and pipx run uses a temporary environment that is garbage-collected, which would leave the units pointing at a path that no longer exists.
Known limits: units are written under $XDG_CONFIG_HOME (or ~/.config), where systemd looks only if that is its user config directory; --no-agora does not remove an agora unit installed earlier (uninstall-service does).
Requirements: tmux (3.x; 3.2+ for the browser terminal), the agent CLIs you want to run (claude, codex, opencode), and systemd --user for the units (loginctl enable-linger $USER keeps them alive after logout). nexor-runner and runner are the same command; python -m nexor_runner works too.
Quick start on Linux (one command)
The owner first creates the runner in the hub (Settings -> Runners: a name and a one-time nxr_ token). The token is not the Agora connector's delegation token (nxad_): the hub refuses that one on every runner endpoint. Save it in a file with mode 0600, then:
nexor-runner install-service --hub https://hub.example.com --token-file ~/runner-token # or: printf '%s' "$TOKEN" | nexor-runner install-service --hub https://hub.example.com --token-stdin # or: NEXOR_RUNNER_HUB_TOKEN=... NEXOR_RUNNER_HUB=https://hub.example.com nexor-runner install-service nexor-runner doctor install-service writes the three systemd --user units (nexor-runner-tmux, nexor-runner-api, nexor-runner-agora) pointing at the interpreter the package is installed in, creates the config directory (0700) and the API token (0600), links the runner to the hub (validating the token), and enables and starts everything. The hub token is copied to ~/.config/nexor-runner/hub-token (0600) when it comes from stdin or the environment; it is never printed, logged, put on a command line or in a unit. Without --hub the agora unit is skipped (add it later by re-running with --hub); other flags: --no-agora, --no-api (both remembered in service.json, so an update keeps those units out; --agora / --api or an explicit --hub bring them back), --port, --extra-path, --cards-dir, --host, --host-id, --no-auto-update, --no-cards-sync, --dry-run (print the units, change nothing). The directories of the claude, codex and opencode binaries your login shell finds (nvm included) are added to the units. It also writes and enables nexor-runner-update.timer (see Automatic updates below).
One machine, several people. Each user has their own runner and their own API on 127.0.0.1, so the API port cannot be the same for everybody. A new install without --port takes a port derived from the user id in 7800-7999 (uid 1000 gets 7800, uid 1003 7803, ...) and, when that one is taken, the first free port after it; it prints which one it picked and keeps it in service.json. An existing install never changes its port on its own (an update re-runs install-service with no flags); to move it, nexor-runner install-service --port
Automatic updates. A runner installed with install-service updates itself: a systemd --user timer (nexor-runner-update.timer) runs nexor-runner self-update about ten minutes after boot and then daily, with a random delay of up to 30 minutes so two runners do not update at the same moment (Persistent=true: a run missed while the machine was off happens at the next start). Nothing to do, nothing to remember.
nexor-runner self-update --check # is there a newer release? (changes nothing) nexor-runner self-update --dry-run # what an update would do nexor-runner self-update # update now (what the timer runs); --json for scripts nexor-runner install-service --no-auto-update # opt out: removes the timer, remembered nexor-runner install-service --auto-update # opt back in Cards clone. If your agent cards live in a git repository cloned on this machine and used as the cards directory (cards-dir in config.json, else ~/.config/nexor-runner/cards), self-update keeps that clone fresh too: after the package step, also when the package is already up to date and also when that step failed, it runs git pull --ff-only there, with GIT_TERMINAL_PROMPT=0 (and ssh in batch mode, unless you set GIT_SSH_COMMAND) and a 60 second limit, so a credential question can never hang a run. It does nothing, silently, when there is no such directory, it is not inside a git work tree or its branch has no upstream. It never merges, rebases or forces: a clone with uncommitted changes to tracked files is skipped (one log line), a diverged clone fails the fast-forward and stays as it is (untracked files, such as a card you are drafting, do not stop it; git itself refuses to overwrite one). A cards failure, with or without network, never fails the update and never triggers the rollback. Each run adds one line, cards-synced, cards-current, cards-skipped or cards-failed, to update.log. Turn it off with nexor-runner self-update --no-cards-sync, with nexor-runner install-service --no-cards-sync (remembered in service.json, so the timer honours it; --cards-sync turns it back on) or with NEXOR_RUNNER_CARDS_SYNC=0. --check never touches the cards and --dry-run only looks (would: git -C
The cards that changed go to the hub. When the pull brought new commits and the runner is linked to a hub, the runner sends each *.md card of the cards directory that changed in those commits. It uses its own token (PUT /api/v1/runner-hosts/{name}/charters/{handle}). The hub only updates an agent that already exists and belongs to the runner's owner, and only from the owner's charter_source (Settings, owner/repo:path/). A new agent is still created once, by hand, with nexor-agora charters push.
Some cards never leave the machine:
a personal card (scope p: by the handle letter, the frontmatter scope: or the charter's scope.kind);
a card of a hosted person of the registry. If there is no registry, or it cannot be read, the runner sends nothing;
a dormant card (status: dormiente), a README.md, a card the runner cannot read (not UTF-8, no JSON block), anything that is not a regular file in the commit (a symlink is never followed).
What is sent is the card as it is in the pulled commit, never the file on disk.
The run adds one line to update.log: cards-push-pushed, cards-push-failed (a refusal or the hub unreachable, with the reason), or cards-push-off (the hub has no charter source for you). All the hub calls of a run share a 120 second budget. The push stops at the first unreachable call. It never fails the update. Turn it off and keep the pull with NEXOR_RUNNER_CARDS_PUSH=0.
Changes made in Agora are written into the cards. When the owner changes an agent's projects on the hub's map, the hub keeps the change until the runner writes it. The linked runner asks every minute (GET /api/v1/runner-hosts/{name}/card-edits) and, for each change, in its cards clone:
checks that the clone is the repo the card was pushed from and the file is the same path, that the card is a tracked file with no local changes, and that it may leave the machine (the same rule as the push above);
runs git pull --ff-only, then rewrites project: in the frontmatter (one name alone, several as [First, Second], the line removed when the list is empty). The rest of the file, line endings included, is left as it is;
commits only that file (card:
pushes the card to the hub, which closes the change, and reports applied with the commit.
If a step fails, the runner reports failed with the reason, and the owner sees it on the map. The clone is left as it was: the file is restored if the commit fails. A commit that could not be pushed stays in the clone, and the report says so. NEXOR_RUNNER_CARDS_PUSH=0 also turns this off. A hub without the endpoint is asked again only once an hour.
What an update does: takes a lock for the whole run (two runs never overlap), reads the newest release from PyPI (pre-releases and yanked ones are ignored; stdlib only, no new dependency); if it is newer than the installed one, pip install --upgrade nexor-runner==
Upgrading by hand (also when auto-update is off): pipx upgrade nexor-runner && nexor-runner install-service (no flags: the link, the port and the extra path you installed with are kept in ~/.config/nexor-runner/service.json; an explicit --port / --extra-path overrides and becomes the new value; an install that never wrote service.json keeps the --port of its API unit). Or just nexor-runner self-update, which does this with the checks and the rollback. It is idempotent and restarts the API and agora units, which are stateless. It never restarts or stops nexor-runner-tmux: that unit hosts your running sessions. If its unit file changed, the new one applies the next time you restart it yourself, between sessions.
nexor-runner doctor [--json] checks tmux, the agent CLIs, linger, the three units, the update timer, the last update run, GET /health (and that it is this user's runner that answers), the host id (a warning with nexor-runner config set host-id
Plain-http hub (trusted network only). The hub URL must be https:// (http only for loopback). If your hub is plain http on a trusted network such as the VPN, opt in explicitly: --allow-insecure-hub on link and install-service, or NEXOR_RUNNER_ALLOW_INSECURE_HUB=1. Each use prints WARNING: plain http: token and traffic are not encrypted; use only on a trusted network such as the VPN (on stderr; the token is never printed). The choice is stored as "insecure": true in agora.json, so the agora unit and doctor keep working and later install-service runs need no flag. runner link is safe to re-run: it validates the token and rewrites agora.json with the same content, touching nothing else.
macOS and Windows: there is no service installer (systemd is Linux only) and install-service exits 3 after printing this. Run the pieces in the foreground, each in its own terminal: nexor-runner serve --init-token, nexor-runner link --hub https://
Install from a clone (development)
git clone https://github.com/nexorhq/nexor-runner.git ~/dev/nexor-runner cd ~/dev/nexor-runner python3 -m venv .venv .venv/bin/pip install -e ".[dev]" Manual setup of the units
The three sections below are what install-service does, one unit at a time (useful to tune a unit by hand).
1. The tmux server unit
runner systemd install --dry-run # print the unit and tmux.conf runner systemd install # write them systemctl --user daemon-reload systemctl --user enable --now nexor-runner-tmux.service The unit runs tmux -L nexor-runner -f
2. The API unit (optional)
runner serve --init-token # creates ~/.config/nexor-runner/token (0600); stop it with Ctrl-C runner systemd install --api --extra-path "$HOME/.nvm/versions/node/
3. The agora link (optional)
Connect the runner to an agora hub: the hub records intents (launch, kill, restore, remote-control, stop-scope), the runner connects outbound (no inbound port), reports its sessions and cards, executes the intents and reports the result. The hub never executes anything.
runner link --hub https://hub.example.com --token-file ~/.config/nexor-runner/hub-token runner systemd install --agora --dry-run runner systemd install --agora systemctl --user daemon-reload systemctl --user enable --now nexor-runner-agora.service The owner creates the runner (name plus a one-time nxr_ token) in the hub's Settings -> Runners and saves the token in a file with mode 0600. runner link validates it with GET /self and writes ~/.config/nexor-runner/agora.json (0600: hub URL, token-file path, runner name); the token is never on the command line and never logged. The hub URL must be https (http only for loopback). runner unlink removes the link. The unit requires the tmux unit; runner agora runs the same loop in the foreground.
The loop: heartbeat every ~30 s; the full snapshot (sessions and cards) on start and whenever it changes, at most every 10 s; long-poll for intents, claim (a 409 is skipped), execute through the same code as the local API, report done or failed with a short message (the dead-pane tail on a failed start). Hub errors back off from 1 s to 60 s and never stop the loop.
Chat and terminal channel
Next to the intent loop, runner agora keeps ONE more outbound connection to the hub: a WebSocket (wss://
Two kinds of stream, each opened by the hub for one browser pane:
chat (OpenCode sessions only): the message history (paged), live events (text and reasoning deltas, tool calls, status, approval prompts), send a prompt, interrupt, answer a permission. The adapter (oc_chat.py) is a whitelist, not a proxy: it can only call GET /api/session/{id}/message, GET /api/event, GET /api/session/active, GET|POST /api/session/{id}/permission[/{request}/reply], POST /api/session/{id}/prompt, POST /api/session/{id}/interrupt and two read-only lookups, GET /api/session (find the engine session titled with a handle) and GET /api/session/{id}/message/{message} (the finished copy of one message), on engine session ids it validated (ses_...). Engine calls go straight to loopback: no proxy from the environment and no redirects, so the Basic credentials cannot be sent elsewhere. The engine's filesystem and shell endpoints are unreachable from a browser. The engine session of a runner session is the session_id the runner stored (see "Stable Agora handles for OpenCode sessions"), else the newest engine session titled with the handle; with neither, the session is terminal-only. The engine is only ever contacted on loopback, with the password from its own service.json, never logged.
terminal (ANY runner tmux session, so Claude and Codex sessions too). Off by default: turn it on for this runner with NEXOR_RUNNER_TERMINAL=1 or runner config set terminal on (independent of chat; while it is off the terminal capability is not advertised and an open is refused with terminal_disabled). A browser terminal is a SHELL-LEVEL capability on this machine (whatever the agent's program can do, the owner's browser can type), so it is the owner's explicit choice, and the hub audits every one that is opened. The viewer is tmux -L nexor-runner attach-session -r -t =
Capabilities per session, announced to the hub in a sessions frame (every 10 s when changed): {read, send, approve, interrupt, terminal_only, terminal}. OpenCode sessions with an engine session get chat (terminal_only: false) and a terminal; everything else is terminal_only.
The browser terminal does not resize the real session, unless a viewer asks for Fit pane (see below). Measured on tmux 3.4: ignore-size alone is not enough, because when the browser is the only client tmux still sizes the window to it and keeps that size afterwards. So while a browser watches a session the runner pins every window of it to its current size (resize-window -x W -y H, which makes tmux treat the size as manual, plus a @nxr_pin window marker that remembers the previous window-size). The PTY is opened at the window's size; a plain browser resize {cols, rows} only changes the PTY (the part of the window the client shows). When the last stream of the session closes, the previous setting is restored; a runner that died while pinned undoes the pins at its next start. While a browser is attached, a human who attaches with a real terminal sees the pinned size. A window created while a browser watches (the agent or a human runs new-window) is sized by tmux to the browser at first: the runner checks the windows of watched sessions every ~2 s and puts a new one back to the size the session's windows had. The pin is held until the attach client of a stream has started, even if the stream is closed in that moment. Closing a stream hangs up the PTY (the tmux client detaches); the session itself is never killed.
resize-window -t
Before the first fit the window's size is saved (memory + window option @nxr_orig = WxH) and restored with resize-window -x W -y H (the saved dimensions, not resize-window -A: -A recomputes the size from the attached clients under the window-size policy, which with read-only clients is the unpredictable size the pin exists to prevent). It is restored when the last fitting viewer of the session closes, disconnects, or sends resize ... window: false (back to Scale), when the hub link drops, and at runner stop (close_all); a runner that died is cleaned by the start-up sweep (reads @nxr_orig). Several viewers: the last resize wins; when one leaves the window follows the most recent one still fitting.
If the session has a client that is not read-only (list-clients -F '#{client_readonly}', i.e. someone attached with a real terminal) the window is NOT resized (the viewer still fits its own PTY), so a human's view is never shrunk. A human attaching AFTER the fit sees the fitted size.
The agent inside the session gets SIGWINCH and redraws, which is expected. The idle gate (pane_free, read_input_line, ghost-suggestion) does not assume a width (edges are 3+ rule characters, the prompt is found by shape); a test covers 45, 200 and 300 columns. Not measured against a real tmux in CI: the restore after a SIGKILL of the runner, and resize-window behaviour on tmux versions other than the tested 3.4.
After a reconnect the hub may reuse a stream id while a slow open of the old connection is still running: a stream only ever removes the chat subscription it registered itself, and one that was closed registers none.
Limits: at most 32 open streams per runner, 1 MiB per WebSocket message, 64 KiB per terminal input frame, 32,000 characters per chat prompt, snapshot frames trimmed to about 600 KB. The protocol is specified in the hub's docs/chat.md.
Claude: every session the runner starts or restores runs claude --remote-control
What the watch reads. Only the visible screen (capture-pane, no scrollback), and it sends no key at all (no Escape either). The URL is read only from the line(s) right under the newest /remote-control is active banner and must be https://claude.ai/code/session_
After a reboot. A session restored before the network is up starts Remote Control offline: the footer says /rc failed and no URL ever comes. runner restore therefore waits up to 5 minutes (--wait-network SECONDS, NEXOR_RUNNER_NET_WAIT, 0 = do not wait) until claude.ai:443 resolves and accepts a connection (a bare probe: no credentials, no payload), logs what it waited for, then restores (also when the time ran out). As a second line of defence the leader process runs a watchdog over the rows in pending/sent with no URL: 3 minutes after arming (NEXOR_RUNNER_RC_REARM_AFTER, seconds) a row whose footer ends with /rc failed is re-armed by typing /remote-control, only if the same snapshot shows an empty input box (a faint suggestion is not text), no dialog (folder trust, Remote Control modal, numbered options) and no esc to interrupt, and the screen stayed unchanged for 10 s (NEXOR_RUNNER_RC_REARM_IDLE); the typing is the read-back-then-Enter one below, under the session's typing lock. A draft in the box, a busy session or a dialog means nothing is typed and no attempt is used. Three attempts at +3, +10 and +30 minutes; if the footer still says /rc failed 3 minutes after the last one the row is gave_up and rc_attention says Remote Control failed to connect and re-arming did not help: open the session and run /remote-control, or restart it. It works for rows started with the flag; for the others (imported, not started by the runner) only with rc-typing on, like any typed /remote-control.
Restore at boot. install-service also writes and enables (never starts) nexor-runner-restore.service, a oneshot that runs runner restore when the user manager starts, so with linger (loginctl enable-linger $USER) every agent session comes back after a reboot with no human action. It is ordered after nexor-runner-tmux.service (and the API/agora units when installed), waits up to 30 s for the tmux socket, and gives the restore itself up to 15 minutes (the network wait above is part of that). It is not started by install-service, so neither an install nor the daily self-update relaunches sessions during the day. Existing hosts get it from the next self-update (which re-runs install-service), within a day. Opt out with install-service --no-restore-on-boot (remembered; --restore-on-boot turns it back on, and uninstall-service removes it); doctor reports it as restore-on-boot. Personal-scope sessions stay skipped, as with a manual restore: set NEXOR_RUNNER_RESTORE_PERSONAL=1 in the unit (a drop-in: systemctl --user edit nexor-runner-restore.service) to bring them back too.
Folder-trust dialog. A session started in a folder Claude has not been trusted in stops at Quick safety check: Is this a project you created or one you trust?. Measured on Claude Code 2.1.305: the options are ❯ No, exit and Yes, I trust this folder, No, exit is pre-selected (an Enter exits the session), Down/Up toggle the two and number keys do nothing. The runner never sends a key to it: it only recognises it, by its structure on the visible screen (no input box on the screen, the footer Enter to confirm · Esc to cancel as the last non-empty line, a contiguous block of Yes/No options right above it, the question under a column-0 rule above them), so a quoted dialog in the transcript or a draft saying "yes, i trust this folder" is not one. The row stays pending and rc_attention (in GET /sessions and the agora snapshot) says folder trust needed — open the session and accept; once a person answers, Remote Control (already asked for by the flag) comes up by itself and the note goes away. The typed fallback stops at the dialog too (nothing typed).
Typed fallback (off by default). For a session the runner did not start itself (one imported from a foreign tmux and still running, or a row armed by an older runner) there is no flag to give. NEXOR_RUNNER_RC_TYPING=1 or runner config set rc-typing on (an empty variable defers to the config file) lets the runner type /remote-control into such a session once its input box is idle, as before. Without it such a row is not armed and not watched: the next retry gives it up (gave_up) with rc_attention not started with Remote Control: restart it with Remote Control (runner restore) or enable rc-typing (runner restore relaunches it with the flag). It is the old, careful path: the input box may hold a prompt suggestion or text somebody typed, so the runner never presses Enter blindly: it clears the input line (C-u), types /remote-control, reads the input line back from the pane, and sends Enter only if the line is exactly /remote-control. Any other line is cleared again, nothing is submitted, the attempt is retried later (not before 5 s, kept on the row) and a line without the text itself goes to the log; after 20 wrong lines it gives up at the deadline. A session that is working (its footer says it can be interrupted) is not typed into, and a typing lock (flock on
OpenCode: sessions connect to the machine's always-on opencode service engine (the runner ensures it is up before launch and before issuing a ticket). There is no automatic step: GET /sessions/{ref}/remote-control (or a remote-control intent from the linked agora hub) issues a fresh pairing ticket with opencode pair --remote --yes — a one-time link, valid five minutes, through the OpenTunnel public address. Opening it shows the engine's web UI, where the session can be prompted and its permission requests answered, like the terminal does. The ticket is returned to the caller and stored as the session's remote_url (the last one issued); it is never logged. The engine is per-user and the ticket reaches every session on it, so keep the runner user's account the only one running agents on the machine.
Remote access security
OpenCode remote control goes through the engine's public tunnel (OpenTunnel), which stays on whenever the engine runs. What protects it:
The engine has one fixed password (service.json, key password). It also works over the public address (Basic opencode:
A pairing ticket (opencode pair --remote --yes, what Remote Control issues) is one-time and valid 5 minutes. Opening it hands the device a token valid for 30 days. Tokens are signed and stateless: OpenCode has no per-device revocation. The only way to invalidate them is to change the engine password.
The runner therefore rotates the password. runner opencode rotate-password (or POST /opencode/rotate-password, {"rotated": true}) sets a new random 43-character secret with the official opencode service set password
Weekly rotation: runner systemd install --rotate [--extra-path DIRS], then systemctl --user daemon-reload && systemctl --user enable --now nexor-runner-rotate.timer (OnCalendar=weekly, Persistent=true). It is opt-in; turn it off with systemctl --user disable --now nexor-runner-rotate.timer. Every rotation invalidates all paired devices: open Remote again to pair them.
Lost or stolen phone: run runner opencode rotate-password now; do not wait for the timer.
Never send a ticket through chat apps or any shared channel: whoever opens it first gets a 30-day token.
The engine daemonizes inside the cgroup of whoever starts it, so a unit that starts it would kill it when that unit stops. The runner starts the engine (rotation and ensure_running, also from the API unit) through systemd-run --user --scope when it runs inside a unit, so restarting nexor-runner-api or the end of the rotate oneshot does not take the engine down; the rotate unit also sets KillMode=process as a second guard.
Effect on running sessions: the password change stops and restarts the engine process. Sessions started with --standalone run their own server and are not touched. Sessions the runner launched attach to the engine (opencode --session
Stable Agora handles for OpenCode sessions
The Agora connector gives every OpenCode session its own identity, taken from the session id on each tool call. So that a runner-launched session acts under its stable handle (gc-oc-agora, not a per-session one), the runner keeps a map {"ses_...": "
Where the session id comes from. The runner chooses it: oc sessions are launched as opencode --session ses_
Ids not known yet (rows from runner import, older state files): the agora loop reconciles every 30 s (and runner opencode map --sync on demand). It lists the engine's sessions (GET /api/session, password from service.json), picks the newest one titled with the handle (the runner titles its sessions that way) that no other row owns, stores the id in the state file and maps it. An unreachable engine only leaves those rows unmapped.
Rules. One handle maps to at most one session id (the newest wins and the old entry is dropped); entries for handles the runner does not know are kept; the file is written atomically (temp file plus os.replace, mode 0600, directory 0700) under a lock shared by the API unit, the agora unit and the CLI. A file that cannot be read is never overwritten; one that is not a JSON object is kept as
runner opencode map [--sync] [--json] # print the map (session ids and handles, no secrets) CLIs installed with nvm
The session environment is an allow-list, so nvm directories are not on PATH. The runner resolves each client binary to an absolute path at launch, in this order:
NEXOR_RUNNER_CLAUDE_BIN / NEXOR_RUNNER_OPENCODE_BIN (absolute path);
NEXOR_RUNNER_EXTRA_PATH (colon-separated directories, e.g. ~/.nvm/versions/node/
the login shell (bash -lc 'command -v claude', once, cached).
The binary's directory is prepended to the session PATH so npm-installed CLIs find node. --dry-run on runner systemd install prints the detected paths.
One file, ~/.config/nexor-runner/config.json, holds the settings every entry point shares, so the CLI in a shell, runner serve and the agora unit cannot disagree (the unit needs no environment variable for them):
runner config set cards-dir /srv/agent-cards # where the agent cards live runner config set host my-box # the name cards' home.host is compared with runner config set host-id srv # the 3-letter id the handle grammar checks (or: install-service --host-id) runner config show [--json] # effective values and where each comes from runner config unset cards-dir runner systemd install --agora --cards-dir /srv/agent-cards # writes the same file Precedence, highest first: the flag (--cards-dir), the environment variable (NEXOR_RUNNER_CARDS_DIR, NEXOR_RUNNER_HOST, NEXOR_RUNNER_HOST_ID), config.json, then the default (cards in ~/.config/nexor-runner/cards; host from the agora link name, else the system hostname; the host id as described under Handles). When the cards directory does not exist, runner new / runner cards say so and print how to set it.
Other variables: NEXOR_RUNNER_RESTORE_PERSONAL (restore personal sessions too), NEXOR_RUNNER_REMOTE_CONTROL, NEXOR_RUNNER_HANDLE_PREFIX, NEXOR_RUNNER_CARDS_DIR (cards directory), NEXOR_RUNNER_HOST (see Cards), NEXOR_RUNNER_HOST_ID (see Handles), NEXOR_RUNNER_TOKEN / NEXOR_RUNNER_TOKEN_FILE, NEXOR_RUNNER_CLAUDE_SESSIONS (where runner import looks for Claude session files).
Handles and renaming
One name everywhere: handle = tmux session name (cc-
The values come from the owner's registry, registry.yaml, in the cards directory or its parent (or the file NEXOR_RUNNER_REGISTRY names):
version: 1 people: - {initials: gc, agora_handle: owner} # the owner (an Agora account) - {initials: tc, name: Tess} # a hosted person (no Agora account) hosts: srv: "the build server" lap: "laptop" This is the file nexor-agora cards init writes and the hub validates: people is a non-empty list (at most 20) of {initials, agora_handle} or {initials, name} with distinct 2-letter initials; the runner reads the same shape, inline {...} entries and hosts: {srv: "..."} included, and accepts a handle whose initials are any listed person's. The older single person: block (initials, agora_handle) is still read (as a one-person list); having both person: and people: is an error.
NEXOR_RUNNER_HANDLE_GRAMMAR=off|warn|enforce (default warn) decides what a launch does (runner new, POST /sessions, the agora launch intent, restore):
warn: a handle that breaks the grammar or the registry is logged ([handles] warning: ...) and started anyway.
enforce: it is refused (400; restore leaves the row in the state file and skips it). The runner's own host id must be a 3-letter id listed in the registry hosts, and the handle's host segment must equal it: a card whose handle says lap is refused on the srv runner. The host id is, in order: NEXOR_RUNNER_HOST_ID; host-id in config.json (runner config set host-id srv, or install-service --host-id srv); the host part of the runner name when it is
runner rename
checks:
stops the tmux session with tmux kill-session only: the state row is not deleted;
updates the row under the state lock (and only if the old session has not been started again meanwhile, e.g. by a restore): handle, name cc-
resumes it: claude --resume
syncs the server-side title: a resumed session re-uses the same Remote Control session on claude.ai, so the title shown by the desktop app and claude.ai/code would stay the old handle. The API types /rename
runner retitle
It is idempotent and safe to re-run after a crash: before step 3 the row still has the old name, after it the new one with rename_from set, and the same command does what is left (a re-run of a finished rename is a no-op, but only while the renamed session is alive: otherwise it is a 409 telling you to runner restore; runner new
Every session row carries what the agent is doing right now, so a dashboard can tell a busy agent from a parked one without opening its terminal:
It is in GET /sessions, in the agora snapshot (sessions[]) and in runner ls (a column, and the three fields in --json). It is computed on every listing and every agora report tick (5 s), read-only, and bounded: an unchanged transcript costs one stat, an engine answer is reused for 3 s, a pane is captured only for a session that looks busy (or has no other source) and at most once per 2 s. A source that fails makes that row unknown; it never fails a listing.
OpenCode sessions are looked up by the row's session_id; when the engine does not know it the newest engine session titled with the handle is used (the same rule as the handle map).
Codex allocates its own thread ID. Until that ID is known to the runner, activity uses pane heuristics and automatic restore skips the session. Use Codex's own resume picker to recover it; the runner never guesses with resume --last.
waiting for Claude Code and Codex comes from the screen only: neither writes the pending approval to its transcript. The menu patterns are heuristics; an unrecognised prompt keeps the row working.
When the source gives no timestamp (pane fallback, OpenCode working/waiting), activity_since is the moment this runner first saw the new activity.
A transcript whose last conversation entry is a prompt or a tool result is working even if the client died mid-turn; the session disappears from the list when its tmux pane does.
Handle. A session's identity (the current grammar is under Handles and renaming; this is the older form, still accepted):
Codex launch requires a Codex CLI supporting --no-daemon. Sign in with codex login and configure the Agorà MCP server for Codex on the runner host. The launch uses the runner's environment allow-list and Codex's configured model unless a model is supplied. Use tmux or the runner's browser terminal if already enabled. Claude's Remote Control launch option does not apply to Codex.
Card.
Scope. A card may declare scope: personal or scope: p in its frontmatter (work / w is the default when the key is absent; case and surrounding blanks are ignored, anything else is work). It marks agents the owner wants kept apart from work ones. When the handle conforms to the grammar its scope letter (-p- / -w-) is authoritative: a card can never downgrade a -p- handle to work, and when the two disagree the more private one wins (a -w- handle whose card says personal is personal too). The disagreement is reported as handle_problems in GET /cards and refused at launch when the grammar is enforced. Older handles and dev-* use the card alone. The scope is stored on the session row at new / launch / import / restore and is re-read from the card whenever it matters (snapshot, restore, bulk stop), so editing a card takes effect without relaunching. Free (dev-*) sessions and sessions without a readable card are work.
runner restore skips personal rows (reported as skipped (personal)
runner kill --scope personal|work stops every live session of that scope (the same through POST /sessions/stop-scope {"scope": "personal"} and the agora intent stop-scope).
The agora snapshot carries scope on every session and every card.
Free sessions. Handle dev-
Environment. Sessions start with env -i plus an allow-list (PATH, HOME, LANG, TERM, NEXOR_AGORA_*, XDG_CONFIG_HOME, ...). Variables matching *API_KEY* and ANTHROPIC_AUTH_TOKEN are refused even when requested: agents run on the subscription login.
State. ~/.local/state/nexor-runner/sessions.json. Claude sessions are started with --session-id
runner ls [--json] list sessions (with their activity) runner cards [--json] [--cards-dir D] list agent cards and whether they run runner new
attach / kill accept an index (order of runner ls), an exact name or a unique fragment.
restore skips rows whose name (or imported origin) is still alive in another tmux server, so two clients never share one conversation.
import is described under Migration.
Loopback only (127.0.0.1, ::1, localhost; any other --host is refused), JSON in and out, no access log. Every endpoint except GET /health needs Authorization: Bearer
state is always running; what the agent is doing is activity (see Session activity); session_id is the Claude conversation id or the OpenCode ses_ session id (empty only for rows the runner did not launch); remote_url is the Remote Control URL (Claude) or the last pair ticket issued (OpenCode, one-time, five minutes); rc_status is the Remote Control outcome (see Remote Control: pending, sent, ok, gave_up, or null) and rc_attention says why a person has to look at the session (a folder-trust dialog waiting for an answer, no Remote Control URL after two minutes, a session not started with Remote Control; null when nothing is needed); last_active is null; url and port are empty (no web terminal).
Own tmux server and a dedicated systemd --user unit with env -i, an explicit PATH/HOME/LANG and UnsetEnvironment for API keys. Restarting another service cannot touch the sessions; restarting the runner's own unit does, and runner restore brings them back.
Sessions start from the allow-list only. *API_KEY* and ANTHROPIC_AUTH_TOKEN are never passed.
The API listens on loopback only, with no unix socket and no TLS: put anything that must reach it from outside behind your own authenticated proxy.
The bearer token is read from NEXOR_RUNNER_TOKEN, else from a file (--token-file, NEXOR_RUNNER_TOKEN_FILE, default ~/.config/nexor-runner/token) that must be mode 0600 and at least 16 characters. It is never accepted on the command line.
import only reads the source tmux (list-panes) and Claude session files; it never starts, kills or renames a session.
Migrating from an existing tmux-based launcher
Sessions started by an older launcher live in the default tmux server. The runner's sessions live in its own server, so the two coexist.
Recommended: gradual
Old sessions stay where they are; new ones are born in the runner; agent sessions are moved one at a time.
Install the runner and both units (above). Start new sessions with runner new or POST /sessions from now on.
To move one agent session: runner import --dry-run and check the table (handle, cwd, model, session id).
runner import records the live sessions in the state file. Nothing is started or touched, and re-running adds nothing.
Close the old session (exit the client, or kill that tmux session in the default server).
runner restore --dry-run, then runner restore: the session comes back in the runner with claude --resume
Remote access is re-enabled automatically (see Remote Control below).
Repeat for the next session whenever convenient. restore refuses a session that is still alive in the old server, so you cannot end up with two clients on one conversation.
Agents still running in the old server
While agents are not moved yet, the runner also watches the foreign tmux servers listed in NEXOR_RUNNER_FOREIGN_TMUX (comma-separated socket names; default = the default server, which is also the default value; empty = none). GET /cards, runner cards and the agora report show a card as running when cc-
Alternative: one shot
runner import --dry-run, then runner import (all live sessions).
Stop whatever owns the default tmux server (this kills every session in it).
What runner import does
runner import [--from-tmux default|<-L socket>] reads the source tmux and ~/.claude/sessions/
Filtering. --only HANDLE_OR_GLOB and --exclude HANDLE_OR_GLOB (both repeatable) are matched with case-sensitive fnmatch against the resulting agent handle (e.g. --exclude 'tc-*'); --prefix P is shorthand for --only 'P-*'. --exclude wins over --only. Non-matching sessions are reported as excluded (also with --dry-run) and are neither recorded nor counted as imported. Empty patterns are rejected; when nothing matches, a message says so and the exit code stays 0. Sessions skipped with a warning have no handle yet and are not filtered. The HTTP API does not expose import, so there is no API counterpart.
pip install -e ".[dev]" && ruff check . && pytest Project links
Released: Nov 30, 2026
Author: nexor-runner contributors
Both files in this release have provenance metadata.
View provenance details
agents claude-code codex nexor-agora opencode systemd tmux
Development Status 4 - Beta
Intended Audience Developers
License OSI Approved :: MIT License
Operating System POSIX :: Linux
Programming Language Python :: 3.11
Topic Software Development
System :: Systems Administration
Release files for nexor-runner 0.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 547.3 kB
Release files / nexor_runner-0.8.1.tar.gz
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 30, 2026.
Release files / nexor_runner-0.8.1-py3-none-any.whl
Security for nexor-runner 0.8.1
Both files in this release have been uploaded with provenance metadata.
With provenance nexor_runner-0.8.1.tar.gz Nov 30, 2026
With provenance nexor_runner-0.8.1-py3-none-any.whl Nov 30, 2026
Attestation for nexor_runner-0.8.1.tar.gz
Attestation for nexor_runner-0.8.1-py3-none-any.whl
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.
Release history Release notifications | RSS feed
Nov 30, 2026 2 release files Full provenance
Nov 28, 2026 2 release files Full provenance
Nov 27, 2026 2 release files Full provenance
Nov 24, 2026 2 release files Full provenance
Nov 21, 2026 2 release files Full provenance
Oct 29, 2026 2 release files Full provenance
Oct 27, 2026 2 release files Full provenance
Oct 26, 2026 2 release files Full provenance
Oct 25, 2026 2 release files Full provenance
Oct 24, 2026 2 release files Full provenance
Oct 23, 2026 2 release files Full provenance
Oct 22, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from fc0d8e6











