back to projects
Esc to return
2026 Systems & CLI AUR · Open Source
pty-ring
Transparent Rust PTY ring-buffer shim capturing recent shell commands and output.
Why it exists
Piping or inspecting output from a command you already ran usually requires re-running it or manually scrolling and copying from terminal scrollback. I wanted instant programmatic access to recent command blocks without altering shell ergonomics.
Architecture
pty-ring sits transparently between the terminal emulator and Zsh, listening for OSC 133 and OSC 777 semantic prompt markers to delimit commands in a fixed-capacity in-memory ring buffer. A per-session Unix domain socket ($PTY_RING_SOCK) serves structured JSON dumps and formatted output slices on demand.
Key highlights
- Captures command text, stdout/stderr block, exit code, cwd, timestamp, and runtime duration.
- Query recent blocks directly with `pty-ring out`, `pty-ring out 3`, or raw JSON via `pty-ring dump`.
- Packaged for Arch Linux on AUR (`yay -S pty-ring`) with minimal Zsh hook integration.
Built with
Rust · POSIX PTY · Unix Sockets · Zsh