Agent skill · Databases

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.

aden-hivegithub.com/aden-hiveGitHub ↗
claude-codeApache-2.0
Install
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.

Facts
Files in the skill folder: 1
SKILL.md size: 5 KB
Bundled scripts: none
Version: 1.0
Declared author: hive
Path: core/framework/skills/_preset_skills/terminal-tools-pty-sessions/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 10,850
Language: Python
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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

What's inside
Steps it walks through
  1. Why PTY (and not subprocess pipes)
  2. Bash on macOS — by deliberate policy
  3. Three modes of terminalptyrun
  4. 1. Default: send command, wait for prompt sentinel
  5. 2. rawsend: send raw input, no waiting
  6. 3. readonly: drain currently-buffered output
  7. Custom prompt detection (expect)
  8. Always close
  9. Common patterns
  10. Stateful navigation
  11. Python REPL
  12. ssh with host-key prompt
More from hive
All skills →
About this skill
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.

Keep going