Start it so it survives SSH disconnection (use a fixed port for easy reconnection):
nohup opencode serve --port 4096 > ~/.opencode-serve.log 2>&1 &From anywhere (same machine or remote via SSH tunnel):
opencode attach http://localhost:4096If connecting from a different directory, specify which project to work on:
opencode attach http://localhost:4096 --dir /path/to/project- Check status:
pgrep -f "opencode serve" - View logs:
tail -f ~/.opencode-serve.log - Stop it:
pkill -f "opencode serve"
If the server is on a remote machine, create an SSH tunnel:
ssh -L 4096:localhost:4096 user@remote-host
# Then in another terminal:
opencode attach http://localhost:4096