Skip to content

CLI Reference

This is the quick-lookup cheat-sheet for the leapmux command line. It covers the top-level command list, a synopsis and flag table for each daemon mode (solo, hub, worker, dev), the version command, the environment variables LeapMux reads, and outlines of the three large command groups — recover (offline break-glass), control (user-facing scripting), and control admin (hub administration) — which have their own dedicated chapters.

For task-oriented walkthroughs rather than reference tables, see Running LeapMux (run modes, ports, data dirs, Docker), Configuration (full config-key reference and storage backends), Recovery, and Control CLI.

Top-level usage

leapmux is a single binary with seven commands:

Usage: leapmux <command> [flags]

Commands:
  solo      Run Hub + Worker locally for single-user use
  hub       Run the Hub service
  worker    Run a Worker connected to a Hub
  dev       Run Hub + Worker for development
  recover   Offline break-glass recovery (opens the database directly)
  control   Remotely control LeapMux from a script or another LeapMux agent
  version   Print version and exit

Common options:
  -h, --help     Print help and exit
  -version       Print version and exit
  --version      Print version and exit

Any command name can be shortened as far as it stays unambiguous.
CommandWhat it doesReference
soloHub + Worker in one process, loopback only, no loginRunning LeapMux
hubHub service only; Workers connect separatelyRunning LeapMux
workerWorker only; connects out to a HubManaging Workers
devHub + Worker in one process with real auth (development)Running LeapMux
recoverOffline break-glass: first-admin bootstrap, password reset, keys, dbRecovery
controlDrive a running Hub over RPC (scripts / spawned agents)Control CLI
versionPrint the build version and exitbelow

Notes on dispatch:

  • The default TCP port for every mode is 4327.
  • -h, -help, and --help are recognized at every level (help prints to stdout, exit 0). The bare help token works only at the top level.
  • -version, --version, and the version command all print the same version string.
  • Daemon flags must follow the command keyword — leapmux solo -listen ..., not leapmux -listen ... solo. LeapMux rejects an unknown leading -flag because it is not a top-level flag.
  • LeapMux rejects an unexpected positional argument and points you at --help.
Flags accept both single- and double-hyphen forms (-listen and --listen are equivalent). The daemon-mode flag tables below use the single-hyphen form, matching the binary’s help output; the control and recover sections keep the double-hyphen form used by their chapters.

Durations. Every flag whose default is shown as a duration (1h, 5m, …) takes a unit suffix — ns, us, ms, s, m, h, d, w — and combines parts. A bare number is a count of seconds. See Duration values.

solo

Run a Hub and a Worker in one process on loopback, with no login (every request is auto-authenticated as the admin). See Running LeapMux for details.

leapmux solo [flags]
# then open http://127.0.0.1:4327
FlagDefaultMeaning
-listen127.0.0.1:4327TCP listen address
-data-dir. (resolves to ~/.config/leapmux/solo)Data directory (split into <data-dir>/hub and <data-dir>/worker)
-dev-frontendemptyFrontend dev-server URL for the local reverse proxy
-storage-sqlite-max-conns4SQLite max open connections
-storage-sqlite-cache-size0Page cache: positive = pages, negative = KiB (e.g. -65536 = 64 MiB)
-storage-sqlite-mmap-size0Memory-mapped I/O size in bytes (0 = disabled)
-max-incomplete-chunked0 (= 4)Max in-flight chunked sequences per channel (for the bundled Worker)
-encryption-modepost-quantumclassic or post-quantum (for the bundled Worker)
-use-login-shelltrueWrap the agent invocation in the user’s login shell (for the bundled Worker)
-log-levelinfodebug, info, warn, error
-config~/.config/leapmux/solo/solo.yamlConfig file path
-versionPrint version and exit
Binding solo to a non-loopback address logs a warning because every request is auto-authenticated as the admin — use hub or dev for network-exposed deployments.
The public_url setting applies in solo: it sets the URL in the startup banner, and the --hub address in the command that the Register worker dialog prints.

hub

Run only the Hub: authentication, workspace management, Worker registration, and the encrypted relay. Binds all interfaces by default and requires a real login. See Running LeapMux and Configuration for the complete key reference.

leapmux hub [flags]

This table lists the most common flags. The full set — including all PostgreSQL/MySQL/CockroachDB/YugabyteDB/TiDB pool-tuning flags — is in Configuration.

