ssh_start_session
Start a new persistent interactive SSH session to a remote host, returning a session ID and initial output for subsequent commands.
Instructions
Start a new persistent interactive SSH session backed by a local PTY. Returns the session id, initial output, and observer metadata. If 'truncated' is true or 'pending_output_chars' > 0 in the response, call ssh_read_session to retrieve the remaining buffered output. For most agent workflows, prefer ssh_ensure_session instead — it reuses existing sessions and avoids accidental duplicates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Remote directory to cd into at session start. | |
| env | No | Remote environment variables to export at session start. | |
| port | No | ||
| shell | No | Remote shell executable to launch. | |
| target | Yes | OpenSSH target such as host, alias, or user@host. | |
| auto_close | No | When true, the session is automatically cleaned up after the remote shell or command exits. Use for one-shot long-running commands where you want session-style output streaming but don't need the shell afterwards. Default: false. | |
| session_name | No | Stable name for this session, used for recovery and reuse across tool calls. Choose a short, descriptive kebab-case name reflecting the task, e.g. 'deploy-staging', 'tail-api-logs', 'debug-worker-3'. This name also appears in tmux session listings for human observers. Strongly recommended for any multi-step workflow. | |
| wait_seconds | No | Seconds to wait for initial output. Default: 1.0. | |
| identity_file | No | ||
| observer_mode | No | Passive observer mode. Defaults to 'tmux' and falls back to transcript-only observation if tmux is unavailable. 'transcript' always records a transcript and returns a local follow command. | |
| extra_ssh_args | No | Additional ssh(1) flags passed verbatim, e.g. ["-J", "jumphost"]. Prefer the dedicated port, identity_file, and strict_host_key_checking parameters. | |
| known_hosts_file | No | ||
| max_output_chars | No | ||
| strict_host_key_checking | No | Boolean or one of yes, no, ask, accept-new, off. |