← ClaudeAtlas

drive-remote-terminallisted

Operate and observe an interactive, full-screen terminal program (a TUI) on a REMOTE machine over SSH by hosting it in a tmux (or screen) session and driving it like a human: TYPE with `tmux send-keys` and SCREENSHOT with `tmux capture-pane -p`. The loop — send input, wait, capture, read, decide the next input — IS the technique. Use it whenever you must act as the human at a remote terminal: launching or resuming an interactive app (Claude Code TUI, vim, top, an installer, a REPL, a curses menu), answering its prompts, typing into it, or reading what's on screen over SSH. Reach for it the moment a plain `ssh host 'cmd'` or a pipe isn't enough because the program needs a real terminal/PTY and stays running. Triggers: drive the TUI on my server, answer the prompt in that remote session, screenshot the terminal, resume my claude session on the server, type into the running program over ssh, automate keystrokes. Prefer this over one-shot SSH for anything interactive.
88plug/drive-remote-terminal · ★ 0 · AI & Automation · score 60
Install: claude install-skill 88plug/drive-remote-terminal
# Driving a remote terminal as a human would You cannot operate an interactive TUI with one-shot SSH. `ssh host 'cmd'` runs a command and exits; piping into a full-screen program (Claude Code's interactive UI, `vim`, `top`, a curses installer, a REPL) fails because that program needs a real terminal (a PTY), stays running, redraws the screen, and reads keystrokes. To be the human at the keyboard you need two things a human has: **a way to type, and eyes to see the screen.** tmux gives you both remotely. ## The heart of this skill: the type → wait → screenshot → read loop **This loop is the whole technique. Everything else is setup around it.** You drive a remote TUI exactly like a human plays a turn-based game: make one move, look at the screen, decide the next move. - **Type (input):** `tmux send-keys -t SESSION 'what the human would type' Enter` — but for a **long line, send the text and `Enter` as two separate calls** (type, brief `sleep`, then `Enter`); a fast text+Enter burst often lets `Enter` arrive before the composer has settled, so the text just sits there unsubmitted (see rule 4). For arbitrary or untrusted text, use `send-keys -l -- "$text"` (then a separate `Enter`): `-l` forces *literal* characters so a payload that equals a key name (`Enter`, `Up`, `C-c`) is typed verbatim instead of interpreted, and `--` stops a leading `-` parsing as a flag. - **Wait:** `sleep N` — let the app process and redraw. - **Screenshot (observe):** `tmux capture-pane