Server options

FlagDefaultMeaning
-listen:4327TCP listen address (e.g. :4327 or 127.0.0.1:4327)
-local-listenplatform defaultLocal IPC URL (unix:<path> or npipe:<name>); default unix:<data-dir>/hub.sock on Unix
-data-dir. (resolves to ~/.config/leapmux/hub)Data directory
-dev-frontendemptyFrontend dev-server URL for the reverse proxy
-log-levelinfodebug, info, warn, error

Behavioral settings. Auth policy (sign-up, verification, sessions), SMTP, timeouts, and per-user limits are not flags: they are instance settings in the Hub’s database, managed by leapmux control admin settings (see Configuration and the control admin section).

Storage options

FlagDefaultMeaning
-storage-typeempty (= sqlite)sqlite, postgres, mysql, cockroachdb, yugabytedb, or tidb
-storage-sqlite-pathempty (= <data-dir>/hub.db)SQLite database file path
-storage-sqlite-max-conns4SQLite max open connections
-storage-sqlite-cache-size0Page cache: positive = pages, negative = KiB (e.g. -65536 = 64 MiB)
-storage-sqlite-mmap-size0Memory-mapped I/O size in bytes (0 = disabled)
-storage-postgres-dsnemptyPostgreSQL connection string (required when storage.type is postgres)
-storage-mysql-dsnemptyMySQL connection string (required when storage.type is mysql)

The Postgres family (-storage-postgres-*, -storage-cockroachdb-*, -storage-yugabytedb-*) and the MySQL family (-storage-mysql-*, -storage-tidb-*) share pool defaults:

Familymax-connsmin-connsmax-idle-connsconn-max-lifetimeconn-max-idle-timehealth-check-period
Postgres (postgres, cockroachdb, yugabytedb)255360030030
MySQL (mysql, tidb)2553600300

CockroachDB/YugabyteDB use the Postgres driver; TiDB uses the MySQL driver. See Configuration for every storage flag and DSN format.

Common options

FlagDefaultMeaning
-config~/.config/leapmux/hub/hub.yamlConfig file path
-versionPrint version and exit
One hub config key has no CLI flag and is set only via YAML or env var: encryption_key_path (LEAPMUX_HUB_ENCRYPTION_KEY_PATH, default <data-dir>/encryption.key). Runtime settings such as secure_cookies are database settings managed with leapmux control admin settings — see Admin CLI. See also Configuration and Encryption & Data.

worker

Run a Worker that connects out to a Hub. Workers do not serve an inbound HTTP port; they register with the Hub using a key minted in the Hub UI. See Managing Workers.

# First run — register with a key from the hub UI:
leapmux worker -hub https://hub.example.com -registration-key <key>

# Subsequent runs — credentials are saved, no key needed:
leapmux worker -hub https://hub.example.com

Worker options

FlagDefaultMeaning
-hubhttp://127.0.0.1:4327Hub URL (http[s]://..., unix:<socket>, or npipe:<name>)
-registration-keyemptyRegistration key from the Hub UI (required on first run; never persisted)
-nameempty (= hostname)Worker display name
-data-dir. (resolves to ~/.config/leapmux/worker)Data directory (holds state.json, worker.db)
-encryption-modepost-quantumclassic or post-quantum
-use-login-shelltrueWrap the agent invocation in the user’s login shell
-log-levelinfodebug, info, warn, error

Timeout and limit options

FlagDefaultMeaning
-max-incomplete-chunked0 (= 4)Max in-flight chunked sequences per channel
-max-message-size0 (= 16 MiB)Max application payload size in bytes; reassembled ceiling adds 64 KiB headroom
-agent-startup-timeout5mAgent startup timeout
-api-timeout10sJSON-RPC request timeout

SQLite database options

FlagDefaultMeaning
-db-max-conns4Max open database connections
-db-cache-size0Page cache: positive = pages, negative = KiB (e.g. -65536 = 64 MiB)
-db-mmap-size0Memory-mapped I/O size in bytes (0 = disabled)

Common options

FlagDefaultMeaning
-config~/.config/leapmux/worker/worker.yamlConfig file path
-versionPrint version and exit
An unregistered Worker with no saved credentials fails to start, and the error tells you to pass a registration key from the hub UI. Passing -registration-key again to an already-registered Worker also fails, which protects you from burning a one-time key.

