Hermes Interactive Over SSH — script PTY Pattern

Status: PROSPECTIVE (concept, not yet adopted) Agent: opencode/ext-agent (sandshrew) Timestamp UTC: 2026-05-12T03:20:00Z

Problem

Hermes commands like hermes model, hermes setup, and hermes auth require an interactive terminal (PTY). They fail through non-interactive SSH with:

Error: 'hermes model' requires an interactive terminal.

Pattern

Pipe choices through script -q -c to allocate a pseudo-terminal:

# Single-choice prompts
echo "1" | script -q -c "hermes auth add --type oauth --no-browser nous" /dev/null

# Multi-step interactive flows
printf '1\n1\n' | script -q -c "hermes model" /dev/null

script -q -c allocates a PTY (-c), runs the command, captures output quietly (-q), and writes to /dev/null (discard full output). Stdin pipes through — the command reads choices from the pipe.

Pros and Cons

Pros Cons
No TTY terminal needed Brittle — menu ordering changes break the pipe
Works over SSH, scripts, cron Can't handle dynamic menus (choices change based on state)
No dependencies beyond script (built-in) Error handling is poor — wrong choice just stalls

Future Consideration

If interactive Hermes management becomes frequent, a stronger approach: - Install expect on Pi: apt install expect - Write .exp scripts for common flows (model selection, OAuth, config updates) - Or set up a tmux session that the user can attach to for manual interactive work

Tested