Cell-based double-buffered TUI with 24-bit color, UTF-8 rendering, draggable overlays, and 4 operating modes. The session view is the primary interface for interacting with ScorpioX Code.
Full TUI with cell-based rendering, panels, input field, status bar, overlays, mouse support, and double-buffered drawing via sx_term
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
Stdin is a pipe (echo 'hi' | sx). Drains piped data, reopens /dev/tty, sends piped text as first message, then enters interactive TUI
One-shot prompt via --prompt flag. Treated as piped input — sends message, receives response, then enters interactive TUI
Initialize everything, emit tools/system prompt, skip agentic loop. Enabled via -n/--dry-run flag
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
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
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
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
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
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
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
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
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
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
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
None
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
None
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
None
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
None
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
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
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
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
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
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
Set these keys in scorpiox-env.txt to customize session behavior.
AGENTLESS_MODE
Run in agentless mode (no sub-agents)
0
AGENT_MAX_RECURSION_DEPTH
Maximum recursion depth for nested agent calls
10
ASKUSER_TIMEOUT
Timeout in seconds for AskUserQuestion prompts
120
AUTO_ACCEPT_PLAN
Auto-accept plans without user confirmation
1
BASH_DEFAULT_TIMEOUT
Default timeout in ms for Bash tool execution
30000
BASH_MIN_TIMEOUT
Minimum timeout in ms for Bash tool (0 = no minimum)
0
LOG_DIR
Directory for session logs
.scorpiox/logs
LOG_LEVEL
Logging verbosity level
INFO
SESSION_RETENTION_DAYS
Days to retain session logs
7