Kyon
Contents

Working on a server

Add a host as a target, then open terminals, coding agents, files, search and review on it, with sessions that keep running there when you disconnect.

Working on a server

Kyon works on another machine over SSH as it does on this Mac: terminals, coding agents, the explorer and editor, search and review all run against the host's files, with the host's tools. Shells and agents there keep running when the connection drops or you quit.

Everything starts from a target: a host, the command that connects to it, and where to start. Saved targets appear beside this machine wherever Kyon asks where to run something.

Add a host

A target uses your existing SSH setup, so your ports, keys and jump hosts work as in a terminal.

  1. Click the globe in the title bar, or choose Show remote connections from the File menu or the command palette (⌘P). The Connections dropdown opens.
  2. Click Add target and fill in the form:
    • Name: what the target is called in menus and lists. It cannot contain a dot.
    • Reached by, where you have connection plugins: SSH, or a plugin, and for a plugin that lists machines which of them. A target reached through a plugin has no Host: its plugin says how it is connected to and whether it is online. A wrapper or a provider's helper that connects to a machine is a plugin; see Connection plugins.
    • Host: what you would type after ssh, such as user@host or an alias from ~/.ssh/config. An alias is the best choice, because it carries your port, key and jump host.
    • Before connecting (optional): a command to run on this Mac first, such as refreshing a certificate.
    • Default working directory (optional): where terminals and agents start on the host, such as /srv/app.
    • Launch Claude Code with, and likewise for Codex, Gemini, OpenCode and pi (optional): a program that starts that agent on this host instead of its usual command.
  3. Click Save target.

Authentication is left to SSH. Kyon refuses to save a private key, a password in an address, or a flag such as --token followed by the secret itself, and asks you to confirm anything that looks like a credential (Save anyway). Commands run as one program and its arguments; for anything with pipes or ;, write a script and name it.

Each row keeps one button, Connect or Disconnect, beside More, which shows everything else that can be done to it under the row: for a target, Edit, Duplicate, arrows to reorder, and Remove. Less folds them away again, as closing the dropdown does. Targets are kept in your settings file, under Settings › System › Remote in the Remote targets section, where Manage targets opens the same dropdown.

How Kyon signs in

The form's Kyon's own connection choice decides how the login happens:

  • Automatic: signs in from the connections panel, and every pane on the host shares that one login.
  • Share the connection: asks the connection for a shared SSH connection and uses it. Through a plugin, its command has to pass -o options on to ssh.
  • Take over the terminal's connection: takes over the connection a terminal made. It works with any command, but cannot confirm the host was reached, so a slow login can look finished.

When a host asks for a password, a code or a browser sign-in, the dropdown shows its prompt in a small terminal to answer, with links you can click. A host you reach with a key asks nothing.

What gets installed on the host

Kyon talks to a host through a small helper program it brings with it, so you have nothing to install by hand.

The first time you connect, Kyon copies the helper matching the host's system to ~/.cache/kyon/orb-… on the host, named after the build. By default it asks first: a notice says Kyon's host helper is not on this machine yet, with an Install it button. Later connections reuse the copy; a newer Kyon brings its own and replaces an older one without asking, and copies no build has used for 14 days are cleared away. If the copy has gone from the host, or will not start, Kyon copies it over again when it reconnects or when you press Connect, without you disconnecting first.

Also under ~/.cache/kyon/ on the host: sessions, where the host keeps track of your running shells, and pasted, which holds files you drop onto a terminal there.

The Install SSH extension setting (Settings › System › Kyonify, SSH section) chooses ask, always or never. With never, Kyon uses an orb already on the host's path.

Supported hosts

Linux on x86-64 or ARM64 (the helper is a static build, so any distribution works) and macOS on Apple silicon or Intel. For any other system, connecting stops saying no helper is built for it.

Open a terminal or an agent on the host

