Seamless remote development with pi coding agent via SSH.
# With auto-mount (recommended)
pi -e pi-ssh-remote --ssh-host user@server --ssh-cwd /path/to/project
# Or use the wrapper script
./pi-ssh user@server:/path/to/projectThe extension automatically:
- Mounts the remote
--ssh-cwdvia SSHFS to a temp directory - Changes pi's working directory to the mount
- Routes bash commands to the remote host via SSH
- Unmounts on session end
git clone https://github.com/cv/pi-ssh-remote ~/.pi/agent/extensions/pi-ssh-remoteThen either:
- Use the
pi-sshwrapper:~/.pi/agent/extensions/pi-ssh-remote/pi-ssh user@host:/path - Or add to PATH:
ln -s ~/.pi/agent/extensions/pi-ssh-remote/pi-ssh ~/bin/pi-ssh
# Basic - mounts remote path automatically
pi -e pi-ssh-remote --ssh-host user@server --ssh-cwd /home/user/project
# Custom port
pi -e pi-ssh-remote --ssh-host user@server --ssh-cwd /home/user/project --ssh-port 2222
# Custom SSH key
pi -e pi-ssh-remote --ssh-host user@server --ssh-cwd /home/user/project \
--ssh-command "ssh -i ~/.ssh/mykey"
# No remote path - mounts user's home directory
pi -e pi-ssh-remote --ssh-host user@server# Basic
pi-ssh me@server:/home/me/project
# Custom port
pi-ssh me@server:/home/me/project --ssh-port 2222
# GitHub Codespaces
gh cs ssh --config >> ~/.ssh/config
pi-ssh cs.my-codespace.main:/workspaces/projectIf you prefer to manage SSHFS yourself or don't have it installed:
# Mount manually
sshfs user@server:/path ~/mnt
# Run pi with auto-mount disabled
cd ~/mnt
pi -e pi-ssh-remote \
--ssh-host user@server \
--ssh-cwd /path \
--ssh-no-mount
# Unmount when done
umount ~/mnt| Flag | Description |
|---|---|
--ssh-host |
SSH host (e.g., user@server) |
--ssh-cwd |
Remote working directory (auto-mounted via SSHFS) |
--ssh-port |
SSH port (default: 22) |
--ssh-command |
Custom SSH command (e.g., ssh -i ~/.ssh/mykey) |
--ssh-timeout |
Timeout for SSH commands in seconds |
--ssh-no-mount |
Disable auto-mounting (use existing mount or bash-only) |
--ssh-strict-host-key |
Require known host keys (reject unknown hosts) |
SSHFS must be installed for auto-mount:
- macOS:
brew install macfuse && brew install gromgit/fuse/sshfs-mac - Linux:
apt install sshfs
Without SSHFS, the extension still works but only bash commands will work remotely (file tools won't have access).
| Tool | Execution |
|---|---|
read, write, edit, grep, find, ls |
Local (on SSHFS mount) |
bash |
Remote (via SSH) |
The auto-mount creates a temporary directory under /tmp/pi-sshfs/ and mounts the remote path there. On session end (or Ctrl+C), the extension automatically unmounts and cleans up.
Note on print mode (-p): Auto-mount works best in interactive mode. In print mode, the working directory is captured before the extension can mount, so file tools may not see the mounted files. For print mode, either:
- Use
--ssh-no-mountwith a pre-mounted SSHFS, or - Use bash commands to access files (e.g.,
bash cat file.txt)
MIT