Make agent TUI Optional and Enable Fully Scriptable Session Management

Feature request for product/service

Cursor CLI

Describe the request

The TUI is a great experience and should absolutely remain the default interactive interface, as it provides an excellent workflow for direct usage. However, it should be optionally bypassed for users who need programmatic or IDE-driven control. It should be possible to communicate with a running session without going through the TUI—for example via commands like agent send --resume “message” or by piping input into a session. This would enable automation, scripting, CI workflows, and integration with IDEs that have their own UI (e.g neovim), effectively turning agent into a persistent, composable backend while preserving the TUI as a first-class—but optional—interface.

To support this, the agent command should provide clearer, fully non-interactive session management semantics so it can function as a predictable and scriptable interface for persistent chat sessions. In particular, agent ls should print a plain list of running sessions instead of launching a TUI, and the existing --resume flag should be consistently usable across subcommands to explicitly target a session. Attaching, stopping, renaming, and sending messages to sessions should all work in a uniform, target-based way, making session control reliable and composable from the command line.