Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
LLeMbas TTY
LLeMbas in the terminal. LLeMbas TTY is a fork of WezTerm with LLeMbas built into it: you ask at your own prompt, the answer shows beside your shell, and what the agent does in a shell it types into your pane, at your prompt, where you see it. It is not a terminal that starts another program in a split.
With AI switched off, or until you press one of the keys below, it is an ordinary terminal: nothing is started, nothing of a pane is read and nothing leaves the machine.
The engine is the LLeMbas CLI (lembas), installed
beside the terminal as its own thing, and the editor is
LLeMbas IDE (llembas-ide). The terminal carries no
copy of either: it uses the ones you have and installs what is missing when you ask
(Set-up, below). The CLI logs in to your own LLeMbas server and uses that server's models.
State: beta. Built and packaged by CI for Linux x86-64 (a .deb and a tarball on the
releases page); macOS and Windows are not packaged yet. Asking needs a LLeMbas CLI that can
be the terminal's display (2.0.0-beta.19 or newer); with an older one the terminal says so in
words, with how to update. Version in VERSION, changes in CHANGELOG.md. MIT, like
WezTerm — see LICENSE.md.
How it works
- Ask in place.
Ctrl+Shift+Aturns the line you are on into a line for a question:llembas <model> · <mode> ›, so you see which model and mode will answer before you send. Type,Entersends,Escapeor the key again leaves it — and your shell's line is as it was: nothing you type on the ask line reaches the shell. It edits like a shell line (arrows,Home/End,Ctrl/Alt+arrows by word,Ctrl+W,Ctrl+U,Ctrl+K, paste) andUp/Downwalk through your earlier questions. In a full-screen program it is drawn on the bottom row. - The display. The answer shows in a pane on the right, a third of the width, which the
terminal opens when you first ask; the keyboard stays in your shell. It has no prompt of
its own: it shows what LLeMbas says, the tools it uses that are not the shell, and what it
asks you.
Ctrl+Shift+Dhides and shows it. - Commands happen in your pane. When LLeMbas runs a command it is typed at your prompt
as if you typed it, and its output is in your scrollback. In manual mode every command
is asked first;
Ctrl+Shift+Yallows,Ctrl+Shift+Jdenies, from your own pane. In auto mode the commands the CLI's rules allow are typed without asking. There are no file-edit tools here: this is for terminal work, and the CLI or the IDE are a key away. - The CLI itself, whole.
Ctrl+Shift+Sopenslembasin a new tab, in the pane's directory, exactly as if you had typed it. - AI on and off.
Ctrl+Shift+Iswitches all of it at any moment; the optionaisays how the terminal starts. Off: every key below but the switch does nothing (and says so once), no process is started, nothing of a pane is read and nothing leaves the machine. - A shell line with comforts, in any shell. Drawn by the terminal itself, so they work
in bash as in zsh, and inside
sshwhere the other machine's shell has the shell integration:- suggestions: the rest of the line, dimmed after the cursor, from the commands this
terminal has seen you run.
RightorEndtakes it,Alt+Rightone word, anything else just goes on typing; - colours: the command (when it exists), options, strings, variables, the signs between commands, comments, and paths that exist;
- AI autocomplete, off unless you turn it on: when your history has nothing for the line, LLeMbas is asked after a pause and its answer shows in the same place, in italics.
- suggestions: the rest of the line, dimmed after the cursor, from the commands this
terminal has seen you run.
| Key | Command palette (Ctrl+Shift+P) |
What it does |
|---|---|---|
Ctrl+Shift+A |
LLeMbas: ask the model | The ask line. The question goes with the terminal context of your pane (below). |
| LLeMbas: ask about this screen | The same, with what is visible on the screen instead of the last commands — also from a full-screen program. | |
Ctrl+Shift+S |
LLeMbas: open the CLI | lembas, whole, in a new tab. |
Ctrl+Shift+I |
LLeMbas: AI on/off | The switch. |
Ctrl+Shift+Y |
LLeMbas: approve (allow once) | Answers what LLeMbas asks, from your pane. |
| LLeMbas: approve always | Where the question offers it (never for a command typed into your pane). | |
Ctrl+Shift+J |
LLeMbas: deny | |
Ctrl+Shift+G |
LLeMbas: stop the turn | |
| LLeMbas: new conversation | A tab has one conversation, which goes on until you start a new one. | |
Ctrl+Shift+D |
LLeMbas: show/hide the display | Hidden, it runs on behind your pane. |
| LLeMbas: choose model | The terminal's own chat model, from your server's list. | |
| LLeMbas: choose autocomplete model | The terminal's own autocomplete model. | |
| LLeMbas: choose mode | manual or auto. | |
Ctrl+Shift+H |
LLeMbas: private pane on/off | Nothing of the pane is passed on, and its commands are not remembered. |
| LLeMbas: suggestions on/off | ||
| LLeMbas: syntax highlighting on/off | ||
| LLeMbas: AI autocomplete on/off | ||
| LLeMbas: clear command history | ||
| LLeMbas: log in | lembas login, in a new tab. |
|
Ctrl+Shift+E |
LLeMbas: open LLeMbas IDE here | LLeMbas IDE in a new tab, in the pane's directory. |
| LLeMbas: set up (CLI and IDE) | Installs what is missing of the two (below). |
- A quiet window. With no configuration of your own there is no tab bar while a window has
one tab; from the second tab on it is a plain line of text at the bottom. Tabs are worked by
keys either way:
CTRL+SHIFT+Tnew,CTRL+SHIFT+Wclose,CTRL+TAB/CTRL+SHIFT+TABnext and previous,CTRL+SHIFT+1…9by number. The session bar below sits in that line, so it shows from two tabs on;config.hide_tab_bar_if_only_one_tab = falsein your own file keeps the line always. - Session bar. The right of the tab bar shows the model, mode, state and how full the
context is of the conversation in the tab you are in,
AI offwhen it is off, andprivatefor a private pane. A tab in which LLeMbas waits for you is marked with●, and what it asks is said at the cursor of your pane, with the keys that answer. - Its own everything. LLeMbas TTY installs beside WezTerm and shares
nothing with it: its commands are
llembas-tty,llembas-tty-guiandllembas-tty-mux-server, its configuration is~/.config/llembas-tty/llembas-tty.lua(or~/.llembas-tty.lua), and it neither reads WezTerm's files nor talks to a running WezTerm.
Set-up: the CLI and LLeMbas IDE
LLeMbas TTY is the terminal of a set of three: the terminal, the LLeMbas CLI (the engine) and
LLeMbas IDE (the editor). The other two are installations of their own — in your home
directory, updated by themselves (lembas update, llembas-ide update), and the same whether
you start them here or anywhere else. The terminal looks for lembas and llembas-ide on
your PATH and then in ~/.local/bin.
When one is missing, the palette entry LLeMbas: set up (CLI and IDE) — or llembas-tty-setup
in a shell — says which, and asks before installing each. It runs that product's own
installer from that product's own release, after checking it: the release's SHA256SUMS must
be signed with the LLeMbas release key and the installer must match it. Nothing runs as root
and nothing already installed is touched. A beta terminal installs the newest betas, a stable
one the newest stable releases (--channel stable|beta to say otherwise; --dry-run to see
what it would do; --no-cli, --no-ide).
What is passed on, what is kept, and when
With AI off: nothing, to anyone. With AI on, still nothing until you ask.
When you send a question (the two ask entries), LLeMbas is given, with it:
- the last 5 commands of that pane with the end of each one's output (200 lines or 16 KiB at most), and the pane's directory and shell. This needs the shell integration (below), which marks where a command and its output begin;
- without shell integration: the last screenful instead;
- from a full-screen program (an editor, a pager): only the directory, unless you chose ask about this screen.
Never: a pane you marked private, a pane that is asking for a password, a pane that runs on another machine, the scrollback as a whole, or anything at all while you have not asked. The context is written to a file only you can read, in the terminal's runtime directory; LLeMbas deletes it after reading it and the terminal removes any that are left after ten minutes.
While a conversation runs, LLeMbas can read the pane you asked from and type commands into it, by its own permissions: in manual mode it asks for each command first. That is the CLI's business; it never types at a password prompt.
AI autocomplete, when you turned it on: the line you are typing is sent to
lembas complete after a pause, when your own history has no suggestion for it — never an
empty line, a line that starts with a space, a private pane, or a shell on another machine.
What comes back is shown as text; nothing runs until you take it and press Enter.
Kept on this machine, sent nowhere:
- The command history behind the suggestions:
~/.local/share/llembas-tty/command-history, readable by you alone. One line a command the terminal saw run: when, its exit status, its directory, its text. Never kept: a line that starts with a space, a command of several lines, a command that was not found, anything from a private pane, and nothing you type while a program hides what you type (it is read from the screen, where such text never is). At most 5000 commands. To clear it: LLeMbas: clear command history, or delete the file. To keep none:history = { enabled = false }. It is the terminal's own; your shell's history file is never read. - The pane's status record, which the shell integration writes at every prompt: whether the shell is at its prompt or running a command, the last exit status, the time, the directory — not what the command was. It is how LLeMbas knows that a command it typed has ended. In the terminal's runtime directory, readable by you alone.
The session bar reads what LLeMbas itself tells the terminal about its session. It does not read the pane. The colours and the suggestion are drawn when a pane is painted: nothing is written into the pane for them.
Configuration
With no configuration file, the built-in one applies the layer with its defaults. Your own file — everything WezTerm's configuration can do, see https://wezterm.org/config/files.html — opts in with one line:
local wezterm = require 'wezterm'
local config = wezterm.config_builder()
require('llembas').apply(config, {
-- every line is optional; these are the defaults
enabled = true, -- false: no layer at all
ai = true, -- false: the terminal starts with AI off (the switch still works)
cli = nil, -- path of `lembas`; nil: PATH, then ~/.local/bin
ide = nil, -- path of `llembas-ide`; nil: the same two places
session_bar = true,
tab_marker = true,
palette = true,
bar = { fields = { 'model', 'mode', 'state', 'context' } },
-- also: 'session', 'title', 'effort', 'tokens', 'spend'
keys = { -- false turns a key off; any of them can be given a key
ask = { key = 'A', mods = 'CTRL|SHIFT' },
cli = { key = 'S', mods = 'CTRL|SHIFT' },
ai = { key = 'I', mods = 'CTRL|SHIFT' },
approve = { key = 'Y', mods = 'CTRL|SHIFT' },
deny = { key = 'J', mods = 'CTRL|SHIFT' },
stop = { key = 'G', mods = 'CTRL|SHIFT' },
display = { key = 'D', mods = 'CTRL|SHIFT' },
private = { key = 'H', mods = 'CTRL|SHIFT' },
ide = { key = 'E', mods = 'CTRL|SHIFT' },
ask_screen = false, always = false, new = false, model = false, mode = false,
},
display = { width = 0.33 }, -- of the pane it opens beside
mode = 'manual', -- the mode a display starts in; or 'auto'
context = {
enabled = true, -- false: questions go alone, nothing of the pane
blocks = 5, -- commands passed on (at most 20)
output_lines = 200, -- of each command's output, from its end
output_bytes = 16384,
alt_screen = false, -- true: also the screen of a full-screen program
},
suggestions = true, -- the rest of the line from your own command history
highlight = true, -- the command line in colours
autocomplete = false, -- AI: true, drawn by the terminal; 'shell', by the shell integration
history = { enabled = true, max = 5000 },
colors = { -- a number of your colour scheme's palette, '#rrggbb', or false
prefix = 6, ghost = 8, notice = 3,
command = 2, unknown = false, option = false, string = 3,
variable = 6, operator = 5, comment = 8, path = 4,
},
})
return config
The colours are numbers of your colour scheme's palette, so they follow your theme.
unknown — a command that is not found — is left alone by default, because the terminal
looks in PATH and does not know your shell's aliases and functions; give it a colour to
mark such words.
To have none of it: leave the line out of your file, pass { enabled = false },
or start with llembas-tty -n.
If your file sets its own right status or tab titles, turn session_bar or
tab_marker off, or call apply after your own handlers: the terminal uses
the first tab-title handler it was given.
Shell integration
The package installs it for bash through /etc/profile.d. For zsh, or after
unpacking the tarball, add to ~/.zshrc or ~/.bashrc:
[ -n "$LLEMBAS_TTY" ] && . /usr/share/llembas-tty/shell/llembas-tty.sh
It marks commands and their output for the terminal (WezTerm's own integration script, OSC 133 and OSC 7), writes the pane's status record, and does nothing outside LLeMbas TTY. The suggestions and the colours need it: it is how the terminal knows which cells are your command line.
On another machine, reached with ssh from a pane: copy llembas-tty.sh and wezterm.sh
there and source the first from that shell's rc file with LLEMBAS_TTY set (for instance
[ -n "$SSH_CONNECTION" ] && LLEMBAS_TTY=remote . ~/.llembas-tty.sh). Suggestions and
colours then work there too, drawn by your terminal; whether a command or a path exists is
not marked, since that is the other machine's to know.
The older autocomplete drawn by the shell itself (zsh shows it, bash completes on
Ctrl+X Ctrl+A) is still there as autocomplete = 'shell'.
Wez's Terminal
A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
User facing docs and guide at: https://wezterm.org/
Screenshot of wezterm on macOS, running vim
Installation
https://wezterm.org/installation
Getting help
This is a spare time project, so please bear with me. There are a couple of channels for support:
- You can use the GitHub issue tracker to see if someone else has a similar issue, or to file a new one.
- Start or join a thread in our GitHub Discussions; if you have general questions or want to chat with other wezterm users, you're welcome here!
- There is a Matrix room via Element.io for (potentially!) real time discussions.
The GitHub Discussions and Element/Gitter rooms are better suited for questions than bug reports, but don't be afraid to use whichever you are most comfortable using and we'll work it out.
Supporting the Project
If you use and like WezTerm, please consider sponsoring it: your support helps to cover the fees required to maintain the project and to validate the time spent working on it!
