mit einem Klick
tui
// Use when you need to operate a full-screen terminal application (TUI) via wsh. Examples: "navigate vim to edit a file", "use lazygit to stage and commit changes", "interact with htop or k9s".
// Use when you need to operate a full-screen terminal application (TUI) via wsh. Examples: "navigate vim to edit a file", "use lazygit to stage and commit changes", "interact with htop or k9s".
| name | tui |
| description | Use when you need to operate a full-screen terminal application (TUI) via wsh. Examples: "navigate vim to edit a file", "use lazygit to stage and commit changes", "interact with htop or k9s". |
IMPORTANT: EXECUTION CONTEXT This skill describes what to do — domain patterns and decision-making. It does NOT describe how to call the API.
- If you have
wsh_*tools (check your toolkit forwsh_send_input,wsh_get_screen, etc.): use them directly. Operation names in this skill generally map to tool names (e.g., "send input" →wsh_send_input). When in doubt, list your availablewsh_*tools.- If you do NOT have
wsh_*tools: you are in HTTP/curl fallback mode. DO NOT GUESS endpoints or CLI subcommands. Load the full API reference first: search your workspace forskills/core/and readSKILL.md. It contains every endpoint with working curl examples and a bootstrap sequence.- Quick bootstrap:
curl -sf --unix-socket ${XDG_RUNTIME_DIR:-/tmp}/wsh/default.http.sock http://localhost/health— if that fails:wsh server -L agent-$$ --ephemeral &and retry.
Some programs take over the entire terminal — vim, htop, lazygit, k9s, midnight commander. They use the terminal's "alternate screen buffer," a fixed grid where the program controls every character position. This is a fundamentally different interaction model from command-and-response.
When a TUI is active, the screen response includes:
"alternate_active": true
This tells you you're in grid mode. The screen is no longer a log of output — it's a 2D canvas the program redraws at will. Scrollback is irrelevant while alternate screen is active; the program owns the entire display.
When the TUI exits, alternate_active flips back to false
and the normal scrollback view resumes exactly where it left
off. None of the TUI's screen content leaks into scrollback.
In a TUI, screen position matters. A line isn't just text —
it's a row in a spatial layout. Use styled format here;
formatting carries critical information:
Read the full screen and interpret it spatially. The first few lines are often a header or menu bar. The last line or two are often a status bar or command input. The middle is content.
TUI programs don't use typed commands — they use keystrokes. Every key does something different depending on context. You need to know the program's keybindings.
Arrow keys, Page Up/Down, Home/End, Tab (cycle panes), Enter (confirm/open), Escape (cancel/back).
Many TUIs adopt vim conventions:
h, j, k, l # left, down, up, right
g, G # top, bottom
/ # search
n, N # next/previous match
q # quit
Send one keystroke at a time. Wait briefly between keystrokes to let the TUI redraw — TUIs repaint the screen after each input, and you need the updated screen to know where you are.
send: j # move down
wait (500ms)
read screen # see what's selected now
send: j # move down again
wait (500ms)
read screen # verify position
This is slower than blasting keys, but reliable. You're navigating blind if you don't read between keystrokes.
When you first enter a TUI, read the full screen and build a mental map. Most TUIs follow common layout patterns:
+----------------------------------+
| Menu bar / Title bar | <- rows 0-1
+----------------------------------+
| |
| Main content area | <- middle rows
| (list, editor, dashboard) |
| |
+----------------------------------+
| Status bar / Help / Command line | <- last 1-2 rows
+----------------------------------+
q:quit j/k:navigate ?:help or ^X Exit ^O Save.|, -, + characters or
box-drawing characters. These indicate split panes. Only
one pane is active at a time — Tab or Ctrl+W typically
switches between them.TUIs often pop up confirmation dialogs or input fields over the main content. These appear as a differently-styled block in the middle of the screen. Look for:
[ OK ] [ Cancel ]When a modal is active, navigation keys operate on the modal, not the content behind it.
You don't need to memorize every TUI's keybindings. But knowing the basics for frequently encountered programs helps.
vim/neovim: Starts in Normal mode. i to insert text,
Esc to return to Normal. :w save, :q quit, :wq both.
If lost, press Esc Esc then :q! to quit without saving.
nano: Simpler. Just type to edit. Keybindings shown at
bottom. ^ means Ctrl. ^X exits, ^O saves.
lazygit: Pane-based. Tab switches panes (files, branches,
commits). j/k navigates, Enter opens, space stages, c
commits, p pushes, q quits.
htop/top: Shows processes. j/k or arrows to navigate,
k to kill a process, q to quit. F keys for actions
(shown at bottom).
k9s: Resource browser. : opens command mode for
resource type (:pods, :deployments). j/k navigates,
Enter drills in, Esc goes back, d describe, l logs.
? or h — most TUIs open a help screenq or Esc to close itq, Esc, :q, Ctrl+C,
Ctrl+Q — try these in order to exitGetting out is as important as getting in. When you're done with a TUI, you need to return to the normal shell prompt.
q, :q, Ctrl+X)Esc to back out of any modal or sub-mode firstCtrl+CCtrl+Z to suspend, then kill %1After sending a quit command, wait for idle, then check:
"alternate_active": false
If this is false, you're back in normal mode with your shell
prompt. If it's still true, the TUI is still running —
your quit command may not have worked, or the program asked
for confirmation before exiting.
A TUI is not a shell. If you send ls -la\n into vim, you'll
get those characters inserted into the document. Always know
what mode you're in before sending input.
TUIs redraw the screen after each input. If you send 10 j
keystrokes without reading in between, you won't know where
you landed. Navigate one step at a time.
Many TUIs have multiple modes (vim's Normal/Insert/Visual, lazygit's panes). The same key does different things in different modes. Read the screen after each action to confirm you're in the mode you expect.
If you launch a TUI from within a TUI (e.g., vim from within
a file manager), alternate_active is still just true. You
need to track the nesting yourself by remembering what you
launched and how many layers deep you are.
REQUIRED before any wsh terminal operation. Contains the complete MCP tool reference and bootstrap sequence for wsh_create_session, wsh_send_input, wsh_get_screen, wsh_send_and_read, wsh_send_keys, and all wsh_* tools. Do NOT guess wsh CLI commands or HTTP endpoints — use MCP tools or load this skill first.
Use when you need to drive a CLI program through command-and-response interaction via wsh. Examples: "run a build command and check the output", "interact with an installer that asks questions", "execute a sequence of shell commands and handle errors".
Use when you need to launch and drive other AI agents (Claude Code, Aider, Codex, etc.) through their terminal interfaces via wsh. Examples: "run multiple Claude Code sessions in parallel on different tasks", "feed a task to an AI agent and handle its approval prompts", "coordinate several AI agents working on subtasks of a larger project".
Use when you need to manage sessions across multiple wsh servers in a federated cluster. Examples: "distribute builds across several machines", "create sessions on a specific backend", "monitor health across a cluster of servers", "coordinate work across server boundaries".
REQUIRED before any wsh terminal operation when you do NOT have wsh_* MCP tools. Contains the complete HTTP API reference with working curl examples, bootstrap sequence, and authentication guide. wsh has no CLI subcommands for programmatic use — do NOT run 'wsh <verb>' commands or guess endpoints. Load this skill first.
Use when you need to build dynamic, interactive terminal experiences on the fly. Examples: "create a live dashboard in the terminal", "build an interactive file browser", "generate a custom TUI for this workflow".