worker cross-worker-pins

A local-only utility for inspecting the Worker’s TOFU pin store. It runs entirely against local files — no Worker process starts. See Security & Threat Model for what these pins protect.

leapmux worker cross-worker-pins list|show|remove [--target-worker-id=<id>] [--data-dir=<dir>]
SubcommandRequiresAction
listPrint all pins as JSON
show--target-worker-idPrint one pin (errors no pin recorded for target_worker_id=<id> if absent)
remove--target-worker-idRemove the pin; prints {"removed_target_worker_id": <id>}

When --data-dir is omitted, the data directory is resolved through the standard Worker config loader, so it matches what leapmux worker would use: default ~/.config/leapmux/worker, overridable with LEAPMUX_WORKER_DATA_DIR (or a data_dir entry in worker.yaml).

The binary’s own help text for this flag mentions LEAPMUX_DATA_DIR, but that variable is not read by the leapmux binary itself (only by the Docker entrypoint script), so it has no effect on this subcommand’s data-dir resolution. Use LEAPMUX_WORKER_DATA_DIR (or --data-dir) here.

dev

Run a Hub and a Worker in one process with real password authentication — the same program as solo but with login enabled, binding all interfaces, and the first admin bootstrapped through the /setup flow. See Running LeapMux.

leapmux dev [flags]

Dev mode uses the same flag set as solo.

The other differences from solo: dev enables signup_enabled=true by default, and the bundled Worker’s auto-registration is deferred until the first admin completes /setup. The runtime knobs (session_duration_seconds, limits, timeouts, …) are leapmux control admin settings keys. The default -listen is :4327 (all interfaces), and the config/data location is ~/.config/leapmux/dev/.

version

Print the build version and exit. The output is a single line with fields joined by ·:

$ leapmux version
0.0.1-dev · 9c81b87 · feature/foo · Thu, 4/23/2026, 11:45:00 PM KST

Fields are conditional: the version value is always present (falls back to dev), the commit hash and build time appear when set, and the branch is shown only when it is not main. The top-level -version / --version flags print the same string.

recover (command-group outline)

leapmux recover is the offline break-glass tree: it manages the Hub’s database and encryption key file directly, with the hub stopped — no network call, no login. It is deliberately tiny. For full per-command flags and behavior, see Recovery.

leapmux recover <group> <command> [flags]
GroupCommands
bootstrapcreate-admin (refuses once any admin exists)
passwordreset (--id or --username; prompts for the new password)
encryption-keyrotate, remove, reencrypt, rotate-pepper
dbpath, migrate, version

Recover commands accept --data-dir to locate the data directory. The commands that open the database also accept --config, which loads the Hub’s storage settings; pass it whenever the Hub runs on Postgres or MySQL. Three leaves need no database connection and take no --config: db path, encryption-key rotate, and encryption-key rotate-pepper (which also takes --yes).

Commands that take --password prompt interactively when you omit the flag. Every other administration task is online — see Admin CLI, and Recovery for the full per-command reference.

control (command-group outline)

leapmux control drives a running Hub over RPC — it does not touch the database. It is used both by external scripts (which authorize with leapmux control auth login) and by agents/terminals that LeapMux spawns (which inherit LEAPMUX_CONTROL_* env vars). Every command emits a JSON envelope — {"data": ...} on success, {"error": {"code", "message"}} on failure (both on stdout) — with a non-zero exit on failure. For full per-command flags, entity-ID resolution, and output shapes, see Control CLI.

leapmux control <group> <command> [flags]
leapmux control auth login --hub https://hub.example.com   # authorize first
GroupCommands
(top level)whoami, version
authlogin (add --scope to ask for particular permissions), logout, list, status, credentialslist reads this machine’s credential files, credentials asks the Hub what the whole account holds
adminsubgroups settings, user, session, worker (with reg-key), app, idp, captcha, rate-limit, api-token, delegation-token — the online hub administration surface (requires an admin login; never available over the worker-IPC transport), covered in Admin CLI. app registers the apps a consent screen authorizes; idp configures the providers users sign in with.
workspacelist, get, create, rename, delete
tablist, get, open, close, rename, move
workerlist, get; subgroup pins: list, show, remove
agentsend, interrupt, get, providers, messages, set, send-control-response
tilelist, split, close, make-grid, remove-grid, set-ratios, set-grid-ratios
layoutget, set
filelist, read, stat
gitstatus, branches, worktrees, read
terminalsend, get, shells
eventswatch
Agents are opened, closed, listed, and renamed through the tab group (tab open --type agent, tab close, …) — there is no agent open/agent close/agent list. The agent group is for agent-specific operations only.

