Autocomplete over SSH, without installing anything
Gatesys SSH suggests commands, services, containers and folders as you type over SSH, with nothing installed on the server. How it works and what it keeps.
On this page
Why autocomplete over SSH is harder than it looksThe shell can say where the prompt endsOne line, and only if you askWhat the list is made ofWhat a suggestion can and cannot doUsing it without losing your shellWhat it remembersThe same idea for files: the SFTP path barWhat this does not doTry itFAQAutocomplete in a local terminal is easy to take for granted. Over SSH it depends on what each server happens to have: the right completion packages, the right shell configuration, your history on that machine. And the terminal window you are typing into cannot fill the gaps, because it has no idea where your prompt ends and your typing begins.
Gatesys SSH suggests the rest of a command as you type it: from your snippets, from what you ran on that host, and from facts the app has already measured there. It does this with no agent on the server and no model in the loop. This post explains how, because the interesting part is not the list. It is how the app learns where your prompt ends without changing anything permanent on a machine that is not yours.
Why autocomplete over SSH is harder than it looks
A terminal emulator draws bytes. When you type systemctl res, it sees a stream of characters going out and a stream coming back. It cannot tell whether res is part of your command, part of a password prompt, or the middle of a line vim is editing. A suggestion popup that guesses wrong types into a live shell, and on a production server that is not a harmless mistake.
There are three common ways out:
- Guess from the screen. Cheap, and wrong whenever the prompt is unusual, the line wraps, or the echo of your keys lags behind.
- Replace the shell or install a helper on the server. It works, and it changes a machine you may not be allowed to change.
- Ask the shell. A shell can be made to mark its own prompt. That is the route we took.
The shell can say where the prompt ends
Terminals such as iTerm2, kitty and WezTerm understand a small set of escape sequences, known as OSC 133 or semantic prompts, that let the shell mark the end of its prompt. A shell that prints the mark tells the terminal exactly where your input starts. Gatesys SSH asks bash or zsh to print three things:
ESC ] 133 ; B BEL the prompt ends here; what follows is what you type
ESC ] 7 ; file://host/path BEL the folder you are in
ESC ] 133 ; E ; <command> BEL the command the shell has just runWith the first mark, the text you have typed is exactly what sits between it and the cursor. No guessing. With the second, a suggestion for cat knows which folder to list. With the third, the history comes from what the shell itself says it ran.
One line, and only if you ask
Those marks have to come from the shell, so the app types one line into it. It is the one thing the app types into your shell that is neither a command you chose nor a read-only fact probe, so it is opt-in and visible:
| What | How it works |
|---|---|
| Turning it on | The Suggestions button in the terminal header, then Turn on in this shell. For a host you use every day, Turn on terminal suggestions at connect in the host editor does the same once the first prompt has shown. |
| Seeing it first | The line it types in that menu shows the line in full before anything is sent. |
| Size | Under 1,000 bytes. Until the shell’s line editor starts, the server’s terminal driver keeps only 1,024 bytes of typed text, and a line cut in half is a broken command. |
| Where it lives | In that one shell process. It defines two prompt hooks, writes nothing to disk on the server, and ends when the shell does. |
| Shells | bash and zsh. Anywhere else, the line answers that it found neither and changes nothing. |
| Record | Turning it on is written to the app’s audit log. |
Until the shell answers, the app holds back what the server prints, for at most three seconds, so you see a prompt redraw rather than a pasted block of shell code. If the server never answers, everything held is drawn as it came.
This is why we describe the app as installing nothing on your servers and still say, honestly, that this one feature types a line. The line is yours to read, yours to refuse, and gone when the shell is.
What the list is made of
Suggestions appear once you have typed two characters, or when you press CtrlSpace. There are at most eight, best first, one per resulting command line:
| Source | Offered when |
|---|---|
| Snippets | What you typed starts, or is a word of, a snippet’s command or name |
| History | What you typed starts a command you ran on this host |
| Common verbs | After systemctl, docker, git, journalctl, kubectl or apt, the verbs that follow |
| Services | After systemctl restart or journalctl -u: failed units and the services of packages the app measured |
| Containers | After docker logs, docker restart and the like: containers from Host facts |
| Paths | The word you are typing looks like a path, or the command takes one: a directory listing over the session’s own SFTP channel |
All of it is code. No model is asked, so nothing you type is sent anywhere to be completed, and the list works on the Free plan.
The path lookup gives up after 400 milliseconds and remembers a folder for five seconds, so a slow link delays a suggestion but never your typing. Facts marked private, or held back by the Injection Shield, are not used. A name that comes from a server, such as a file called a; rm -rf ~, is quoted before it is offered. It is data, not a command.
What a suggestion can and cannot do
Picking a row only types text. It never presses Enter. Before typing, the app checks that the line is still the one the list was made for, and if you kept typing in the meantime, nothing happens.
It also reads the whole command each row would make with the same rules that rate everything else in the app. A command a blocking rule refuses is not offered. A risky one carries its marker beside it. It is the division of labour from why our AI is not allowed to rate its own commands: code proposes, code rates, you decide. The levels are described in Command safety.
Using it without losing your shell
A completion popup that steals keys is worse than none. Until you step into the list, your shell keeps ↑ for its history, Tab for its own completion and Enter for running the line.
| Key | Does |
|---|---|
| CtrlSpace | Opens the list on demand |
| ↓ | Steps into the list |
| ↑ ↓ | Moves between rows |
| Tab, →, Enter | Types the selected row. Enter does not run it |
| Esc | Closes the list |
Suggestions stay out of the way in full-screen programs such as vim and less, and while you are searching history with CtrlR, because the prompt line is not your input then.
What it remembers
History is the part people reasonably worry about, so the rules are plain:
- It records what the shell says it ran, not what was on screen. The echo of your keys can lag behind Enter, and a screen read at that moment records half a line.
- Per host, on this computer only, and encrypted with your vault key. 500 lines for 90 days.
- A line is never kept if it starts with a space, a common shell convention for “do not remember this”, or if the app’s secret scrubber would change it, such as a line holding a token.
- It is never sent to a model.
- Two switches in Settings › Terminal: Suggestions while you type and Remember what I run, and a button to clear what has been kept.
The same idea for files: the SFTP path bar
The other half is the path box above each pane of the SFTP view, which is now a proper “go to” bar. It suggests the folders under what you have typed, and understands ~ and ... Paste a path to a file and it opens the file’s folder with the file selected. If a jump fails, it keeps what you typed and says why.
| Key | Does |
|---|---|
| CtrlL (⌘L on macOS) | Focuses the bar of the pane you are in |
| Alt← Alt→ (⌘[ ⌘] on macOS) | Back and forward through folders you have been in |
| Focus the empty bar | A list of recent folders |
It needs no shell integration: it uses the listing the pane could already read. See SFTP for the rest of the view.
What this does not do
- It is not a model. It will not write a command from a sentence. That is Farabi’s job, and it runs only when you ask.
- bash and zsh only. fish, PowerShell, cmd and a Windows server get nothing, and are left untouched.
- A nested shell has no hooks. After
sudo -ithe new shell does not print the marks, so suggestions are not offered in it. - It does not replace your shell’s own completion. Tab still belongs to the shell.
- It will not hide risk. A suggestion that is marked risky is still offered, marked, because you may mean it.
Try it
- Open a host in Gatesys SSH and click Suggestions in the terminal header.
- Read The line it types, then click Turn on in this shell.
- Type
systemctl restartand look at the list. Press ↓ to step in, Tab to type a row, and press Enter yourself.
For hosts you use every day, tick Turn on terminal suggestions at connect in the host editor. The reference, with every key, is in Terminal. For the full account of what the app sends to a server, see What runs on the server. For how it compares with other approaches to AI and completion in SSH clients, see AI in SSH clients compared.
FAQ
Does Gatesys SSH install anything on my server?
No. Suggestions work by having your shell print marks for where the prompt ends. The one line that does it lives in that shell process, writes nothing to disk on the server and ends with the shell.
Does terminal autocomplete over SSH use AI?
No. The list comes from your snippets, your command history on that host, a table of common verbs, facts the app measured and a directory listing over SFTP. No model is asked, and nothing you type is sent to one.
Which shells does it support?
bash and zsh. On fish, PowerShell, cmd or a Windows server, the setup line answers that it found neither shell and changes nothing.
Is my command history sent anywhere?
No. It stays on your computer, encrypted with your vault key, for 500 lines per host and 90 days. Lines starting with a space and lines holding secrets are never kept, and you can clear it in Settings.
Can a suggestion run a command by itself?
No. Choosing a suggestion types text and leaves Enter to you. A command a blocking rule refuses is not offered at all.
Does it work without the Pro plan?
Yes. It is code, not a model, and it works on the Free plan. Pro adds Farabi, the assistant, whose suggestions are rated by the same rules.
