Reference
CLI reference
Every dpty subcommand and flag, taken from the command definitions in src/main.rs. id accepts a session's id, name or label.
In this guide
Guide
On this page
Daemon
Clients start the daemon automatically; these commands manage it directly.
Runs the daemon in the foreground. Clients start it automatically; use install to run it at login instead.
--http ADDRHTTP/WebSocket listen address (default127.0.0.1:7878)--no-httpdisable the HTTP listener entirely
Stops the daemon. By default sessions keep running in their shims and the next daemon start picks them back up with nothing lost.
--sessionsalso stop every session, instead of leaving them running
Prints daemon status as JSON. Exits with code 3 if the daemon is not running.
Prints the bearer token used by the HTTP, WebSocket and MCP-over-HTTP listeners.
Installs a login service — launchd on macOS, systemd --user on Linux — that runs the daemon and restarts it if it exits.
--http ADDRHTTP/WebSocket listen address (default127.0.0.1:7878)--no-httpdisable the HTTP listener for the installed service
Removes the login service. Sessions and history in ~/.durable-pty are kept.
Sessions
Create, list and manage sessions.
Lists sessions.
--jsonprint the full session list as JSON-l, --label LABELfilter by label, repeatable--status STATUSfilter by status (e.g.running,lost)
Starts a session. Example: dpty new -n work -C ~/proj -- claude "fix the bug".
-n, --name NAMEa short name to attach by later-C, --cwd CWDworking directory (default: current directory)-l, --label LABELarbitrarykey=valuelabel, repeatable-e, --env KEY=VALUEextra environment variable, repeatable--env-allpass the whole environment (default passes PATH, HOME, locale and agent API variables only)-d, --detachcreate the session without attaching to it--restart POLICYnever,on-failureoralways--kind KINDforce the agent adapter instead of detecting it from the command--resume-cmd CMDhow to resume an agent with no built-in adapter, e.g."grok --resume {id}"
Attaches this terminal to a running session. Detach with Ctrl-\ without stopping it.
Sends a signal to the session's process.
-s, --signal SIGNALe.g.TERM,KILL(default: the process's normal termination signal)
Deletes a session and its stored history.
Relaunches a session, resuming the agent conversation when its id is known.
Updates a session's name, labels or restart policy without restarting it.
--name NAMErename the session-l, --label LABELset akey=valuelabel, repeatable--restart POLICYnever,on-failureoralways
Records an agent's own session id, for use from a hook: dpty tag-agent "$DPTY_SESSION" <id>.
Interacting with a session
Types into a session.
--no-enterdo not send a trailing Enter after the text-k, --key KEYsend a named key instead, e.g.ctrl-c, repeatable
Prints the session's current screen as plain text.
Blocks until a pattern appears in the session's output. Exits with code 2 on timeout.
--timeout SECONDSdefault 30
Reading history and events
Reads output from a session.
-n, --bytes Nhow many bytes to read (default 65536)--rawwrite the raw bytes instead of decoded text
Lists commands typed into a session.
-n, --limit Ndefault 100
Lists daemon events, optionally filtered to one session.
-n, --limit Ndefault 50
MCP
Runs the MCP server. With no flags, serves over stdio. With --http, serves streamable HTTP (POST /mcp) and legacy SSE (GET /sse).
--http ADDRlisten address for streamable HTTP + SSE instead of stdio--no-authdo not require the bearer token on the HTTP listener