Every new session can run on this Mac or on any target, chosen as you open it.

  1. Open the New session menu with ⌃⌘T, or the new-tab button.
  2. Choose Terminal or a coding agent (Claude Code, Codex, Gemini, OpenCode or pi). A panel beside it lists Local, each target, and Manage targets…. A connection plugin's machines are listed by their own names with the plugin beside them; the ones its plugin says are offline are left out, unless one is connected or is where you last started a session. Start a stopped one from the Connections dropdown, and it is offered once it runs. The place you used last is selected first.
  3. Pick the target. A terminal opens straight away. For an agent, Kyon asks which folder to start in, offering the target's default working directory, folders on the host as you type a path, and folders you used there before; choose Launch Claude Code in … on name (or the agent you picked).

If the host isn't connected yet, the pane says Waiting for the login to … and starts once connected; panes waiting on one host share one login. Once signed in, while Kyon reaches the host and copies its helper over, the pane says Connecting to … and the target's row says Connecting; the rest of the window keeps working meanwhile.

Opening a session on a host also points the window at it, so ⌘T opens further terminals there. Agents on a host work as they do here, and Kyon offers its plugins for them once per host; see Coding agents.

Files, search and review on the host

The explorer, editor, search and review follow the session in front, so with a host's tab focused they all work on that host.

  • Browse files (⌘E) and Open a file (⌘O) list the host's tree. Files open in the editor and save back to the host. Language servers for those files run on the host.
  • Search the workspace (⌘⇧F) searches the host's files on the host.
  • Review changes (⌘R) shows the host repository's changes. Committing, pushing and opening a pull request run with the host's git.

To point the window at a machine without opening a session, run Read from another machine from the File menu or the palette and pick a host, or this machine to come back.

While a host is away, its open files say so and can't be edited; what you typed is kept, and a file changed on the host meanwhile is read again.

Working in a host's terminal

A terminal on a target behaves like one on this Mac.

  • Blocks and the input: with Kyonify SSH Sessions on (the default), shells on hosts get Kyon's blocks and input. It applies to shells opened after you change it.
  • Completion: Tab completes paths and directories from the host's files.
  • The directory chip shows ~ for your home directory on the host.
  • Typing appears at once, before the host echoes it back.
  • Dropping files: drop a file from Finder onto the terminal and Kyon copies it to the host, showing Sending name to the host with the percentage done, then types the path it has on the host into the prompt, or into Rich Input if that is open. Any size works; folders can't be sent. Copies are kept in ~/.cache/kyon/pasted for a day, at most 50 at a time.

A host Kyon serves, and ssh typed in a terminal

Running ssh yourself in a local terminal gives a plain shell at the far end. For blocks, host completion, kept sessions and file drops, add the machine as a target and open the terminal from the New session menu.

Sessions that keep running

Shells and agents on a host keep running when your connection drops or you quit Kyon, so a long build or a working agent carries on without you.

When you quit with tabs open, Kyon asks (unless you have told it not to): Quit ends the shells and the tabs come back with new ones, while Keep Shells and Quit leaves them running. With Restore the last session on, the next launch puts each terminal back on the host it was on, attached to the same shell, sized to its pane.

The Connections dropdown lists the sessions kept on this Mac, then on each connected target, with each one's folder and state: In tab "…" (click to go there), Open elsewhere (attached in another window or another Kyon), Left … ago (running, nobody on it), or Not running · starts again when opened.

Click End, then Confirm end, to stop one; closing its tab does the same. Unattached sessions end after the days set in End sessions left alone for (7 by default; 0 keeps them).

When the connection drops

A dropped connection repairs itself, and nothing you type is lost.

The target's row in the dropdown turns to Reconnecting and a strip across the top of the terminal says why and that it is reconnecting, without writing anything into what the shell or the program in it shows. While an attempt to get through fails, the row and the strip both say what it was answered, such as what the connect command printed, and how many attempts have failed, so a host that keeps refusing is told from one that has only just dropped. Kyon retries with growing pauses for about two minutes; once through, the strip goes and the terminal is back in the same shell. What you typed meanwhile is held, the pane says Not sent yet … it goes once the connection is back, and it is sent once it can be. Keys typed into a terminal that has no shell yet are refused and the pane says they were not sent.

