Imagine Anthropic Claude Code using OpenAI Codex directly. No API. No subprocess wrapper. Just Claude typing into a terminal and reading what Codex prints back, the way a human would.

The Gap: Beyond bash -c

Most agent harnesses run shell commands through bash -c or exec. That covers most of what agents need: scripts, file operations, installs, anything that returns and exits. But there is a whole category of programs that do not fit this model: programs that hold the terminal open and paint to the screen: vim, ssh, psql, htop. Programs you interact with, not just invoke.

And because each terminal is its own session, an agent can run several at once.

Inverting the Terminal

I built term39, a terminal multiplexer. I knew the internal architecture. Writing for AI agents inverted the problem. A human terminal renders pixels and reads keystrokes. An agent terminal needs to expose structured screen state in memory and accept programmatic input. The internals are the same. The interface is the opposite.

npcterm: Headless Terminal over MCP

That became npcterm: a headless terminal emulator exposed over MCP. The agent types with terminal_send_keys and reads with terminal_read_screen. The harness owns the PTY, parses ANSI, and detects process state: Running, Idle, WaitingForInput, Exited. The LLM only reads the result.

What This Unlocks

This unlocks the rest of Unix. For example:

  • btop exposes CPU and memory in a structured grid the agent can sample.
  • nethogs reports per-process network traffic.
  • vim edits files the way a human does: the agent navigates the same interface.
  • ssh opens a real remote shell because the PTY is real, not emulated.

Every menu-driven TUI becomes a tool an agent can use. No rewrite required.

The Tradeoff

For one-shots like ls /tmp, exec is still cheaper. npcterm earns its cost when a program needs to stay open and be observed. It is not a replacement for the command line. It is the layer that sits between the command line and the full-screen TUI: the territory agents could not reach before.

Two Paths, Same Question

browser39 replaced human web infrastructure with an agent-native version. npcterm does the opposite: a thin shell around decades of Unix software, so an agent can use it. Two strategies. One question: what actually needs to reach the LLM?


This is the third post in a series on building AI agent harnesses. Read the first: From HCI to ACI and the second: Change the Interaction, Not the Model.