Skip to content

πŸ“ docs(design): RFC β€” session persistence via a detached daemon - #46

Open
winlp4ever wants to merge 2 commits into
mainfrom
docs/session-daemon-rfc
Open

πŸ“ docs(design): RFC β€” session persistence via a detached daemon#46
winlp4ever wants to merge 2 commits into
mainfrom
docs/session-daemon-rfc

Conversation

@winlp4ever

Copy link
Copy Markdown
Contributor

Drafts the "big gun" we discussed into a proper RFC β€” docs/design/SESSION_DAEMON.md β€” promoting ARCHITECTURE Appendix A from a sketch to a buildable plan. No code; this is the doc to argue against as we continue.

What it captures

  • The two-reconnects reframe (the key clarification): app disconnect (quit/crash/auto-update) is what the daemon solves; network disconnect (sleep/wifi) needs wrapping the remote's tmux/mosh. The full ssh-survives story = daemon + remote-tmux. Machine reboot stays a non-goal (layout-restore is the fallback).
  • The genuinely hard part: the daemon models the screen, not a byte pipe β€” a headless @xterm/headless emulator per session + @xterm/addon-serialize snapshot for a correct cold reattach, with the fidelity cases that'll eat the time (alt-screen TUIs incl. Claude's, reflow-on-resize, scrollback bound, cwd/status tracking).
  • Transport/protocol + lifecycle: unix socket / named pipe, a small frozen verb set, discover-or-spawn, orphan reaping β€” and the rule that keeps it sane: the daemon stays dumb, all product logic stays client-side.
  • Auto-update Γ— daemon (new since Appendix A): thin frozen protocol so a new client speaks to an old daemon; new sessions on a fresh daemon, old one drains β€” no forced session kill on update.
  • Perf budget for the extra hop (coalescer moves to the socket boundary; <1–2 ms added keystroke latency, gated on the SMTERM_PERF harness), security (0600 socket), quit-UX (keep-running-in-background default; "N background sessions" in the status bar), and WSL/hook interplay.
  • A staged build plan (0–4) β€” pty-host child + screen model β†’ detach it (the M5 headline) β†’ remote ergonomics β†’ multi-client/CLI β€” so we ship value early and defer the scary lifecycle work.
  • Β§12 Open decisions for us: build-local/wrap-remote, quit default, perf gate, v1 scope, scrollback cap.

Appendix A now links here. Ready to iterate β€” the open questions in Β§12 are where I'd like your calls next.

Promote ARCHITECTURE Appendix A into a full RFC (docs/design/SESSION_DAEMON.md):
the two-reconnects framing (app-disconnect = daemon; network-disconnect = wrap
remote tmux/mosh), the screen-model plan (@xterm/headless + addon-serialize snapshot
for cold reattach), transport/protocol + lifecycle, the auto-update Γ— daemon
versioning policy (thin frozen protocol so a new client speaks to an old daemon),
perf budget for the extra hop, security, quit-UX, WSL/hook interplay, a staged
build plan (0–4), and the open decisions. Appendix A links here.

No code β€” design discussion doc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant