PiloTY (PTY for your AI Copilot) is an MCP server that gives an agent a persistent, interactive terminal. If you have used Claude Code / Codex to run shell commands, you have probably hit the same wall: tool calls tend to be stateless. Each call starts "fresh", so environment variables disappear, interactive programs cannot be driven reliably, and long-running processes get cut off or orphaned whi
Add this skill
npx mdskills install yiwenlu66/pilotySolves persistent terminal state for agents with clear capabilities and excellent setup guidance

PiloTY (PTY for your AI Copilot) is an MCP server that gives an agent a persistent, interactive terminal.
If you have used Claude Code / Codex to run shell commands, you have probably hit the same wall: tool calls tend to be stateless. Each call starts "fresh", so environment variables disappear, interactive programs cannot be driven reliably, and long-running processes get cut off or orphaned while the agent is thinking.
PiloTY exists to make the agent's terminal behave more like a human's: start something in a real terminal, come back later, and keep going.
Warning: PiloTY exposes unrestricted terminal access. Treat it like giving the agent your keyboard.
tail -f, journalctl -f, kubectl logs -f, CI logs, service restarts.python, ipython, pdb).sudo, SSH passwords, key passphrases).less, man, top, vim can work, but cursor-heavy programs often require screen snapshots instead of plain text output.PiloTY is meant to be launched by an MCP client over stdio.
Add it to Codex CLI as an MCP server:
codex mcp add piloty -- uvx --from git+https://github.com/yiwenlu66/PiloTY.git piloty
If you prefer SSH-based Git fetch:
codex mcp add piloty -- uvx --from git+ssh://git@github.com/yiwenlu66/PiloTY.git piloty
If you already have a local clone:
codex mcp add piloty -- uv --directory /path/to/PiloTY run piloty
Run the server command directly (without adding it to an MCP client):
uvx --from git+https://github.com/yiwenlu66/PiloTY.git piloty
One session is one real interactive terminal that stays alive across tool calls.
PiloTY keeps two representations:
output: incremental text stream (optionally ANSI-stripped)Sessions are addressed by a session_id string. Reusing the same id is what keeps state.
MCP does not expose a standard "client cwd" field, so the first step is always to create a session with an explicit working directory, then reuse the same session_id for subsequent calls.
Typical agent workflow:
session_id.expect_prompt after ssh or other login flows where the prompt appears later.send_password for secret entry; terminate the session when done.For exact tool names, arguments, and return fields, use your MCP client's tool schema or read piloty/mcp_server.py.
send_password() suppresses transcript logging and terminal echo for that send. It does not prevent other prompts/programs from echoing secrets later.PILOTY_QUIESCENCE_MS (default 1000).Each server instance writes session logs under ~/.piloty/:
~/.piloty/servers//sessions//transcript.log: raw PTY bytes (combined stdout/stderr)~/.piloty/servers//sessions//commands.log: inputs sent (best-effort)~/.piloty/servers//sessions//interaction.log: inputs plus captured output (best-effort)~/.piloty/servers//sessions//session.json: metadata snapshot~/.piloty/active//: symlink to the current session directory (when symlinks are supported)Server logs default to /tmp/piloty.log.
tools/session_viewer.py can inspect sessions:
python tools/session_viewer.py list
python tools/session_viewer.py info /
python tools/session_viewer.py tail -f /
Repository layout:
piloty/
core.py # PTY + terminal renderer + session logs
mcp_server.py # MCP tools + state inference
tests/
tools/
pty_playground.py
session_viewer.py
Run tests:
python -m pytest -q
License: Apache License 2.0, see LICENSE.
Install via CLI
npx mdskills install yiwenlu66/pilotyPiloTY is a free, open-source AI agent skill. PiloTY (PTY for your AI Copilot) is an MCP server that gives an agent a persistent, interactive terminal. If you have used Claude Code / Codex to run shell commands, you have probably hit the same wall: tool calls tend to be stateless. Each call starts "fresh", so environment variables disappear, interactive programs cannot be driven reliably, and long-running processes get cut off or orphaned whi
Install PiloTY with a single command:
npx mdskills install yiwenlu66/pilotyThis downloads the skill files into your project and your AI agent picks them up automatically.
PiloTY works with Claude Code, Claude Desktop, Cursor, Vscode Copilot, Windsurf, Continue Dev, Codex, Gemini Cli, Amp, Roo Code, Goose, Opencode, Trae, Qodo, Command Code. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.