TUI
The TUI is ka’s home surface, built on ratatui with a hand-rolled markdown renderer. The Nocturne design assigns one hue per role (violet for ka’s voice, orange for the human, cyan for tools, pink for thinking, lime for success, yellow for warnings, red for errors, azure for links) over a warm-graphite ground, with a monochrome glyph set instead of emoji. Streaming text, collapsed tool rows, live meters, and mouse support share the same process as the engine.
Starting
Section titled “Starting”ka # fresh sessionka -c # this terminal's latest sessionka --session 3f9c # by id prefixka -i "fix the tests" # run one prompt, then open the TUI resumed on that strand| Key | Action |
|---|---|
Enter |
Send, or steer mid-turn (checked between stream deltas) |
+text + Enter, or Alt+Q |
Queue the draft until the turn settles (Ctrl+Q recalls the last queued item into the draft) |
Esc |
Explicit precedence: close a popup (or path completion), then unpin a pinned scroll, then abort the turn, then open the rewind menu; a pinned scroll never costs the turn |
Ctrl-C |
Abort turn |
↑ / ↓ |
Input history |
Ctrl-P / Ctrl-N |
Input history |
PgUp / PgDn |
Scroll transcript (title shows ↑N above) |
⇧Enter / Ctrl-J |
Newline in the draft |
| bracketed paste | Multi-line paste arrives as one draft |
Ctrl+S |
Stash the draft for later recall |
Steers and queued items post a visible ack line while the turn runs; nothing you type is lost or silently dropped. A steer sent while a tool batch runs rides the history at the batch boundary as an [operator, while you were working] message with a steer delivered ack; one that lands too late to reach a boundary settles into a queued follow-on turn on the same strand. Queued slash commands replay through the slash dispatcher in order when the turn settles; entries that no longer parse are skipped, and commands that cannot run headlessly (picker-openers like bare /model) are refused at enqueue time with a reason, so they never mis-run as prompts.
Capture is the default: tool rows, the ▲▼ jump arrows, and the bottom-strip buttons respond to clicks, the wheel scrolls at line granularity, and a plain left-drag over the transcript highlights those rows and copies them to your system clipboard on release (OSC 52; a toast confirms). ⇧drag still selects natively in your terminal.
Ctrl+M (or [tui] mouse = "native" in config) flips to native mode: nothing is captured, so drag selects and pastes with the terminal’s own bindings and the wheel scrolls via alternate-scroll; click-only affordances fall back to their keys (Ctrl+O, Ctrl+↑/↓). The choice persists.
With [tui] herdr = true, ka reports its idle / working / blocked state, its resume command, and exit to the Herdr pane hosting it. It requires Herdr’s pane environment to be present, so the toggle is inert in any other terminal.
A TUI that bends
Section titled “A TUI that bends”The TUI is configuration, not fixed chrome:
- Themes as data:
[tui] theme = "solarized"selects a theme; the live/themepicker previews as you move. Themes are TOML files in.ka/themes/(project) or~/.config/ka/themes/(user); Nocturne is the built-in fallback. - Remappable keybindings:
[keybindings]maps an action id to a chord. An unknown action id or a chord claimed twice is a hard error at startup, so mappings cannot silently rot;/helpshows the effective bindings. - Segmented status line:
[tui] status_line = [...]composes the bottom strip from segments: model, mode, session, effort, context, cost, tokens, cache, toggles, update. - Dynamic terminal title:
[tui] titlesets the window title; on by default. - Notification tuning:
[tui] notify_on = [...]picks which events notify;notify_unfocusedlimits them to unfocused terminals via terminal focus reporting.
Interactive TUI
Section titled “Interactive TUI”/vim: modal editing over the draft. INSERT / NORMAL / VISUAL modes with minimal motions, counts, and text objects./screen: fullscreen alt-screen mode; on exit the transcript dumps cleanly into your scrollback./plain: decoration-free render for screen readers; no rails, glyphs, or color coding.- Ghost text in the composer: slash commands and paths complete inline;
Tabaccepts. Ghost suggestions also appear for/goaland/looparguments. /recap: show the last recap or a fresh local summary; an automatic recap lands when focus returns after more than 5 minutes away./hooks,/permissions,/doctor: read-only panels over their config and state.- Jobs and DAP sessions show as a pill on the status line while they run; a
tan:Npill counts live tangential questions.
Slash commands
Section titled “Slash commands”/help lists everything with keys. The highlights:
- Model & mode:
/model [sel](picker when empty),/mode [mode](ask / accept edits / allow / readonly; legacy guarded / free / plan slugs still parse),/thinking [level](reasoning-level picker: off | low | medium | high | max, model-dependent; Enter persists, the named form is session-scoped),/settings(persist withs),/provider,/key,/usage,/context,/theme(live theme picker),/style [name](output styles from.ka/styles/*.md; session-scoped) - Session:
/session(alias/resume, type-to-filter picker),/new,/fork,/tree,/export,/rewind [N],/name <word>(set a memorable alias;ka --session <name>resumes on it),/transfer [focus](digest the live context into a fresh handoff strand that carries only the summary),/copy(block picker; copy to clipboard or write to a file),/search <text>(transcript search),/queue(view the follow-up queue),/diff(the session’s cumulative diff),/changelog - Work:
/plan <task>,/build,/review,/ship,/approve,/compact [focus],/compactfrom [N] [focus](compact from turn N, with an optional focus),/git(staging panel),/pr(review and fix presets) - Context & effort:
/focus(collapse older turns),/shake [thinking|images](deterministic context trim on demand),/autocompact N|off(threshold or off),/goal <condition>(◎ badge; a cheap-model judge checks it each turn, with an optional USD budget; pause, resume, or drop),/loop <task> [--every Ns](↻ badge; re-runs when the engine settles idle;/loop offstops it) - Ask on the side:
/btw <question>(side-channel answer from the fast role; tools off; it never enters the transcript or your context),/tan <question>(tangential background question on a read-only child session; the answer arrives as atan · …note, never a turn;/tanlists live jobs,/tan cancel [id]cancels one; off in safe mode) - Background work & debugging:
/tasks(picker over background delegates, bash jobs, and debug sessions; Enter pages the selected task’s full result),/debug(live debug sessions: breakpoints and console tail) - Safety:
/undo,/checkpoint,/restore,/spills(spill pointers from staged images and trimmed output register here) - Toggles:
/features(panel: ↑↓ choose, Enter toggles,ssaves the set as your user-layer default;/features on|off <spec>toggles directly),/sandbox off|fs(bash sandbox live;fsrecomputes the policy from[sandbox] allow_write). The status bar shows⊘ Nwhile N specs are disabled - Extensions:
/agents,/mcp,/prompt,/memory,/image /quit(alias/exit)
:emoji: shortcodes expand on completion.
Plus your custom commands from .ka/commands/*.md, which appear in the / popup and /help like builtins.
Rendering
Section titled “Rendering”Markdown with headers, lists, inline code, and fenced blocks: shaded code panels, rounded tables, depth bullets, and ☐/☑ tasks. Mermaid diagrams render as box-drawing flowcharts, sequence and state diagrams, and quadrant planes; anything the renderer does not cover keeps its source panel. User turns ride a rail band, assistant prose sits on the canvas, and thinking collapses to a ✻ head with a quiet rail; click it or Alt+T to toggle. Tool calls render as a timeline row (status glyph, tool icon, detail, right-aligned exit code and duration); clicking a row (capture mode) or Ctrl+O expands its full output in a tinted panel. A single header bar carries the session title, scroll position, cwd, branch, and jump arrows; the status line holds the meters and the mode pill. Turn verdicts close with a rule, and small actions ack as toasts instead of transcript rows. Motion is state-driven only: the working label shimmers and the composer comet sweeps while a turn streams, so an idle transcript costs no CPU. Rendered rows are cached per entry: streaming redraws only the live region, which keeps the TUI snappy on huge transcripts. Since v0.6.0 the render path is buffered end to end: each frame flushes to the terminal as one write, and draws arriving mid-stream coalesce onto the 80 ms tick, so a streamed answer costs about 64 tty writes and an idle session 0% CPU. NO_COLOR is honored.
Multiple staged images render as positional [Image #N] chips in the draft, and any spill:// pointers they create register in /spills.