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 the command is
placed at your prompt and not entered:
Enterruns it, you may change it first, andCtrl+C(or clearing the line) dismisses it — a dimmed hint beside it says so, and no approval card stands in the way. In auto mode the commands the CLI's rules allow are typed and entered without asking. (With a LLeMbas CLI older than 2.0.0-beta.20, manual mode asks in the display before typing:Ctrl+Shift+Yallows,Ctrl+Shift+Jdenies, from your own pane.) Whatever else LLeMbas asks — a question, a permission for a tool that is not the shell — stands at your cursor's row with the keys that answer it, until it is answered. 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 (LLeMbas: AI autocomplete on/off in the command palette; choose its model with LLeMbas: choose autocomplete model): when your history has nothing for the line, LLeMbas is asked after a pause and its answer shows in the same place, in italics. LLeMbas: autocomplete status says in words whether it is on, which engine and model it uses, and what the last attempts gave — a suggestion, nothing, a timeout, or the engine's own error sentence.
- suggestions: the rest of the line, dimmed after the cursor, from the commands this
terminal has seen you run.
- Your choices are remembered — for this machine, and for a working directory where you want it different there. See Settings below.
| 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 — here / — everywhere | 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 — here / — everywhere | The terminal's own chat model, from your server's list. | |
| LLeMbas: choose autocomplete model — here / — everywhere | The terminal's own autocomplete model. | |
| LLeMbas: choose mode — here / — everywhere | manual or auto. | |
| LLeMbas: display width — here / — everywhere | The display's part of the pane, from the next time it opens. | |
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 — here / — everywhere | ||
| LLeMbas: syntax highlighting on/off — here / — everywhere | ||
| LLeMbas: AI autocomplete on/off — here / — everywhere | ||
| LLeMbas: settings | What applies in this pane and where each value comes from; forgets this directory's own. | |
| LLeMbas: autocomplete status | The AI's autocomplete in words: on or off, engine, model, the last attempts. | |
| 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 a command is placed at your prompt for you to run, and only at an empty prompt — nothing is ever added to what you typed. That is the CLI's business; it never types at a password prompt. So that it knows your prompt is empty whatever your prompt looks like, the terminal writes, with AI on, a four-line input mark beside each pane's status record: which prompt it is of, and whether anything stands on its input line — never what.
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 of fewer than three characters, 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. The engine is given eight seconds for an answer
(autocomplete_timeout_ms), and twenty for the first one after you switch autocomplete on or
change its model: a model on your own machine may have to be loaded. The last few attempts — the start of the line, how long it took, what came back — are
kept in memory for LLeMbas: autocomplete status and go when the terminal closes.
Settings
What you switch and choose in the terminal is remembered: AI on or off, AI autocomplete, suggestions, highlighting, the mode, the chat model, the autocomplete model and the display's width. Each is in the command palette twice:
- … — here keeps it for the working directory of the pane you are in;
- … — everywhere keeps it for this machine.
A directory's own value wins over the machine's there. A key (Ctrl+Shift+I, or one you gave
to model or mode) keeps the choice here when this directory already has settings of
its own, and everywhere otherwise; the word shown at your cursor says which. The settings
of the directory of the pane you are in apply: change directory, or pane, and the
suggestions, the colours, the autocomplete, the model and mode on the ask line and what the
next display starts with follow.
LLeMbas: settings lists what applies now and where each value comes from — here (with the directory), everywhere, or the configuration — and has a line that forgets this directory's own settings.
They are kept by the LLeMbas CLI in its own directory on this machine (its README has the
path and the commands: lembas terminal settings), not in the working directory, and are
sent nowhere. Nothing is read until your first LLeMbas key or palette entry; once you have
chosen something through the terminal, they are read at the first prompt, so that they hold
from the start. The options in your configuration file are the starting values only: a value
you set through the terminal wins over the file, until you remove it (LLeMbas: settings,
or lembas terminal settings set … <key>=default).
With a LLeMbas CLI that has no such store (before 2.0.0-beta.20) everything works as before: a choice holds until the terminal closes, and the terminal says once that remembering it needs a newer CLI.
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,
},
-- (ai, mode, display.width, suggestions, highlight and autocomplete are starting values:
-- what you choose in the terminal is remembered and wins - see Settings)
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
autocomplete_timeout_ms = 8000, -- how long LLeMbas is given for the rest of a line
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!
