Operating Modes

🖥

interactive

Full TUI with cell-based rendering, panels, input field, status bar, overlays, mouse support, and double-buffered drawing via sx_term

headless

No TTY required — sx_term_init_headless(w,h) renders into cell buffer for daemon/SDK use. Enabled via --headless flag. Implies --emit-session for file-based message exchange

📥

piped

Stdin is a pipe (echo 'hi' | sx). Drains piped data, reopens /dev/tty, sends piped text as first message, then enters interactive TUI

prompt

One-shot prompt via --prompt flag. Treated as piped input — sends message, receives response, then enters interactive TUI

dry-run

Initialize everything, emit tools/system prompt, skip agentic loop. Enabled via -n/--dry-run flag

Components

Component Description Source Custom
sx_term Zero-dependency terminal library. Provides raw mode (termios/Win32), double-buffered cell-based rendering with diff-based present, 24-bit truecolor, UTF-8 input/output, mouse support (SGR protocol), resize handling (SIGWINCH), alternate screen, bracketed paste, text selection, OSC 52 clipboard, and headless mode for daemon rendering scorpiox/sx_term.c
scorpiox/sx_term.h
no
status_bar 5-line status bar at bottom showing: model name, stacked usage history (input/output/cache_read/cache_write tokens with color coding), cache keep-alive timer with color thresholds (green >3min, yellow 1-3min, red <1min), current working directory, git branch, background task count, bash running indicator, and callback status. Supports mouse click hit areas for cwd (file explorer toggle) and bash indicator scorpiox/sx_statusbar.c
scorpiox/sx_statusbar.h
yes
input_field Multi-line input field with cursor, UTF-8 editing, word-level operations (Ctrl+W delete word, Ctrl+Left/Right word navigation), kill line (Ctrl+K), blinking cursor, text wrapping, and input history (up to 100 entries with Up/Down navigation) scorpiox/libsxui/sxui_input.c
scorpiox/libsxui/sxui_input.h
no
chat_display In-memory message display manager. Stores up to 512 cached messages of types: user, assistant, tool_call, tool_result, error, info, thinking. Rendered bottom-up as single page (no scrolling) in sx.c chat_render() with per-type color coding and optional gradient background scorpiox/libsxui/sxui_display.c
scorpiox/libsxui/sxui_display.h
no
ui_state In-memory UI state management. Tracks input text, cursor position, UI mode (normal/completion/rewind), selected index for popups, loading state with start time, and dirty flag for triggering re-renders scorpiox/libsxui/sxui_state.c
scorpiox/libsxui/sxui_state.h
no
info_box Draggable overlay widget (36x13) showing version, model, provider, tools status, session name, FPS, memory usage (RSS MB), CPU percentage, active forks, open file descriptors, and keyboard shortcuts. Toggled via /info command. Supports drag-to-move and click-to-close with mouse scorpiox/libsxui/sxui_infobox.c
scorpiox/libsxui/sxui_infobox.h
no
bash_terminal Live bash terminal overlay widget (120x12) that streams command output in real-time when the Bash tool runs. Shows command name, rolling output buffer (8 lines x 256 chars), elapsed time, total bytes, exit code. States: hidden/running/done/error/minimized. Supports background button [BG], drag-to-move, suppress mode (/terminal off), and Ctrl+B to background scorpiox/libsxui/sxui_bashterm.c
scorpiox/libsxui/sxui_bashterm.h
no
file_explorer File explorer overlay widget for browsing directories. Shows sorted file listing with icons, supports navigation (Enter to open, Backspace to go up), selection movement (Up/Down/Home/End/PgUp/PgDown), hidden file toggle, scrolling for long lists, mouse interaction, drag-to-move, and file selection callback scorpiox/libsxui/sxui_fileexplorer.c
scorpiox/libsxui/sxui_fileexplorer.h
no
resume_picker Conversation resume picker overlay (60x12) for selecting and resuming previous conversations. Shows up to 50 conversation previews with 8 visible rows, scroll support, mouse interaction, drag-to-move, and selection callback. Toggled via /resume command scorpiox/libsxui/sxui_resume.c
scorpiox/libsxui/sxui_resume.h
no
callback_list Draggable popup (52 wide) showing all active SetCallback timers with slot index, message preview, time remaining, repeat count, and pause state. Toggled via /callbacks command. GitHub dark theme styling scorpiox/libsxui/sxui_callbacks.c
scorpiox/libsxui/sxui_callbacks.h
no
completion_popup Slash command autocomplete popup rendered inline above the input field. Shows matching commands as user types /. Separate argument completion popup for commands like /model (shows opus/sonnet/haiku) and /resume. Triggered by Tab key scorpiox/sx.c no
loading_spinner Animated spinner with 10 braille-pattern frames cycling at 80ms intervals. Shows elapsed time during API requests. WASM mode uses a separate JS-side spinner (requestAnimationFrame) that runs while the C stack is suspended by JSPI scorpiox/sx.c no
welcome_screen Welcome screen rendered when no messages exist. Shows provider/model info with gradient background (if enabled). Info box rendered separately as overlay scorpiox/sx.c no
gradient_background Optional gradient background drawn behind chat messages and welcome screen. Controlled by enable_gradient config option via sx_state_get_enable_gradient() scorpiox/sx.c yes
text_selection Mouse-based text selection with highlight overlay. Tracks start/end coordinates, active/valid states. Selection applied to back buffer before present. Copy via OSC 52 clipboard protocol. Supports press/drag/release mouse states scorpiox/sx_term.c
scorpiox/sx_term.h
no
tmux_backend Backend abstraction for session multiplexing. Vtable interface supporting tmux CLI (shells out to tmux binary) or sxmux (native scorpiox-multiplexer API). Auto-detects best backend, override via TMUX_BACKEND config. Provides list/create/kill sessions, capture pane, send keys, resume scorpiox/sxtmux_backend_tmux.c
scorpiox/sxtmux_backend.h
yes
shortcut_registry Centralized keyboard shortcut registry — single source of truth for all keybindings. Categorized as Editing, Navigation, Actions, Tools, Mouse, Other. Provides match_ctrl() lookup for dispatch, formatted help text generation for /help, and enumeration for info box display scorpiox/libsxutil/sx_shortcut.c
scorpiox/libsxutil/sx_shortcut.h
no
slash_commands Slash command system with auto-completion. Sources: system built-ins, embedded skills, embedded commands, user commands (~/.claude/commands/), project commands (./.claude/commands/), user skills, project skills. System commands include /exit, /clear, /help, /model, /save, /load, /rewind, /config, /transcript, /continue, /info, /resume, /keepalive, /context_resize, /terminal, /history, /compact, /cd, /voice, /callbacks scorpiox/libsxutil/sx_slashcmd.c
scorpiox/libsxutil/sx_slashcmd.h
yes
rewind_system Conversation checkpoint and rewind system. Each user message creates a checkpoint (up to 100). Users can rewind to any previous checkpoint via /rewind command, discarding subsequent messages. Stores message preview, full text, API/display indices, and timestamp scorpiox/libsxutil/sx_rewind.c
scorpiox/libsxutil/sx_rewind.h
no
cache_keepalive Background thread that auto-sends a keep-alive message through the normal agent path when idle for ~4:30 to maintain Claude prompt cache. Timer displayed in status bar with color-coded urgency. Toggled via /keepalive command scorpiox/sx_cache_keepalive.c
scorpiox/sx_cache_keepalive.h
yes

