### Install SessionCast CLI using npm Source: https://github.com/sessioncast/sessioncast-cli/blob/main/README.md Installs the SessionCast CLI globally using npm. This is the primary method for installing the CLI on compatible systems. ```bash npm install -g sessioncast-cli ``` -------------------------------- ### Quick Start: Launch and Task an AI Worker Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Demonstrates how to create a tmux session, launch an AI agent (e.g., Claude Code) within it using SessionCast, wait for it to start, and then send it a specific task. This showcases basic agent control. ```bash # 1. Create a tmux session ``` ```bash tmux new-session -d -s worker1 ``` ```bash # 2. Launch any AI agent in it ``` ```bash sessioncast send worker1 "claude" # Claude Code ``` ```bash # or: sessioncast send worker1 "gemini" # Gemini CLI ``` ```bash # or: sessioncast send worker1 "codex" # OpenAI Codex ``` ```bash # or: sessioncast send worker1 "aider" # Aider ``` ```bash # or: sessioncast send worker1 "cursor" # Cursor CLI ``` ```bash # 3. Wait for it to start ``` ```bash sleep 5 ``` ```bash # 4. Send a task ``` ```bash sessioncast send worker1 "Fix the login bug in src/auth.ts - users get 401 after token refresh" ``` -------------------------------- ### SessionCast Agent Configuration File Example Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt An example of the agent configuration file (`~/.sessioncast.yml`). It defines essential parameters like machine identifier, relay server URL, and authentication token, along with optional API and LLM settings. ```yaml # ~/.sessioncast.yml - Required on each machine running the agent machineId: my-machine # Unique identifier shown in session list relay: wss://relay.sessioncast.io/ws # WebSocket relay server URL token: agt_your_agent_token_here # Agent token from sessioncast login # Optional: API configuration for remote command execution api: enabled: true agentId: "your-agent-uuid" # UUID from SessionCast dashboard # Command execution settings exec: enabled: true shell: /bin/bash workingDir: /home/user defaultTimeout: 30000 # 30 seconds # Optionally restrict allowed commands: # allowedCommands: # - "git .*" # - "npm .*" # LLM settings (for AI features) llm: enabled: false provider: ollama baseUrl: http://localhost:11434 model: llama2 ``` -------------------------------- ### Install and Login SessionCast CLI Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Installs the SessionCast CLI globally using npm and logs the user in via an OAuth flow that opens in a browser. This is a prerequisite for using SessionCast. ```bash # Install ``` ```bash npm install -g sessioncast-cli ``` ```bash # Login (opens browser for OAuth) ``` ```bash sessioncast login ``` -------------------------------- ### Configure SessionCast CLI with Environment Variables Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Demonstrates how to configure the SessionCast CLI and agent behavior using environment variables, specifically for setting custom configuration file paths. Includes an example for CI/CD usage. ```bash # Set custom config file path export SESSIONCAST_CONFIG=/custom/path/config.yml # Alternative config path (legacy support) export TMUX_REMOTE_CONFIG=/custom/path/config.yml # Example usage in CI/CD SESSIONCAST_CONFIG=/etc/sessioncast/ci-agent.yml sessioncast agent ``` -------------------------------- ### Start SessionCast Agent Source: https://github.com/sessioncast/sessioncast-cli/blob/main/README.md Commands to start the SessionCast agent. The first command runs the agent in the foreground, while the second runs it in the background with logging to a file. ```bash # Run agent (foreground) sessioncast agent # Run agent (background) nohup sessioncast agent > /tmp/sessioncast-agent.log 2>&1 & ``` -------------------------------- ### Start SessionCast Agent with AgentRunner.start() in TypeScript Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Illustrates how to start the SessionCast agent using the `AgentRunner.start()` method in TypeScript. This method enables auto-discovery of tmux sessions and establishes a WebSocket connection to the relay server. The agent automatically scans for sessions, manages handlers, streams terminal output, and handles graceful shutdown. ```typescript import { AgentRunner } from 'sessioncast-cli/agent/runner'; const config = { machineId: 'my-machine', relay: 'wss://relay.sessioncast.io/ws', token: 'agt_your_token_here', api: { enabled: true, agentId: 'your-agent-uuid', exec: { enabled: true, shell: '/bin/bash', workingDir: '/home/user', defaultTimeout: 30000 } } }; const runner = new AgentRunner(config); // Start the agent (blocks until SIGINT/SIGTERM) await runner.start(); // Output: // Starting SessionCast Agent... // Machine ID: my-machine // Relay: wss://relay.sessioncast.io/ws // Token: present // Agent started with auto-discovery (scanning every 5s) // Discovered new tmux session: workspace // Started handler for session: my-machine/workspace // Discovered new tmux session: worker1 // Started handler for session: my-machine/worker1 // Agent automatically: // - Scans for tmux sessions every 5 seconds // - Creates handlers for new sessions // - Removes handlers for deleted sessions // - Streams terminal output through WebSocket relay // - Handles graceful shutdown on SIGINT/SIGTERM ``` -------------------------------- ### Windows SessionCast CLI Installation with itmux Source: https://github.com/sessioncast/sessioncast-cli/blob/main/README.md Installs the SessionCast CLI on Windows, including the necessary itmux component for terminal management. This script downloads and extracts itmux, then installs the CLI globally. ```powershell # Download and extract itmux to C:\\itmux Invoke-WebRequest -Uri "https://github.com/itefixnet/itmux/releases/download/v1.1.0/itmux_1.1.0_x64_free.zip" -OutFile "$env:TEMP\\itmux.zip" Expand-Archive -Path "$env:TEMP\\itmux.zip" -DestinationPath "C:\\itmux" -Force # Install SessionCast CLI npm install -g sessioncast-cli ``` -------------------------------- ### Start SessionCast Agent Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Launches the SessionCast agent on the local machine. The agent automatically discovers running tmux sessions and streams their output to the SessionCast relay server, making them available for remote control. ```bash # Run agent in foreground (for debugging) sessioncast agent # Output: # Starting SessionCast Agent... # Machine ID: my-machine # Relay: wss://relay.sessioncast.io/ws # Token: present # Agent started with auto-discovery (scanning every 5s) # Discovered new tmux session: workspace # Started handler for session: my-machine/workspace ``` -------------------------------- ### Send QA Agent Command Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Sends a command to the 'qa-agent' to initiate integration tests on a specific file. This is a basic example of directing an agent to perform a task. ```bash sessioncast send qa-agent "Now run integration tests: npm test src/__tests__/integration/signup.integration.test.ts" ``` -------------------------------- ### Start SessionCast Agent on a Machine Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Starts the SessionCast agent on a machine, which allows it to be controlled by a leader agent. The agent runs in the background, and its logs are redirected to a file. Requires Node.js 18+ and tmux. ```bash # Start agent on each machine you want to control ``` ```bash nohup sessioncast agent > /tmp/sessioncast-agent.log 2>&1 & ``` -------------------------------- ### Run SessionCast Agent in Background Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Starts the SessionCast agent in the background, redirecting output to a log file. This is the recommended method for production environments. ```bash nohup sessioncast agent > /tmp/sessioncast-agent.log 2>&1 & ``` -------------------------------- ### Start SessionCast Agent Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Start the SessionCast agent, which streams tmux sessions to the relay. It can be run in the background for continuous operation or in the foreground for debugging purposes. ```bash # Background (recommended) nohup sessioncast agent > /tmp/sessioncast-agent.log 2>&1 & # Foreground (for debugging) sessioncast agent ``` -------------------------------- ### Configure Server URLs Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Functions for getting and setting the API, authentication, and relay server URLs used by the CLI. These are useful for connecting to self-hosted SessionCast deployments. Default URLs are provided, but custom URLs can be configured and persist across CLI invocations. ```typescript import { getApiUrl, setApiUrl, getAuthUrl, setAuthUrl, getRelayUrl, setRelayUrl } from 'sessioncast-cli/config'; // Get default URLs console.log(getApiUrl()); // 'https://api.sessioncast.io' console.log(getAuthUrl()); // 'https://auth.sessioncast.io' console.log(getRelayUrl()); // 'wss://relay.sessioncast.io/ws' // Configure custom URLs (for self-hosted deployments) setApiUrl('https://api.my-sessioncast.example.com'); setAuthUrl('https://auth.my-sessioncast.example.com'); setRelayUrl('wss://relay.my-sessioncast.example.com/ws'); // URLs persist across CLI invocations ``` -------------------------------- ### Manage Authentication Credentials Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Functions for setting, getting, and clearing authentication credentials like API keys, agent tokens, and access tokens within the CLI configuration. These functions manage tokens that authenticate the CLI with the SessionCast service. They return undefined if tokens are not set or have expired. ```typescript import { setApiKey, getApiKey, setAgentToken, getAgentToken, setAccessToken, getAccessToken, isLoggedIn, clearAuth } from 'sessioncast-cli/config'; // Set API key (starts with 'sk-') setApiKey('sk-your-api-key-here'); // Set agent token (starts with 'agt_') setAgentToken('agt_your_agent_token'); // Set OAuth access token with expiration (in seconds) setAccessToken('oauth-access-token', 3600); // expires in 1 hour // Check if any authentication method is active if (isLoggedIn()) { console.log('Authenticated'); // Returns true if apiKey, accessToken, or agentToken exists } // Get tokens (returns undefined if not set or expired) const apiKey = getApiKey(); // 'sk-...' or undefined const agentToken = getAgentToken(); // 'agt_...' or undefined const accessToken = getAccessToken(); // OAuth token or undefined (checks expiration) // Clear all authentication credentials clearAuth(); // Removes: apiKey, accessToken, refreshToken, tokenExpiresAt, agentToken ``` -------------------------------- ### Run SessionCast Agent with Custom Configuration Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Launches the SessionCast agent using a specified custom configuration file. This allows for flexible deployment scenarios. ```bash sessioncast agent -c /path/to/custom-config.yml ``` -------------------------------- ### List and Control AI Sessions Across Machines with SessionCast CLI Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Demonstrates how to use the 'sessioncast' command-line tool to list active AI sessions on various machines (development, staging, production) and send commands to them. This includes building on a dev machine, testing on staging, and deploying to production. ```bash # Discover all sessions across machines sessioncast list # Output: # AGENT SESSION STATUS TARGET # dev-macbook workspace online dev-macbook/workspace # staging-server main online staging-server/main # prod-server deploy online prod-server/deploy # Build on dev machine sessioncast send dev-macbook/workspace "claude" sleep 5 sessioncast send dev-macbook/workspace "Run npm run build and fix any TypeScript errors" # Test on staging server sessioncast send staging-server/main "git pull origin main && npm ci && npm test" # Deploy to production (with caution) sessioncast send prod-server/deploy "Deploy v2.1.0: git checkout v2.1.0 && npm ci --production && pm2 reload api" ``` -------------------------------- ### Multi-Agent Fan-Out for Parallel Development Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Demonstrates a pattern for splitting large features across multiple AI agents working in parallel on different code areas. This includes setting up tmux sessions and assigning tasks for frontend, backend, database, and documentation. ```bash # Create workers for each area tmux new-session -d -s frontend tmux new-session -d -s backend tmux new-session -d -s database tmux new-session -d -s docs # Launch agents (can mix different AI tools) sessioncast send frontend "claude" sessioncast send backend "gemini" sessioncast send database "claude" sessioncast send docs "codex" sleep 10 # Assign parallel tasks for "Add user settings page" feature sessioncast send database "Create a database migration for user_settings table with columns: user_id (FK), theme (varchar), language (varchar), notifications_enabled (boolean), updated_at (timestamp). File: src/migrations/003_user_settings.sql" sessioncast send backend "Create REST endpoints for user settings: GET /api/settings (read), PUT /api/settings (update). Use the user_settings table. Follow patterns in src/routes/profile.ts. Include validation." sessioncast send frontend "Build a Settings page component at src/pages/Settings.tsx. Include theme toggle (dark/light), language selector (en/ko/ja), notification toggle. Use the existing UI component library. Call PUT /api/settings on save." sessioncast send docs "Write API documentation for the user settings endpoints. Follow the OpenAPI format in docs/api/. Include request/response examples and error codes." ``` -------------------------------- ### Orchestration Pattern: Dev → QA → Deploy Pipeline Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Sets up three specialized AI agents for development, QA, and deployment stages. It demonstrates sending tasks sequentially, handling feedback from QA to Dev, and proceeding to deployment only after QA passes. This simulates a CI/CD workflow. ```bash # === Setup: Create sessions for each stage === ``` ```bash tmux new-session -d -s dev ``` ```bash tmux new-session -d -s qa ``` ```bash tmux new-session -d -s deploy ``` ```bash # Launch agents (can be different tools for each role) ``` ```bash sessioncast send dev "claude" # Claude for development ``` ```bash sessioncast send qa "codex" # Codex for QA/testing ``` ```bash sessioncast send deploy "gemini" # Gemini for deployment ``` ```bash sleep 10 ``` ```bash # === Stage 1: Development === ``` ```bash sessioncast send dev "Implement the user profile API endpoint: GET /api/users/:id with fields name, email, avatar. Write it in src/routes/users.ts following the existing patterns." ``` ```bash # Wait for dev to finish (monitor at app.sessioncast.io) ``` ```bash # ... ``` ```bash # === Stage 2: QA Testing === ``` ```bash sessioncast send qa "Run the test suite and verify the new user profile endpoint. Execute: npm test -- --grep 'user profile'. If tests fail, report which tests failed and why." ``` ```bash # If QA fails → send feedback back to dev ``` ```bash sessioncast send dev "QA found failures: the GET /api/users/:id endpoint returns 500 when user not found. It should return 404 with {error: 'User not found'}. Fix this." ``` ```bash # After dev fixes → re-run QA ``` ```bash sessioncast send qa "Re-run the user profile tests: npm test -- --grep 'user profile'" ``` ```bash # === Stage 3: Deploy (only after QA passes) === ``` ```bash sessioncast send deploy "Deploy the latest changes to staging: git pull origin main && npm run build && pm2 restart api-server. Verify the deployment by checking the health endpoint." ``` -------------------------------- ### Create Multi-Pane Tmux Workspace with SessionCast CLI Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md This bash script demonstrates how to set up a multi-pane tmux workspace for SessionCast. It creates a new session, splits it horizontally, and then splits one of the panes vertically, allowing for independent streaming of each pane. ```bash # Create multi-pane workspace tmux new-session -d -s workspace mux split-window -h -t workspace # Split horizontally tmux split-window -v -t workspace # Split vertically # Each pane is independently viewable at app.sessioncast.io # Click a pane to focus, or see full layout ``` -------------------------------- ### Orchestrate Code Review Pipeline with SessionCast CLI Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Details a three-agent workflow for code review using SessionCast CLI. It covers creating separate sessions for a coder, reviewer, and tester, then orchestrating the process from implementation to testing and fixing review findings. ```bash # Create sessions for each role tmux new-session -d -s coder tmux new-session -d -s reviewer tmux new-session -d -s tester sessioncast send coder "claude" sessioncast send reviewer "gemini" sessioncast send tester "codex" sleep 10 # Step 1: Implement sessioncast send coder "Implement a rate limiter middleware using sliding window algorithm. Max 100 requests per minute per IP. File: src/middleware/rateLimiter.ts" # Step 2: Review sessioncast send reviewer "Review the file src/middleware/rateLimiter.ts. Check for: correctness of sliding window algorithm, edge cases (concurrent requests, clock skew), memory leaks, security issues. Suggest improvements as code comments." # Step 3: Test sessioncast send tester "Write comprehensive tests for src/middleware/rateLimiter.ts. Cover: basic rate limiting, window sliding, concurrent requests, IP tracking, cleanup of expired entries. File: src/__tests__/rateLimiter.test.ts" # Step 4: Fix review findings sessioncast send coder "Address the code review comments in src/middleware/rateLimiter.ts. Then run the tests with: npm test src/__tests__/rateLimiter.test.ts" ``` -------------------------------- ### Login to SessionCast CLI using OAuth Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Authenticates with SessionCast using a browser-based OAuth flow with PKCE. This is the recommended method for interactive use as it opens your default browser for secure authentication and automatically generates an agent token upon successful login. ```bash # Browser-based OAuth login (recommended) sessioncast login # Login opens browser to auth.sessioncast.io # After authenticating, returns to CLI with success message: # ✓ You are now logged in to SessionCast # # Run `sessioncast agent` to start the agent # Run `sessioncast status` to check your login status ``` -------------------------------- ### Cross-Machine Orchestration Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Illustrates controlling agents on different servers (dev, staging, production). It includes listing available sessions across machines, building on a dev machine, testing on staging, and deploying to production. ```bash # Discover all sessions across machines sessioncast list # Output: # AGENT SESSION STATUS TARGET # dev-macbook workspace online dev-macbook/workspace # staging-server main online staging-server/main # prod-server deploy online prod-server/deploy # Build on dev machine sessioncast send dev-macbook/workspace "claude" sleep 5 sessioncast send dev-macbook/workspace "Run npm run build and fix any TypeScript errors" # Test on staging server sessioncast send staging-server/main "git pull origin main && npm ci && npm test" # Deploy to production (with caution) sessioncast send prod-server/deploy "Deploy v2.1.0: git checkout v2.1.0 && npm ci --production && pm2 reload api" ``` -------------------------------- ### Dev → QA → Deploy Pipeline Orchestration Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Orchestrates a software delivery pipeline using multiple AI agents for development, QA, and deployment stages. It involves setting up tmux sessions, launching agents, sending tasks, and handling feedback loops. ```bash # Setup: Create tmux sessions for each stage tmux new-session -d -s dev tmux new-session -d -s qa tmux new-session -d -s deploy # Launch different AI agents for each role sessioncast send dev "claude" # Claude for development sessioncast send qa "codex" # Codex for QA/testing sessioncast send deploy "gemini" # Gemini for deployment sleep 10 # Stage 1: Development sessioncast send dev "Implement the user profile API endpoint: GET /api/users/:id with fields name, email, avatar. Write it in src/routes/users.ts following the existing patterns." # Wait for dev to finish (monitor at app.sessioncast.io) # Stage 2: QA Testing sessioncast send qa "Run the test suite and verify the new user profile endpoint. Execute: npm test -- --grep 'user profile'. If tests fail, report which tests failed and why." # If QA fails, send feedback back to dev sessioncast send dev "QA found failures: the GET /api/users/:id endpoint returns 500 when user not found. It should return 404 with {error: 'User not found'}. Fix this." # Re-run QA after fix sessioncast send qa "Re-run the user profile tests: npm test -- --grep 'user profile'" # Stage 3: Deploy (only after QA passes) sessioncast send deploy "Deploy the latest changes to staging: git pull origin main && npm run build && pm2 restart api-server. Verify the deployment by checking the health endpoint." ``` -------------------------------- ### Code Review Pipeline Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Details a pipeline where one agent writes code, another reviews it, and a third writes tests. This pattern involves setting up separate agents for coding, reviewing, and testing, then orchestrating the flow of tasks between them. ```bash tmux new-session -d -s coder tmux new-session -d -s reviewer tmux new-session -d -s tester sessioncast send coder "claude" sessioncast send reviewer "gemini" sessioncast send tester "codex" sleep 10 # Step 1: Implement sessioncast send coder "Implement a rate limiter middleware using sliding window algorithm. Max 100 requests per minute per IP. File: src/middleware/rateLimiter.ts" # Step 2: Review sessioncast send reviewer "Review the file src/middleware/rateLimiter.ts. Check for: correctness of sliding window algorithm, edge cases (concurrent requests, clock skew), memory leaks, security issues. Suggest improvements as code comments." # Step 3: Test sessioncast send tester "Write comprehensive tests for src/middleware/rateLimiter.ts. Cover: basic rate limiting, concurrent requests, IP tracking, cleanup of expired entries. File: src/__tests__/rateLimiter.test.ts" # Step 4: Fix review findings sessioncast send coder "Address the code review comments in src/middleware/rateLimiter.ts. Then run the tests with: npm test src/__tests__/rateLimiter.test.ts" ``` -------------------------------- ### Load Agent Configuration with AgentRunner.loadConfig() in TypeScript Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Shows how to load agent configuration using the `AgentRunner.loadConfig()` method in TypeScript. It supports loading from default paths (like ~/.sessioncast.yml) or custom paths, and handles environment variable overrides. If no config file is found but an OAuth token exists, it creates a default configuration. ```typescript import { AgentRunner } from 'sessioncast-cli/agent/runner'; // Load from default paths (~/.sessioncast.yml or ~/.tmux-remote.yml) const config = AgentRunner.loadConfig(); // Searches in order: // 1. SESSIONCAST_CONFIG environment variable // 2. TMUX_REMOTE_CONFIG environment variable // 3. ~/.sessioncast.yml // 4. ~/.tmux-remote.yml // Load from custom path const customConfig = AgentRunner.loadConfig('/path/to/custom-config.yml'); // If no config file but OAuth token exists, creates default config: // { // machineId: os.hostname(), // relay: 'wss://relay.sessioncast.io/ws', // token: agentToken, // api: { enabled: false } // } // Start the agent with loaded config const runner = new AgentRunner(config); await runner.start(); // Output: // Starting SessionCast Agent... // Machine ID: my-machine // Relay: wss://relay.sessioncast.io/ws // Token: present // Agent started with auto-discovery (scanning every 5s) ``` -------------------------------- ### Incident Response Coordination Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Outlines how to coordinate multiple agents during a production incident. This includes spawning agents for diagnostics, hotfixes, and monitoring, then directing them to diagnose issues, monitor systems, apply fixes, and verify resolutions. ```bash # Spawn diagnostic and fix agents simultaneously tmux new-session -d -s diagnostics tmux new-session -d -s hotfix tmux new-session -d -s monitoring sessioncast send diagnostics "claude" sessioncast send hotfix "claude" sessioncast send monitoring "gemini" sleep 10 # Diagnose the issue sessioncast send diagnostics "Production API is returning 503 errors. Check: 1) tail -n 100 /var/log/api/error.log 2) Check DB connection: psql -c 'SELECT 1' 3) Check memory: free -h 4) Check disk: df -h. Report findings." # Monitor real-time sessioncast send monitoring "Watch the API health: while true; do curl -s -o /dev/null -w '%{http_code}' https://api.example.com/health; echo; sleep 5; done" # After diagnosis → apply fix sessioncast send hotfix "The DB connection pool is exhausted. Fix: update src/config/database.ts to increase pool max from 10 to 50, add connection timeout of 5000ms, add idle timeout of 30000ms. Then restart: pm2 restart api" # Verify fix sessioncast send diagnostics "Verify the fix: 1) Check API health endpoint 2) Check DB connections: psql -c 'SELECT count(*) FROM pg_stat_activity' 3) Run a smoke test: curl https://api.example.com/api/users/1" ``` -------------------------------- ### Multi-Agent Fan-Out (Parallel Development) Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Demonstrates splitting a large feature across multiple agents working simultaneously. It involves creating separate tmux sessions for different areas (frontend, backend, database, docs) and then assigning specific tasks to agents like 'claude', 'gemini', and 'codex'. ```bash # Create workers for each area tmux new-session -d -s frontend tmux new-session -d -s backend tmux new-session -d -s database tmux new-session -d -s docs sessioncast send frontend "claude" sessioncast send backend "gemini" sessioncast send database "claude" sessioncast send docs "codex" sleep 10 # Assign parallel tasks for "Add user settings page" feature sessioncast send database "Create a database migration for user_settings table with columns: user_id (FK), theme (varchar), language (varchar), notifications_enabled (boolean), updated_at (timestamp). File: src/migrations/003_user_settings.sql" sessioncast send backend "Create REST endpoints for user settings: GET /api/settings (read), PUT /api/settings (update). Use the user_settings table. Follow patterns in src/routes/profile.ts. Include validation." sessioncast send frontend "Build a Settings page component at src/pages/Settings.tsx. Include theme toggle (dark/light), language selector (en/ko/ja), notification toggle. Use the existing UI component library. Call PUT /api/settings on save." sessioncast send docs "Write API documentation for the user settings endpoints. Follow the OpenAPI format in docs/api/. Include request/response examples and error codes." ``` -------------------------------- ### Send Commands to SessionCast Session Source: https://github.com/sessioncast/sessioncast-cli/blob/main/README.md Demonstrates how to send text commands or special keys to a specific SessionCast session. Requires the agent to be running and connected. ```bash # Send text to a session sessioncast send my-machine/dev "ls -la" # Send special keys sessioncast send my-machine/dev "Enter" ``` -------------------------------- ### Login to SessionCast CLI using API Key or Agent Token Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Authenticates with SessionCast using a pre-generated API key or agent token. This method is suitable for headless environments or CI/CD pipelines where browser interaction is not possible. It also supports specifying a custom API URL. ```bash # Login with agent token (for automated environments) sessioncast login agt_your_agent_token_here # Login with API key sessioncast login sk-your-api-key-here # Login with custom API URL sessioncast login agt_xxx --url https://custom-api.example.com # Output: # ✓ Agent token saved! ``` -------------------------------- ### List Available Tmux Sessions via SessionCast CLI Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Discovers and displays all tmux sessions across connected machines that are registered with the SessionCast relay server. It can list all sessions or filter them by a specific agent/machine name. ```bash # List all sessions across all agents sessioncast list # Output: # Sessions: # # AGENT SESSION STATUS TARGET # ──────────────────────────────────────────────────────────────────────────────── # dev-macbook workspace online dev-macbook/workspace # dev-macbook worker1 online dev-macbook/worker1 # staging-server main online staging-server/main # prod-server deploy offline prod-server/deploy # # Use: sessioncast send "command" # Filter by agent/machine name sessioncast list dev-macbook # Output shows only sessions from dev-macbook ``` -------------------------------- ### Check SessionCast Agent Logs Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Monitors the SessionCast agent's log file in real-time using the `tail -f` command. Essential for debugging and monitoring agent activity. ```bash tail -f /tmp/sessioncast-agent.log ``` -------------------------------- ### Troubleshoot Login Issues with SessionCast CLI Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md If you are experiencing 'Not logged in' errors, use these commands to log in and verify your authentication status. 'sessioncast login' initiates the OAuth flow, and 'sessioncast status' confirms successful login. ```bash sessioncast login # OAuth login sessioncast status # Verify ``` -------------------------------- ### List Registered SessionCast Agents Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Retrieves and displays a list of all agents that are currently registered under your SessionCast account. This command helps in managing your deployed agents. ```bash sessioncast agents ``` -------------------------------- ### Orchestration Pattern: Dev ↔ QA Feedback Loop Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Establishes a continuous feedback loop between development and QA agents. It shows an initial task to dev, followed by QA testing. If QA finds issues, it sends a detailed report back to dev, who then fixes them, and QA re-tests until all tests pass. ```bash # Setup ``` ```bash tmux new-session -d -s dev-agent ``` ```bash tmux new-session -d -s qa-agent ``` ```bash sessioncast send dev-agent "claude" ``` ```bash sessioncast send qa-agent "claude" ``` ```bash sleep 10 ``` ```bash # Initial task to dev ``` ```bash sessioncast send dev-agent "Implement input validation for the signup form. Fields: email (valid format), password (min 8 chars, 1 uppercase, 1 number), name (required, 2-50 chars). Add validation in src/validators/signup.ts and integrate with POST /api/signup." ``` ```bash # After dev completes → QA ``` ```bash sessioncast send qa-agent "Test the signup validation. Run: npm test src/__tests__/signup.test.ts. For each failing test, provide: 1) Test name 2) Expected vs Actual 3) Root cause. Format your findings as a clear bug report." ``` ```bash # QA finds issues → back to dev with specific feedback ``` ```bash sessioncast send dev-agent "QA report: 2 failures. (1) Password 'Abcdefg1' with exactly 8 chars is rejected — off-by-one in length check. (2) Email 'user+tag@domain.com' is rejected — regex doesn't handle + in local part. Fix both issues." ``` ```bash # Dev fixes → QA again ``` ```bash sessioncast send qa-agent "Re-run all signup tests: npm test src/__tests__/signup.test.ts. Confirm all pass." ``` -------------------------------- ### Login to SessionCast Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Log in to SessionCast using either browser-based OAuth or an agent token. After logging in, you can verify the status of your connection. ```bash sessioncast login # Browser OAuth (recommended) sessioncast login agt_xxx # Agent token sessioncast status # Verify login ``` -------------------------------- ### Monorepo Multi-Service Development with Tmux and SessionCast Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Develop across multiple services in a monorepo simultaneously using tmux for session management and sessioncast to send commands to each service. This pattern allows for coordinated feature development across different parts of a monorepo. ```bash # One session per service tmux new-session -d -s api-service tmux new-session -d -s auth-service tmux new-session -d -s web-client sessioncast send api-service "claude" sessioncast send auth-service "gemini" sessioncast send web-client "codex" sleep 10 # Coordinated feature: "Add OAuth2 Google login" sessioncast send auth-service "Add Google OAuth2 provider to packages/auth/src/providers/. Implement authorization URL generation, token exchange, and user info fetch. Export the provider from packages/auth/src/index.ts." sessioncast send api-service "Add POST /api/auth/google endpoint in packages/api/src/routes/auth.ts. It should: receive auth code from frontend, call auth-service to exchange for tokens, create/update user in DB, return JWT session token." sessioncast send web-client "Add 'Sign in with Google' button to packages/web/src/components/LoginForm.tsx. On click, redirect to Google OAuth URL (GET /api/auth/google/url). Handle the callback at /auth/callback and store the session token." ``` -------------------------------- ### Troubleshoot Agent Streaming with SessionCast CLI Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md This script addresses issues where the agent is not streaming screen data. It involves verifying tmux sessions, restarting the agent process, and monitoring its log file for connection or error messages. ```bash tmux ls # Verify sessions exist pkill -f "sessioncast agent" # Restart agent nohup sessioncast agent > /tmp/sessioncast-agent.log 2>&1 & tail -f /tmp/sessioncast-agent.log # Check logs ``` -------------------------------- ### SessionCast Agent Configuration Source: https://github.com/sessioncast/sessioncast-cli/blob/main/README.md Defines the configuration for the SessionCast agent, including machine ID, relay server address, and authentication token. Optional API configurations for agent ID, shell execution, and LLM integration are also shown. ```yaml machineId: my-machine relay: wss://relay.sessioncast.io/ws token: agt_your_agent_token_here # Optional: API configuration api: enabled: true agentId: "your-agent-uuid" exec: enabled: true shell: /bin/bash workingDir: /home/user defaultTimeout: 30000 llm: enabled: false ``` -------------------------------- ### Troubleshoot Session Not Found with SessionCast CLI Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md When encountering a 'Session not found' error, these commands help diagnose the issue. 'sessioncast list' shows available sessions, and 'sessioncast send' with the full target path ensures the correct session is targeted. ```bash sessioncast list # Check available sessions sessioncast send my-machine/worker1 "hello" # Use full target path ``` -------------------------------- ### Check SessionCast CLI Authentication Status Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Verifies the current login status of the SessionCast CLI and displays the authentication method currently in use. This command helps confirm if you are logged in and how you authenticated (OAuth, API Key, or Agent Token). ```bash # Check login status sessioncast status # Output (when logged in via OAuth): # ✓ Logged in # Auth method: OAuth # Output (when using API key): # ✓ Logged in # Auth method: API Key / Agent Token # Output (when not logged in): # Not logged in # Run: sessioncast login ``` -------------------------------- ### SessionCast Agent Configuration Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Configure the SessionCast agent by creating a `~/.sessioncast.yml` file. This file is required on each machine running the agent and specifies the machine ID, relay server, and agent token. ```yaml machineId: my-machine # Shown as AGENT in session list relay: wss://relay.sessioncast.io/ws # Relay server token: agt_your_agent_token_here # From app.sessioncast.io ``` -------------------------------- ### Send Keystrokes to Remote Tmux Sessions with SessionCast CLI Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md Send keystrokes to a remote tmux session. Supports basic commands, explicit machine targeting, and sending input without automatically pressing Enter for special keys or partial input. ```bash # Basic command (Enter pressed automatically) sessioncast send worker1 "npm run build" # Explicit machine targeting sessioncast send dev-server/workspace "ls -la" sessioncast send dev-server:workspace "ls -la" # colon also works # Without Enter (for special keys, partial input) sessioncast send worker1 "C-c" --no-enter # Ctrl+C sessioncast send worker1 "/exit" --no-enter # Type without executing ``` -------------------------------- ### Send Task Command with SessionCast CLI Source: https://github.com/sessioncast/sessioncast-cli/blob/main/docs/claude-to-claude.md This command is used by a leader agent to instruct a worker agent to perform a specific task. It connects to the relay server via WebSocket, which then forwards the command to the target agent. ```bash sessioncast send worker1 "task" ``` -------------------------------- ### Send Keystrokes to Remote Tmux Session via SessionCast CLI Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Sends keystrokes to a specified remote tmux session through the SessionCast WebSocket relay. It supports various target formats (session label, machine/session, machine:session) and can send commands, special key sequences, or partial input without executing. ```bash # Send command to session (Enter pressed automatically) sessioncast send worker1 "npm run build" # Output: # ✓ Keys sent to dev-macbook/worker1 # (Enter key was pressed) # Target by machine/session sessioncast send dev-macbook/workspace "ls -la" sessioncast send dev-macbook:workspace "git status" # colon also works # Send without pressing Enter (for special keys) sessioncast send worker1 "C-c" --no-enter # Ctrl+C # Output: # ✓ Keys sent to dev-macbook/worker1 # Send partial input without executing sessioncast send worker1 "/exit" --no-enter # Launch an AI agent in a session sessioncast send worker1 "claude" # Claude Code sessioncast send worker1 "gemini" # Gemini CLI sessioncast send worker1 "codex" # OpenAI Codex sessioncast send worker1 "aider" # Aider ``` -------------------------------- ### Logout from SessionCast CLI Source: https://context7.com/sessioncast/sessioncast-cli/llms.txt Clears all stored credentials on the local machine, including OAuth tokens, API keys, and agent tokens. This command effectively logs you out of the SessionCast service. ```bash # Clear all credentials sessioncast logout # Output: # ✓ Logged out successfully! ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.