hive.terminal-tools-pty-sessions
Use when you need state across calls — building env vars, navigating with cd, driving REPLs (python -i, mysql, psql, node), or responding to interactive prompts (sudo password, ssh host-key confirmation, mysql connection). Teaches the prompt-sentinel exec pattern (default mode), raw I/O for REPLs (raw_send=True then read_only=True), the one-in-flight-per-session rule, and the close-or-leak-against-the-cap discipline. Bash on macOS — never zsh; explicit shell=/bin/zsh is rejected. Read before calling terminal_pty_open.
npx skills add aden-hive/hive --skill terminal-tools-pty-sessions --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Persistent PTY sessions PTY sessions are how you talk to interactive programs — programs that detect a terminal (`isatty()`) and behave differently when they don't see one. Use a session when: - You need state to persist across calls (`cd`, env vars, sourced scripts) - You're driving a REPL (`python -i`, `mysql`, `psql`, `node`, `irb`) - A program demands an interactive prompt (`sudo`, `ssh`, `npm login`, `gh auth login`) For everything else, `terminal_exec` is simpler. Sessions cost more (per-session bash process, ring buffer, idle-reaping bookkeeping) and have a hard cap (`TERMINAL_TOOLS_MAX_PTY`, default 8). ## Why PTY (and not subprocess pipes) Subprocess pipes break on every interactive program. The moment a program calls `isatty()` and sees False, it disables prompts, color, line-editing, password masking, progress bars — sometimes refuses to start. PTY makes us look like a real terminal so these programs work the same as in your shell. The cost: PTY output includes terminal escape codes (cursor moves, color codes). The session captures them as-is; if you need clean text, strip ANSI escapes in your processing layer. ## Bash on macOS — by deliberate policy `terminal_pty_open
- Why PTY (and not subprocess pipes)
- Bash on macOS — by deliberate policy
- Three modes of terminalptyrun
- 1. Default: send command, wait for prompt sentinel
- 2. rawsend: send raw input, no waiting
- 3. readonly: drain currently-buffered output
- Custom prompt detection (expect)
- Always close
- Common patterns
- Stateful navigation
- Python REPL
- ssh with host-key prompt
What does the hive.terminal-tools-pty-sessions skill do?
Use when you need state across calls — building env vars, navigating with cd, driving REPLs (python -i, mysql, psql, node), or responding to interactive prompts (sudo password, ssh host-key confirmation, mysql connection). Teaches the prompt-sentinel exec pattern (default mode), raw I/O for REPLs (raw_send=True then read_only=True), the one-in-flight-per-session rule, and the close-or-leak-against-the-cap discipline. Bash on macOS — never zsh; explicit shell=/bin/zsh is rejected. Read before calling terminal_pty_open.
How do I install it?
Run `npx skills add aden-hive/hive --skill terminal-tools-pty-sessions --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From aden-hive/hive, a repository with 10,850 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