Keyboard Shortcuts

Other

Key Action Context
Enter Send message input
Escape Cancel generation / close dialog global
Tab Autocomplete command input
Ctrl+C Quit global
Ctrl+L Clear input line input
Ctrl+U Clear input line (alt) input
Ctrl+W Delete word backward input
Ctrl+K Kill to end of line input
Ctrl+A Move to start of line input
Ctrl+E Move to end of line input
Ctrl+X Open external editor (vim/nano) input
Ctrl+O Open transcript viewer global
Ctrl+B Send foreground task to background global
Backspace Delete character backward (UTF-8 aware) input
Delete Delete character forward input
Left Move cursor left input
Right Move cursor right input
Ctrl+Left Move to previous word input
Ctrl+Right Move to next word input
Up Previous input / history input
Down Next input / history input
Home Move to start of line input
End Move to end of line input
Left-click Select text / interact with UI widgets global
Right-click Paste from clipboard global
Left-drag Text selection / drag widgets global
Scroll-up Scroll (overlay context dependent) overlay
Scroll-down Scroll (overlay context dependent) overlay
!command Run bash command directly input

Color System

Message Colors

TypeColor

Usage Colors

TypeColor

Cache Timer Colors

StateColor
Cell attributes:

Rendering

double buffered
diff based present
cell based
markdown
syntax highlighting
diff view
unicode
wide char support
emoji support
gradient background
alternate screen
bracketed paste

Terminal Requirements

RequirementValue
min_width 40
max_width 1024
max_height 512
max_width_wasm 256
max_height_wasm 64
color_support 24-bit truecolor (with fallback constants for 256-color)
unicode_required False
mouse_protocol SGR (1006)
clipboard_protocol OSC 52
alternate_screen True
raw_mode termios (Unix) / Win32 Console API (Windows) / xterm.js (WASM)

Platform Support