Overview

Scorpiox code follows a strict modular architecture: the main sx binary is the interactive TUI, while every capability — shell execution, web search, file operations, container management — lives in its own dedicated binary. Each tool is compiled from C with static linking, producing a single executable with zero runtime dependencies.

┌─────────────────────────────────────────────────────┐
│                      sx (TUI)                       │
│              main interactive binary                │
├──────────┬──────────┬──────────┬────────────────────┤
│ scorpiox │ scorpiox │ scorpiox │  scorpiox-search   │
│  -bash   │  -tmux   │  -mcp   │  scorpiox-docs     │
│  -pwsh   │  -host   │  -sdk   │  scorpiox-agent    │
├──────────┴──────────┴──────────┴────────────────────┤
│           stdin/stdout JSON pipes                   │
├─────────────────────────────────────────────────────┤
│  libsxutil (26)  │  libsxnet (20)  │  libsxui (7)  │
└──────────────────┴─────────────────┴────────────────┘

How It Works

When sx needs to execute a shell command, it spawns scorpiox-bash as a child process. When AI requests a web search, scorpiox-search is invoked. The main process communicates via stdin/stdout pipes and JSON-formatted messages. This process-isolation model means a crash in any tool never takes down the main session.

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
scorpiox-bash Shell execution (bash)
scorpiox-pwsh Shell execution (PowerShell)
scorpiox-agent Sub-agent spawner
scorpiox-config Configuration manager
scorpiox-systemprompt System prompt editor
Search & Web
scorpiox-search Web search (11 engines)
scorpiox-docs Fetch & render docs
scorpiox-executecurl HTTP request executor
Session
scorpiox-conv Conversation manager
scorpiox-tasks Persistent task tracking
scorpiox-planmode Plan mode manager
scorpiox-compact Context compaction
scorpiox-rewind Session rewind
scorpiox-transcript Session transcripts
scorpiox-emit-session Session export
Infrastructure
scorpiox-tmux Terminal multiplexer
scorpiox-wsl WSL bridge (Windows)
scorpiox-unshare Linux namespace isolation
scorpiox-podman Container runtime
scorpiox-host Service host daemon
scorpiox-cron Scheduled task runner
scorpiox-hook Git hook manager
Communication
scorpiox-email Email client
scorpiox-whatsapp WhatsApp bridge
scorpiox-imessage iMessage bridge
scorpiox-traffic Network traffic monitor
AI & Providers
scorpiox-mcp MCP server
scorpiox-gemini Gemini provider CLI
scorpiox-openai OpenAI provider CLI
scorpiox-claudecode-fetchtoken OAuth token fetcher
scorpiox-sdk SDK framework
Diagnostics
scorpiox-usage Token usage tracker
scorpiox-debug Debug inspector
scorpiox-logger Log viewer
scorpiox-printlogs Print log output
Media & Testing
scorpiox-renderimage Image renderer
scorpiox-runtest Test runner

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 disable 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

# Disable specific tools
SCORPIOX_DISABLED_TOOLS=scorpiox-whatsapp,scorpiox-imessage

# 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 "dev-session" -c "npm run build"

# Read session output
scorpiox-tmux --read "dev-session"
scorpiox-mcp
# Start MCP server (Model Context Protocol)
scorpiox-mcp --transport stdio

# Expose tools over MCP to external clients
scorpiox-mcp --transport http --port 3100

# List available MCP tools
scorpiox-mcp --list-tools
scorpiox-bash
# Execute with timeout and working directory
scorpiox-bash -c "git status" --cwd /home/user/project --timeout 30000

# JSON input mode (used by sx internally)
echo '{"command":"ls -la","timeout":5000}' | scorpiox-bash --json