SuperAPIAI Directory

agent-assh

github.com · AI agents

agent-assh (assh) is an SSH workflow assistant for LLM agents, used to let AI agents operate remote servers safely and efficiently. It completes first login, key deployment, tmux installation, and persistent session creation with a single command, and maintains a persistent tmux session on the server so that the working directory and environment persist across multiple commands. To avoid large outputs consuming the agent's context, commands return compact JSON metadata by default, and the agent can read specified lines in pages on demand. The tool provides session execution, asynchronous tasks, file transfer, port forwarding, multi-host parallel execution, host information scanning, service management, and other capabilities, and includes a built-in command safety classifier, read-only/ops configuration profiles, output sensitive-information redaction, and audit logs. Passwords are passed only via environment variable names and are not written to the command line or audit logs. The tool depends on the system OpenSSH, persistent sessions target Unix-like remote hosts, and interactive password prompts are not supported in v1.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

agent-assh (command-line name assh) is an SSH workflow assistant for LLM agents, with the goal of enabling AI agents to complete remote server operations in a controllable, context-efficient manner.

Purpose assh is responsible for preparing SSH access, opening a persistent tmux session on the server, and avoiding stuffing large command outputs directly into the agent's context. Commands first return compact JSON containing metadata, and the agent then reads the needed lines on demand.

Main capabilities

  • One-click connection: assh connect completes first-time bootstrapping and session opening, including using or creating the key specified by --identity (default ~/.ssh/id_agent_ed25519), trying key login first, using the environment variable specified by --password-env only when the key fails, deploying and verifying the public key, checking server capabilities, installing tmux non-interactively (can be disabled with --no-install-tmux), safely cleaning up old trusted assh sessions (can be disabled with --no-gc), and saving local registry metadata.
  • Persistent sessions: assh session exec|read|close|gc maintains the working directory and environment via tmux; session ps|kill manages processes; session service manages services (status/restart/start/stop/logs); session exec-async|job-status|job-cancel handles background tasks; session watch lets humans observe the agent's tmux session; session list lists local sessions; session export exports session records and output.
  • Output paging: assh exec executes a single remote command and saves the output locally; assh read reads it in pages or outputs plain text via --raw. Paging is calculated by lines, and overly long single lines need to be truncated on the server side.
  • Files and network: assh transfer provides file operations and synchronization such as put/get/read/list/stat/mkdir/rm/mv/sync; assh forward provides port forwarding (start/status/stop).
  • Multi-host and inspection: assh fleet exec runs in parallel across multiple hosts and returns per-host results and failure counts (output per stream limited to 8 KiB); assh scan returns a host JSON inventory (OS, CPU, memory, disk, uptime, primarily targeting Linux); assh capabilities checks whether the server supports session workflows.
  • Auxiliary commands: assh connect-info parses the provider-supplied server information block and connects; assh prompt outputs instructions for agents; assh --help outputs an agent-oriented JSON inventory; assh key-deploy performs low-level key installation using a password from an environment variable; assh audit reads the local audit log (--last, --host, --failed, --savings summarizes the number of lines retained by pagination); assh version outputs version metadata, and --check checks for a new version.

Usage Install via npm i -g agent-assh; this wrapper downloads the corresponding Go binary from GitHub Releases. Release archives can also be downloaded manually; the installer verifies SHA-256 using checksums.txt from the same release, but there is no independent signature, so build from source if provenance verification is needed. The tool uses the system OpenSSH client; transfer sync requires rsync on both ends; transfer list and transfer stat require GNU find/stat on the remote side. Passwords are never passed via command-line arguments: connect and key-deploy accept an environment variable name (-E), connect-info reads the provider information block from a file or stdin, and there is no --password flag. If key-based login already works, connect will not read the password environment variable.

Security and limitations

  • Output is redacted for sensitive information by default (e.g., AWS keys, JWTs, bearer tokens, PEM keys, common provider tokens, passwords in URLs, and password/secret/token/api_key assignments), marked with redacted:true in JSON, and can be disabled with --no-redact; this is a best-effort hygiene measure, not a security mechanism.
  • session exec, session exec-async, exec, and fleet exec pass through a command classifier that blocks obviously destructive commands (e.g., rm -r, rm on system paths, find -delete, mkfs, wipefs, dangerous dd, recursive permission changes, redirection to system paths, etc.); transfer rm refuses to delete system paths. --confirm-danger exists only in session exec; destructive multi-host execution is intentionally prohibited. The classifier is based on pattern matching; it does not inspect scripts and interpreters passed via --stdin, nor does it recognize docker rm, DROP DATABASE, git reset --hard, etc. The real boundary is the privileges of the remote account.
  • Additional forbidden commands can be appended via ~/.config/assh/safety.rules (one command name per line); this file only adds restrictions and does not weaken built-in rules. It must have mode 0600 and be owned by the current user, otherwise it fails closed.
  • Profiles: connect --profile readonly or ops restricts the commands that can be run within the session, while admin (the default) allows all; the allow lists are located in ~/.config/assh/profiles.json. Profiles are checked in session exec, session exec-async, session service, and session kill; every part of a compound command must be allowed, and command substitution and file redirection are rejected; exec, transfer, and fleet are addressed per host and are not constrained by profiles. Profiles are likewise guardrails, not security boundaries.
  • SSH does not use a pseudo-terminal by default (-T); --force-pty can enable one for gateways that require it; under --batch, ssh fails immediately when prompted for a password or passphrase. The default --host-key-policy is accept-new, trusting the host on first contact and rejecting it if the key changes; hardened environments can use strict, while no-check is insecure and suitable only for one-off experimental/development hosts.
  • Persistent sessions target Unix-like remote hosts; package installation is non-interactive, and unsupported package managers return machine-readable errors; v1 does not support interactive password prompts. Each session shouldOnly one session exec runs at a time; commands share the same shell and execute sequentially. Each host reuses a single SSH connection (ControlMaster), which closes after 5 minutes of inactivity; changes that only take effect for new logins (such as group membership or sshd settings) will not be reflected until the connection closes. session exec forwards local stdin only with --stdin (limit 4 MiB, written to a temporary file on the server); assh exec does not forward stdin, so large data should use assh transfer put.
  • The audit log does not record password values or command text (it stores hashes); however, the local session record does save command text, so secrets should not be embedded in commands.

Use cases Suitable for letting terminal-based AI agents (such as Codex, Claude Code, OpenCode, etc.) perform remote operations, log viewing, service management, file transfer, multi-host inspection, and other tasks after obtaining SSH credentials, while controlling context overhead through paginated reads.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools