원클릭으로
ssh-tasks
Execute code on remote GPU machines via SSH - connectivity check, GPU status, env validation, script/command execution
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Execute code on remote GPU machines via SSH - connectivity check, GPU status, env validation, script/command execution
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Search and read Claude Code official docs, changelog, and GitHub issues. Use when the user asks how Claude Code works, what a setting/env var/flag does, wants release notes, or wants to find/triage a known issue. Handles proxy + GitHub fallback automatically for network problems.
One-stop GitHub operations - connectivity check, fork repos, manage proxy, common gh workflows, and issue search/management
Run LLM serving benchmarks (sglang/vllm) on remote GPU machines - environment check, service launch, benchmark execution, and result collection
Transfer files between machines via SSH - supports direct transfer, jump host relay, and progress monitoring
Generate and install a custom Claude Code status line with selectable columns (model, context, effort level, git, dir, worktree, vim) and a color theme. Context and effort elements color-change based on level. Triggers on "status line", "statusline", "customize status", "status bar", "effort level display", "状态栏", "ステータスライン", or similar.
Manage shell proxy environment variables - on, off, toggle, status, and pip/uv proxy helpers
| name | ssh-tasks |
| description | Execute code on remote GPU machines via SSH - connectivity check, GPU status, env validation, script/command execution |
| user-invocable | true |
Execute code on remote GPU machines when the local dev machine lacks GPUs or has different GPU types. Handles SSH connectivity, GPU selection, environment validation, and remote execution.
Always follow these steps in order. Do not skip steps or assume previous checks passed.
Before doing anything, confirm with the user:
root → luban → gogongxt → gongxiaotian. Use the first one that connects successfully.didi — use sshpass -p 'didi' prefixUser Discovery: If user is not specified, try these usernames in order until one succeeds:
rootlubangogongxtgongxiaotianTest that the connection works. Try SSH key first, then password auth if needed:
# Try SSH key auth first
ssh -o ConnectTimeout=10 -o BatchMode=yes -p <port> <user>@<host> "echo 'SSH OK'"
# If SSH key fails, use sshpass with password
sshpass -p 'didi' ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -p <port> <user>@<host> "echo 'SSH OK'"
User discovery loop: For each candidate user, attempt connection. On success, record the working user and proceed. If all fail:
ssh-add -lssh -v -p <port> <user>@<host> "echo 'SSH OK'"Password auth pattern: When SSH key is not available, prefix all ssh/scp commands with sshpass -p 'didi':
sshpass -p 'didi' ssh -p <port> <user>@<host> "<command>"
sshpass -p 'didi' scp -P <port> <local_file> <user>@<host>:<remote_path>
Check remote GPU availability and pick idle GPUs:
ssh -p <port> <user>@<host> "nvidia-smi --query-gpu=index,name,memory.total,memory.used,memory.free,utilization.gpu --format=csv,noheader,nounits"
GPU Selection Rules:
CUDA_VISIBLE_DEVICES based on selected GPUs for the execution commandAlso check if any processes are holding GPU memory:
ssh -p <port> <user>@<host> "nvidia-smi --query-compute-apps=pid,gpu_uuid,used_memory --format=csv,noheader"
Remote machines are typically Docker containers with pre-installed environments (sglang, vllm, torch, etc.). The goal is to verify the environment matches requirements, not manage it. Run all checks via SSH:
# Check Python version
ssh -p <port> <user>@<host> "python --version"
# Check installed packages relevant to the task
ssh -p <port> <user>@<host> "pip list | grep -iE 'torch|sglang|vllm|transformers|ray'"
# Check CUDA version and torch compatibility
ssh -p <port> <user>@<host> "python -c 'import torch; print(f\"torch={torch.__version__}, cuda={torch.version.cuda}, gpu_available={torch.cuda.is_available()}')'"
# Check available GPU count visible to PyTorch
ssh -p <port> <user>@<host> "python -c 'import torch; print(f\"gpu_count={torch.cuda.device_count()}\")'"
# Check system CUDA/driver info
ssh -p <port> <user>@<host> "nvcc --version 2>/dev/null || cat /usr/local/cuda/version.txt 2>/dev/null"
If the remote uses conda (rare, user will specify), adapt to conda run -n <env_name> prefix. Otherwise assume the default Python environment is the target. If a required package is missing, report to the user — do not pip install without explicit approval.
NFS Shared Paths: If the user mentions NFS or the script path starts with /nfs/, the files are already accessible on the remote machine at the same absolute path. No transfer needed:
/nfs/ofs-llm-ssd/user/gogongxt/project/train.py/nfs/ofs-llm-ssd/user/gogongxt/project/train.py (identical)Just verify the file exists on remote:
ssh -p <port> <user>@<host> "ls -la /nfs/ofs-llm-ssd/user/gogongxt/project/train.py"
Non-NFS Paths: If files are not on shared storage, transfer is needed:
# Copy script to remote (SSH key auth)
scp -P <port> <local_script_path> <user>@<host>:<remote_dir>/
# Copy script to remote (password auth)
sshpass -p 'didi' scp -P <port> <local_script_path> <user>@<host>:<remote_dir>/
# Or copy an entire project directory (SSH key auth)
rsync -avz -e "ssh -p <port>" <local_dir>/ <user>@<host>:<remote_dir>/
# Or copy an entire project directory (password auth)
sshpass -p 'didi' rsync -avz -e "ssh -p <port>" <local_dir>/ <user>@<host>:<remote_dir>/
SCP destination dir best is ~/gogongxt. mkdir it before transfer.
Verify the file arrived:
ssh -p <port> <user>@<host> "ls -la <remote_dir>/<script_name>"
CRITICAL: Always use absolute paths. Never use relative paths in any SSH execution command. This means:
/full/path/to/script.py, NOT ./script.py or script.py/nfs/ofs-llm-ssd/user/gogongxt/project, NOT ~/project or ./project/full/path/to/output.log, NOT output.logRelative paths are unreliable over SSH because each SSH call starts in the remote's default $HOME, and cd + relative path combinations are fragile.
CRITICAL: Verify file exists before execution. Never assume the script path is correct — always check first:
# Check if script exists on remote (use absolute path)
ssh -p <port> <user>@<host> "test -f /full/path/to/script.py && echo 'EXISTS' || echo 'NOT_FOUND'"
# If not found, report to user and ask for correct path
# Do NOT proceed with execution if file check fails
After file verification, build and run the command. Always use nohup for long-running tasks so they survive SSH disconnects.
# For a script (short-running, wait for output) — use absolute paths
ssh -p <port> <user>@<host> "cd /full/path/to/project && CUDA_VISIBLE_DEVICES=<selected_gpus> python /full/path/to/project/script.py <args>"
# For a long-running task (background, no hang) — use absolute paths for everything
ssh -p <port> <user>@<host> "cd /full/path/to/project && nohup bash -c 'CUDA_VISIBLE_DEVICES=<selected_gpus> python /full/path/to/project/script.py <args>' > /full/path/to/project/output.log 2>&1 & echo \$!"
For background tasks, capture the PID and check status:
# Check if process is still running
ssh -p <port> <user>@<host> "ps -p <pid> -o pid,stat,etime,cmd"
# Tail the log
ssh -p <port> <user>@<host> "tail -n 50 <log_file>"
# Check GPU usage while running
ssh -p <port> <user>@<host> "nvidia-smi"
sudo on remote machines — if elevated privileges are needed, ask the user.bashrc or shell configs — use inline env setup onlypip install changes the remote environmenttest -f <path> or ls -la <path> on remote. If file not found, ask user for correct path. Never execute with a guessed path.CUDA_VISIBLE_DEVICES explicitly — never let the script grab all GPUs blindly./script.py, output.log) over SSH. Each SSH call has an independent shell with unpredictable $PWD, making relative paths unreliable. Example: use /nfs/ofs-llm-ssd/user/gogongxt/project/train.py not train.py or ~/project/train.pynohup + background for anything that takes more than a few minutes — SSH timeouts will kill foreground processesscp/rsync, confirm the file exists and has the expected size on the remotepython directly — remote Docker containers have pre-installed environments, no need for conda run or venv activationconda run -n <env_name> prefixssh -p <port> <user>@<host> "ss -tlnp | grep <serve_port>"
# 1. Transfer script
scp -P <port> train.py <user>@<host>:/tmp/train.py
# 2. Check GPU, pick idle ones (e.g. GPU 0,1)
ssh -p <port> <user>@<host> "nvidia-smi --query-gpu=index,memory.free --format=csv,noheader,nounits"
# 3. Run with selected GPUs (absolute paths for script and log)
ssh -p <port> <user>@<host> "cd /tmp && CUDA_VISIBLE_DEVICES=0,1 nohup python /tmp/train.py --epochs 10 > /tmp/train.log 2>&1 & echo \$!"
# 4. Monitor
ssh -p <port> <user>@<host> "tail -20 /tmp/train.log"
ssh -p <port> <user>@<host> "CUDA_VISIBLE_DEVICES=2 python -c 'import torch; print(torch.cuda.mem_get_info())'"
# Check port availability
ssh -p <port> <user>@<host> "ss -tlnp | grep 30000"
# Launch (absolute paths for log)
ssh -p <port> <user>@<host> "CUDA_VISIBLE_DEVICES=0,1 nohup python -m sglang.launch_server --model-path <model> --port 30000 --tp 2 > /nfs/ofs-llm-ssd/user/gogongxt/sglang.log 2>&1 & echo \$!"
# Wait for ready
ssh -p <port> <user>@<host> "tail -5 /nfs/ofs-llm-ssd/user/gogongxt/sglang.log"
If the user provides an SSH alias (from ~/.ssh/config), use it directly — no need to specify user/host/port separately:
ssh my-gpu-server "nvidia-smi"
-o ConnectTimeout=10 for quick failure detectionscp, note the capital -P for port (unlike ssh's lowercase -p)sshpass -p 'didi' prefix for all ssh/scp/rsync commands. Default password is didi./nfs/ are shared between local and remote — use the same absolute path on both sides, no transfer needed.root → luban → gogongxt → gongxiaotian in order.test -f <path> check. Never execute with an unverified path.$PWD.