rclaude: launch path no longer forces --continue; resume path keeps it
Conflating launch and resume was wrong: tmux already provides 'reattach to the live conversation' (named session keyed by dir). Adding --continue to the launch path also caused surprise replays of stale conversations and clashed with other claude processes holding the same on-disk session. - launch (rclaude HOST DIR): plain 'claude' — fresh session - transport-drop reattach: tmux session reattach (automatic, same command) - explicit on-disk resume: 'rclaude resume <pattern>' — sets RCLAUDE_RESUME=1 when re-execing, which adds --continue to the launch invocation
This commit is contained in:
parent
509cdbbeec
commit
1f7f0779bd
1 changed files with 12 additions and 3 deletions
15
bin/rclaude
15
bin/rclaude
|
|
@ -152,8 +152,10 @@ cmd_resume() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
disk)
|
disk)
|
||||||
# Spawn a fresh tmux + claude --continue at the recorded cwd.
|
# Spawn tmux + claude --continue at the recorded cwd. The env var
|
||||||
exec "$0" "$_host" "$_target"
|
# tells the launch path below to add --continue (it doesn't by
|
||||||
|
# default, since --continue is the explicit-resume behavior).
|
||||||
|
RCLAUDE_RESUME=1 exec "$0" "$_host" "$_target"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
@ -216,8 +218,15 @@ esac
|
||||||
build_inner() {
|
build_inner() {
|
||||||
# Single-line, single-quote-safe. Variables prefixed with rc_ to avoid
|
# Single-line, single-quote-safe. Variables prefixed with rc_ to avoid
|
||||||
# collision with anything in the user's shell.
|
# collision with anything in the user's shell.
|
||||||
|
#
|
||||||
|
# Note: launch path uses plain `claude` (fresh session). Reattach to a
|
||||||
|
# live conversation is handled by tmux (named session keyed on dir, so
|
||||||
|
# re-running rclaude in the same dir reattaches). Disk-resume is the
|
||||||
|
# explicit `rclaude resume <pattern>` subcommand.
|
||||||
|
_resume_flag=""
|
||||||
|
[ "${RCLAUDE_RESUME:-0}" = "1" ] && _resume_flag="--continue"
|
||||||
printf '%s' \
|
printf '%s' \
|
||||||
"cd ${1} && rc_t=\$(date +%s); claude --continue ${flag}; rc_ec=\$?; " \
|
"cd ${1} && rc_t=\$(date +%s); claude ${_resume_flag} ${flag}; rc_ec=\$?; " \
|
||||||
"rc_e=\$(date +%s); rc_d=\$((rc_e - rc_t)); " \
|
"rc_e=\$(date +%s); rc_d=\$((rc_e - rc_t)); " \
|
||||||
"if [ \$rc_ec -ne 0 ] || [ \$rc_d -lt 2 ]; then " \
|
"if [ \$rc_ec -ne 0 ] || [ \$rc_d -lt 2 ]; then " \
|
||||||
"printf '\\n[rclaude] claude exited in %ds with code %d\\n' \$rc_d \$rc_ec; " \
|
"printf '\\n[rclaude] claude exited in %ds with code %d\\n' \$rc_d \$rc_ec; " \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue