agent-ssh 0.4.1

Arrange agent terminal layouts and reconnect through provider attachment plans
Documentation
# Marshal and agent-ssh


Reviewed against [Marshal PR #180](https://github.com/ignition-is-go/marshal/pull/180), `feat/launch-core`. This API is still work in progress.

Marshal owns launch orchestration, launch IDs, backend recovery handles, roster binding, and first-task delivery. Its proposed `LaunchBackend` contract includes `check`, `recovery_handle`, `launch`, `recover`, `stop`, and `status`. The selected backend owns its execution resource. `Launched` includes an optional human-readable attach command.

Marshal, Pulse Agents, and agent-ssh consume the independent [`tmux-session`](https://github.com/ignition-is-go/tmux-session) crate. It owns tmux client execution, queries, literal launch, guarded stopping, and attachment command construction. Each application retains its lifecycle and credential policy. Pulse separately implements Marshal's managed launch contract through its lifecycle API:

```text
Marshal
  +-- native tmux LaunchBackend --> tmux-session --> native agent
  +-- marshal-launch-pulse -----> Pulse Agents --> tmux-session --> guest agent

agent-ssh --> tmux-session for existing tmux attachment
          --> Windows Terminal for pane layout
```

Pulse's backend integration and the shared library have independent release boundaries. The agent-ssh Windows path invokes the installed Unix agent-ssh command. It neither requires Marshal's daemon nor imports its launch records. Marshal and Pulse depend on the library package, not the terminal binary.

agent-ssh owns the operator's terminal workspace: ordered pane commands, local working directories, Terminal profiles, panes per tab, restore, and moving existing panes between tabs. It does not implement another launch registry or claim to recover a running worker from its terminal title. Local sessions are supported alongside SSH sessions.

Explicit-command panes store argv. Version 2 provider-backed panes store references and resolve fresh attachment plans during restore. Existing Marshal-compatible SSH/tmux attach scripts and `marshal-shim codex-run resume THREAD_ID` commands can be used without linking an unreleased Marshal dependency. This is command-level compatibility, not a live integration with the launch API.

An attachment integration with Marshal must:

1. Save launch IDs as references to Marshal records, not copy backend handles as new authoritative records.
2. Query status/recover through Marshal before attaching. A restore must not silently issue another launch when attachment is unavailable.
3. Preserve the exact Codex thread binding and matching client/server version. A newer client can trigger an isolated server and ownership locks, as observed during recovery on this machine.
4. Use structured attach argv from the backend if available. The current optional `attach` string is human-readable and crosses two shells; do not split it on whitespace or execute it through an implicit local shell.
5. Leave launch orchestration and first-task delivery in Marshal. Leave Pulse-backed agent lifecycle, credentials, and guest provisioning in Pulse. Moving a pane must not imply stopping or relaunching its worker.

`agent-ssh` arranges terminal panes and attaches to existing executions. Pulse's managed adapter provides launch capability. These responsibilities remain separate even though both use the same tmux library.