A short interruption, such as a blip on Wi-Fi, is not taken for a drop: while the host is still sending anything, or answers within three tries about ten seconds apart, the connection goes on as it was.

If the host stays away longer than that, the row offers Reconnect and panes waiting on it say Not connected to … with a Connect link, and Kyon goes on trying about once a minute for as long as the host cannot be reached, and at once when your computer wakes from sleep. While the screen is locked Kyon signs in to nothing: a connection that drops then waits, and is made again once you unlock, so a host or an SSH wrapper that needs you there does not see a night of failed sign-ins. A connection lost overnight is back by itself in the morning, once you are. A host that turns the connection down, with Permission denied or a changed host key, is not asked again until you press Reconnect. Turn off Reconnect dropped sessions to have terminals end instead.

When the host restarted

A host that restarts loses its shells and everything running in them. Once you are connected again, each terminal that was open on it comes back as a new shell in the same folder, taking what you type once that shell is at its prompt, and a coding agent that was running there goes on with its conversation, as it does when Kyon itself is restarted. Connect on a host shown as offline reconnects the terminals already open there; it does not start them over.

Where a terminal you signed in from carries the connection, that terminal ends when the connection drops. Kyon signs in again by itself, with the same pauses as above: the dropdown opens only if the host asks you something, such as a password or a code. The new sign-in then carries every terminal on the host. If it still cannot get through, a notice says why and that Kyon is still trying, the row offers Reconnect, and it goes on trying as above. The same goes for a host with a command to run first, such as a plugin's before, or one set to Share the connection, once the connection it shared has gone: Kyon signs in again in the dropdown's terminal, running that command first, so what it prints is shown there and it opens if anything is asked.

Disconnect or remove a host

You can close a connection or forget a target without touching the host itself.

  • Disconnect, then Confirm disconnect, closes the connection. Every shell and agent on it ends, and its pane says it was disconnected from the host; Kyon does not reconnect it by itself, even when you type in it. The shared SSH connection Kyon made to the host closes too, so the next terminal you open there signs in again; a shared connection of your own that Kyon was using is left open. The target stays saved.
  • Remove, then Confirm remove, deletes the target from your settings. It changes nothing in your SSH config, credentials or on the host, and stops nothing running there. A window reading from that host goes back to this machine.

Connection plugins

A target is one machine reached one way. Where a tool of your own reaches machines, such as a wrapper that connects to one big server or one that makes small instances by name, a connection plugin tells Kyon how to use it. Its machines then appear beside your saved targets in the Connections dropdown and wherever Kyon asks where to run something, and you open terminals and agents on them as on any target.

A plugin is a short script in the Rhai language. Keep each one as a file of its own in the plugins folder beside your settings file, ~/Library/Application Support/com.ryowave.kyon/plugins: name.rhai holds the script itself, and the file's name is the plugin's name. Kyon looks in the folder every few seconds, so a plugin you add, save or delete there is picked up without anything else to do. A name.toml file with the script as its script works too, as does a plugin in the settings file itself, under [remote.plugins.name]; where both the settings and the folder have the same name, the settings' one is used and a notice says so. In a TOML file, write the script between ''' rather than """: in a """ string a backslash is read by TOML first, and \" in the script loses its backslash.

Plugins in Settings

Settings › System › Remote has a Connection plugins section. Each plugin has a card with its title, its name, whether it is one machine or machines by name, where it is kept, and how it stands: how many machines it listed, or what is wrong with it. Edit opens a plugin's file in the editor beside your session and brings it to the front, or brings it forward where it is already open; it is always this computer's file, even while you are working on a host (one kept in the settings opens the settings file); Remove, then Confirm remove, deletes a plugin's file. New plugin starts new-plugin.rhai in the folder from a script that says what each part is for, and opens it: rename the file to name the plugin.

