dwgx@blog:~$dwgx
> cd ../posts

SmartCLI: Making Agents Actually Use the Terminal Instead of Blindly Sleeping

// created

SmartCLI is a Python toolkit that makes agents actually know how to use the terminal. It does exactly three things: drive interactive programs, read the screen, and render the screen back out. The core idea is that it never waits by blindly sleeping. It actually looks at the screen before deciding what to type next.

The foundation is smartcli_core, a pluggable PTY backend plus a pyte screen model. The key point is that it reads the terminal as a grid of cells, not as a byte stream, so it can tell which line is highlighted and where the cursor is parked. The PTY layer is not hardwired to tmux.

Real tmux has not been verified yet. The README says so plainly: “not yet verified.” The screenshots from the dev machine are labeled pyte-simulation, not real tmux captures. No hiding that.

Three skills sit on top. cmd-art is a terminal effects engine: 30 effects, donut, fire, plasma, rain, across 8 themes. tui-ui is a layout engine that emits tmux-safe ANSI frames. drive-tui is the main event. It drives REPLs, menus, pagers, and prompts, running a perceive → decide → act → wait → confirm loop, never sleeping blindly. In the demo it drives a real lazygit TUI end to end.

One thing to watch when installing: the distribution name and the import name are different.

pip install smartcli-toolkit

The importable package is called smartcli_core because the short name was taken. The skills run in place from the checkout; they are not installed system-wide.

On dependencies, pyte is cross-platform, pywinpty is Windows-only, and POSIX uses the stdlib pty directly. It also ships a knowledge graph of 122 notes covering rendering formulas, ANSI sequences, and constants. There is an MCP server, so drive-tui actions can be called from any MCP client. Tested on CPython 3.14.6, with CI covering Windows, Linux, and macOS. MIT.