Overview

scorpiox code follows a multi-binary architecture. The main sx binary handles the TUI, AI provider communication, and conversation state. Every other capability — shell execution, web search, container management, MCP servers, screenshot capture — is delegated to a standalone scorpiox-* binary. Each tool communicates with sx over stdin/stdout JSON pipes.

┌─────────────────────────────────────────────────────────────┐
│                        sx (TUI)                             │
│            main interactive binary — AI loop                │
├──────────┬───────────┬───────────┬───────────┬──────────────┤
│ scorpiox │ scorpiox  │ scorpiox  │ scorpiox  │ scorpiox     │
│  -bash   │  -search  │  -agent   │  -mcp     │  -tmux       │
│  -pwsh   │  -docs    │  -sdk     │  -gemini  │  -podman     │
│  -busybox│  -curl    │  -init    │  -openai  │  -wsl        │
├──────────┴───────────┴───────────┴───────────┴──────────────┤
│              stdin/stdout JSON pipes (IPC)                   │
├─────────────────────────────────────────────────────────────┤
│          $SCORPIOX_HOME/bin/scorpiox-* discovery             │
└─────────────────────────────────────────────────────────────┘

How It Works

When sx needs to execute a shell command, it spawns scorpiox-bash as a child process. When the AI requests a web search, scorpiox-search is invoked. The main process communicates via stdin/stdout pipes and JSON-formatted messages. Tools are discovered at startup by scanning $SCORPIOX_HOME/bin/ for scorpiox-* executables.

process lifecycle
# sx spawns scorpiox-bash for a shell command
sx --tool bash -c "ls -la /tmp"

# Internal flow:
1. sx receives tool_use from AI provider
2. sx forks + exec("scorpiox-bash")
3. scorpiox-bash reads JSON from stdin
4. executes: /bin/bash -c "ls -la /tmp"
5. captures stdout/stderr
6. writes JSON result to stdout
7. sx reads result, sends to AI provider

Tool Catalog

Core
sx Interactive TUI — main entry point
scorpiox-bash Shell execution (bash/sh)
scorpiox-pwsh Shell execution (PowerShell)
scorpiox-busybox Minimal shell for containers
scorpiox-agent Sub-agent spawner
scorpiox-config Configuration manager
scorpiox-init Selective tool loader
scorpiox-systemprompt System prompt editor
Search & Web
scorpiox-search Concurrent web search (11 engines)
scorpiox-docs Fetch & render URL content
scorpiox-executecurl HTTP request executor
Session
scorpiox-conv Conversation manager
scorpiox-tasks Persistent task tracking
scorpiox-planmode Plan mode manager
scorpiox-rewind Session rewind / undo
Infrastructure
scorpiox-tmux Terminal multiplexer
scorpiox-wsl WSL2 bridge (Windows)
scorpiox-unshare Linux namespace isolation
scorpiox-podman Container runtime
scorpiox-server HTTP server daemon
scorpiox-hook Git hook manager
scorpiox-vm Virtual machine manager
Communication
scorpiox-beam Encrypted file transfer
scorpiox-voice Voice input / TTS
scorpiox-askuserquestion Interactive multi-choice TUI
AI & Providers
scorpiox-mcp MCP server (native protocol)
scorpiox-gemini Gemini provider CLI
scorpiox-openai OpenAI provider CLI
scorpiox-sdk SDK framework / agent runner
Diagnostics
scorpiox-printlogs Structured log viewer
scorpiox-runtest Test runner framework
Media & Capture
scorpiox-renderimage Terminal image renderer
scorpiox-screenshot Screen capture tool

Configuration

Tools are discovered at startup from $SCORPIOX_HOME/bin/. The main binary scans this directory and registers each scorpiox-* executable. You can override the tool directory or configure specific tools in scorpiox-env.txt.

scorpiox-env.txt
# Tool discovery directory
SCORPIOX_HOME=~/.scorpiox

# All tools live in $SCORPIOX_HOME/bin/
# sx scans for scorpiox-* executables at startup

# Override specific tool paths
SCORPIOX_BASH_PATH=/usr/local/bin/scorpiox-bash
SCORPIOX_SEARCH_PATH=/usr/local/bin/scorpiox-search

# MCP server configuration
MCP_SERVER_PORT=3100
MCP_TRANSPORT=stdio

# Container runtime
CONTAINER_RUNTIME=podman
CONTAINER_IMAGE=scorpiox-sandbox:latest

Examples

scorpiox-search
# Search the web from CLI
scorpiox-search --query "rust async patterns" --engines google,bing,duckduckgo

# JSON output (pipe to sx)
{"results": [{"title": "...", "url": "...", "snippet": "..."}]}
scorpiox-tmux
# Create a persistent session
scorpiox-tmux --create "dev-session"

# Run command in background session
scorpiox-tmux --send "make test" --session "dev-session"

# Read session output
scorpiox-tmux --read --session "dev-session"
scorpiox-podman
# Run command in sandboxed container
scorpiox-podman --image scorpiox-sandbox:latest --exec "gcc -o test test.c && ./test"

# Mount workspace read-only
scorpiox-podman --mount ./src:/workspace:ro --exec "make build"
scorpiox-beam
# Send a file with end-to-end encryption
scorpiox-beam --send ./report.pdf
Beam code: ALPHA-BRAVO-7742

# Receive on another machine
scorpiox-beam --receive ALPHA-BRAVO-7742
scorpiox-mcp
# Start MCP server on stdio transport
scorpiox-mcp --transport stdio

# List registered tools via MCP protocol
scorpiox-mcp --list-tools
{"tools": ["bash", "search", "docs", "agent", ...]}