External CLI
The shellrs command lets AI agents such as Codex, Claude Code and OpenCode run remote commands and transfer and sync files on the hosts saved in ShellRS, and also view, create, change and delete hosts and credentials. The command itself reads no passwords or private keys, and no database: it hands the request to the running ShellRS, which connects with the saved settings and the keychain. Requests travel over local interprocess communication: the socket cli.sock in the data folder on macOS and Linux (when the data folder’s path is too long for a socket, it goes in $XDG_RUNTIME_DIR instead, named by a hash of the data folder), and the named pipe \\.\pipe\shellrs-cli-<hash of the data folder> on Windows.
Enabling and installing
Section titled “Enabling and installing”In Settings → External CLI:
- Enable external CLI: off by default. While it’s off, ShellRS still listens but refuses every request, and the command tells you to turn it on here. Once it’s on, any program running as the current user on this computer can use the saved hosts this way, change hosts and credentials, and type commands into the remote terminals open in ShellRS (
exec --terminal, including terminals that have switched to root); none of this has a separate switch. Only the current user can read and write the socket, and ShellRS also checks the identity of the user connecting. On Windows, the pipe likewise admits only the current user and only local connections, and before sending a request the command checks that the pipe belongs to the current user (or an administrator), so nobody else can grab a pipe with the same name. - Command: puts
shellrson the PATH.- macOS: links it to
/usr/local/bin/shellrs; if that folder isn’t writable, the system asks for authorization. - Linux: links it to
~/.local/bin/shellrs. For the portable copy the link points to theshellrsin its folder, and the command talks to that copy; install it again after moving the folder. - On macOS and Linux, “Remove” deletes only a link that points to shellrs; other files with the same name are left alone.
- Windows: a GUI app has no console, so the command is a separate console program,
shellrs-cli.exe(next toshellrs.exe). “Install” copies it to%LOCALAPPDATA%\ShellRS\bin\shellrs.exeand adds that folder to the current user’s PATH (no administrator needed); terminals and agents find it once they’re reopened. After ShellRS updates, it refreshes this copy when it starts; when it can’t, “Update” appears. The copy can be updated even while it’s in use. “Remove” deletes the copy and takes the folder off the PATH. A portable copy copies it tobin\shellrs.exein the portable folder and puts thatbinon the PATH, so the command talks to that portable copy; install it again after moving the folder or when its drive letter changes. With both the installed and the portable command installed, whichever comes first on the PATH wins.
- macOS: links it to
- Agent Skills: writes the skill that teaches agents to use
shellrsto the standard folder (~/.agents/skills) or to the skills folder of Codex, Claude Code, OpenCode or WorkBuddy; when the content differs from the current version, “Update” appears. “Copy skills” copies the whole skill to the clipboard.
Command overview
Section titled “Command overview”Commands (shellrs --help has the full details):
shellrs hosts list [-q <keyword>] [--json] # list hosts; JSON when the output isn't a terminal
shellrs hosts show <ID> [--json] # one host's full settings
shellrs exec <ID> "<command>" # or --stdin to read the command from stdin
shellrs exec --json # read {"host", "command"} from stdin, print JSON
shellrs exec <ID> --terminal "<command>" # run in a terminal already open in ShellRS; see below
shellrs upload <ID> <local-path> <remote-path>
shellrs download <ID> <remote-path> <local-path>
shellrs sync <ID> <local-folder> <remote-folder> [--delete]
shellrs hosts create | update <ID> | delete <ID>
shellrs credentials list | show <ID> | create | update <ID> | delete <ID>
<ID>is the 16-character host ID: theidinshellrs hosts list, which is also what “Copy ID” on a host’s context menu copies. The list also includes quick connections and external connections whose tabs are open ("temporary": true); see “Quick connect” and “Opening from a bastion host (external connections)”.
Running commands
Section titled “Running commands”execopens a new connection each time and disconnects when it’s done. The remote command gets no stdin, and the exit code is the remote command’s; if a signal killed it, the exit code is 128 plus the signal number.exec --terminal("terminal": trueinexec --json) doesn’t log in again: it types the command into this host’s remote terminal that’s already open in ShellRS, for bastion hosts that allow only one login (see “Opening from a bastion host (external connections)”). It first sends Ctrl+C, which interrupts whatever program is running in the terminal and clears anything typed but not yet entered, then types a probe line and a command line; both lines and the command’s output show in the terminal. The command runs as the terminal’s current user, in its current folder and on its current machine (aftersu,sudo -ior a nestedsshtoo), and with--jsonthe result has an extracontext(user,host,cwd,shell,interp) saying where. The command’s output goes through a pipe, so programs don’t see a terminal: no colors or pager, and stderr comes as stdout. The command gets no stdin, and a program that asks for a password waits in the terminal. Which terminal it uses: the one the right sidebar is working on, if that’s this host’s; otherwise this host’s newest connected terminal.- Only bash, dash and busybox ash on Linux are supported (otherwise
unsupported_shell). The encoded command line can be at most 4000 bytes for bash and dash, and 1000 bytes for busybox (otherwisetoo_long). - It fails with
terminal_busy, and the command doesn’t run, when a full-screen program (vim, less, top, tmux and so on) has the terminal; the previous--terminalcommand hasn’t finished; the terminal is transferring files with ZMODEM; the shell doesn’t answer within 5 seconds (a foreground program that ignores Ctrl+C, such as python or mysql); or the shell doesn’t start the command within 15 seconds (the bastion host’s command filter or review may have held it back; Ctrl+C is then sent again). If the terminal isn’t open or isn’t connected, it fails withno_terminal. - There’s no time limit while the command runs; if the command-line tool is ended partway (say, by an agent’s timeout), the command in the terminal gets Ctrl+C.
- The two lines start with a space, so bash with
ignorespaceset keeps them out of the history; otherwise they’re recorded. A shell waiting at aread -swithout a prompt, or in the command mode of vi editing, can’t be recognized, and the command fails saying the shell didn’t answer.
- Only bash, dash and busybox ash on Linux are supported (otherwise
Transferring and syncing files
Section titled “Transferring and syncing files”- Uploads and downloads use the SFTP tab’s transfer engine (recursive,
.filepart, reconnecting after a drop), and destination paths follow scp’s rules: if the destination is an existing folder, the item goes into it under its own name; otherwise the destination is the path of the copy itself, and its parent folder must exist. Existing files are overwritten; new files keep the source’s executable permission.~means the login folder. syncgoes only from this computer to the host: it syncs the contents of the local folder into the remote folder. If the remote folder doesn’t exist, it’s created (its parent must exist); if it’s a file, that’s an error; and it can’t be the root folder/. Files whose size and modification time haven’t changed, and links whose target hasn’t changed, are skipped and counted as “unchanged” in the summary, so syncing again sends only what changed; other files are overwritten, and new files keep their executable permission.--deletefirst deletes items in the remote folder that aren’t in the local one, or are of a different type (without following links), but never the.filepartand.shellrs-….backupfiles that transfers in progress leave behind, and it doesn’t clean up folders that can’t be read locally; items it can’t delete count as failures.
Managing hosts and credentials
Section titled “Managing hosts and credentials”hostsandcredentialsmanage the saved hosts and credentials.createandupdateread a JSON object from stdin (updatechanges only the fields given); the fields are inshellrs hosts create --helpandshellrs credentials create --help. Whatshow --jsonprints can be edited and passed straight back toupdate. The checks are the same as in the dialogs, and errors use the dialogs’ wording:- Hosts:
name,host(the address),port(default 22),user(default root),group(a group path such asProduction/Databases, created level by level if it doesn’t exist; an error if more than one group has that path),auth(password/credential/no_password),credential(a credential ID),password,route(direct, jump hosts listed by ID, or an HTTP / SOCKS5 proxy; it can’t set a proxy command, whichhosts showstill shows andupdatewithoutroutekeeps) andnotes. Jump hosts must be saved SSH hosts, and not the host itself. If you change the address, port or user without giving a password, the saved password moves along, as in the dialog. - Serial hosts:
protocolisserial(sshby default), withserialin place ofhost,port,user,auth,credential,passwordandroute.serialhasdevice(required to create),baud,data_bits,parity(none/odd/even),stop_bitsandflow_control(none/rts_cts/xon_xoff). Givingserialalone makes a serial host.exec(--terminaltoo),upload,downloadandsyncfail on a serial host withnot_ssh. - Telnet hosts:
protocolistelnet,portis 23 by default, andusermay be empty.authis its automatic login:passwordtypes its own username and password,credentialuses a password credential, andno_passworddoesn’t log in (the default; givinguserorpasswordwithoutauthturns it on).telnethas the two prompts,user_promptandpassword_prompt(nullor empty for the usual ones), andtelnetalone makes a Telnet host. A Telnet host can’t be a jump host, andexec,upload,downloadandsyncfail on it withnot_sshtoo. - Credentials:
name,kind(password/key/agent),user,password,key_path(a private key file on this computer) orprivate_key(the full text of a private key, like “Paste” in the dialog, kept inkeys/in the data folder), andpassphrase. A credential’s ID is a 16-character random string, shown bycredentials list. - Passwords, passphrases and private keys are write-only: they go into the system keychain or
keys/, no command ever prints them, andshowonly says whether one is saved; for a private key ShellRS keeps, it doesn’t even show the path. updatecan changeprotocoltoo: the host keeps its name, group and notes (between SSH and Telnet also its address, its connection, and its port unless that is a default), and the rest takes the new protocol’s defaults, which you can give in the same request (serial.devicefor a serial host). An SSH host that other hosts use as a jump host, or that port forwards go via, stays SSH.- Quick connections and external connections can be shown with
show, but not changed or deleted. hosts deletedoesn’t ask for confirmation and deletes the host’s port forwarding rules along with it; the host’s open tabs in ShellRS stay open (--forceis still accepted and does nothing). Hosts that jump through it are left with a “Deleted host” hop.credentials deletedoesn’t ask either; hosts that use the credential switch to logging in on their own (as in the app).- ShellRS makes changes one at a time: a change that hasn’t had its turn within 10 seconds is withdrawn and not made; once it has started, the command waits for it to finish.
- Hosts:
Errors and exit codes
Section titled “Errors and exit codes”- On failure, the command prints
shellrs: [code] messageto stderr and exits with 255. The error codes arenot_running(ShellRS isn’t running),not_enabled(the external CLI isn’t enabled),host_not_found,credential_not_found,host_key_unknown(you haven’t connected to this host in ShellRS yet),host_key_changed,missing_credential(no saved password or passphrase),connect_failed,transfer_failed,bad_request,save_failed(the change was made but couldn’t all be written to the database or keychain),version_mismatch(the command and the running ShellRS are different versions, or ShellRS is too old to know the command), andno_terminal,terminal_busy,unsupported_shellandtoo_long, which onlyexec --terminalreports. The CLI never prompts: an unknown host or a missing password fails right away, so connect once in ShellRS first. When a transfer finishes but some items failed, the exit code is 1.
JSON output and PowerShell
Section titled “JSON output and PowerShell”exec --jsonreads{"host": "<ID>", "command": "<command>"}from stdin and, once the command ends, prints{"exit_code", "stdout", "stderr"}, or{"error": {"code", "message"}}on an error, with the same exit codes as without--json. The output is ASCII only: Chinese and other characters are escaped as\uXXXX, and output that isn’t UTF-8 becomes U+FFFD. The command doesn’t go through the local shell’s quoting, and the console code page can’t garble the output, which suits Windows PowerShell and agents that need to read stdout and stderr separately.- macOS, Linux and Windows are supported. In Windows PowerShell, prefer
exec --jsonfor running commands (@{ host = '<ID>'; command = '…' } | ConvertTo-Json -Compress | shellrs exec --json). To watch the output while the command runs (long builds, lots of logs), pass the command as a here-string through--stdininstead (@'…'@ | shellrs exec <ID> --stdin), and, as forlist,uploadanddownload, first run$OutputEncoding = [Console]::OutputEncoding = [Text.UTF8Encoding]::new(), or Chinese and other non-ASCII text turns into question marks or garbage. Any BOM at the start of the command text is removed and CRLF becomes LF, so the remote shell sees no stray carriage returns.