Terminal shell
A second front end: the same agent, sessions, and tools, rendered in a terminal
instead of a webview. The robi-api HTTP surface stays exactly as it is; the TUI
does not call it. It links crates/robi, builds the same AppState the API
builds, and drives the same services.
This is a surface page, like frontend-layout.md, not a
milestone. It adds no capability to the loop and changes nothing in robi-core.
It exists because the domain layer already separates a service from a controller,
so a second front end is a rendering problem and not a rewrite.
Phases are numbered T0–T6 rather than M-numbers, because they do not gate any M-milestone and no M-milestone gates them.
Scope is the chat surface only. Review and docs are not planned here. Both
are already off in the GUI — reviewScreen and docsViewer in
src/app/surfaces.ts, shipped as S2 and S5 in streamlining.md
— so a terminal copy would resurrect a surface the product has decided against.
git diff and the user’s own editor are the review path; the docs screen is not
replaced at all. The backend routes stay served, as they do for the web shell.
What this page does not cover
| Topic | Where it belongs |
|---|---|
| The turn lifecycle, approvals, tool execution order | agent-loop.md |
| The CloudEvents envelope, the bus, and the SSE route | events-sse.md |
The per-session actor and ChatRuntime | chat-runtime.md |
| Store, schema, migrations | persistence.md |
| What a tool card shows, and when approval pauses | chat-ui.md — the TUI reaches parity with it, and does not restate it |
| Theme tokens | visual-style.md. tui/theme.rs is its terminal peer |
| Crate layout and the process model | docs/src/design/core/architecture.md, still unwritten |
Problem
The agent is reachable only through a Tauri window. That costs a webview, a window manager, and a display for work that is mostly text: a transcript, a diff, a list of sessions. A terminal front end reaches the same sessions from a shell, over SSH, and inside an editor pane.
The naive implementations are both wrong:
- A TUI that speaks HTTP. It re-introduces the whole wire layer between two
processes on one machine, replaces
robi_core::message::Messagewith theChatMessageDTO, and stops working when the API is not running. - A TUI that re-implements the domain. A copy of the session lifecycle in a second binary, drifting from the first.
The reason neither is necessary: bootstrap::build_app_state is HTTP-free.
bootstrap::router is the optional half, and only robi-api and src-tauri
call it.
Decision
A module in crates/robi, a binary in the same package, behind a cargo
feature. In-process. Elm-shaped. One event subscription. Refetch, never append.
flowchart LR
subgraph P["one process"]
T[robi<br/>tui::app] --> S[bootstrap::build_app_state]
S --> D[domain services]
R[SerializedChatRuntime] --> A[Agent loop]
D --- R
A -->|BusEventSink| B[(EventBus)]
B -->|EventSubscription| T
end
AppState is the whole contract. Its fields — workspace_service,
chat_session_service, chat_message_service, settings_service, event_bus,
file_changes, mcp, originals, image_source — are the same handles
the Axum handlers take. A controller is State<AppState> plus Path plus Json;
the TUI is an Arc<AppState> plus a keymap.
One of those it never reads: docs_edits (no docs surface; see Deliberately
not planned). It stays in AppState because build_app_state is shared and
the HTTP routes still serve it.
Where it lives
A module, not a crate.
crates/robi/
src/tui/
mod.rs # run(): terminal lifecycle, the feature gate
app.rs # App, Msg, update()
action.rs # Action: the effect update() asks for
effects.rs # Action -> service call, on the runtime
keys.rs # (Mode, KeyEvent) -> Msg
command.rs # the built-in `/` commands, `/open` today
lifecycle.rs # init/restore and the panic hook
theme.rs # Style constants; the peer of visual-style.md
persist.rs # ~/.robi/tui.json
state/ # transcript, sessions, workspaces, composer,
# approval, prompt, confirm, status, detail
view/ # header, transcript, detail, composer, prompt,
# strip, sessions, workspaces
src/bin/robi.rs
Cargo.toml gains a feature and a binary:
[features]
tui = ["dep:ratatui"]
[dependencies]
ratatui = { workspace = true, optional = true }
[[bin]]
name = "robi"
path = "src/bin/robi.rs"
required-features = ["tui"]
ratatui and crossterm are declared once in [workspace.dependencies], per
the existing rule that versions cannot drift. Take crossterm from
ratatui::crossterm, not as a second direct dependency: ratatui 0.30 pins its
own and a second version in the tree fails to typecheck on KeyEvent.
Why not a crate
The rule in AGENTS.md is to add a module and split only for one of four
reasons. Only the second applies — a heavy, optional dependency — and a cargo
feature isolates it just as well without moving code:
robi-apiandsrc-taurido not compile ratatui, because they do not enabletui.cargo tree -p robi-coreis unchanged. That is the audit that matters.- No item becomes
pubonly so a second crate can reach it.tuiispubso the binary can calltui::run, which is a real entry point.
Promote to crates/robi-tui when one of these is true, and not before: the M8
headless robi-cli needs the same module (the split AGENTS.md already
anticipates, “a new binary with no code moved”); the TUI’s tests need to run
without the web stack; or a measured build cost appears. The promotion is a move
plus a manifest, because the module is already shaped like one.
Rejected instead of a new crate now: robi-index and robi-lsp were the
splits with a real dependency argument, and both are deleted with M7. A crate
for one binary that depends on crates/robi in both directions is the “split
that happened too early” anti-signal.
Process model
In-process, no listener, no port. robi shares ROBI_DATABASE_URL with
robi-api and src-tauri, so all three see the same sessions. With that
variable unset it opens the desktop app’s database — the app’s own in a release
build, the dev one in a debug build, which is the condition
src-tauri’s is_dev() applies. The rule is in bootstrap::desktop_database_url,
and file-locations.md states it for users.
Distribution
Each release carries a tarball per target, beside the desktop bundles:
| Asset | Target | Runner |
|---|---|---|
robi-v<X.Y.Z>-aarch64-apple-darwin.tar.gz | arm64 macOS | macos-latest |
robi-v<X.Y.Z>-x86_64-unknown-linux-gnu.tar.gz | x86_64 Linux | ubuntu-22.04 |
Each holds one directory, robi-v<X.Y.Z>-<target>/, with robi and LICENSE.
checksums.txt on the release covers them with the bundles.
The Linux tarball is built on 22.04, which sets its glibc floor at 2.35, so one
file runs on 22.04 and 24.04 both. Nothing in crates/robi needs more: SQLite is
bundled, reqwest is rustls, and bollard is pure Rust. The desktop bundles
still build on 24.04, and a binary that needs the system’s WebKitGTK is why they
are separate.
Only tui is enabled: the gated workstreams are the restore path, so the shipped
binary is the default harness. The binary is stripped, and on macOS re-signed
ad-hoc after stripping, because strip voids the signature ld64 wrote and an
arm64 binary without one does not run. Nothing is notarised, so a downloaded
macOS binary needs xattr -d com.apple.quarantine.
--version on the packaged binary is the release smoke test: it proves the
tarball runs and that the tag and CARGO_PKG_VERSION agree.
The workspace argument
robi [PATH]
PATH is the workspace the process opens, and it is the answer to which
sessions the reader starts with: the remembered workspace from tui.json is not
a fallback. Without an argument the path is the working directory, so
cd ~/code/pocket && robi and robi ~/code/pocket are the same session
list. The argument is canonicalised before it is compared, because the store keeps
a canonical root and one directory has many spellings.
A path with no workspace row behind it is a prompt, not a silent fallback to
some other workspace: No workspace at this path. with the path under it, and two
answers — y creates the workspace there (open_workspace, the same call the
POST /workspaces route makes), n opens the switcher so an existing workspace
can be chosen. Opening anything else on the reader’s behalf would show them a
session list that is not the one they asked about.
The switcher opens over the question, not instead of it. n pushes the
workspaces overlay on the mode stack above workspace-missing, so the question
stays the page: the panel draws over it, dimmed, without its y/n line because
the panel owns the keyboard. Esc closes the panel and returns to the question;
choosing a row — or creating one from the panel’s create screen — pops both. The
first cut left the question first and opened the overlay in the chat, so
Esc-ing the overlay landed the reader in a chat frame with no workspace, no
session, and no way to answer.
Two flags and one path, not a flag set:
-h, --help Print the help and exit.
-V, --version Print `robi <version>` and exit.
-- Treat every later argument as a path.
-- exists so a directory whose name starts with a dash has a spelling. A second
path is a mistake worth naming on stderr before the alternate screen, because a
terminal that ignores an argument opens the wrong chat. Everything is parsed
before the terminal is taken raw, and before the TTY check, so robi --version | cat works. A usage error exits 2, to tell it apart from a run that started and
failed.
args::parse in tui/args.rs returns the decision; bin/robi.rs owns the TTY
check, the logger, and the exit code. The split is what makes the flags a unit
test rather than a terminal session.
SerializedChatRuntime is per-process and in memory: running_session_ids is
not persisted, and an actor belongs to the process that started it. Two front
ends on one database therefore mean two runtimes, which can drive two turns on
one session.
Ownership across processes is a per-session lease, not a database lock: the TUI
takes Open on the session it displays and Turn through the runtime, so a
second process may read that session and may not submit to it. The lease, the
redb handle invariant it depends on, and what parallel processes still share
are in parallel-front-ends.md.
Two terminals in one workspace are allowed. There is no ~/.robi/tui.lock:
the whole-home lock is gone. A session another process owns still renders — its
transcript, tool names, arguments, and statuses come from the chat database —
and each tool result it holds is replaced by open in another process (pid N),
with the same sentence in the footer. A submit to that session is refused with
Conflict, which reads as a footer notice naming the pid, and the draft stays in
the composer.
The loop
self.view(&App) is a pure function of state. update() is a pure function
(State, Msg) -> (State, Vec<Action>). Effects run on the runtime and report
back as a Msg. The four sources feed one select!:
#![allow(unused)]
fn main() {
loop {
tokio::select! {
Some(msg) = input.recv() => app.update(msg),
Some(env) = events.recv() => app.update(Msg::Agent(env)),
_ = tick.tick() => app.update(Msg::Tick),
Some(done) = results.recv() => app.update(Msg::Done(done)),
}
for action in app.take_actions() { effects::run(&state, action, &results); }
terminal.draw(|frame| app.view(frame))?;
if app.should_quit() { break; }
}
}
ratatui::crossterm::event::read blocks. It cannot run on the runtime: it would
hold a worker for as long as the user takes to press a key. A dedicated
std::thread reads events and sends them into a bounded(64) mpsc. A resize
event arrives on the same channel.
Interfaces
#![allow(unused)]
fn main() {
pub fn run(state: AppState, options: Options) -> std::io::Result<()>;
pub struct App { /* AppState, view state, mode stack, actions */ }
pub enum Msg {
Key(KeyEvent),
Agent(EventEnvelope), // what the bus carries
Tick, // 250 ms: spinners, elapsed, catch-up
Done(ActionOutcome), // one effect finished
Resize,
}
pub enum Action {
Submit { session: SessionId, text: String, files: Vec<FileAttachment> },
StartSession { workspace: WorkspaceId, text: String, files: Vec<FileAttachment> },
Decide { session: SessionId, call: ToolCallId, decision: Decision },
Stop(SessionId),
Compact(SessionId),
Reload(SessionId), // refetch the transcript
LoadMessage { session: SessionId, message: MessageId },
Rename { session: SessionId, title: String },
Delete(SessionId),
Create,
LoadSettings { generation: u64 },
SaveSetting { key: &'static str, value: Option<String> }, // from the surface's table
LoadMcpConfig { workspace: WorkspaceId },
OpenFile { path: String, line: Option<u32> },
}
impl App {
pub fn update(&mut self, msg: Msg);
pub fn take_actions(&mut self) -> Vec<Action>;
pub fn view(&self, frame: &mut Frame);
pub fn should_quit(&self) -> bool;
}
}
Every Action names a service call. effects::run is the only module that
touches AppState, and it is the only place a .await exists:
Action | Call |
|---|---|
Submit | chat_message_service.submit_instruction, after image_source.store for each pending image |
Decide | chat_message_service.decide_tool_call |
Stop / Compact | chat_message_service.stop / .compact |
Reload | chat_message_service.list_messages |
LoadMessage | chat_message_service.get_message |
RenameSession / DeleteSession / StartSession | chat_session_service.*; StartSession creates the row and submits the first message in one effect, and a delete stops the turn first, as the route does |
LoadWorkspaces / CreateWorkspace / DeleteWorkspace | workspace_service.*; a delete closes that workspace’s MCP connections |
LoadSessions | list_chat_sessions plus running_session_ids |
LoadMcp / FocusMcp | mcp.status / mcp.focus, the peer of GET/POST /workspaces/{id}/mcp |
Probe | list_workspaces inside a three-second timeout: the strip’s health mark |
CompletePath | the tools’ resolver, then one read_dir, directories only |
LoadSettings | settings_service.get_many, with each secret reduced to configured |
SaveSetting | settings_service.set / .remove; the secret flag is re-read from known_setting, never carried on the action |
LoadMcpConfig | workspace_service.get_workspace, then McpHub::config_files on blocking::call; the file text is dropped |
Attach | resolve, read, sniff, slice, and classify one file the reader named |
OpenFile | the lifted file opener: configured file_open_command only |
SubmitOutcome::AwaitingApproval is unreachable from the real runtime — nothing
constructs it outside web_api’s mapping, which turns it into a Conflict — so
the terminal keeps the arm as a defensive no-op. A paused turn is answered on the
selected card, not by a modal.
State ownership
The transcript is not built from deltas. message_delta moves the phase to
Responding and no more; message_added, message_updated, and
tool_call_updated mean refetch that row. This is the rule the web shell already
follows, and in a TUI it is load-bearing rather than tidy: the bus drops a queued
message_delta when a subscriber falls behind (make_room in domain/events),
so a transcript rendered from deltas silently loses tokens.
Two refetches of one URL can be in flight together, so each Action carries the
generation it was issued at, and a Done whose generation is stale is dropped.
The GUI solves the same problem with an epoch in useAgentEvents; the mechanism
is the same and the reason is not obvious, so it is written here.
State lives in one of three places, and nothing is duplicated between them:
| Where | Holds | Survives |
|---|---|---|
AppState services | every domain fact | restart |
App | the mode stack, scroll offset, composer buffer, expansion flags | the process |
~/.robi/tui.json | workspace, open session, expansion flags, layout | restart |
Parity map
Every GUI surface that is on today, its TUI form, and the phase that lands it.
The two surfaces the GUI has switched off — reviewScreen and docsViewer in
src/app/surfaces.ts — are out of scope here as well, so a TUI flag is not
needed for them; see Deliberately not planned. The index status is gone with
the index itself, so nothing in the frame carries an index line.
| GUI surface | TUI form | Phase |
|---|---|---|
Transcript + AssistantMarkdown | scrollable buffer, turn-grouped, styled spans; every message railed in the ink of the mode that produced its turn | T1, T4 |
Composer textarea, drafts per session | text area, draft kept per session in App, in memory | T1 |
| Send / Stop button | Enter / Esc (Ctrl-C also stops) | T1, T2 |
ActivityLine, streaming | status strip above the composer: Thinking for 4s and animated dots, at the end of the transcript | T1 |
Turn footer Worked for … | one gray row under each closed turn, from the turn’s first and last message ids | T3 |
ToolCallCard and its six variants | one background band per call, no border, muted heading and $; the per-variant bodies, and Enter on the selected card opens the whole body in a scrollable detail view | T2 |
| Approval buttons on a card | in-transcript: a / r / A act on the selected card, with the reason as a one-line prompt | T2 |
RecentsMenu (filter, rename, delete) | sessions overlay: filter-as-you-type, running spinner, waiting dot, Ctrl-R rename, Ctrl-D delete behind a confirm; New session… is the first row | T3 |
WorkspaceSwitcher | workspace overlay: the eight most recent, then Manage workspaces… and New workspace… | T3 |
WorkspacesPage | manage view: every workspace with its own filter and remove, Ctrl-N to create; the create screen’s typed path with directory completion | T3 |
robi workspace argument | robi [PATH], the working directory by default; a path with no workspace is a prompt, not a fallback | T3 |
ErrorNotices, ApiStatus | status strip above the composer: ! <error>, ! health: …, sending…, stopping… | T3 |
| MCP marks in the tray | one word at the header’s right edge: MCP Online / MCP Failed (per-server detail later) | T3 |
| New chat | Ctrl-N: the landing page, and no session until the first message | T3 |
EmptyGreeting + welcome composer | the landing page: the greeting centred in green, the composer under it | T3 |
Mode ChoiceMenu | Ctrl-T cycles, /mode names one; the word and the rail colour are the state | T4 |
ModelEffortMenu | Ctrl-M: one overlay with a model group and an effort group, Use default in each | T4 |
SkillMenu | @ completion over the composer, with · manual and scope; accepting leaves @id | T4 |
ContextMeter | the token count at the right edge of the composer’s facts row | T4 |
| Compact | Ctrl-L or /compact, behind a confirmation; divider row on transcript_compacted | T4 |
| Composer command surface | /models, /sessions, /workspaces, /new, /rename, /mode, /compact, /help — each a keybinding’s twin | T4 |
Nothing (the design promised ?) | ? from the transcript, or /help: a page of every key and command | T4 |
| General settings | settings surface, section rail | T4, T5 |
| Model provider settings | settings surface, secrets masked | T5 |
| Permissions settings | settings surface, two toggles | T5 |
| Sandbox settings | settings surface, six fields and two choices | T5 |
| MCP settings | settings surface: servers, the two config paths, trust, logs | T5 |
| Audit log | settings surface: a paged service-call table, Enter expands a body | T5 |
Composer attachments | /attach and /detach; images by path | T6 |
MermaidDiagram | source fence | T6 |
OpenedFile, openWorkspaceFile | /open <file>, configured program only | T6 |
Phases
T0 — Skeleton and the pump
Goal — a terminal app that renders a real transcript and nothing else.
-
tui/mod.rs::runowns the terminal:ratatui::init, a panic hook that restores before the message prints,ratatui::restoreon every exit path. -
bootstrap::build_app_statefor state. Nologs::init()as-is: a debug build writes tracing to stderr, which corrupts the frame.logs::init_tuiis the same file layer with no stderr layer in any build, and its files are namedtui-<timestamp>.logso a TUI run is distinguishable from the app’srobi-api-/robi-dev-files in the same directory. Pruning is per prefix, so a TUI start never deletes the app’s logs. -
The four-source
select!, the input thread,Msg,Action,effects::run. -
state/transcript.rs: turn grouping, follow-the-bottom with a scroll lock that yields onPageUpand re-arms at the bottom. -
theme.rsfromvisual-style.md’s tokens, so the two front ends stay one product. -
A
TestBackendharness: renderApp::viewinto a buffer and assert on a string. This is the TUI’s test strategy from the first commit. -
Every message and every tool call is a band: a raised surface with a one-cell rail on its left edge, one cell of horizontal padding, and one row of padding above and below. The rail is the only vertical rule in the transcript itself; the scrollbar, when there is one, sits in the gutter beside it. — there is no drawn border, so the band contrast plus the rail is the whole affordance. The rail’s colour is what identifies the block. The rail cell itself is
\u{258d}(left three-eighths block) rather than the hairline│: one box-drawing line is nearly invisible at a normal cell size, and the rail is what a reader scans for. A block glyph costs the same one cell, so the wrap width, the band width, and the scroll arithmetic are unchanged, and the colour is still the whole signal — the glyph only decides how much ink it carries.Block Band Rail User message --bg-user--accent(blue)Tool call --code-bg--ink-faint(gray)Composer --bg-surface--accent(blue)A user message is therefore a full-width band with the text left-aligned, not a right-aligned capsule. The blue is the transcript’s one piece of state: the user’s own turn. Machinery is gray. The composer wears the blue rail too, because it is the user’s turn before it is sent — the same column, the same accent, so the two read as one thing at either end of the transcript — and one row of canvas separates it from the transcript above, so the last row of prose never reads as part of the band.
-
A tool call’s card reads, in order:
│ │ # shell │ │ $ cd /pocket && php artisan migrate --no-interaction │ │ INFO Running migrations. │The heading is
#then the call’sdescriptionargument or the tool’s name, in--ink-muted. A shell call withunsandboxed: trueappends· unsandboxed, so the one property that changes what the command can touch shows without opening the card:# shell · unsandboxed. A blank row separates it from the contents; the subject line is$ command, with the$muted too and the command in the card’s ink; a second blank row precedes the output. The output is not indented past#or$— all three start in the same column, so the card reads as one block rather than a nested list. At mostMAX_TOOL_OUTPUT_LINES(6) lines of the result show, the cut counted as… (+N more lines). One blank row also separates every block, and that one comes frombuild_rowsalone, so inter-block spacing is uniform no matter what a block does inside its own band. T2 replaces the output per variant and adds expansion.
Exit — cargo run -p robi --features tui --bin robi shows the most recent
session of the active workspace, scrolls, and quits cleanly. One snapshot test
renders a two-message transcript.
T1 — Send, stream, stop
Goal — the M2 exit criteria, in a terminal.
- Composer:
ratatui-textareaon a--bg-surfaceband wearing the same blue rail as a user message, two cells of horizontal padding inside the field, and one blank row of canvas above the band.Entersends,Ctrl-Jinserts a newline (Alt-Entertoo, where a terminal reports it as one key — T2 bindsEsc, so theEsc,Enterambiguity is whyCtrl-Jis the documented one). Draft per session, in memory, keyed the waycomposerDrafts.tskeys it. A failed send restores the buffer and attachments. message_delta→ phase;message_added/message_updated/tool_call_updated→LoadMessagefor that row;turn_finished→ reload, then idle. Deltas never write text.Ctrl-CsendsStop(T2 addsEscas the same interrupt); a cancelled turn leaves a resolvable transcript, so the view reloads rather than truncating.- Phase, elapsed, and a caret at the end of streaming text. The phase is the
status strip above the composer —
Thinking for 4swith the webview’sThinkingDots— not a header segment; T3 moved it there with every other status. - Assistant prose rendered as markdown — headings, lists, tables, fenced code,
links, quotes, GFM alerts — through
tui-markdown, styled fromtheme.rs. - Scrolling:
↑/↓(when the composer is empty or the transcript has focus),PageUp/PageDown,Ctrl-U/Ctrl-D,Home/End, and the mouse wheel. The wheel is enabled next to raw mode and turned off before the alternate screen goes. - The status strip’s progress widget: eight cells with one moving head, at the right edge of the strip above the composer, shown only while a turn runs or a stop is in flight. T3 moved it there with the rest of the status.
- The 2-second catch-up: while a turn is busy and no frame for the open session
has arrived, reload. Elapsed time and the quiet stretch are counted in 250 ms
ticks, not wall clock, so
updatestays a pure function. - A send while a turn is running interrupts and queues, as it does in the
GUI. T1 refused it, on the theory that
Entermid-stream more often means “newline” in a terminal; T2 reversed that, because refusing made the terminal disagree with the product in a way the user had to discover.ChatRuntime::submitalready replaces a pending instruction, so nothing had to be built.
Exit — send a message, watch it stream, stop it, quit, restart, find the
session intact. The turn ran through SerializedChatRuntime and the real
provider.
T2 — Approval and tool cards
Goal — the loop’s pause invariant, made visible and unmissable.
- A pause takes the keyboard, off an empty composer. When a call starts
waiting, the card is selected and focus moves to the transcript, so the first
aanswers the question instead of landing in a message. It only does that when the composer is empty: a draft is the reader’s work in progress, and an arriving pause is no reason to take the caret out of it. With a draft the card is still selected and its rail still says it needs an answer, and the keyboard is oneTabaway. A detail view or a reason field the reader opened is never interrupted, and a second call in the same batch follows the same rule. - A waiting card wears an orange rail and moving dots. The rail column every
card row shares is
--attention(#e39a3c, the same value as--mode-plan, under its own name) while the call ispending,not_started, and the turn is idle, and the quiet--ink-faintotherwise. The idle half is the peer ofneedsDecisionintoolCallView.ts, and without it the rail was wrong for every call between the model’s response and its own execution: that is exactly thepending+not_startedstate, because that is how a model’s request arrives. A shell command that runs without asking wore the rail and the label of a question for the whole of that window. The label row reads waiting for approval followed by one, two, or three dots, advancing once a second — four 250 ms ticks a step, so a full cycle is three seconds. A quarter-second flicker reads as machinery waiting on itself; a slow, even beat reads as a prompt. That is what makes a pause visible when it is not the selected card: the selection only ever marks one block, and a pause can be anywhere in the transcript. A card in the running window says running… instead, and its heading readsshell · runningrather thanshell · not started: the turn is what the reader is watching, and a call that is next in line is not a call that has stalled. The phase is what tells those two apart, so a session switch has to rebuild it: an opening session whose actor is still live opens atThinking, fromApp::running— the same set the list read fills — rather than at idle. The frames that would have set it belong to the session that was on screen, and a phase left at idle drew the in-flight call of a running turn as a question. For the same reasonturn_startedandturn_finishedkeepApp::runningcurrent for a session that is not on screen, so a switch does not have to wait for a list read to learn whether the actor is still there. - The dots are painted, not stored. A row whose text changed every second would
rebuild and rewrap the transcript once a second, and the scroll offset would
twitch. The dots play into the band’s own padding instead: the view rebuilds the
label from
WAITING_LABELplus a fixed three-cell dot field, andband_linepads the result to the content width. Fixed field, not appended dots, for one reason: the first dot has to stay in its column, so growing to two and three extends rightwards instead of shifting what is already on screen. Editing the padded row text in place — the first attempt — made the rowwidth + dotscells long, and the band’s fill saturated to nothing. The clock is a tick counter onApp, never the wall clock, soupdatestays a pure function of the messages it has seen andviewa pure function of the state. - The activity line’s dots sit in the same fixed field.
Thinking for 4s .keeps its column as the marker advances, for the same reason as the waiting card’s: a fixed three-cell field after the text, never appended dots. The line used to be a right-aligned header segment; T3 moved it to the strip above the composer, where the webview puts it, and the header’s right edge now carries the one-word MCP summary instead. - A selected block is lighter than the rest. Every row of it is painted on
--surface-hoverand filled to the frame’s content width, so a message, a paragraph, and a card all read the same way. This replaced a▸on a card’s heading, which was too quiet and left prose with no mark at all. The foreground is kept — a heading stays muted, a diff stays green and red — because only the background is saying “this is the one the keys act on”. - The arrows select; a key acts on the selection. With the transcript
focused,
↑/↓(andj/k) move a selection over the transcript’s blocks. A block is a user message, an assistant prose run, or one tool call — so every card, pending or finished, is addressable. The selection is aBlockRef(message, optionalcall), keyed on the message id rather than a row offset, so it survives a rewrap, a reload, and a row arriving underneath it. - There is no modal. T2 shipped one because the GUI can disable a composer and
a terminal cannot. Selecting in the transcript replaces it: the pause is state
(
Approval), not a mode, and nothing covers the frame. What replaces the modal’s visibility is that a pause takes the selection to the waiting card — without that, a pause arriving mid-transcript would be invisible. - The footer hint is contextual, because the actions are: a selected pending
card offers
a approve · r reject · A approve all · Enter open · Ctrl-C decline, a finished card offersEnter open, and nothing selected shows the composer’s keys. A hint that offered approval on a card that already ran would be a lie the user has to test. Enteropens a card in a detail view: the whole body, uncapped (the band stops at forty lines and an edit at twenty-four), its own scroll,Escback with the selection where it was. On a prose block it does nothing — a message has no second view. The body is wrapped toview::content_widthwhen the view opens and again onMsg::Resize, because aParagraphwithout.wrap()truncates: one long shell command ran off the right edge and its tail was unreachable. Rows are built in the state, sooffsetcounts rows and the1-22 of 83position stays honest.- In-card expansion is dormant. The detail view replaced it: growing the band
in place could push the turn it belonged to off the screen.
Render.expanded, thetui.jsonkey, the expanded branch and the expanded shell/MCP original fetch stay in the code behind#[allow(dead_code)], so re-enabling is deleting a marker. Nothing toggles them, so the set stays empty and no original is fetched for them. - A send interrupts and rejects, like the webview. There is no busy refusal
and there is no pause protection:
ChatRuntime::submitreplaces a queued instruction (interrupt_if_running), andAgent::user_inputrejects a paused turn’s waiting calls with “the user sent a new message” before appending. The terminal now inherits both rather than disagreeing with them, and clears its own pause state as soon as the send is taken. - Card variants, matching
ToolCallCard: edit diff, shell, MCP, retrieve, delegate steps, generic. An edit shows the four changed lines it is asking about, or the result’s patch once it has run. A shell or MCP card shows six lines; the detail view is what shows the rest, so an opened card no longer fetches anything by itself — opening the view does, throughOriginalStore::lookup, the same bodygetToolOriginalserves the GUI. - A card’s line stops at two frame widths. Lines are wrapped, not counted, so
a cap on lines said nothing about a result that is one enormous line: a JSON
body, a minified bundle, or a base64 blob arrived as a single line of thousands
of cells and wrapped into dozens of rows of one band, pushing the rest of the
turn a page away. Every line the band draws — heading, subject, and body —
is cut to
CARD_LINE_FACTOR(2) times the frame width, with…as the mark, and the cut is measured in cells so a run of wide characters cannot overflow the frame. Two widths is long enough to read the shape of the line and short enough that one result cannot own the transcript. The cut belongs to the collapsed card only:Enteropens the detail view, which builds its own lines fromtool_card::full_bodyand draws them whole, so the full context is always one key away. - A retrieve card shows no output at all. Its body is a page of another
call’s log, so the transcript is the wrong place for it: the card keeps the
window —
# retrieveover> 0193a1b2 stdout, the id and the stream — and one muted… Enter opens the output. The page is built only bytool_card::full_body, the uncapped form the detail view calls, so the two cannot drift apart, and the transcript pays nothing for a log it would have had to truncate anyway. awaiting_approvalwhile the window is unfocused → terminal bell, and the title becomes robi — approval needed either way. No OS notification; that is Tauri-only. Focus reporting is optional (DECSET 1004), so a terminal that does not implement it simply never rings.- A pause is not the end of a turn. The loop emits
awaiting_approvaland thenturn_finishedwith outcomepaused, because the actor really does exit. That frame must not close the pause: the transcript is parked, not finished. - A pause is entered from the transcript as well as from the frame. Reopening
a session paused by an earlier run — a restart, or a switch back to it — selects
the waiting card the same way a live pause does, from the loaded transcript.
Without that, a pause on screen had no way in from the keyboard, and the only
remaining answer was “send a message to clear it”. The list is
pendingapproval withnot_startedexecution, which is the same predicate the loop uses, so a call that ran without asking is never a prompt. Idle only: after a decision the phase isThinking, so a reload still in flight cannot re-list a settled call.
Exit — a turn that needs approval selects its waiting card, a or r on it
decides, and the turn resumes; a refusal reaches the model as a structured
rejection. That is Event::AwaitingApproval →
ChatMessageService::decide_tool_call → Event::ToolCallUpdated in
agent-loop.md.
T3 — Sessions and workspaces
Goal — you can get to any session without the mouse. Done.
- Sessions overlay on
Ctrl-S: a filter field with the keyboard, arrows over the rows,Enterto open,Ctrl-Rto rename,Ctrl-DorDelto delete behind a one-line confirmation. Each row carries one cell of state: a braille spinner while the actor runs, an--accentdot while the turn waits on approval.New session…is the first row, so a fresh chat is the first thing under the cursor when nothing is open, andEnteron it creates one.Enteron the session that is already open still issues a read: “open” always means “show me this transcript”. - Workspace overlay on
Ctrl-W: the eight most recently selected workspaces followed byManage workspaces…andNew workspace…. The create screen is a typed path with directory completion onTab. The GUI’s folder dialog has no terminal equivalent, so the path is resolved with the tools’ own resolver (~, relative, absolute) and handed toopen_workspace, which still refuses a path that is not a directory. - Managing workspaces is a view (
modemanage), not a screen of the switcher: every workspace, filtered, with remove behind the confirmation, andCtrl-Nto create. A menu is a thing you leave in one keystroke; reading paths and deleting rows is a place you stay. - Panels erase what is under them. A
Blockpaints a background colour but leaves the characters, so an empty transcript’s centred sentence read through the switcher. Every panel clears its rectangle first, and every list row is painted with its background applied after the text style, so a selected row is one unbroken band — including the two action rows, which the theme helpers were silently cancelling to canvas. robi [PATH]— the process opens the workspace atPATH, or the working directory. A path with no workspace is a prompt (ycreate,nswitcher over the question), not a fallback to whichever workspace an earlier run left open; see The workspace argument.Ctrl-Nopens the landing page and creates nothing. A workspace with no session open shows the webview’s welcome: the time-of-day greeting (Good morning/afternoon/evening, in--mode-askgreen) centred above the composer. The session row is created when the first message is sent —Action::StartSessioncreates and submits in one step — so opening a workspace, reading the list, and leaving never leaves an empty chat behind. A failed first send keeps the row and puts the text back in the field.Ctrl-Rrenames the open one.- A status strip above the composer:
! <app error>,! health: <reason>from alist_workspacesprobe every five seconds, and the turn’s own activity. The HTTP health route is not called: the terminal does not speak HTTP, and a store that answers is the fact the route is standing in for. - The frame keeps one blank row above the header and one below the hint
(
view::FRAME_PAD), and one between the composer’s underside and the hint. Chrome that touches the terminal’s edge reads as cut off rather than placed; the transcript pays for those rows out ofbody_height. - One faint row of
\u{2500}under the header, exactly the content width: the frame draws no other border, so a single line is enough to say the bar above is chrome and the page below is the conversation. - A one-word MCP summary at the header’s right edge —
MCP Online,MCP Failed,MCP Starting,MCP Offline— because a terminal tray would cost cells and say less; a status surface can carry the per-server detail later. - A gray
Worked for 2m 5sunder every closed turn, the webview’s turn footer, computed from the turn’s first and last message ids. robi.session.v1.*frames refetch the list and never the transcript;robi.mcp.v1.statusrefetches the marks for the active workspace.- Choosing a workspace also focuses its MCP servers once, the peer of
focusOpenWorkspaceinworkspaceStore.ts, so the marks have something to report without waiting for a turn.
Exit — create a workspace by path from inside the TUI, create and rename a session, delete one, and see a second one marked running while a turn is in flight.
T4 — Modes, model, effort, skills, context
Goal — everything the composer carries, minus attachments. Done.
- The facts row is the composer band’s last row:
Agent · GLM-5.3 · OpenCode Go · Highon the left, the token meter on the right. It is the rowview/composer.rsalready reserved as the band’s bottom padding, so the band does not grow and T3’s layout is untouched. See The composer band. - The rail is the mode. Agent
--accent, ask--mode-ask, plan--mode-plan, on the user band and the composer — not on the assistant’s reply, which is the model’s output rather than a statement of mode. The colour follows the mode a message was submitted under, so a plan-mode message keeps its orange afterCtrl-T; see The mode on the rail. Ctrl-Tcycles ask → plan → agent, writingmodeon the session row or the draft when there is no row yet.Ctrl-Mopens one picker overpickable_models—tool_capable()filtered by the provider-enabled settings, the same function/api/v1/modelscalls. That helper is lifted, not copied; see Gaps. Effort comes first: three fixed rows should not sit below thirty models.- Two sigils.
@completes this workspace’s skills (· manualand scope) and leaves@id;/completes commands, and each one is a keybinding’s twin. See The two sigils and Composer commands. - A leading
@or/that names nothing is refused without being sent, and the field keeps its text. - The meter is
contextUsage.ts’s estimate, ported;Ctrl-Lcompacts behind a confirmation, and the divider appears ontranscript_compacted. ?from the transcript, or/help: a page of every key and command, sectioned, with its own scroll. The key was documented since T0 and never mapped.
Exit — cycle the mode mid-session and watch the band and the new turn’s rail
change colour while the earlier turns keep theirs; pick another model and put it
back with Use default; type @ and accept a skill; send, press Ctrl-L, answer
y, and see the divider and a smaller meter; type /nope and get a refusal with
the text still in the field.
T5 — Settings
Goal — configure the app without leaving the terminal. Done.
- One surface, six sections, in the GUI’s row order: General, Model
providers, Permissions, Sandbox, MCP, Audit log. The rail is the nav;
h/l(or←/→) move it andj/kmove the row. See The settings surface. - A field is explicit, because a terminal has no blur.
Enteropens an editor band,Enterapplies,Escreverts. A toggle flips and a choice advances onEnterat once, since there is nothing to type. An empty buffer clears the key — except on a secret, where the service refuses to remove one, so an empty buffer leaves the stored credential alone. - A secret is one bit.
effectsreduces a credential read toconfigured: boolbefore the outcome exists, so the plaintext never entersApp; the row draws••••••••, and the editor band starts empty. - The audit log is the TUI’s own, not a lift: the webview records HTTP with an
openapi-fetchmiddleware, and the terminal records service calls ineffects::dispatch. See The audit log. - A write is followed by a read.
saved · Modelappears over the surface, and bothLoadSettingsandLoadModelsare re-issued; a refusal reverts the row and shows the service’s own sentence.
Exit — set an API key from the TUI, press Ctrl-C twice (Esc out of the
surface first, or let the second press leave the process), start a turn that uses
it. Then set max_iterations to abc and watch the row revert with the service’s
own sentence under the table.
T6 — Attachments and the graphical remainder
Goal — close the parity gap on the chat surface, and name what is permanently out. Done.
- Attachments are two commands, not a menu.
/attach <path>reads one file into the composer;/detachtakes every one off and/detach <name>takes one. An@file picker was the plan and was dropped: a command takes the path the reader meant without a per-workspace file index, a relaxed@token rule, or anignorewalk behind the menu — and the line they typed is its own record of what was attached.@stays skills-only. - A path may be relative,
~, or absolute. Relative resolves against the workspace root; an attach outside it lands aspath: None, name only, because an explicit attach is the consent and the GUI’s picker does the same. - Text or image is decided by the bytes. An image signature is an image
(10 MiB) with its bytes still bound for the model; otherwise the NUL-and-UTF-8
rule makes it text (64 KiB).
MAX_ATTACHMENTS,MAX_TEXT_FILE_BYTESandMAX_TEXT_TOTAL_BYTESare the GUI’s numbers, now shared throughdomain::chat_message::attachmentrather than restated. - A path may carry
:start-end./attach src/app.rs:40-80attaches those lines, which is how a file over the text cap gets in at all; the chip says(40-80)and the model’s block sayslines="40-80". A clamped tail reports the lines it actually took. - Images by path: no thumbnail, a
[image name, 1.2 MB]chip in the composer. The bytes still travel to the model, and the transcript shows[image, image/png]— the stored attachment is an id and a media type, so the name and weight are the composer’s. Backspaceon an empty field takes the last attachment off, the peer of the GUI chip’s×;/detachis the spelling that names one.- Mermaid fences render as source with the language on the fence line, never as a diagram.
- Opening a file is
/open <path>and nothing else. The command resolves the path inside the workspace and hands it to the configuredfile_open_command. It never falls back to$EDITOR, never suspends the terminal, and never opens anything in-process: when no command is configured it says so and stops, which is the same refusalPOST /workspaces/{id}/openreturns. A terminal user sees the file in the editor they already chose for the GUI. - Both lifted, in the same change, with the
web_apicallers switched over — see Gaps to lift out ofweb_api.
Exit — /attach src/error.rs, send it, see it in the user message and in the
model’s context; /attach shot.png and see [shot.png, 1.2 MB] with the bytes
reaching the provider; /detach src/error.rs leave the image and /detach leave
nothing; render an assistant message containing a mermaid fence without
panicking; /open src/error.rs land in the configured program and get a clear
message rather than a fallback when none is set.
Deliberately not planned
| Not built | Why |
|---|---|
| Review surface — diff list, file tree, approve/reject, reject-with-reason | Off in the GUI as S2, and there is no terminal equivalent worth writing. git diff is the review path, and the edit tools already write session baselines for it. A TUI copy would put a surface the product removed back in front of the user |
| Docs surface — tree, viewer, find, search, editor | Off in the GUI as S5. Not replaced. The agent still reads and edits docs through the existing tools; a human reads them in their editor |
In-app file peek (OpenedFile dialog) | The GUI needs a second destination so a path can render inside the app. /open has one destination — the configured program — so there is no dialog and no fileOpenPatterns split to reproduce |
| In-terminal markdown editor | Roadmap non-goal: “not a code editor” |
| Clipboard image paste, drag-and-drop | No terminal protocol worth the complexity. Paths only, through /attach. Pasting text does work: see the keyboard model |
| Image and diagram rendering | No portable cell-accurate graphics; the source is shown, and an image is a [name, 1.2 MB] chip |
An @ file picker over the workspace | Dropped for /attach: a menu over a per-workspace index needs an ignore walk, a relaxed @ token rule and a Cargo feature edge, and a path typed after a command is the same gesture with none of that |
| OS notifications | Tauri-only. Bell and title change instead |
| UI scale, pointer resize | Terminal-owned layout |
A second EventSource-style reconnect | The subscription is in-process and does not disconnect |
Keyboard model
A mode stack, so Esc unwinds one level and is predictable. Exactly one mode
owns the keyboard; chat is the base.
| Mode | Enter from | Leave with |
|---|---|---|
chat | startup; also the landing page when no session is open | Ctrl-C when idle, or q when idle |
workspace-missing | the first listing, when the path has no workspace | y creates it; n or Esc opens the switcher above it, and closing that returns here |
sessions | Ctrl-S | Esc; Ctrl-W replaces it |
workspaces | Ctrl-W | Esc, which steps back a screen before closing; Ctrl-S replaces it |
manage | the switcher’s Manage workspaces… row | Esc, back to the chat; Ctrl-S and Ctrl-W replace it |
models | Ctrl-M, or /models | Enter writes and closes; Esc closes |
help | ? from the transcript, or /help | Esc, back to the chat |
complete (the / and @ menu) | typing the sigil in the composer | Enter/Tab accept; Esc closes the menu alone; it closes itself when nothing matches |
settings | Ctrl-, | Esc |
detail | Enter on a card | Esc, back to the transcript |
prompt (reject reason, rename) | r on a pending card, Ctrl-R | Enter, or Esc which keeps the text where that matters |
confirm (delete a session or workspace, compact) | Ctrl-D / Del in a list, Ctrl-L, /compact | y accepts; n or Esc cancels back to the list |
The confirmation is its own mode rather than a flag on the list because the list’s
field owns printable keys: y would otherwise be a character in a filter and an
answer to a question at once. One overlay at a time, also by design: Ctrl-S and
Ctrl-W replace rather than stack, so one Esc always closes what is on top.
Managing workspaces is a view, not a screen of the switcher. The switcher is a
menu — eight rows, two actions, gone in one keystroke — and a full list stacked on
it read as the same thing twice, with the menu’s frame still visible around it.
manage owns the frame the way detail does: a title with its position, a filter,
the list, and its own hint row. Enter opens, Ctrl-N creates, Ctrl-D removes
behind the confirmation, Esc returns to the chat.
There is no approval mode. A pause is state, answered on whichever card is
selected, so it does not need the keyboard to itself — the design’s own
“a terminal has no disabled composer” problem is solved by the selection instead
of by covering the frame.
Global bindings, checked before the mode’s own map:
| Key | Does |
|---|---|
Ctrl-C | Decline a paused batch. Otherwise: cancel a confirmation, stop the running turn, close an overlay. Idle: quit |
Esc | Unwind one level: the reason prompt, then the detail view, then the selection (handing the keyboard back to the composer), then stop the turn. Never quits |
q | Quit, idle only and transcript focus only |
Ctrl-N | New chat: the landing page, with no session created until the first message. A new workspace from inside the workspace overlay |
Ctrl-R | Rename: the open session from chat, the selected one from the sessions overlay |
Ctrl-S / Ctrl-W / Ctrl-M | Sessions / workspaces / model + effort |
Ctrl-, | Settings |
Ctrl-L | Compact |
Tab / Shift-Tab | Move focus between the transcript and the composer |
↑ / ↓, j / k | Move the selection block to block. The selected block is painted on --surface-hover, every row of it; a card waiting on a decision — idle turn, pending, not_started — has an --attention rail and animated dots after waiting for approval |
| Mouse wheel | Scroll the transcript (three rows a notch) |
PageUp / PageDown | Scroll by a screen, and release the follow lock |
Ctrl-U / Ctrl-D | Half a screen |
Home / End | The first row / the last, which re-arms the follow lock |
Ctrl-T | Cycle the mode: ask → plan → agent |
Ctrl-M | The model and effort picker |
Ctrl-L | Compact, behind a confirmation |
? | The help page — transcript focus only, because ? typed in the field is a character |
/ | Commands, and @ skills, as completion over the field |
Focus is part of the keymap, not a check inside a handler. From T1 the
composer is on screen for the whole life of the process, so q cannot mean
“quit” while it may be a character someone is typing. The map is
(Mode, Focus, Key) -> Command, and the composer holds focus by default
because typing is what a chat is for. The composer’s own bindings:
| Key | Does |
|---|---|
Enter | Send |
Ctrl-J (and Alt-Enter) | Newline, without sending |
Tab / Shift-Tab | Give the keyboard to the transcript, and back |
Esc | Stop the running turn |
Ctrl-J is named first for a reason: some terminals deliver Alt-Enter as
Esc, Enter, and with Esc bound as the interrupt that sequence would stop
the turn and then send the draft. Alt-Enter stays bound where a terminal
reports it as one key.
A paste is text, never keystrokes. The app asks the terminal for bracketed
paste (DECSET 2004) at startup and releases it on the way out, so a pasted block
arrives as one Msg::Paste instead of being typed at the field. Anything else is
a bug with a message attached: typed one character at a time, the first newline
in a pasted block is Enter, so a pasted message was sent a line at a time. The
block goes to the field a keystroke would reach — the composer, the prompt, a
filter, the path field, a settings value — and no character in it is a binding,
so a paste cannot send, stop, turn, or quit however it is spelled. A field that
holds one line gets the block flattened, with each break a space, and the
composer keeps the breaks as breaks and normalises \r\n and a bare \r to
\n. A terminal that ignores the request degrades to the old behaviour; the
key path is still the one that submits.
With the transcript focused, the keys act on the selected block:
| Key | Does |
|---|---|
↑ / ↓, j / k | Select the previous / next block |
Enter | Open the selected card in the detail view. Nothing on a paragraph |
a / r / A | On a selected pending card: approve, reject with a reason, approve all |
Esc | Clear the selection, and put the keyboard back in the composer |
The arrows select rather than scroll, and that is a real cost: one-row scrolling
is gone, and what is left is the wheel, PageUp/PageDown, Ctrl-U/Ctrl-D
and Home/End. ↑ on an empty composer hands the keyboard to the
transcript and selects the last block, so the gesture still works from the field
people start in.
An overlay’s field owns printable keys, exactly as the composer does, so its
actions are control keys and j/k are text:
| Mode | Keys |
|---|---|
sessions | typing filters; ↑/↓ and PageUp/PageDown select, starting on the open session with New session… one Up above it; Enter opens, or goes to the landing page on the action row; Ctrl-N does the same; Ctrl-R renames; Ctrl-D or Del deletes; Esc closes |
workspaces (recent) | ↑/↓ select; Enter opens the row, or the screen the action row names; Ctrl-N opens the create screen; Esc closes |
workspaces (new) | typing is the path; Tab accepts the highlighted directory; ↑/↓ pick a candidate; Enter opens the path as typed; Esc goes back |
manage | typing filters; ↑/↓ select; Enter opens; Ctrl-N creates; Ctrl-D or Del removes; Esc closes |
workspace-missing | y creates the path’s workspace; n or Esc opens the switcher |
confirm | y accepts; n or Esc cancels |
Esc | Drop the selection |
The arrows scroll, and the field keeps them while it holds text. ↑/↓ map
to a one-row scroll from either focus, and app::update hands the key back to
the text area when the composer is non-empty — a multi-line draft is navigated
with arrows, and taking the caret away would make the field unusable. An empty
field has no caret to move, so there the arrows scroll the transcript, which is
the gesture people try first. ←/→ always belong to the caret.
The wheel goes through the same scroll_by call as the keys, so the follow lock
behaves identically however the reader scrolled. Mouse reporting is enabled by
tui::lifecycle next to raw mode and disabled before the alternate screen goes;
only wheel events are read, so text selection still works the usual way.
The trade is PageUp/PageDown: with the composer focused they reach the text
area’s own scrolling, not the transcript. Tab moves focus to the transcript
first.
There is no editor mode and no key that opens a file. The screen belongs to the
TUI for its whole life: an external program is started and left to its own
window, so there is nothing to suspend for. Opening a file is /open, a
composer command, which is why it does not appear in this table.
The landing page
A workspace with no session open — Ctrl-N, a fresh workspace, or the moment after
the last session is deleted — is the terminal’s peer of the webview’s welcome: one
centred group, the greeting and the composer together, with the header above and
the hint below.
robi · workspace · New chat
Good morning
│
│ Message robi…
│
Enter send · Esc stop · Ctrl-J newline · Tab focus · ↑↓ select
- The greeting is
greeting.ts’s three words, in--mode-askgreen. The clock is read once at startup and carried onApp, soupdateandviewstay pure functions of state and a frame test is not a clock test. - The header names the chat
New chat, which is whatsessionDisplayTitlereturns for a chat with no row.no sessionstays for the frame with no workspace at all. - No session exists yet.
Ctrl-Nused to create the row immediately, which meant a workspace opened, skimmed, and left collected an untitled session every time. NowAction::StartSessioncreates the row and submits the first message in one effect, and the outcome carries both: the session is selected and the transcript shown as soon as it exists. A create that succeeds and a send that is refused still leaves the row — the text goes back into the field and oneEnterretries it. - The composer keeps its per-session draft, so text typed on the landing page is
parked under the draft key the GUI’s
composerDrafts.tsuses for a chat with no row yet. A send that is taken drops that draft with the field. The row exists before the send is reported, so opening the new session parks the message under the landing page’s key a moment beforeComposer::take_sent(None)runs; taking the draft as well as the buffer is what keeps a sent message from coming back on the nextCtrl-N.
The composer band
The webview puts the mode, model and effort controls inside the composer, and the terminal does the same: the band’s last row carries them, on the band’s own surface, with the rail unbroken beside.
┃ src/app.rs (40-80) [shot.png, 1.2 MB]
┃ Message robi…
┃
┃ Agent · GLM-5.3 · OpenCode Go · High 214k / 1.0M · 21%
┃
The attachments row is the band’s first content row, and only when there is
something on it. A chip is what the message carries and the text is what it
says, so the chips sit above it — the same order the transcript’s user band uses,
so a sent attachment stays where the reader last saw it. name (1-10) for a text
file, [name, 1.2 MB] for an image: the weight is there because a terminal cannot
show the picture, so the number is the only evidence the bytes are real. The row
is cut with an ellipsis rather than wrapped, because a second row would move the
text being typed, and it costs Composer::height exactly one row.
Backspace on an empty field takes the last attachment off, which is the peer of
the GUI chip’s ×; /detach <name> is the spelling that takes one you name, and
/detach alone takes them all.
The facts row is boxed in by a blank row on each side. The facts say what the
next send will carry; the text is what is being typed, so a gap above stops the mode
line reading as part of the message. The gap below keeps it off the band’s bottom
edge, so it is a caption on the band rather than the field’s last line. The band is
four rows taller than the text — a padding row, the text, a blank row, the facts row,
a blank row — and App::body_height follows Composer::height.
Every span on the row carries the band’s background. The theme’s text helpers are
built for the canvas, so a theme::faint() separator here paints --bg-canvas in the
middle of a --surface band, which reads as a dark dot. The background is patched
last, the same rule rows::row follows and for the same reason: a colour helper must
not be able to punch a hole in a band.
- Clipping order: the meter goes first, then the provider, then the effort, then
the model. The mode word is never cut — it is the one fact the row exists to state
and the one
Ctrl-Tchanges. - The provider name is derived from the id’s prefix (
ProviderKind::display_name), never stored: one less field to fall out of step with the model. - Before the first settings read the row names the mode and nothing else. A guessed model id would be the band lying about what the next send carries.
- The model’s name is the catalog’s, with the
OCG -prefix where the webview’smodelDisplayNameadds one, so the two front ends label a model the same way.
The mode on the rail
| Mode | Token | Ink |
|---|---|---|
| Agent | --accent | #55a2fb |
| Ask | --mode-ask | #6fbf7a |
| Plan | --mode-plan | #e39a3c |
Two surfaces wear it: the composer’s rail and a user message’s band. A mode is what a person asked for, so it colours what they typed and what they are about to type, and it stops there. A reply is the model’s output, not a statement of mode.
Assistant prose gained a rail in T4, and that is the phase’s one layout change: it
wraps one rail and one pad narrower and starts in the same column as a user message.
Its rail is --ink-faint — the quiet tone a tool card’s rail wears — in every mode.
Per message, not per session. The band says which mode that message was typed
under, so a session cycled from plan into agent keeps a readable history. Nothing else
remembers that: the session row holds only the mode in force now. So the mode is
stamped on the user message itself (Message::mode, an opaque label
robi-core’s loop writes and never reads back). A message with no stamp — everything
written before the label existed — follows the session’s current mode, so an old
transcript is one coherent colour rather than a bare one.
Tool cards keep their own rail. A card is machinery inside the turn, not the
turn’s voice. Its waiting rail is --attention, which is now cyan (#4ec9d6)
rather than --mode-plan’s orange: with the mode’s ink on the band and the composer,
a card asking a question in a plan-mode turn would otherwise share the one colour the
turn already wears, and the question would be the least visible thing in the frame. The palette documented
--attention as a second name for that value “so ‘this needs you’ can diverge”; T4
is when it does. The animated waiting for approval dots stay --ink-muted: the cyan
is one cell and the word does the rest.
One overlay style
Every panel over the frame — the sessions list, the workspaces switcher, the manage
view, the model picker, the / and @ menu, and a confirmation — is drawn by
rows::panel and rows::row. That is not tidiness: it is what stops one surface
having a background the next one lacks.
rows::panelerases the rect (Clear, then a canvasBlock), draws oneBlock::bordered()with--ink-faintsides and a strong title, and hands back the inner rect. A panel that forgot the clear let the transcript’s empty state read through it; a panel that built its own background painted a darker rectangle than the one beside it. One function, one answer.rows::rowpaints each row’s background last, over the span’s own style, and pads to the panel’s width. A theme helper carries--bg-canvas; composed in the other order it replaces a selection with the canvas, which is the bug that made the first cut of these panels look wrong on screen.- A heading is a row too. A group label in the picker is painted on the same band as any other row, so the label does not end in a ragged darker patch.
- The completion menu is the one panel that places itself instead of centring: it belongs at the caret, one keystroke above the field. It uses the same border and fill, so the difference is its position alone.
A confirmation is a panel, in view/confirm.rs. A question that takes the keyboard
should look like it takes the keyboard, and the row it used to occupy came out of the
transcript — so asking about a compaction moved the transcript under the reader’s eyes.
It takes no layout row: App::prompt_rows counts the one-line prompt only.
The two sigils
| Prefix | Kind | Source | On submit |
|---|---|---|---|
/ | built-in command | tui/command.rs, a fixed table | the terminal acts, and the field clears |
@ | skill mention | list_skills for this workspace | sent as text, unchanged |
/lists commands and nothing else. Each one is a keybinding’s twin, or — for/attach,/detachand/open— a command whose whole value is a path no keystroke could carry; those print no key and the menu omits the separator rather than leaving one dangling. See Composer commands. A/token that names a skill is refused with the sigil to use instead:"/create-skill is a skill — type @create-skill". Two prefixes only stay distinct if each one holds its side.@lists this workspace’s user-invocable skills, marked· manualwhen the model may not invoke them and with their scope. Accepting rewrites the token in place and adds a space; the message is then sent as typed, and the runtime loads the skill from the mention.- A leading token that names nothing is refused, and the text stays exactly as it
was typed.
/nopeis never sent to the model as prose, because the terminal acting as though a command ran is worse than saying it does not exist. - Only the first token of the first line decides.
either/ormid-message, a path, and a mention the domain cannot resolve are prose;agent::skills::loads_for_textalready ignores an unknown mention, and refusing a message for what it says in the middle would be the terminal reading over the user’s shoulder. - A refusal is a
Notice::errorin the footer — an answer to a keystroke — while a failure the app observed stays on the strip. - The domain reads both sigils.
agent::skills::mention_idsmatches[ @/ ]after whitespace, so the webview keeps/and the terminal adds@, with one loader behind both.
The menu is Mode::Complete while it is open, because keys::command is a pure
function of (Mode, Focus, KeyEvent) and cannot see whether a menu is up: ↑/↓
move, Enter/Tab accept, Esc closes the menu alone (so it never becomes the
interrupt, and a running turn is not stopped by dismissing a menu), and every other
printable key goes to the field, after which the query is recomputed and the menu
closes itself when nothing matches. A picked command takes one more Enter to run,
which is why a reader typing /detach and pressing Enter twice is the documented
gesture and not a quirk: the first Enter accepts the row.
The status strip
One row between the transcript and the composer, and it is the only place a
status is shown: T3 moved sending…, stopping…, and the activity line here
from under the band, because a reader looks in one place or the terminal makes
them hunt. A blank row sits between it and the band’s top edge
(view::STRIP_GAP), so the activity line reads as a caption over the field
rather than as its first row; the row is not kept when the strip is idle, and
App::body_height adds it only while there is something to say. One thing is said at a time, in this order — the first true one wins:
| Row says | When |
|---|---|
! <message> in --danger | a robi.app.v1.error frame, or a read that failed |
! health: <reason> in --danger | the five-second store probe did not answer |
stopping… | a stop is in flight |
sending… | the submit itself has not come back yet |
Thinking for 4s / Responding for 4s + dots | a turn is running |
| nothing — the row is not drawn | idle, nothing failed |
The activity line is the webview’s ActivityLine: its words (Thinking for 4s),
its dots, and its place at the end of the transcript — which in a terminal is the
row directly above the composer. The dots sit in a fixed three-cell field, so the
text before them never shifts. An error outlives a turn and outranks it, so the
error is what stays on the row.
A notice is not a status. The footer under the band keeps the hint and the
answer to the last keystroke — nothing to send, a title is required,
stopped, one call decided — the next one is waiting — because those answer
something the reader just did and belong next to what they did it in. A failure
the app observed — a failed read, a refused decision, a turn that ended
Failed, a rename the service refused — is not an answer to a keystroke: it goes
on this strip and stays there until a read succeeds.
The progress widget
At the right edge of the same strip, a row of eight ▪ cells: the track in
--ink-faint, one head in --ink — the same leading-edge rule visual-style.md
gives the desktop shell’s running spinner. The head advances one cell every two
ticks, so a pass takes four seconds.
It is an indeterminate marquee, not a bar: a model turn reports no percentage, and a widget that filled would claim to know how much is left. It shows while a turn runs or a stop is in flight, and disappears when idle. The status is clipped to make room for it, never the other way round.
The turn footer
A closed turn ends with one gray row, Worked for 2m 5s, in --ink-muted — the
webview’s turnDuration.ts label, from the same two facts: the turn’s first
message id and its last. Both are UUIDv7s, so the timestamp leads the bytes and
the gap is the turn’s duration without the store keeping one.
A turn is open while the phase is busy or a call is still waiting on a decision, and an open turn has no footer; it gets one when it closes. A single-message turn has no gap to report, and a compaction divider is not a turn’s work, so neither gets one. The row is not a block: the arrow keys step over it. One blank row separates it from the turn — the same gap the transcript keeps between blocks — so it reads as the turn’s footnote rather than its last sentence.
The scrollbar
When the transcript is taller than its viewport, the first column of the right
gutter carries a scrollbar: a full-height track in --rule and a proportional
thumb in --ink-faint, both │ (\u{2502}) and ┃ (\u{2503}) — two weights
of the same box-drawing line, so the cells line up and a moving thumb changes
only how much ink one column carries. The thumb is at least one cell long, so a
transcript a hundred screens long still shows where it is; its position is
offset / max_offset of the travel, so the bottom row of the frame is the last
row of the transcript while following.
It is chrome in the gutter, not a column of the text. The transcript is
wrapped to content_width, so the bar costs no wrap width and no row, and the
scroll arithmetic stays exactly what state::transcript computed. Nothing is
drawn when every row fits: a bar is a statement that there is more, and a
full-height thumb on a short conversation is a lie. Nothing is drawn either when
the frame runs to the terminal’s edge, because there is no gutter to draw in.
It never brightens with focus or scroll, unlike the desktop shell’s webview scrollbar: the transcript already spends its one piece of state on the user’s blue rail, and a second thing that lights up would be a second answer to the same question.
Assistant markdown
Assistant prose is rendered as markdown, not as its source characters. The
terminal’s peer of AssistantMarkdown.tsx is tui/state/markdown.rs, which
feeds the text to tui-markdown — a
pulldown-cmark front end that returns a ratatui Text — and then wraps it into
the transcript’s own rows.
- The palette is a
StyleSheet, not a post-pass. The renderer asks for aStyleper construct and every answer is a token fromtui/theme.rs, so the desktop and the terminal cannot drift. Headings drop their#marker and carry weight instead; level 1 also underlines. Code, links, quotes, list markers, table boxes and GFM alerts each get a token. - Rows stay row-exact. A
Rowcarries styled byte ranges, so wrapping a marked-up paragraph is the samesplit_cellsthe plain path uses, and the scroll offset is still one row per visual line. - A table is cut, not wrapped. The renderer draws its box to its own width; wrapping would tear the borders apart, so an over-wide table is truncated with an ellipsis, which keeps the columns aligned.
- Syntax highlighting is off. The
highlight-codefeature pulls insyntect, which is a large build cost for one view; fenced code renders in--code-inkon--code-bgwith its language tag intact. Turning it on later is one manifest line and oneOptionscall. - Images render as their alt text, and a mermaid fence renders as its source —
T6’s rule, unchanged. There is no portable cell-accurate way to draw a diagram,
so the fence keeps its
mermaidtag and shows the source under it, and a test instate/markdown.rspins that rather than a reader discovering it.
A selected card is answered in place: a approve, r reject with a reason, A
approve every call still waiting, Ctrl-C decline them all, and Enter to read
the whole body. Where the reason field is open every printable key is text, so
Enter refuses the selected card with what was typed and Esc closes the field
and keeps the text. A card that already ran takes only Enter: an approval key on
it is answered with a notice rather than a decision.
Composer commands
/ and @ are the two prefixes, and each one is honest about what it does: see
The two sigils. A command never reaches the model; a skill mention always does.
| Command | Argument | Key | Does |
|---|---|---|---|
/models | none | Ctrl-M | the model and effort picker |
/sessions | none | Ctrl-S | the sessions overlay |
/workspaces | none | Ctrl-W | the workspace switcher |
/new | none | Ctrl-N | the landing page |
/rename | optional title | Ctrl-R | the rename prompt, or the title outright |
/mode | optional ask|plan|agent | Ctrl-T | cycle, or set that mode |
/compact | none | Ctrl-L | the confirmation, then the compact |
/help | none | ? | the help page |
/settings | none | Ctrl-, | the settings surface |
/attach | <path> | — | put a file or an image on this message |
/detach | optional name | — | take that attachment off, or every one |
/open | <path> | — | open a workspace file in the configured program |
Every command is a keybinding’s twin, or takes an argument no key could carry.
A twin is the discoverable spelling of a key a reader may not know yet, and
state/help.rs prints the pair. The three commands with a — in the Key column
are the second kind: what they need is a path, and a keystroke has nowhere to put
one. They print no key in the menu, because · with nothing after it reads as a
column that failed to render.
Arg is None, Optional or Required in the table, so /open <path>,
/attach <path> and /detach [name] are three entries and no new parser. A
command given an argument it does not take is refused by name rather than ignored.
/attach reads, /open launches, and that is the whole difference between
their path rules: /attach resolves a relative path against the workspace and
also accepts ~ and an absolute one, because reading a file the reader named is
what they asked for and the caps bound what comes back; /open refuses both,
because it hands the path to a program that will show it in the workspace the
reader is working in, and the route it mirrors refuses the same three.
/attach path:40-80 attaches those lines. The suffix is recognised only when
everything after the last : is digits or digits-dash-digits, so a:b.rs and
C:\src\x.rs keep their colons. The cap applies to what is attached rather than
to the file, which is what makes a range the answer to the 64 KiB limit on a file
that cannot be attached whole — and a range past the end clamps and reports the
lines it actually took, so a chip never claims lines the file does not have.
The help page
/help, or ? from the transcript, opens a dedicated view — the shape manage and
detail use, because a reader who opened it went somewhere on purpose. Sections, in
the order a reader meets them: Sending, Moving, Approvals, Overlays and
views, Composing, Commands, Leaving.
The list is data, and it fails the build rather than drifting. state/help.rs
holds SECTIONS of Entry { keys, what, command }, and section_of(Command) is an
exhaustive match over Command: a new keybinding is a new Command variant, so the
crate does not compile until the binding is classified. Two tests close the rest — no
key is listed twice in one section, and every entry is filed in a section
section_of gives it. A command genuinely in two places says so: Ctrl-C stops a
turn, declines a paused batch and leaves from idle, and Alt-Enter/Ctrl-J are two
spellings of one Newline.
The Commands section is generated from command::BUILT_INS, so a new command
appears on the page the moment it exists. /help is also the one command whose key
was documented and missing: the global bindings table has promised ? since T0, and
T4 finally maps it.
The guard’s honest scope: it catches an unclassified or misfiled command, not a
stale key string. keys is prose, so rebinding Ctrl-T and leaving the row alone
would pass every test. Documenting every binding is enforced; keeping every string
true is a review duty.
The settings surface
Ctrl-,, or /settings: a dedicated view like manage and help, because six
sections and thirty-six rows do not fit a panel over a chat and a reader who is
changing a credential stays a while.
The rail is the GUI’s nav. General, Model providers, Permissions, Sandbox,
MCP, Audit log — in the order src/features/settings/ lists them, so the two
front ends configure the same things in the same order. Below 60 columns the rail
is not drawn and the section rides on the title row (settings · Sandbox); h/l
still move it, so no key changes with the width. At MIN_WIDTH (40) an eighteen
column rail would leave the pane nothing to show.
Four kinds, and each answers a question the terminal cannot ask.
| Kind | Keys | Enter sends |
|---|---|---|
Text | models, numbers, URLs, the three path lists, the container’s image and runtime | the buffer, or remove(key) when it is empty |
Secret | the four credentials | the buffer, and nothing when it is empty |
Toggle | the five on/off keys plus sandbox_project_files | the flipped word |
Choice | the four effort keys (optional), sandbox_mechanism, sandbox_network (fixed) | the next value, wrapping |
Choice exists because a stored value is not always a word a reader recognises —
sandbox_network is on and means Sandboxed — and because it makes a mistake
unrepresentable: reasoning_effort is stored unvalidated and parse_effort then
fails the turn. Its optional flavour starts by leaving inherit and wraps back
to it last, which is where the delete lives. Toggle does the same job for the six
keys the service would otherwise answer with a 400.
An empty value deletes, and the default returns. SettingsService::set
refuses an empty string, so “clear this” is remove(key); the read that follows
writes the key’s default back through the store. For the container’s five fields
that is robi/agent:0.1.0, runsc, 4096, 2, 512. The GUI cannot do this:
its onBlur cannot tell “cleared” from “unchanged”, so it reverts. A terminal has
an explicit Enter, which can.
Sandbox is one section, not four. SandboxSettings.tsx has four headings; a
rail already says which page you are on, and four dividers would cost rows a
24-row terminal does not have. Its ranges are not copied here — 256–65536 MiB,
64–8192 processes, and sandbox_cpus’s ceiling is available_parallelism() on the
machine the terminal is running on. A copy would drift and would be wrong on the
host that matters, so the fields are Text and the service’s own sentence is what
a refused write shows.
A secret is one bit. The read returns its value over HTTP unless the controller
omits it; the terminal omits it one step earlier, in effects, so App never
holds a credential and no Debug of one can appear in a log. The row draws eight
bullets, the band starts empty, and re-sending a value is the only way to change
one.
A write is followed by a read. SettingSaved shows saved · <label>, then
re-issues LoadSettings and LoadModels: the surface, the facts row, and the
picker all read one store, so there is no second copy to drift. A SettingFailed
puts the service’s message in the surface’s own footer row — the status strip is
behind this view — and the re-read is what reverts the row.
The MCP section is read-only. One row per server (title, status, tool count,
from the status already loaded for the header), the two config paths, not trusted
on the project file when its hash does not match, and where each server’s log
lands. The file text is not read into the app: the terminal never becomes an
editor, and a config file is one cat away.
Two surfaces are deliberately absent. Display is a webview UI scale with no
terminal meaning; file_open_patterns and file_open_command configure /open,
which is T6. A row whose feature has not shipped is a row that lies.
The audit log
The webview’s audit log is client state: src/state/requestLog.ts, fed by the
auditRequests.ts middleware over openapi-fetch, 250 entries, memory only. The
terminal makes no HTTP at all, so its peer boundary is effects::dispatch — one
row per service call, with the call’s name, whether it failed, its duration, and
the outcome’s own one-line summary as the body.
The names are exhaustive. Action::label and ActionOutcome::summary are
matches with no _ arm, so a new effect states what it is called and what it is
worth saying before it can ship.
Three calls are skipped, for the reason the webview skips /api/v1/health:
Probe is a heartbeat, CompletePath runs once per keystroke, and SaveView
happens while the process is leaving. A table of those would be noise around the
calls a reader opened the page to see. /attach and /open are not skipped:
one reads a file the reader named and one starts a program, which is exactly what
a reader opens the table to check.
The table has no cursor of its own. The surface already has one row cursor and
one page size; a second cursor inside one section would be a mode within a mode.
Enter expands the row under the cursor, and an expansion is keyed by the row’s
sequence number, so a call arriving at the front moves the expansion down with the
row it belongs to rather than onto its neighbour.
Gaps to lift out of web_api
Four pieces of logic a controller owned and the TUI also needs. Each one is
lifted into domain (or agent), never copied: two front ends reading one
implementation is the point of the module boundary. Three landed in T4 with their
callers switched over.
| Logic | Today | Needed by | Action |
|---|---|---|---|
Attachment ingestion — build_files, classify_path, decode_base64, decode_text, matches_media_type | web_api/chat_message.rs | T6 | Done, as domain::chat_message::attachment; the handler maps AttachmentError to its statuses and keeps FileAttachmentInput as the wire DTO |
Provider-enabled model filter — provider_on + tool_capable | web_api/models.rs | T4 | Done, as adapters::model_source::pickable_models; the route calls it |
User-invocable skill list — scan + the filter | web_api/workspace.rs | T4 | Done, as agent::skills::user_invocable; the handler also moved its scan onto spawn_blocking |
| Model and effort resolution — override → mode key → fallback → default | adapters/model_source.rs::provider_settings | T4 | Done, as effective_choice; the builder and the facts row both read it |
File opener — spawn_opener, template rendering, the 10-second wait | web_api/workspace.rs | T6 (/open) | Done, as agent::workspace::{argv_for, open} with absolute_inside in agent::workspace::paths; both callers keep the same refusal when the command is unset |
The audit log is the one row T5 did not lift: the webview’s lives in the client, over HTTP, and the terminal makes no HTTP. It is a port at a different boundary — see The audit log — and there is no shared implementation to want, because the thing being recorded is different.
The docs merge (merge3, version_hash, docs_edits, the 409 path) and the
review reader stay where they are: with no docs or review surface, the TUI never
calls them, and two front ends do not need one implementation of something only
one of them uses.
Eradicated on sight: #[utoipa::path], status codes, Json wrappers,
parse_session_id, CORS, the multipart body limit, the SSE keep-alive.
ingest_multipart is the interesting one. It is not HTTP logic — it is “turn a
name and bytes into an ImageAttachment or a FileAttachment within the size
caps”. It belongs in domain/chat_message, and the controller keeps only the
multipart parse.
Persisted UI state
~/.robi/tui.json, written atomically on quit and on a change to the open
workspace or session. Not the settings store: settings are product
configuration, this is view state, and a scroll offset does not belong in a
settings screen.
Keys mirror the GUI’s client state so the two can be compared: active workspace,
open session, tool-card expansion, and the workspace recents (the GUI keeps
robi.recentWorkspaceIds in local storage for the same reason — the switcher
lists the eight most recently selected, and the service only knows creation
order). Recents are unbounded, like the GUI’s list; an id whose workspace has gone
is skipped when the list is read. Version 3 added them; an older file loads with
an empty list. Expansion is one key per call id, not
the GUI’s id, id:diff, id:answer: a terminal card is one band, so there is
nothing for the extra keys to address. Scroll position and the last mode are not
written — a rewrap invalidates a row offset, and a mode is where the reader is
rather than a fact about the session. Composer drafts are not here:
they are held in memory per session, keyed the way composerDrafts.ts keys them,
because typed text can be a secret and the GUI does not persist it either. Never
a secret otherwise. Nothing in the file is required to start: a missing or
malformed file starts at the defaults, because a bad scroll offset must not stop
the app from opening.
Dropped because the surface is gone or terminal-owned: per-document scroll, collapsed directories, docs-tray width, UI scale.
Rejected alternatives
- A TUI that calls the HTTP API. Rejected. It needs
robi-apirunning to be useful, moves every message through JSON and theChatMessageDTO, and losesrobi_core::message::Message— a strictly better type with the approval and execution status enums intact. Nothing about a same-machine second front end justifies a socket. - A TUI as a Tauri-managed sidecar. Rejected for T0–T6. Same cost as 1, plus process lifecycle. Process placement stays D3 and this page does not reopen it.
- A new crate now. Rejected, above. A feature gate isolates the dependency without moving code, and the promotion path is intact when the M8 binary arrives.
- Component architecture, with a trait per widget holding its own state.
Rejected. Immediate-mode rendering wants a pure
view; interior mutability per component is how a transcript ends up with two sources of truth. TEA is also what the roadmap calls “the Bubble Tea update loop” when it says to leave it behind — that entry is about the desktop shell, where a webview needs a reactive store. In a terminal, immediate mode plus a pureupdateis the idiomatic shape, and it is closer togopi’s behavior than the rewrites. - Rendering the transcript from
message_delta. Rejected. The bus drops a queued delta under backpressure by design, so the transcript would lose tokens. Deltas move the phase; stored rows refetch. - An in-terminal editor for the docs screen. Rejected twice over. There is
no docs screen here, and a terminal cannot match cursor, selection, and undo
without becoming an editor, which the roadmap names as a non-goal. The one
handoff is
/open, which starts the user’s own program and keeps the screen. - A TUI-only settings file. Rejected. Settings are already
SettingsServiceover~/.robi/config.tomlandsecrets.toml; a second store would fork the meaning of “default model”. tui-realmor a retained-mode framework. Rejected. It solves a problem this app does not have (reusable widgets with lifecycle) and puts a small corpus between a maintainer and a fix.
Failure modes
- Panic while the terminal is raw. Half-drawn frame, echo off, shell prompt
invisible.
ratatui::initinstalls its own panic hook;tui::lifecyclewraps it so the process log line is written first.restoreruns on the error path and onSIGTERM. - Debug tracing on stderr.
logs::init()adds a stderr layer underdebug_assertions, which overwrites the frame. The TUI initializes the file layer only. - Two front ends on one database. Two
SerializedChatRuntimes can drive two turns on one session and interleave the transcript. The per-session lease in parallel-front-ends.md is the answer:Turnrefuses a second submit and names the holder in aConflict. It also keeps the per-sessionredbhandle exclusive, which is the failure that would otherwise come first — an unreadable transcript, not an interleaved one. - A slow service call. It runs in
effects::runon the runtime and cannot block the pump. Filesystem and SQLite work is already insideagent::blocking::call; the TUI adds no new blocking path. - A drop of a burst of frames. Deliberate. The catch-up reload recovers what the render missed, and the phase does not advance past an unstored row.
- A stale
Done. Two reloads of one session land out of order. Every action carries a generation; a lower one is discarded. The GUI’s epoch rule. - An approval for a session that is not on screen. Bell, and a notice naming it. The turn is paused either way, so it cannot be missed indefinitely; T3’s session list is where it is answered.
- A decision that lands while the actor is running. The runtime refuses it
with a
Conflict, so only one decision is ever in flight:AandCtrl-Cwhile paused queue the rest, and only anawaiting_approvalframe releases the next. A refusal keeps the call listed and shows the message. - A pause restored from the database. The actor belonged to the process that
started it, so a pause found by a later process is decided by a new one: the
decision settles the call in the store and resumes the turn here. The lease in
parallel-front-ends.md narrows it rather than removing
it: a paused turn keeps its
Turnuntil the call is answered or the process exits, so a second process cannot resume it, but a crash mid-pause releases the lease and the next process may. turn_finishedclosing a live pause. The worst failure in this phase, because it degrades into the previous one: the pause opens onawaiting_approvaland a pausedturn_finishedtears it down a frame later, so a live pause is reported as a stale one.turn_pausedreads the outcome before closing anything, and one test feeds the real pause sequence — built fromEvent::AwaitingApprovalandEvent::TurnFinished { Paused }, not from hand-written JSON — and asserts the pause is still up afterwards.- A pause with nothing selected. A pause takes the selection to the waiting card, so the keys are on the thing that needs an answer. If the row has not loaded yet the selection waits for the reload, and the bell and the title have already said something is waiting.
- A send during a pause or a running turn. Both are allowed, and both do what
the webview does: the pending calls are rejected and a running turn is
interrupted with its instruction replaced. That is
ChatRuntime::submit’s behaviour, inherited rather than re-implemented. The one thing the terminal adds is clearing its own pause state as soon as the send is taken. - The selection and the follow lock. A turn streaming while the reader has
selected an older block must not yank the view to the bottom.
revealruns on selection only; growth still follows the end while nothing is selected. - The open session is deleted. The next session in the list is opened, and an
empty list lands on the greeting rather than on a dead composer: the landing page
is what “no session” looks like, and its composer creates the next row when a
message is sent. A
robi.session.v1.deletedframe takes the same path. - A list refresh that keeps the open session. A rename in another window refetches the rows and not the transcript: a refresh is not a selection change, or the reader’s scroll position would be thrown away by someone else’s edit.
- A failed probe while the store is wedged. The mark says so after three seconds; the query keeps its connection until it returns, so the timeout bounds the report and not the query. The frame stays live throughout.
- A workspace removed out from under a running session. Its rows cascade away and the actor keeps running against them: the HTTP handler has the same hole, and closing it is a domain change, not a surface one.
- A path completion on a huge directory. One
read_dirper keystroke, cut to eight candidates. The read is onspawn_blocking, so it cannot stall the pump. - A stale completion or list answer. Each carries the generation it was issued at; a lower one is dropped. Two keystrokes can be in flight together.
- A remembered session that is still listed.
tui.jsonnames the open session, so the first session listing is not a “selection change” and used to skip the read: the frame stayed empty andEnteron that row seemed to do nothing until another session had been opened and come back from. The first listing now always opens a session and reads it, andEnteron the open session issues a read of its own. - An abandoned new chat.
Ctrl-Ncreates nothing, so a reader who opens a workspace, opens a new chat, and leaves without typing has left no row behind. The session appears with the first message, in the same effect that sends it. - A first send that fails. The row exists by then, so it is kept: the session opens with its empty transcript, the text is back in the field, and the failure is on the status strip.
- A path with no workspace. The startup prompt, not a fallback. Starting the
terminal in a directory nobody opened before is the ordinary case: opening some
other workspace would show a session list the reader did not ask about, and
silently creating one would leave a row they did not want.
yandnare the two answers, and the prompt returns on the next start because the path is still the path. - Declining the prompt and then closing the switcher. The question is still
the page underneath, so
Esccomes back to it rather than to a chat frame with nothing open. Only a chosen workspace — or a created one — answers it;Ctrl-Cstill leaves. - A panel over an empty transcript. The empty state is centred exactly where
a panel lands, so a
Blockthat only tints its background left the sentence legible behind the list. The panel clears its rectangle first; the same call is the reason a list row’s highlight is a band and not just font colour. - Terminal too small. Below 40×12 render one centered message instead of a broken layout.
- No TTY (
robiin a pipe or CI). Refuse to start with a line on stderr, rather than drawing escape codes into a file. - Quit with a turn running. Confirm; on confirm,
Stopthen exit, so the transcript is left resolvable. Never drop the process mid-turn. /openwith no configured program, or a program that hangs. An unsetfile_open_commandis one message under the composer, never a fallback to another program. A configured program is waited on for at most 10 seconds and then left running, so a hanging editor cannot freeze the frame; the TUI never suspends its own terminal for it.
Testing
-
update()is a pure function, so it is tested without a terminal, without a database, and without a network — the same discipline asrobi-core. -
A
TestBackendframe test is for a notable bug, not for coverage. The UI is not snapshot-tested per view: a golden frame fails on every cosmetic change and says nothing about behaviour, and the interesting logic — grouping, wrapping, the follow lock, the card’s geometry, the keymap — lives in pure functions that are cheaper to test and fail more precisely. A frame test earns its place when a bug was visible only on screen:- an empty workspace list claimed there was no workspace when the process had opened a different database;
- a tool card needed to be a band, not a bordered box;
- user and tool bands needed rails in different colours, from the buffer, not from a glyph;
- the frame needed one gutter, which also caught the footer padding twice;
- an assistant heading and table painted their own
##and|characters instead of rendering as a document. - the transcript’s scrollbar: absent while the rows fit, one track-or-thumb cell on every body row once they do not, and a thumb that ends on the last row while following and starts on the first at the top. Frames assert on substrings and on cell colours, never on a golden file, so a token change that does not move the layout does not fail.
-
Keymap:
(Mode, Focus, Key)is a table, and one test walks it —qquits only with transcript focus,Entersends whereCtrl-JandAlt-Enterinsert a newline, no key means two things in one mode, andEscfrom each mode returns tochat. Not one test per binding. -
The lists: one test each for the filter (case-insensitive on the title the row shows), the marks (
awaitingoverrunningover idle), the recent order (a stale id skipped, a duplicate not listed twice),split_pathon~, an absolute path, a trailing separator and a bare name, and the selection clamp. -
The sessions rows: row zero is the action and names no session; the gaps around it bound the selection; a session that vanishes takes its row with it; an empty list still has the action row.
-
The landing page:
Ctrl-Ncreates nothing and shows the greeting focused on the composer;Enterissues exactly oneStartSessioncarrying the typed text and keeps it until the actor takes it; the outcome opens the session, clears the field and goes busy; a refused send keeps the row, restores the text and puts the error on the strip; a fresh workspace with no sessions and the delete-the-last case both land here; the greeting’s three bands each draw their own word, from a fixed greeting rather than the wall clock; the greeting isMODE_ASKand sits above the composer, centred. -
The startup path: a typed path with no workspace shows the prompt (
yissues oneCreateWorkspacefor that exact path,nopens the switcher and creates nothing); a path that is a workspace becomes active and leads the recents; a refresh after startup does not re-prompt.nthenEscreturns to the question with its key line,nopens it again, and choosing a row or creating one from the panel answers the question for good. A remembered session is read on the first listing,Enteron the open session still reads it, and a later refresh still does not. -
Panels and bands: the switcher’s
Manage workspaces…andNew workspace…rows are highlighted from their first cell to the panel’s inner edge (asserted on cell backgrounds, not glyphs); the panel leaves no transcript text behind it; the manage view draws its own title, list and hint with no composer; the sessions panel putsNew session…above the sessions and highlights it the same way. -
The overlays: a session frame issues exactly one
LoadSessionsand noReload; a refresh that keeps the open session selects nothing and a refresh that loses it opens the next;Ctrl-Dthennissues nothing and keeps the selection, thenyissues one delete; a rename prompt is pre-filled and sends oneRenameSession, and an empty title stays in the field with a reason; the create screen issues oneCreateWorkspacewith the typed path and keeps it on a refusal; a completion answer for text the field no longer holds is dropped by its generation. -
The strip: a failure sets
! <message>inDANGER, a successful reload clears it while a successful probe does not, the probe fires once per twenty ticks and never while one is in flight,sending…/stopping…outrank the activity line, and an error outranks both. A frame test asserts the strip is two rows above the composer band with a blank row between, that an idle app has no strip row at all and no gap for it, and that the prompt takes a row off the transcript. A blank row above the header and one under the hint are asserted too. -
The header: one word on the right, absent with no servers, and
MCP Failedwhen any server has failed; frame tests assert the label and the cell colour. A frame test asserts the row under it is one unbroken rule that starts at the gutter and ends at the header’s right edge. -
A retrieve card: the page text is absent from the frame, the hint is there, and the detail view opened from the card holds both paged lines. The card builder’s own test pins the same two facts against
cardandfull_body. -
The turn footer:
Worked for 12m 42sfrom two ids 12m 42s apart, none while a turn is open, one per closed turn when the last is still going, none for a single-message turn or a compaction divider, and a rebuild only when the last turn opens or closes — aThinking→Respondingdelta leaves the rows untouched. A test pins the one blank row between a closed turn and its footer, and another pins the blank row between the last message and the strip’s activity line. -
The composer and the pump, one test each: a send records one
Submitand keeps its text until the actor takes it; the two refusals (blank, no session) each say why inside that same test;Escstops a running turn andCtrl-Cstops or quits; and a realEventBuspublishingturn_started→message_delta→message_added→turn_finishedends idle with exactly oneLoadMessagefor the stored row and oneReloadat the end. -
Reopening a paused session: a transcript that loads with a
pending+not_startedcall selects that call’s card, andathen issues oneDecide; a call that ran without asking selects nothing; a session switch drops the previous session’s pause. A switch back to a session whose turn is still running keeps that turn busy, so its in-flight call comes back as running… and no approval opens for it. -
Selection: the arrows walk the prose and then each card; a selection survives an upsert of its own row and is dropped when its block goes;
Enteropens the detail view on a card and does nothing on a paragraph. Frames assert the background of a cell, not a glyph: a selected band, paragraph, and card are allBG_SELECTED, the fill reaches the end of the row, and the unselected rows keep their own tone. A waiting card’s rail cell isATTENTION, and a settled one goes back toINK_FAINT. The dots cycle1, 2, 3over six ticks, and the row count and scroll offset are asserted unchanged across them — the marker must not move the layout. Clearing a selection withEscreturns focus to the composer: the keys that acted on the block mean nothing once it is gone, and typing is what a chat is for. -
A pause takes the keyboard off an empty composer and leaves it alone when there is a draft: the card is selected either way, and only an empty field hands the focus over.
-
The approval keys:
ain the composer is a character andaon the transcript approves the selected card; an approval key off target says so rather than deciding; one decision in flight at a time;Aqueues the rest and the nextawaiting_approvalreleases exactly one;Ctrl-Cdeclines the batch and does notStop; and a call from a later iteration is never swept into the queue. -
EscandCtrl-C:Escunwinds the prompt, then the detail view, then the selection, then stops the turn, and never quits;Ctrl-Ckeeps stop-or-quit and gains decline-the-batch while paused. -
A send while a turn runs, and a send while a turn is paused, are both taken and recorded as one
Submit: the runtime decides what they mean. -
A tool call’s two states: a
pending+not_startedcall in a running turn isrunning…with no attention rail, no approval list and no overlay; the same call in an idle turn iswaiting for approvalwith the rail, and the two are asserted on the same fixture so a predicate that loses the phase fails both. -
The detail view renders the whole body — a two-hundred-line shell result is 203 lines, past the band’s forty-line cap — and
Escreturns with the selection where it was. -
The
/command surface:/openon a path inside the workspace issues oneOpenFile; an absolute path, a~path, and a blank argument each produce a footer error and no action. An unset command comes back asOpenFailedwith no program started, so the fallback this design rules out is a test failure, not a code review. -
Attachments:
/attach src/app.rs:40-80issues one read carrying the whole argument, because the range is the effect’s to split; a blank argument and a two-line one refuse with no read; a file already attached refuses by its source; a read that lands after a session switch is dropped; the count and the text total are enforced against what is already on the message. -
/detach: a unique basename removes one, an unknown name removes none and says so, and no argument removes all and counts them back.Backspacein an empty field removes the last; with text it still deletes a character. -
A message carrying only an attachment is sendable, and a refused send keeps both the text and the chips. The band grows one row for the chips row, and a sent attachment reads as
app.rs (40-80)in the user band beside[image, image/png]. A send that is taken drops the draft it came from: the first message of a new chat leaves nothing behind for the nextCtrl-Nto restore. -
Paste:
Event::Pastebecomes one message and never a run of keys. A block with newlines lands in the composer with its newlines, and issues nothing — no send, no stop, no quit — so a pasted message cannot be sent a line at a time. A one-line field gets the block flattened, with each break a space. The landing page gets text and creates no session. -
A card’s long line: a 4800-cell result costs a handful of rows in the transcript, its cut marked with
…, and the same call in the detail view shows all of it, wrapped to the frame with no cells lost. The heading and the subject are cut the same way, and a cut is measured in cells so a wide run cannot overflow the frame. -
A mermaid fence renders as its own source with the language on the fence line and does not panic.
-
A skill whose id collides with a built-in is listed but not selectable, and typing it still resolves to the built-in.
-
Persistence:
tui.jsonround-trips; a malformed file starts at defaults; a secret-looking key is never written. -
The debug-build stderr regression: a unit test asserts the TUI’s log initializer installs no stderr layer.
-
cargo test -p robi --features tuijoinsmake test, and clippy runs--all-featuresso the feature-gated module is still linted. -
The overlay panels and the status row are checked by frames for position and colour, not by a golden file: the MCP summary sits at the header’s right edge, a
!isDANGER,MCP OnlineisSUCCESS, and aWorked forrow isINK_MUTED. -
T4, the two sigils: prose sends; a leading
@idsends unchanged;/nope,@nope, a lone sigil,/create-skilland an argument where none is taken each refuse with their own sentence; a sigil mid-line and a command on a second line are prose. A refusal leaves the field exactly as it was and sets aDANGERfooter notice. -
T4, the two menus: the trigger (line start, after a space, inside a word, a second line, a bare sigil), the rows a query matches,
· manualand scope, and the replacement length on a multibyte line — with a test that the rewrite replaces the token, becausedelete_strruns forward from the cursor. -
T4, the rail:
mode_ink‘s three values are the tokens’; a stamped user band keeps the mode’s ink after the session has moved on, an unstamped one follows the session, and the reply under it is--ink-faintin every mode — the reply is the model’s output, so a mode colour there was the transcript claiming the assistant was in ask or plan mode. A waiting card in a plan-mode turn is cyan and notMODE_PLAN— the case the old shared value made invisible. -
T4, the keys:
Ctrl-Tcycles and issues oneSetSessionMode, and on the landing page changes the draft and issues nothing;Ctrl-Mopens the picker on the row in force;Ctrl-Lis refused while a turn runs and opens the confirmation when idle, wherensends nothing andyis oneCompact. -
T4, the help page: every entry is filed where
section_ofputs it, no key is listed twice in a section, everyBuiltInappears in the generated Commands section,/helpnames?, and the scroll stops at both ends./helpopens with no session at all;?from the composer is a character and from the transcript opens the page;PageDowninside it moves the page and leaves the transcript’s offset alone. -
T4, the band: the facts row is the band’s last row with a blank row above it — both asserted on cell contents, the rail glyph trimmed before the gap is judged empty — and a cell test pins the separator’s background to
--surface, because a--bg-canvasdot in a band is invisible to a glyph assertion. The row drops the meter, then the provider, then the effort as the band narrows, never the mode. -
T4, one overlay style: the picker and the completion menu both draw a bordered panel with a title, a panel row’s cell background is the panel’s own, and a confirmation reports
prompt_rows() == 0— it is a panel, so the transcript keeps its rows. The picker’s groups put effort first, and the test walks to the first model by kind rather than by counting rows, so a reorder fails only where it is wrong. -
T5, the table: four tests hold it against the store — every key is one
known_settingreturns, aSecretfield is exactly a secret key, everyChoiceoption is a value the service accepts, and no key appears twice. A fifth pins the six section titles toSettingsLayout.tsx’s pages. -
T5, the surface:
Ctrl-,and/settingsland on General with the rail’s six titles; the Sandbox page shows the defaults the first read wrote (OS,robi/agent:0.1.0,4096,Sandboxed,off); a 50-column frame folds the rail and names the section in the title. A stored credential draws bullets andplain(key)isNone, which is the reduction asserted rather than assumed. -
T5, the writes: the second
Entersends exactly oneSaveSettingwith the buffer appended to the stored value; an empty buffer on a secret sends nothing and on a plain key sendsNone; a toggle sends the other word and the row follows the keystroke before the store answers; aChoiceadvanceson→off; aSettingFailedputs the service’s sentence in the footer and issues oneLoadSettings; aSettingSavednames the field and re-reads models and settings.Esccloses the band, and the secondEscleaves. -
T5, the keys:
j/kmove the row,PageDownmoves a page,qdoes nothing, and the audit table’sEnterexpands the selected row, draws its body, and folds it again.Ctrl-Ccloses the settings, help, and detail views instead of quitting, which it had done from all three.
Implementation order
- Workspace dependency, feature,
[[bin]],tui/mod.rs::run, terminal lifecycle, and aTestBackendharness that renders oneParagraph. Proves the plumbing before any state exists. Msg/Action/effects::runand the input thread.state/transcript.rsandview/transcript.rsreadinglist_messages. This is T0.- Composer,
Submit, the event pump, phases and catch-up. T1, done. - The card variants, then approvals on the selected card and the detail view. T2, done. The modal shipped first and was replaced: covering the frame was the wrong answer to “a terminal has no disabled composer”, and selecting a card answers it without taking the keyboard away.
- Sessions and workspaces overlays, then the status surface. T3, done. The
confirmation and the visible prompt came with it: the reject reason had keys
but no view from T2, and one shared one-row prompt fixes both. The status
surface is a strip above the composer rather than a bar below it, plus the
header’s MCP word and the per-turn
Worked forfooter. The phase’s last pass took the startup path (robi [PATH]and the missing-workspace prompt), lifted managing workspaces out of the switcher into its own view, putNew session…first in the sessions overlay, and fixed two things only the screen showed: a highlighted action row that was not, and an empty state reading through a panel. - Lift the model-filter helper and the model/effort resolution; the mode label
and the mode-coloured rail; modes, the picker, the two sigils, the confirmation,
and the help page. T4, done. The phase shipped the facts row inside the
composer band rather than above it, added a rail to assistant prose (the one
layout change), stamped the mode on each turn’s user message so history keeps
its colour, took
--attentionto cyan now that a plan-mode turn is orange throughout, and implemented?— the one key the global bindings table had promised since T0 and nothing had mapped. - Settings surface. T5, done. Six sections in the GUI’s order, four field
kinds, and the audit table ported from the webview’s client-side request log onto
effects::dispatch, since the terminal makes no HTTP. The phase also corrected the parity map, which had never listed the GUI’s Sandbox page, and gaveCtrl-Cthe branch the keyboard table had always promised: it closes the settings, help, and detail views rather than quitting from them. - Lift the file opener and the attachment ingestion together;
/attach,/detachand/open; the chips row; the mermaid pin. T6, done. The phase replaced the planned@file picker with two commands — a menu over a per-workspace index needed anignorewalk, a relaxed@token rule, and a Cargo feature edge, and a path typed after a command is the same gesture with none of that. It also added a:start-endsuffix, without which a text file over 64 KiB could not be attached at all, andfile_open_commandto the General settings page, so a terminal-only install can configure/open.