Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Gaurav-Gosain/tuios/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TUIOS supports persistent sessions through a daemon process, similar to tmux or screen. Sessions continue running in the background even when you disconnect, allowing you to reattach later with all windows, content, and state preserved.Session persistence is powered by a client-server architecture: the daemon manages PTYs and session state, while TUI clients provide the interface.
Key Benefits
Persist Across Disconnects
Close your terminal or SSH connection - your session keeps running
Resume Anywhere
Attach from a different terminal, SSH session, or browser
Multi-Client Support
Multiple clients can attach to the same session simultaneously
State Preservation
Windows, workspaces, layouts, and terminal content all persist
Creating Sessions
Create New Session
Create a new persistent session and attach to it:- Starts the TUIOS daemon (if not running)
- Creates a new session
- Attaches you to the session
Daemon Auto-Start
The daemon starts automatically when you create or attach to a session. No need to manually start it.The daemon runs in the background and continues even after you detach. It only stops when explicitly killed with
tuios kill-server.Attaching to Sessions
Attach to Existing Session
Attach from SSH
When connecting via SSH, the session is automatically selected:- SSH username (if not generic like “tuios”, “root”, “anonymous”)
- Explicit session name via SSH command (e.g.,
ssh host attach mysession) - First available session or create new
Detaching
Detach from your session while keeping it running:What Persists
When you detach, everything is preserved:- All windows with their content and scrollback
- All workspaces with their window arrangements
- Tiling configuration per workspace
- Custom layouts and split configurations
- Running processes in terminal windows
- Terminal output buffered during detachment
Listing Sessions
View all active sessions:Managing Sessions
Kill Session
Terminate a session and all its windows:- Closes all windows in the session
- Terminates all running processes
- Removes the session from the daemon
Kill Daemon
Stop the daemon and all sessions:Multi-Client Sessions
Multiple clients can attach to the same session simultaneously, enabling collaborative work or multi-monitor setups.Attach Multiple Clients
Multi-Client Behavior
Synchronized State
All clients see the same windows, workspaces, and content in real-time
Shared Input
Any client can control windows, create new windows, switch workspaces
Independent Workspaces
Each client can be on a different workspace in the same session
Minimum Terminal Size
Session size is the minimum of all connected clients
Terminal Size Coordination
When multiple clients with different terminal sizes attach:Session State
What’s Stored in Sessions
The daemon stores comprehensive session state:- Updated in real-time as you work
- Synchronized across all attached clients
- Restored when you reattach
- Persisted across daemon restarts (if using state files)
PTY Management
The daemon owns all PTYs (pseudo-terminals):- Creates PTYs when windows are created
- Streams output to subscribed clients
- Buffers output when no clients are attached
- Keeps processes running even when detached
Remote Control
Control sessions remotely using CLI commands:Send Keys
Send keystrokes to a running session:Execute Commands
Run tape commands in a session:Set Configuration
Change runtime settings:Query State
Inspect session state for scripting:SSH Server
Run TUIOS as an SSH server for remote access:SSH Session Selection
By default, SSH sessions use persistent daemon mode. Session selection:- Username-based:
ssh myproject@server→ attaches to “myproject” session - Command argument:
ssh server attach work→ attaches to “work” session - Default session flag:
tuios ssh --default-session shared→ all connections share one session - Auto-create: If no session exists, creates one
SSH Ephemeral Mode
For standalone SSH sessions (legacy behavior):Web Terminal
Access TUIOS via browser usingtuios-web:
Web Session Persistence
By default, web sessions connect to the daemon:- Sessions persist when you close the browser tab
- Multiple tabs can connect to the same session
- State is preserved across reconnections
Web Ephemeral Mode
Practical Workflows
Long-Running Builds
Multi-Project Development
Pair Programming
Remote Monitoring
Implementation Details
Architecture
TUIOS uses a client-server architecture for sessions:Source Code
Daemon implementation:internal/session/daemon.go
Key components:
Daemonstruct - Manages all sessions and client connectionsSessionstruct - Container for windows and PTYsPTYstruct - Pseudo-terminal with process managementManagerstruct - Session lifecycle management
internal/session/protocol.go
- Binary protocol over Unix socket
- Gob encoding for state messages
- Optimized PTY output streaming (binary format)
PTY Ownership
The daemon owns all PTYs:- PTYs are created when windows are created (
CreatePTYmessage) - PTYs stream output to subscribed clients (
SubscribePTYmessage) - PTYs continue running even when no clients are subscribed
- PTYs are closed when windows are deleted (
ClosePTYmessage)
State Synchronization
State is synchronized bidirectionally: Client → Daemon:- Window create/close/move
- Workspace switches
- Layout changes
- Configuration updates
- PTY output streaming
- Session state updates
- Client join/leave notifications
- Session resize events
Socket Location
The daemon socket is located at:- Linux/macOS:
$XDG_RUNTIME_DIR/tuios/tuios.sockor/tmp/tuios-$UID.sock - Windows: Named pipe
\\.\pipe\tuios-$UID
Configuration
Session behavior is configured in~/.config/tuios/config.toml:
Persistent state files are not yet implemented. Currently, sessions only persist while the daemon is running.
Troubleshooting
Daemon Won’t Start
Check if already running:Can’t Attach to Session
Cause: Session name typo or session doesn’t exist. Solution:Session State Not Preserved
Cause: Running in local mode (no daemon). Solution: Usetuios new or tuios attach instead of just tuios.
Cause: Daemon was killed.
Solution: Sessions only persist while daemon is running. Use tuios new to recreate.
Multiple Clients Have Different Sizes
Expected behavior: Session size is minimum of all clients. Smaller client constrains the layout. Workaround: Use similar terminal sizes across all clients, or disconnect the smaller client.PTY Output Not Streaming
Cause: Client hasn’t subscribed to PTY. Solution: This is usually automatic. If windows show no output:- Switch to a different workspace and back
- Detach and reattach
x to close the window.
Related Documentation
- Workspaces - Workspace state persists in sessions
- Tiling - Tiling configuration persists per workspace
- CLI Reference - Complete command reference for session management
- Multi-Client Guide - Technical details on multi-client sessions
Comparison with Other Tools
TUIOS Sessions vs. tmux Sessions
tmux
- Text-based protocol
- Panes share terminal dimensions
- Requires tmux on remote server
- Complex configuration language
TUIOS
- Binary protocol (faster)
- Windows have independent sizes
- Single binary deployment
- TOML configuration
TUIOS Sessions vs. screen Sessions
TUIOS provides:- Modern UI with mouse support
- Multiple workspaces (screen has one)
- BSP tiling (screen has manual splits)
- Remote control API for scripting
- Multi-client support (screen supports but less robust)