Skip to content

CLI Reference ​

The loomtty binary is both the client and the entry point for managing sessions. The client auto-starts loomtty-server when needed.

Synopsis ​

bash
loomtty [SESSION]          # attach to / create a session
loomtty <COMMAND> [ARGS]   # run a subcommand

Running loomtty with no arguments attaches to the last session, or creates one if none exists. A bare positional argument is treated as a session name. A session whose name is also a subcommand (run, runs, new, ...) is opened with loomtty attach <name>.

Sessions ​

CommandAliasesDescription
loomttyAttach to the last session, or create one if none exists.
loomtty <name>Attach to a session by name, creating it if needed.
loomtty newCreate a new session and connect.
loomtty attach <name>aAttach to an existing session (errors if it doesn't exist).
loomtty listlsList sessions.
loomtty kill <name>kKill a running session.
loomtty delete <name>rmDelete a saved (inactive) session.
loomtty kill-serverksKill the server daemon.

loomtty list flags

FlagDescription
-a, --allInclude saved (inactive) sessions, not just running ones.

Remote ​

Connect to a loomtty-server on another host over an SSH tunnel. See Remote & Predictive Echo for the full setup.

bash
loomtty remote <user@host | saved-name> [session] [--port 7890] [--ssh-port 22] [--transport auto|kcp|ssh]

When --port / --ssh-port are omitted and the target matches a saved [[remote.hosts]] entry (by name or host), that entry's ports are used.

Argument / flagDefaultDescription
<user@host>—SSH target, or the name of a saved [[remote.hosts]] entry (required).
[session]—Session to attach to / create on the remote.
--port <n>saved host's port, else 7890The remote's [remote] port (the loopback TCP port the server listens on).
--ssh-port <n>saved host's ssh_port, else 22SSH port for the tunnel.
--transport <t>saved host's transport, else [remote] transport (auto)Data path: auto tries the encrypted UDP (KCP) transport and falls back to the SSH stream, kcp requires UDP, ssh never tries it. Applies to every remote connection of this client process. See UDP transport.

Configuration ​

loomtty init ​

Interactive setup wizard — generates a config file.

It's a TUI that walks you through keybinding style (prefix vs. sticky), leader key, color theme, and status-bar position. Shell and font are auto-detected. Skip it and loomtty runs with defaults. See Configuration.

Browser UI ​

loomtty web ​

Serve the browser web UI (HTTP + WebSocket) and run the server in the foreground. On first run it enables [web], mints a token, and persists both to your config so the desktop app shares them. See Web UI.

bash
loomtty web [--port <n>] [--bind <addr>] [--token <str>] [--static-dir <path>] [--open]
FlagDefaultDescription
--port <n>web.port, else 7891Listen port.
--bind <addr>127.0.0.1Bind address. Use 0.0.0.0 to expose on the LAN — then also set web.allowed_origins.
--token <str>reuse configured, else generateAuth token (32 hex chars when generated); saved to config.
--static-dir <path><server-dir>/webDirectory of the built web bundle.
--openoffOpen the URL in your default browser after starting.

Token on shared hosts

A --token value is visible to other users in process listings. On a shared host, prefer the LOOMTTY_WEB_TOKEN environment variable instead.

Layout templates ​

loomtty template (tpl) ​

Save and reapply pane layouts.

bash
loomtty template <SUBCOMMAND>
SubcommandAliasesArgumentsDescription
listlsList layout templates.
apply<template> [session]Apply a template (to the given or current session).
save<template> <session>Save a session's layout as a template.

Scripting (IPC) ​

loomtty msg ​

Drive a session from the shell — useful for scripting and automation. Add --json to any subcommand for machine-readable output.

bash
loomtty msg <SUBCOMMAND> [--json]
SubcommandArgumentsDescription
send-keys<session> <pane-id> <keys>Send keystrokes to a pane.
list-panes<session>List all panes in a session.
info<session>Get session info.
focus-pane<session> <pane-id>Focus a pane by ID.
close-pane<session> <pane-id>Close a pane by ID.
create-pane<session>Create a new pane.
get-layout<session>Get the full layout state.
run-command<session> <command>Run a command in a new pane.
capture-pane<session> <pane-id>Capture a pane's text to stdout (see flags below).
list-prompts<session> <pane-id>List recorded OSC 133 prompt boundaries.

capture-pane flags

FlagDefaultDescription
--scrollback-rows <n>0Rows of scrollback above the viewport to include (0 = viewport only). Clamped to the pane's history, a 100k row cap, and a ~900 KiB byte budget.
--join-wrappedoffJoin soft-wrapped lines (omit the newline between wrapped rows), like tmux capture-pane -J.
--preserve-trailing-spacesoffKeep trailing ASCII-space cells on each row (default trims them).

capture-pane and alt-screen apps

When an alt-screen TUI (vim, less, htop) is foregrounded, the alt buffer is captured and --scrollback-rows has no effect — the primary buffer's history isn't reachable. list-prompts returning nothing means shell integration isn't active in that pane.

Peer mailbox ​

loomtty peer ​

Named, durable mailboxes inside loomtty-server, so agents (or scripts) can hand work to each other and wait for the answer without polling. See Peer Mailboxes for the model. Add --json to any subcommand to print the server's reply as JSON (see JSON output below).

bash
loomtty peer send <to> --from <me> [-s SUBJECT] [-f FILE] [--reply-to ID] [--json]
loomtty peer recv <me> [--wait] [--timeout SECS] [--json]
loomtty peer ls [HOST] [--json]
loomtty peer log [[HOST:]NAME] [-n 20] [--json]
SubcommandArgumentsDescription
send<to>Send a message. The body is read from -f FILE, else from stdin. Prints the delivery status and the new message id.
recv<me>Take the messages queued in mailbox <me> on this machine and print them.
ls[HOST]List the mailboxes on this machine (or on HOST): waiting receiver, unread count, last seen.
log[[HOST:]NAME]Recent messages of one mailbox, or of every mailbox on this machine when no name is given, grouped by thread.

Addresses. name is a mailbox on this machine; host:name is a mailbox on another machine, where host is the name of a saved [[remote.hosts]] entry (or this machine's own [peer] host). Mailbox and host names follow the session-name rule (lowercase letters, digits and -, at most 64 characters) and may not be a Windows device name (con, nul, com1, …). recv always takes a bare name: waiting happens on the local machine.

send flags

FlagDefaultDescription
--from <name>$LOOM_PEER_NAMEYour mailbox name (required one way or the other). The sender is stamped as <[peer] host>:<name> when [peer] host is set, else just <name>.
-s, --subject <text>first non-empty body lineOne line, no control characters, at most 256 bytes. A derived subject has tabs turned into spaces, control characters removed and is cut to 256 bytes.
-f, --file <path>stdinRead the body from a file. The body must be UTF-8 text of at most 512 KiB; larger content should be sent as a file path or a git ref.
--reply-to <id>—The message being answered; the reply joins its thread.

Sending to another machine requires [peer] host on this machine (otherwise the recipient could not reply) and [remote] enabled = true on the receiving machine. The output names the outcome:

text
delivered (builder is waiting)  id k3f9a2-x81mqd
queued (build:builder last seen 3m ago, 2 unread)  id k3f9a2-x81mqd
queued (nobody has used the name "bulider" on build yet)  id k3f9a2-x81mqd

recv flags

FlagDefaultDescription
--waitoffIf the mailbox is empty, wait until a message arrives. Only one waiter per name: a newer recv --wait takes over an older one.
--timeout <secs>noneWith --wait: give up after this many seconds (exit status 3).

Each message is framed by lines carrying a random marker that changes on every call, so a message body cannot fake the end of a message:

text
=== [7f3a9c21] message 1/2  id k3f9a2-x81mqd  thread k3f9a2  from build:builder  2026-11-30 16:40:12
=== [7f3a9c21] subject: build result
=== [7f3a9c21] file: /home/me/.local/state/loom/mail/main/seen/1764492012345-k3f9a2-x81mqd.md
<body>
=== [7f3a9c21] end  (1 more queued)

A reply to: <id> line follows the subject on replies. Bodies over 8 KiB are cut at a line break and followed by body truncated (N bytes total): read the file above; the file line names the full message on the receiving machine.

recv exit status

CodeMeaning
0Messages were printed.
1Error (server not running, connection lost, invalid name, …).
2Invalid command-line usage.
3The mailbox was empty (without --wait), or --timeout expired.
4A newer recv --wait for the same name took over this one.

send, ls and log exit with 0 on success, 1 on error and 2 on invalid usage.

log flags

FlagDefaultDescription
-n, --limit <n>20Number of (newest) entries to show.

log columns are THREAD, TIME, STATE (queued, delivered or read), FROM, TO, ID and SUBJECT. The newest entries are shown one thread per block, blocks separated by a blank line: the thread with the most recent message comes last, and the messages of a thread are in arrival order. --json adds each message's file path.

JSON output. Times are Unix milliseconds; null means "none".

SubcommandOutput
send{"id", "thread", "status"}, where status is "delivered" or "queued"; a queued message also has "unread" (queued messages, this one included) and "last_seen_ms" (null if the name was never used).
recv{"messages", "remaining", "reason"}, where reason is "messages", "empty", "timeout" or "preempted", and each message has id, thread, from, to, subject, reply_to, sent_ms, delivered_ms, path and body.
ls{"host", "peers"}; each peer has name, waiting, unread and last_seen_ms.
log{"entries"}, oldest first (not grouped); each entry has id, thread, from, to, subject, sent_ms, delivered_ms, state ("queued", "delivered" or "read") and path.

Requirements. Both ends run loomtty 0.3.0 or newer (an older server is reported as such). Cross-machine requests go through ssh -W 127.0.0.1:<port> with BatchMode=yes, so ssh must log in without a prompt (keys or an agent). They reuse the local server's pooled connections like run (see below).

Running commands ​

loomtty run ​

Run a command in a real pane on this machine or on saved [[remote.hosts]] machines, wait for it to end, and print its output. See Running Commands for the model.

bash
loomtty run [--on HOST[,HOST...]] [--tree] [--name TREE] [--repo NAME]
            [--allow-large] [--cwd DIR] [--env K=V]... [--session NAME]
            [--timeout SECS] [--no-wait] [--tail LINES | --all] [--json]
            [--pipe] -- PROGRAM [ARG...]

Everything after -- is the program and its arguments, passed as they are: there is no shell in between, so quotes, &, | and * reach the program literally. For a pipeline or &&, run a shell explicitly (-- sh -c 'make && make test', -- pwsh -c '...'). On Windows a .cmd or .bat file is refused: run it as -- cmd /c build.cmd.

FlagDefaultDescription
--on <hosts>localComma-separated [[remote.hosts]] names; local is this machine. Several hosts run in parallel, one connection each.
--treeoffSend this repository's working tree as a snapshot commit and run in a per-tree build directory on each host (see below). Not available for local.
--name <tree>current branchWith --tree: the tree name. The default is the branch name with / replaced by - (detached on a detached HEAD). It must match [a-zA-Z0-9][a-zA-Z0-9._-]{0,63}, contain no .., not end in . or .lock, and not be a Windows device name; a branch that gives an invalid name needs --name.
--repo <name>repository directory nameWith --tree: which [remote.hosts.repos.<name>] entry to use.
--allow-largeoffWith --tree: also send untracked files over 50 MiB.
--cwd <dir>see descriptionWorking directory. Without --tree: an existing directory on the host (default: the current directory for local; elsewhere the directory a Mutagen session syncs the current one to, else the server's choice); a missing directory fails the start. With --tree: a relative path inside the build directory, no .. (default: the current directory's path relative to the repository root).
--no-syncoffDo not look for a Mutagen session (see below): no flush before the run, no working directory derived from the current one.
--env K=V—An environment variable for the command; repeatable. With --tree the host's repos.<name>.env comes first, then these.
--session <name>[run] session (jobs)The session the pane opens in. A session other than the default must already exist.
--timeout <secs>noneStop the command (its whole process tree) after this many seconds: 1 to 604800 (one week).
--no-waitoffPrint each host's run address (HOST:ID, or ID for this machine) and return as soon as the runs started.
--tail <lines>200Lines of output to print per host. 0 prints none.
--alloffPrint the whole output.
--jsonoffPrint one JSON array instead of text (see below).
--pipeoffRun without a terminal and write the command's stdout and stderr back unchanged (see below). One host only; not with --json, --tail, --all or --session.

While it runs. As soon as a host has started the run, a line [HOST] started ID goes to stderr. Ctrl+C only disconnects: the command keeps running, and loomtty prints how to pick it up again:

text
[build] interrupted; the run goes on. To read or stop it:
  loomtty runs log build:k3f9a2b8c1d0
  loomtty runs stop build:k3f9a2b8c1d0

The same lines are printed when the connection drops after the start.

Mutagen. For a host other than local, without --tree and --no-sync, loomtty reads Mutagen's sessions (mutagen sync list, with MUTAGEN_DISABLE_AUTOSTART=1) and uses those with one local and one ssh end on that host. The ssh end is that host when its name equals the entry's name, its host without user@, or when ssh -G gives both the same hostname and port.

  • Without --cwd, a current directory inside a session's local root runs in the matching directory below its remote root (the longest root wins; a remote root relative to the home directory is not mapped).
  • When the working directory (derived or --cwd) is inside a session's remote root, loomtty runs mutagen sync flush on that session first and prints [HOST] mutagen NAME synced; running in DIR (or just synced with --cwd) on stderr. A paused session or a failed flush (or one over 120 s) stops that host's run with 125; a session with conflicts after the flush (counted again with mutagen sync list) gets a warning. With --pipe the synced line is not printed and a warning starts with loomtty: .
  • No mutagen program, no running daemon or no matching session: nothing changes.

Git Bash. On Windows, under Git Bash (MSYSTEM set), an argument for a run on another host that looks rewritten gets a note on stderr: one under the Git install directory (from EXEPATH), such as C:/Program Files/Git/Users/me/repo (Git Bash rewrote /Users/me/repo), one under TEMP (rewritten from /tmp), and a bare drive such as C:/ (rewritten from /c, as in cmd /c). C:/x from /c/x cannot be told from a Windows path and gets no note. The argument is passed on unchanged. MSYS_NO_PATHCONV=1 turns the rewriting (and the note) off.

Output. After every host has finished, one block per host, in --on order:

text
=== [build] k3f9a2b8c1d0 exit 0, 42.1s, 1234 lines (last 200 shown; all: loomtty runs log build:k3f9a2b8c1d0 --all)
...output...
=== [build] end

The header names the result: exit N, timed out, stopped, pane closed, failed to start, tree checkout failed or lost in a server restart, and for anything but a normal exit the server's message after a :. A run the server refused before it got an id reads === [HOST] failed to start: ...; a host loomtty could not reach (or deliver the tree to) reads === [HOST] error: .... log truncated in the header means the log hit its 64 MiB cap or lost lines. With --tree, files the command changed in the build directory are listed after the output.

The output is the text the pane showed: escape sequences, progress bars and tabs already processed by the terminal, wrapped lines joined. It stays on the host for 7 days ([run] keep_days).

Exit status

CodeMeaning
the command's codeOne host: the command's own exit code. Several hosts: 0 if all exited 0, else the first non-zero code in --on order (using the codes below for hosts that did not exit normally).
124The command timed out.
125loomtty failed: no connection, server too old, tree not delivered or not checked out, stopped with runs stop, pane closed, server restarted, or interrupted with Ctrl+C.
126The program could not be started (not found, not executable, missing working directory, .cmd/.bat/.ps1).
2Invalid command-line usage.

The code is derived from the end reason the server reports, so a command that itself exits with 125 still shows "reason": "exited" in --json.

JSON output. An array with one object per host, in --on order:

FieldDescription
hostThe --on name (local for this machine).
idThe run id, or null if the run never got one.
statepreparing, running, draining, finishing or finished; null when loomtty has no result (--no-wait, or the connection failed).
reasonexited, timed_out, stopped, pane_closed, start_failed, tree_failed or server_restarted; null as for state.
exit_codeThe command's exit code, or null.
duration_msRun time in milliseconds, or null.
output_lines, output_bytesSize of the whole log (null without a result).
truncatedThe log hit its cap or lost lines.
messageWhy a start, checkout, connection or output read failed (empty otherwise).
changed_files--tree: files the command changed in the build directory (at most 200).
outputThe printed part of the output (the --tail lines or all), or null.

--pipe. The command runs without a pane: stdin is the null device, and stdout and stderr are each kept byte for byte on the host (runs/<id>.out, runs/<id>.err, up to 64 MiB each; output past that is dropped and the run marked truncated). When it has ended loomtty writes its stdout to its own stdout and its stderr to its own stderr, unchanged, and prints no block and no started line. Its own messages go to stderr, every line starting with loomtty: : a result other than a normal exit (loomtty: [HOST] ID timed out: ...), a server message, dropped output, an output read that failed, errors, notes and the recovery commands. The exit status is as above. --pipe takes one host: more in --on is a usage error (2), as are --json, --tail, --all and --session. With --no-wait the run address is printed as usual. On Windows the command is started without a console window, with the same registry PATH a pane run gets. A process the command leaves running may keep its output open: 3 seconds after the command exits the run ends with what has arrived, and the message says so; that process is not stopped. --pipe needs loomtty 0.5.0 on the host (an older server is reported as such, 125).

--tree. loomtty uses the system git (never a shell) to:

  1. find the repository root; refuse a repository without a commit, and unresolved merge conflicts;
  2. refuse untracked, non-ignored files over 50 MiB (they are listed) unless --allow-large;
  3. snapshot the working tree (tracked changes and untracked, non-ignored files) as a commit on top of HEAD, using a temporary copy of the index: the real index, the branch and the files are not touched. A clean tree sends HEAD itself;
  4. push it to every host in parallel: git push --force <host>:<repo> <commit>:refs/loomtty/run/<tree>, over ssh with BatchMode=yes and the host's ssh_port (pre-push hooks are skipped).

The host's server then checks the commit out into <builds>/<tree> (a linked worktree of repo, created on first use, reused and force-checked-out after) and starts the command there. A failed push makes that host 125 with git's error; the other hosts still run. Each host needs a [remote.hosts.repos.<name>] entry (see [remote]); loomtty prints the lines to add when one is missing.

  • Build directories are disposable: the next --tree run with the same tree name discards changes to tracked files there (untracked files stay). Do not edit inside them.
  • Submodules and Git LFS are not handled: a submodule's uncommitted changes are not sent.
  • Line endings follow each host's own git settings.
  • A build cache shared between trees (such as a common CARGO_TARGET_DIR in env) is only safe for tools that lock it themselves, like Cargo: runs with different tree names use it at the same time.

Requirements. Both ends run loomtty 0.4.0 or newer (an older server is reported as such). A remote host needs [remote] enabled = true; the connection goes through ssh -W 127.0.0.1:<port> with BatchMode=yes, so ssh must log in without a prompt. --tree also needs git on both machines and the host's repository reachable as git push <host>:<repo> over ssh.

Connection pool. run, runs and peer reach a remote host through the loomtty-server on this machine when it runs and is 0.5.0 or newer: it keeps the ssh connection to each host open for 10 minutes after use (up to 8 per host, one command at a time on each, checked with a ping before reuse) and passes the command's requests through unchanged, so the remote server may be older. Without a usable local server (not running, older, no answer within 2 s, or no connection within 25 s), or with [run] pool = false, the command opens its own ssh connection as before. The pooled ssh runs with the local server's ssh and environment; when it fails, the command's own ssh is tried after it, so an unreachable host takes two ssh timeouts to report (the server log has a relay: line). An idle connection that does not answer its ping (3 s) is closed with the host's other idle ones. A command interrupted before it is done does not give its connection back; the local server closes it. See Running commands.

loomtty runs ​

bash
loomtty runs ls [HOST] [-n 20] [--json]
loomtty runs log [HOST:]ID [--tail LINES | --all]
loomtty runs stop [HOST:]ID
loomtty runs wait [HOST:]ID [--tail LINES | --all] [--json]
SubcommandDescription
lsThe newest runs on this machine or on HOST: ID, RESULT, STARTED, TIME, LINES (pipe for a --pipe run) and COMMAND. --json prints {"host", "runs"}, each run with id, state, reason, exit_code, command, cwd, session, started_ms, duration_ms, output_bytes, output_lines, truncated, message and pipe ({"stdout_bytes", "stderr_bytes"} for a --pipe run, else null).
logPrint a run's output: the last 200 lines by default, --tail N lines, or --all. Works while the run is still going (what it has written so far). For a --pipe run: all of its stdout to stdout and its stderr to stderr, unchanged (--tail is refused).
stopStop a run and its whole process tree. Prints stopped HOST:ID; exits 3 (printing ... had already ended) when the run was no longer running.
waitWait until a run ends (at once if it has ended) and print its result exactly as loomtty run would have: the block (or with --json an array with one object), the last 200 lines by default, and the same exit status (the command's code, 124, 125, 126). Ctrl+C only stops the waiting and prints the runs log / runs stop lines. A --pipe run's output is written as run --pipe writes it; --json, --tail and --all are refused for one (125). Needs loomtty 0.5.0 on that host; an older server is reported as such (125).

HOST is a [[remote.hosts]] name or local; a bare ID is a run on this machine. runs exits with 0 on success, 1 on error, 2 on invalid usage (and 3 from stop as above); runs wait uses the exit codes of run.

The server daemon ​

loomtty-server is normally auto-started by the client — you rarely run it by hand. When you do, these flags apply:

FlagDescription
(none)Run with the system tray (default; needs a desktop session).
--headlessRun in the foreground without the tray — for headless / SSH-only hosts.
--daemonizeUnix only: fork into the background (also no tray).
--print-socket-pathPrint the IPC socket path and exit.
--web --web-port <n> --web-bind <addr> --web-token <tok> --web-static-dir <dir>Enable and configure the web gateway (what loomtty web passes through).

Global ​

FlagDescription
--versionPrint the version.
--help, -hPrint help (works per subcommand too, e.g. loomtty msg capture-pane --help).

See also ​

Released under the AGPL-3.0-only License.