The ⓘ on the Connection plugins row shows what to give a coding agent so it writes a plugin for your tool. It names the folder on this Mac and the command that checks a plugin; paste it, with your tool's command in place of TOOL, into an agent on the Mac where the tool is installed. The agent reads the tool's help, tries the commands that only read, writes the plugin into the folder and checks it. Copy puts it on the clipboard.

Share a plugin

Every plugin's card has Copy, which puts its script on the clipboard to send to someone. They press Paste plugin beside New plugin: Kyon checks that the clipboard holds a plugin it can use, keeps it in their plugins folder named after its title, with a number after the name where it is taken, and opens it. From a terminal, kyon plugin add arca.rhai does the same with a file, named after the file; --name NAME chooses the name, --replace replaces a plugin of that name, and - reads the script from standard input.

Plugins can also be shared from a folder. Kyon reads plugins from this computer's shared folder, /Library/Application Support/Kyon/plugins on macOS, /etc/kyon/plugins on Linux and %ProgramData%\Kyon\plugins on Windows, where whoever looks after the computer can put them, and from each folder named in Shared plugin folders (remote.plugin_folders in the settings file), such as a synced team folder or a checkout of a shared repository:

[remote]
plugin_folders = ["~/team/kyon-plugins"]

A shared plugin's card says where it is shared from, and has View, Make my own and Copy; it cannot be removed from Kyon. Make my own copies it into your plugins folder under the same name and opens it: a plugin of your own is always used in place of a shared one with the same name, so that is how you change a shared plugin for yourself. Remove your copy to go back to the shared one. Kyon notices a plugin added to, changed in or taken out of any of these folders within a few seconds.

Help while you write one

A plugin's .rhai file opened in Kyon's editor is checked as you type, without running anything. Kyon underlines where the script stops reading as Rhai, says what would keep Kyon from using it (no connect, or remove in a plugin that is one machine), points out a function named nearly as one Kyon asks for, such as conect, and a function given what it does not take, such as connect() in a plugin that lists machines. Completion offers each function Kyon asks a plugin for, ready to fill in, and what a script may call: run, tcp and json. Hovering over one of them says what it is for and what it gives back.

Another editor can have the same help: its language server for .rhai files is kyon plugin lsp, run from Kyon's own program, such as /Applications/Kyon.app/Contents/MacOS/kyon plugin lsp. To use a different server in Kyon, set one for rhai under lsp.servers in the settings file.

Check a plugin

Kyon's own program checks a plugin from a terminal, without the window:

/Applications/Kyon.app/Contents/MacOS/kyon plugin check small.rhai
/Applications/Kyon.app/Contents/MacOS/kyon plugin check --trace small
/Applications/Kyon.app/Contents/MacOS/kyon plugin check --machine i-0abc small

Give it a file, or the name of a plugin in the folder or the settings. It reads the plugin, runs what only looks (title, list, connect and reconnect for the first machine listed, or the one given with --machine ID, or each with --all, online, create_form) and checks what each returns and how long it took, and shows the commands create, remove and each of actions would run without running them, nor anything they run themselves but a program run with reads: true. A function named nearly as one Kyon asks for, such as conect, is pointed out. --trace also lists every program the plugin ran, how it ended and how long it took, and --trace --full everything each printed. It ends with 0 where nothing failed, and 1 where Kyon could not use the plugin as it is.

A plugin for a tool that makes machines by name:

