FFFF GitHub - PUT-Request/muxy: SSH but for CLI agents · GitHub
[go: up one dir, main page]

Skip to content
PUT-RequestPublic

About

SSH but for CLI agents

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

muxy

SSH-like remote sessions for AI coding harnesses (pi, codex, claude). One daemon per host, TLS-encrypted, password auth, backed by tmux so sessions survive disconnects.

muxy create desktop pi-1 /root/projects/bot   # create + attach
muxy connect desktop pi-1                      # re-attach
muxy list desktop                              # list sessions
muxy delete desktop pi-1                       # kill session

Detach with Ctrl-] — the session keeps running on the host.

Install

Requires Go 1.24+ to build, and tmux on every host.

go build -o muxy .
cp muxy /usr/local/bin/muxy        # sudo if needed

Host setup

On each host (e.g. desktop):

sudo muxy setup                    # password, TLS cert, /etc/muxy/config.yaml
sudo muxy daemon                   # or deploy/muxy.service via systemd

setup prompts for a password (stored as bcrypt hash only), generates a self-signed cert, and validates tmux + harness binaries. Harness name → binary mappings live in /etc/muxy/config.yaml:

harnesses:
  pi:     { binary: /root/.nvm/versions/node/v24.21.0/bin/pi }
  codex:  { binary: /usr/local/bin/codex }

Client usage

muxy add-host desktop 192.168.1.50
muxy create desktop pi-1                        # harness inferred from pi-*
muxy create desktop pi-1 /root/projects/bot    # run in a host directory
muxy create desktop scratch --harness pi -- --model opus
muxy connect desktop pi-1
muxy list desktop
muxy delete desktop pi-1
  • Password is prompted every time (never in argv/env/logs).
  • First connect shows the server cert fingerprint — verify, accept once, it's pinned in ~/.config/muxy/known_hosts.yaml.
  • muxy create --no-attach creates in the background without attaching.

Reverse proxy (WebSocket)

The daemon also serves a WebSocket endpoint for HTTP reverse proxies (Caddy, nginx, Cloudflare). Raw TCP :7222 keeps working alongside it.

Server config adds:

ws_listen: ":7223"   # WSS endpoint, same cert; "" disables
ws_path: /muxy

Point your proxy at https://<daemon>:7223/muxy (self-signed upstream, skip-verify) and pair clients with the public URL:

muxy add-host desktop-remote --url wss://muxy.example.com/muxy
muxy list desktop-remote
muxy create desktop-remote pi-1 /root
  • One muxy frame = one WS binary message. No compression (jitter), PTY output coalesced in ~5ms windows, ping every 20s so proxies don't idle-kill sessions. GET /healthz for proxy health checks.
  • Trust: system roots first (real proxy cert → no prompt), TOFU pin fallback for direct wss:// to the self-signed daemon.
  • Rate-limiting uses X-Forwarded-For when present.
  • See deploy/Caddyfile.example and deploy/nginx-muxy.conf.example. TLS here is hop-by-hop: the proxy terminates the outer TLS.

Security

  • TLS 1.3, self-signed cert, TOFU pinning (SSH-style). Fingerprint change aborts with a warning.
  • Password sent inside TLS only, bcrypt-verified, rate-limited (5 fails → 30s lockout per IP).
  • Session names validated; tmux invoked via argv (no shell).

Layout

  • cmd/ — CLI (setup, daemon, create, connect, list, delete)
  • internal/daemon — TLS server, auth, tmux bridging
  • internal/client — dial, TOFU, raw-terminal attach
  • internal/proto — frame protocol (JSON hello + PTY byte stream)
  • internal/frameconn — transport abstraction: raw TCP/TLS or WebSocket (one muxy frame per WS binary message)
  • internal/tmux — tmux argv wrapper
  • internal/auth — bcrypt + lockout tracker
  • internal/tlscert — self-signed cert generation
  • deploy/ — systemd unit + launchd plist

Dev

go vet ./... && go test ./...

About

SSH but for CLI agents

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0