Tooluck logoTooluck
SKILL.md

hive.terminal-tools-pty-sessions

Agent skill fromaden-hive/hive

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 to install hive.terminal-tools-pty-sessions

install hive.terminal-tools-pty-sessions
# install the hive pack with the skills CLI
npx skills add aden-hive/hive

# or add only this skill to Claude Code: copy the folder

core/framework/skills/_preset_skills/terminal-tools-pty-sessions/

# into

~/.claude/skills/terminal-tools-pty-sessions/ (all projects)

.claude/skills/terminal-tools-pty-sessions/ (one project)

core/framework/skills/_preset_skills/terminal-tools-pty-sessions/SKILL.md

Apache-2.0Full file
1# Persistent PTY sessions
2
3PTY 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:
4
5- You need state to persist across calls (`cd`, env vars, sourced scripts)
6- You're driving a REPL (`python -i`, `mysql`, `psql`, `node`, `irb`)
7- A program demands an interactive prompt (`sudo`, `ssh`, `npm login`, `gh auth login`)
8
9For 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).
10
11## Why PTY (and not subprocess pipes)
12
13Subprocess 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.
14
15The 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.
16
17## Bash on macOS — by deliberate policy
18
19`terminal_pty_open` always invokes `/bin/bash`, regardless of the user's `$SHELL`. macOS users: yes, even when zsh is your interactive default. This is the **terminal-tools-foundations** policy applied to PTYs.
20
21Reasons:
22…

Excerpt shown under the repository's Apache-2.0 license.

More skills in hive

Keep exploring

Similar skill repositories

thedotmack /

claude-mem
116k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

CCCXGHGM+135 skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates