pty-agent
An ultra-minimal observable PTY-backed coding agent in Rust using Rig.
OPENAI_API_KEY=...
The process immediately enters a terminal UI. The center pane is the same
persistent PTY shell that the Rig agent sees and controls. The agent has exactly
one tool, terminal, and all work happens by typing into that PTY.
Model
user request -> Rig agent -> terminal tool -> shared PTY view -> memory/history -> continue
The shell launch order is $SHELL, then /bin/bash, then /bin/sh.
Terminal Tool
The only tool is terminal.
Actions:
typeentertype_and_enterctrl_ckeyobserve
Observe modes:
screenrecent_outputcommand_historycommand_outputmemory_summaryfull_state
UI
Hotkeys:
Ctrl-C: forward interrupt to PTYCtrl-Q: quit agentCtrl-P: pause/resume agentCtrl-H: toggle memory/history viewCtrl-A: toggle action log
The status area shows the current task, agent state, last action, scrollback size, command count, summary size, and alternate-screen status.
Memory
The implementation keeps:
- a live VT-rendered screen model via
vt100 - bounded raw and cleaned scrollback
- semantic command records with full output excerpts
- a rolling long-term text summary for older commands
This is intentionally small and hackable. It favors observability over sandboxing: YOLO mode means no confirmations, no safety prompts, and no command blocking.
Docker
The Docker path uses a minimal Arch base image and installs Rust plus native build dependencies needed by the Rig/OpenAI stack.
From the directory you want the agent to work in:
OPENAI_API_KEY=...
By default the image runs:
Pin a crates.io version with:
PTY_AGENT_VERSION=0.1.0
Before pty-agent is published to crates.io, test the same container using the
local checkout:
OPENAI_API_KEY=...