fn title() { "Small instances" }
fn list() {
    let ran = run(["fleet", "list", "--json"]);
    if !ran.ok { throw ran.err; }
    json(ran.out).map(|m| #{ name: m.name, state: m.status })
}
fn connect(name)   { ["fleet", "ssh", name] }
fn reconnect(name) { ["fleet", "ssh", "--resume", name] }
fn online(name)    { run(["fleet", "status", name]).ok }
fn create_form()   { [#{ key: "name", label: "Name" }] }
fn create(form)    { ["fleet", "create", form.name] }
fn remove(name)    { ["fleet", "rm", name] }

What each function does:

  • connect (the only one a plugin needs): the command that connects, as a list of words. Its first word is looked for in the folders of your login shell's PATH, or can be a full path; ~/ in front of it stands for your home directory. One that is not found there is run in your login shell, which finds it as it does when you type it, a shell function or alias included. When even that cannot start it, the notice and kyon.log in Kyon's logs folder say which folders were looked in. Where the tool sets up an ssh alias, or gives a host ssh reaches directly, it can answer #{ ssh: "arca.ssh" } instead: Kyon then connects with its own ssh, as to a saved target, so panes share one connection and ports can be forwarded. Add before: ["dbcert", "sync"] for a command to run first, such as one that fetches a certificate: Kyon runs it in the terminal the connection is made in, where it can ask for anything it needs, and connects once it has succeeded. A target reached through that machine runs the plugin's command first, then its own.
  • reconnect: the command used when Kyon connects again, after a connection dropped or when it comes back to sessions kept on the machine after a restart. Without it, connect is used. Worth writing where the tool has a separate command that resumes, or starts a stopped machine.
  • list: the machines there are, each a name or a map with name, and optionally id, state, online (true or false), detail, a short line shown with it, and removable. A machine with an id is kept, remembered and connected to by it, and shown by its name, so two machines can share a name; the other functions are given the id. state is the tool's own word, shown as it is: matched ignoring case, running, up, ready, active and started count as online, and stopped, down, terminated, suspended and paused as offline. removable: false keeps Remove off that machine, so one plugin can list a big machine of its own beside the small ones it makes. Machines are shown in the order listed. Where listing fails, throw a message saying what to do, such as throw "run dbcert to sign in": Kyon shows a message thrown by the script as it is written, on the plugin's card and in a notice when it starts failing.
  • online: whether a machine can be reached now. Kyon asks it only of a machine whose list entry says neither online nor a state it knows, and of a plugin that is one machine. A throw counts as not known; false as offline. Kyon does not sign in to a machine its plugin says is offline; a pane waiting for it waits, and connects once the plugin says it is there.
  • create_form, create and remove: what to ask before making a machine, and the commands that make and remove one.
  • actions: what else can be done to a machine, such as starting, stopping or keeping it alive, as a list of maps with a label, a command (one, or a list run in turn) and confirm: true where the button is to be pressed twice. Each becomes a button on the machine's row, run as create is, with a notice saying how it went. It is asked for each machine as the machines are listed, so it should be quick, and can offer only what fits the machine's state.
  • title: what the plugin is called in the dropdown. Without it, the name it is kept under.

Every function given a machine's id can take a second parameter as well, such as fn actions(id, machine). It is then also given the machine's entry as list last gave it, so machine.state, machine.name and anything else list put there can be used without looking the machine up again. Until the machine has been listed, as just after Kyon starts, the entry holds only its id and name.

A plugin without list is one machine. Its functions take nothing, such as fn connect() { ["big", "ssh"] }, and it can only connect, reconnect and say whether it is online. One that also has create or remove is refused, with a notice saying why.

A plugin's machines are called plugin:machine, such as small:alpha, and a plugin that is one machine by its own name. Terminals, with the agents running in them, and files and reviews opened on a machine remember that name. After a restart they come back on that machine, even when the plugin cannot list its machines at that moment, and Kyon signs in to it with the plugin's reconnect, or connect where it has none. A machine that is missing from a list the plugin did return is treated as offline: its panes wait and are not signed in for until it is listed again. The same goes for a machine its plugin says is stopped: a terminal or agent opened on it says the machine is not running, with Show machines to open the dropdown, where its plugin's actions such as Start are, and connects by itself once the plugin says the machine is running. In the dropdown a plugin that lists more than one machine has a line of its own, with its title and how many machines it lists and how many of them are offline. Its machines are folded under that line, apart from the ones in use: connected, keeping sessions, or being acted on. Press the line to show the rest; the offline ones stay folded under a line such as 5 offline, pressed to show them too. A machine's row shows its plugin and how the plugin says it stands, in the plugin's own words where it gives them, such as running or stopped, with any detail it adds; otherwise whether it is online. Its plugin's actions, Save as target and Remove are under More; it has no Edit, Duplicate or arrows, since the plugin lists it.

Save a plugin's machine as a target

A plugin's machine has no working directory of its own: a new terminal on it starts in your home directory. To give it one, press More on its row, then Save as target, or choose the plugin under Reached by in the Add target form. The form opens named after the machine and reached through it, without the Host field: how the target is connected to, connected to again and whether it is online are its plugin's, as they are for the machine. Give it a Default working directory, a name of your own, a command to run before connecting and how agents start there, as for any target, and it is kept among your targets with Edit, Duplicate, arrows and Remove. In the settings file it is written with through = "small:alpha" in place of ssh and connect. If its plugin is taken away, the target is shown offline and is not connected to until the plugin is back.

A target used to have a Connection command of its own. A plugin does what one did, so the first time this version starts, each target that had one gets a plugin in the plugins folder, named after the target, whose connect is that command with the target's host put in, and the target is kept as reached through it, with its working directory and everything else as they were.

Kyon asks the plugins for their machines when it starts, when you open the dropdown, every five minutes, and every 30 seconds while a pane waits for a machine that was offline; never while the screen is locked. A script has run, which runs a program and gives back ok, code, out and err; run(argv, #{ reads: true, timeout_ms: 2000 }) marks a program that only looks, which a check may run, and gives it less time. It has json, which reads JSON, and tcp(host, port, timeout_ms), true where anything answers on that port, which says a machine is up without signing in. It has no other way to the system, so it reads a file only through a program it runs. A function Kyon calls is stopped after 30 seconds, and a program it runs after 15. Programs run without a terminal or input, with KYON_PLUGIN=1 set, so a tool that would stop to have you sign in should be told not to. A plugin with a mistake in it, or one whose list fails, says so in a notice, and the rest carry on.

Make or remove a plugin's machine

A plugin with create adds New machine to its line in the Connections dropdown. A plugin that lists no more than one machine has no line of its own, so the button is beside Add target at the foot of the dropdown instead, named after the plugin, such as New Small machine. It opens a form with what the plugin's create_form asks: a text box for each field, or a button for each answer where the field has choices. ⇥ moves between the text boxes, Make machine or ↩ asks the plugin, and Esc leaves the form. Each field is a map with a key, and may have a label, a starting value and choices; create is given the answers under their keys.

On a machine of a plugin with remove, Remove, then Confirm remove, has the plugin remove the machine itself, not only its row: whatever runs on it ends.

create and remove each return one command, or a list of commands run one after another. Kyon runs them on this Mac without a terminal, so a command that stops to ask a question waits until it is given up on, after 15 minutes. A notice says the work has started and another how it went; if a command fails, the notice gives the last line it printed. Kyon then asks the plugin for its machines again, so one just made appears in the dropdown without waiting.

Settings

SettingWhereWhat it does
How to reach a hostSettings › System › RemoteThe program SSH targets are reached with in place of ssh, given ssh's options and the host. Empty means ssh.
Remote hostsSettings › System › RemoteYour saved targets.
Connection pluginsSettings › System › RemoteScripts for tools of your own that reach one machine or many.
Kyonify SSH SessionsSettings › System › KyonifyBlocks and the input in shells on hosts.
Install SSH extensionSettings › System › KyonifyWhether a host without the helper gets one: ask, always or never.
Ask connect commands for a ControlMasterSettings › System › KyonifyHas a connection command other than ssh share one login across panes.
Reuse existing SSH ControlMasterSettings › System › KyonifyUses a shared connection from your SSH config.
Reconnect dropped sessionsSettings › Terminal › GeneralRepairs a dropped connection instead of ending the terminal.
Keep shells running after quittingSettings › Terminal › GeneralWhat quitting does when Kyon doesn't ask.
End sessions left alone forSettings › Terminal › GeneralDays a kept shell may go unattached, here and on every host.
Private placesSettings › Agent › AgentFolders only a private model may read; HOST:path names one on a host, HOST: all of it.

See the settings reference for every setting.

Limits

© Ryowavefor Kyon 0.2.35