Environment variables

LeapMux reads configuration and credentials from these environment variables.

Daemon configuration (hub / solo / dev and worker)

Hub-family modes (hub, solo, dev) read variables prefixed LEAPMUX_HUB_; the Worker reads LEAPMUX_WORKER_. The variable name after the prefix is lowercased to form the config key — for example LEAPMUX_HUB_LISTEN sets listen, LEAPMUX_WORKER_HUB sets hub.

VariableSetsExample
LEAPMUX_HUB_LISTENhub listen:4327
LEAPMUX_HUB_LOCAL_LISTENhub local_listenunix:/run/leapmux/hub.sock
LEAPMUX_HUB_DATA_DIRhub data_dir/var/lib/leapmux/hub
LEAPMUX_HUB_LOG_LEVELhub log_levelinfo
LEAPMUX_HUB_ENCRYPTION_KEY_PATHhub encryption_key_path (no CLI flag)/etc/leapmux/encryption.key

The Worker reads:

VariableSetsExample
LEAPMUX_WORKER_HUBworker hubhttps://hub.example.com
LEAPMUX_WORKER_NAMEworker namebuild-box-1
LEAPMUX_WORKER_DATA_DIRworker data_dir/var/lib/leapmux/worker
LEAPMUX_WORKER_ENCRYPTION_MODEworker encryption_modepost-quantum
LEAPMUX_WORKER_LOG_LEVELworker log_levelinfo

The prefix strip lowercases the remainder but does not translate _ into ., so nested storage keys such as storage.type and storage.postgres.dsn cannot be set cleanly via env vars — use the YAML config file or the dedicated -storage-* flags instead. See Configuration for the full list and precedence rules (defaults < config file < env vars < explicitly-set CLI flags).

Remote CLI (leapmux control)

VariableUsed byMeaning
LEAPMUX_HUBcontrol (and auth login --hub fallback)Hub URL when --hub is not passed
LEAPMUX_CONTROL_CONFIG_DIRcontrolOverride the credential/pin directory (default ~/.config/leapmux/control)
LEAPMUX_CONTROL_SOCKspawned agentsLocal IPC socket URL (selects the worker-IPC transport; control admin refuses it)
LEAPMUX_CONTROL_TOKENspawned agentsPer-process bearer token for the local IPC socket
LEAPMUX_CONTROL_USER_IDspawned agentsAuthenticated user ID (informational; no flag defaults from it)
LEAPMUX_CONTROL_WORKER_IDspawned agentsHost worker ID (default for --worker-id)
LEAPMUX_CONTROL_TAB_IDspawned agentsSpawning tab’s ID (default for --tab-id)
LEAPMUX_CONTROL_TAB_TYPEspawned agentsagent, terminal, or file
LEAPMUX_CONTROL_WORKING_DIRspawned agentsWorking directory at spawn
LEAPMUX_CONTROL_AGENT_PROVIDERspawned agentsAgent provider (agents only)

The LEAPMUX_CONTROL_* variables other than _CONFIG_DIR are injected automatically by the Worker into the agents and terminals it spawns; you do not set them by hand. See Control CLI for how they drive entity-ID resolution.

Config and data locations

Each mode reads an optional YAML config file named after the mode. Each mode stores data under its own directory. LeapMux skips a missing config file without a message.

ModeConfig fileDefault data dir
solo~/.config/leapmux/solo/solo.yaml~/.config/leapmux/solo
hub~/.config/leapmux/hub/hub.yaml~/.config/leapmux/hub
worker~/.config/leapmux/worker/worker.yaml~/.config/leapmux/worker
dev~/.config/leapmux/dev/dev.yaml~/.config/leapmux/dev
control~/.config/leapmux/control/<hub-host>.json (credentials, mode 0600)

In solo and dev, the data directory is split into <data-dir>/hub and <data-dir>/worker subdirectories. See Running LeapMux and Configuration for the full layout and resolution rules.

Last updated on