feat(@scripts): add detached tmux session support

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-05-20 02:13:38 -07:00
parent d682cc61f4
commit d145983188

View file

@ -1599,6 +1599,16 @@ fi
setup_host "$host"
sync_tmux_conf "$host"
inner=$(build_inner "$dir")
# RCLAUDE_DETACHED=1 → spawn the tmux session on the remote in the
# background and print the session name. Symmetric with the local-host
# detached branch above; used by supervisor processes (e.g. clare web)
# that bring up a remote Claude pane without attaching the calling tty.
# Mosh is interactive-only — always go through ssh for detached spawn.
if [ -n "${RCLAUDE_DETACHED:-}" ]; then
ssh $_SSH_LIVE_OPTS "$host" "tmux new-session -d -s '${session}' \"${inner}\""
printf '%s\n' "$session"
exit 0
fi
# `new-session -A` attaches if a session of that name already exists, so
# re-running rclaude after a broken pipe lands you back in the same tmux
# session instead of erroring with "duplicate session". Combined with