I wanted an AI shell. First I had to choose what kind of terminal I was building.
I wanted a shell with an AI assistant available when I needed it. Before choosing how the assistant should respond, I had to choose who owned the terminal interaction.
I explored a transparent PTY wrapper in one project and continued the managed REPL in agentsh. Those designs give me different kinds of access to the shell. They also leave me responsible for different problems.
The PTY version keeps the terminal conversation
A pseudo-terminal lets a child program interact with something that behaves like a terminal rather than an ordinary output pipe.

A separate example of PTY communication using script, by Der Messer, CC BY-SA 3.0; unmodified. It is not a diagram of my wrapper.
The experimental path looked like:
User terminal <-> relay <-> PTY <-> Bash and its child programs
|
v
assistant output
That is attractive for interactive programs. It also means handling terminal state and a stream containing prompts, control sequences, and program output.
The July 8 PTY change copies terminal dimensions into the PTY and updates them on SIGWINCH. Full-screen applications need that geometry when the user resizes the window.
The same change delays PTY output while the assistant explanation is being displayed. Otherwise, the next shell prompt and the explanation can compete for the terminal at the same time.
Those are parts of the interface, not merely formatting polish.
The managed REPL owns the input
In the agentsh implementation, prompt_toolkit captures the user’s input. The program classifies that input and chooses a shell or agent path.
For shell execution, the boundary is more explicit:
User terminal -> managed prompt -> runner -> child shell stdin
^ |
| v
result with output,
exit status and cwd
The runner receives a command string it can pass to the shell. It doesn’t have to recover the user’s intended command by watching terminal output after the fact.
That makes permissions, history, and the switch into an assistant conversation easier to place around a known input. The shell backend returns captured output for the REPL to display.
The cost is part of the choice
Pipes don’t give an interactive child program the same terminal environment as a PTY. A full-screen editor expects control over a terminal, not just somewhere to write captured stdout.
So choosing the managed REPL gives up transparent terminal behavior in exchange for a clearer command boundary. I can’t advertise it as a complete pass-through terminal and then treat interactive applications as unexpected edge cases.
I chose the managed REPL for agentsh. Programs that expect to own the terminal would need more work than sending a command like echo.