agent-ssh 0.3.0

Arrange agent terminal layouts and reconnect through provider attachment plans
Documentation

agent-ssh

Arrange agent terminal layouts and reconnect through provider attachment plans. agent-ssh is the command. The repository is ignition-is-go/agent-ssh.

See the experimental attachment contract for version 2 terminal layouts, provider resolution, and machine-readable restore plans.

Attach to an existing tmux session

Version 0.3.0 adds Unix-side tmux inspection through pinned Rust libtmux 0.1.2:

agent-ssh tmux list --json
agent-ssh tmux attach pulse-agent
agent-ssh tmux --socket /run/user/1000/tmux.sock list --json

On Windows, select an SSH host with Unix agent-ssh 0.3.0 installed:

agent-ssh tmux list --on pulse-admin --json
agent-ssh tmux attach pulse-agent --on pulse-admin
agent-ssh tmux list --on pulse-admin --remote-program /root/.cargo/bin/agent-ssh --json

--socket selects a path on the execution host. Session names are literal names, not tmux selectors or prefix searches. Attachment fails if the exact name is absent and never creates a session or agent. The SSH path executes the installed target-side command without a raw-tmux fallback.

The upstream library supplies session queries and exact-name lookup. Its published API captures command output and has no inherited-terminal attachment operation. After a successful lookup, this application hands the terminal to native tmux attach-session on the captured socket. Cancelling that attachment does not terminate the tmux session. Availability can change between lookup and handoff; this is a logical named attachment, not a lease on a process incarnation.

The tmux subcommand does not accept Windows Terminal layout flags. In host lists, use -- before an SSH alias named tmux.

Legacy layouts and recovery

# Save selected SSH hosts without opening terminals.
agent-ssh --group production --save-workspace production.json --panes-per-tab 4

# Restore saved attach/resume commands in four-pane grids.
agent-ssh --restore production.json --window agents
agent-ssh --restore production.json --panes-per-tab 4 --dry-run

# Regroup 16 EXISTING single-pane tabs, beginning at tab zero.
agent-ssh --regroup 16 --window agents

--regroup moves existing panes without starting or stopping their processes. Run it only against the specified number of single-pane tabs; it is not idempotent. --first-tab selects a zero-based starting tab. Terminal chooses split direction when moving existing panes; restoring a workspace explicitly builds balanced grids. Existing tabs outside the selected range remain in place.

--restore opens new terminal interfaces. Remote attach commands should reconnect to an existing tmux session; local Codex commands should use an explicit thread ID. Repeating restore can create duplicate interfaces, especially for local agents. A saved workspace retains commands and layout, not process memory or in-flight command state. Restoring does not stop an already-open interface or take over a conversation lock.

Workspace JSON uses version 1, an ordered pane list, and a per-tab pane count:

{
  "version": 1,
  "panes_per_tab": 4,
  "panes": [
    {
      "title": "remote agent",
      "command": ["ssh.exe", "-t", "pulse-admin", "/root/.local/share/agent-sessions/open-agent.sh"]
    },
    {
      "title": "local agent",
      "cwd": "C:\\Work Projects",
      "command": ["codex.cmd", "resume", "EXPLICIT-THREAD-ID"]
    }
  ]
}

Each pane may specify a Windows Terminal profile. Commands are argument arrays, not shell strings. Use only trusted workspace files: restoring executes their commands. Semicolons and line breaks in pane fields are rejected because Windows Terminal interprets semicolons as action separators. Saving to an existing filename is refused. --save-workspace saves selected SSH destinations, not automatic discovery of active agent IDs; provide explicit resume/attach commands for agent recovery.

See Marshal integration for the boundary with the work-in-progress LaunchBackend API.

agent-ssh opens SSH aliases from ~/.ssh/config as balanced pane grids or tabs in Windows Terminal. Groups and colors are declared with comments:

# @group production #E57000
Host app-one
    HostName app-one.example.com

Host app-two
    HostName app-two.example.com
    User deploy

Install

cargo install agent-ssh --version 0.3.0 --locked
agent-ssh --sync

To install from a source checkout, run cargo install --path . --force.

Restart Windows Terminal after the initial sync.

Usage

agent-ssh --group production
agent-ssh --group production --new-window
agent-ssh --group development --tabs
agent-ssh --group production --command uptime
agent-ssh --list
agent-ssh --sync
agent-ssh --group production --dry-run

Inside a grid, Windows Terminal's Alt+Shift+B toggles broadcast input, Alt+Shift+Z zooms the focused pane, and Alt+Arrow moves focus.

Releases

Push a semantic-version tag matching Cargo.toml to create a GitHub Release:

git tag v0.3.0
git push origin v0.3.0

The release workflow verifies the version, runs the full quality suite, builds the Windows executable, and publishes a ZIP plus a SHA-256 checksum.

When releasing a new shared protocol version, publish it before the terminal crate. Skip the first command if that protocol version is already published:

cargo publish -p agent-attachment-protocol
cargo publish -p agent-ssh

Inspect provider-backed layouts

Version 2 layouts retain references and resolve their attachment plans on every restore. Use the provider on the same host as the terminal consumer. A remote producer's local executable path is not a local Windows executable.

agent-ssh --restore my-layout.json --window agents --plan
agent-ssh --restore my-layout.json --window agents
agent-ssh --restore my-layout.json --window agents --allow-partial

Default restore blocks if a provider cannot attach every referenced agent. Partial restore is explicit. Neither mode starts replacement agents or replays prompts. See the ownership decision and acceptance record.

To convert a version 1 recovery file, use the migration tool. It compares both files through the actual CLI before writing and refuses to overwrite an existing destination.

python scripts/migrate_layout.py old-layout.json terminal-layout.json --binary agent-ssh

Pulse Agents 1.82.2 provides the managed attachment-plan and attach commands. Install that provider before using its provider-backed layouts. Existing configured SSH and local recovery commands remain supported.