Install
openclaw skills install headless-terminalDrive hostile or full-screen terminal UIs through the `ht` CLI from montanaflynn/headless-terminal. Use when an agent needs reliable PTY-backed interaction, screen snapshots, or wait/synchronization for tools like `vim`, `top`, `htop`, `git add -p`, SSH-driven TUIs, installers, auth prompts, or REPLs. Prefer this over plain shell I/O when redraw behavior, alternate screen handling, cursor state, or deterministic waits matter; fall back to exec/process or tmux for ordinary shell commands and human-operated sessions.
openclaw skills install headless-terminalUse ht from https://github.com/montanaflynn/headless-terminal as the special-purpose tool for terminal programs that behave badly under plain stdin/stdout control. It gives a real PTY, terminal-state snapshots, and explicit wait conditions so the agent can drive a TUI without guessing when the screen settled.
Do not let the hammer make everything look like a nail. ht is powerful but heavyweight; if a normal command, pipe, exec with pty=true, or tmux session fits better, use that instead.
ht exists before committing to this path.ht; explicitly reject hammer/nail overuse and try simpler shell or host-agent primitives first when they fit.ht run.ht view.ht vs other toolsUse ht when:
Prefer exec / process when:
exec with pty=true is enough to satisfy a TTY check without needing screen snapshotsPrefer tmux when:
Check availability first:
command -v ht
If ht is missing, say so plainly and switch to another tool or ask whether to install it. The expected install source is Montana Flynn's headless-terminal:
brew install montanaflynn/tap/ht
Without Homebrew, use a release tarball from https://github.com/montanaflynn/headless-terminal/releases that matches the host OS/architecture, then put the ht binary on PATH.
Security/trust posture for publishing:
ht or headless-terminal is this CLI. On macOS/Homebrew, the core formula ht refers to HTE, a viewer/editor/analyzer for executables, not this terminal automation tool. The public npm package headless-terminal is an old library and may not provide the expected ht run / ht send CLI. Do not install either as a guess; verify that the candidate explicitly supports the commands this skill uses.ht run --name demo-$(date +%s) <cmd...>
ht send demo "keys..." --wait-idle 200ms --view
ht view demo
ht view demo --format png > screenshot.png
ht wait demo --wait-text "READY"
ht stop demo
ht remove demo
Treat command names and flags as version-sensitive. If ht --help is available, check it before relying on less-common flags such as PNG output or cursor waits.
This is the main reason to use ht.
Prefer, in order:
--wait-text when a known string should appear--wait-cursor when the cursor position is predictable--wait-idle when the app redraws and then settles--wait-duration only when nothing better existsDo not rely on blind sleeps when a real wait condition is available.
ht run --name notes vim /tmp/notes.md
ht send notes "ihello<Esc>" --wait-idle 200ms --view
ht send notes ":wq<CR>" --wait-exit
ht remove notes
ht run --name remote ssh user@host.example
ht send remote "top<CR>" --wait-idle 500ms --view
ht send remote "q" --wait-idle 200ms
ht send remote "exit<CR>" --wait-exit
ht remove remote
git add -pht run --name addp git add -p
ht view addp
Then send one choice at a time and wait after each response.
ht view before sending more keys.ht remove.ht for privacy-sensitive auth flows, remote systems, or destructive TUI operations. A real PTY can make it easy to do real damage quickly.ht and simplify.references/examples.md: quick fit checks, sample command patterns, and wait-strategy examplesreferences/keys.md: vim-style key notation such as <CR>, <Esc>, arrows, control/meta keys, and raw bytesreferences/waits.md: wait strategy decision tree and timeout guidancereferences/recipes.md: recipes for vim, REPLs, installers, watch, terminal sizing, screenshots, and recordingreferences/troubleshooting.md: exit codes, stale views, wait timeouts, zombies, daemon issues, and ht debug