Goal
Closing or crashing the NMSh frontend should not necessarily kill the user's shell or foreground command. A local session service owns the PTYs and zsh processes. The NMSh frontend becomes a client that can detach and reattach.
nmsh frontend/client
│
▼
persistent local session service
│
├─ PTY + zsh session A
├─ PTY + zsh session B
└─ PTY + zsh session C
Why
Today the PTY and managed zsh live inside the frontend process, so closing a Ghostty window or a frontend crash kills the shell and any running build, server or long job. #22/#88 already restore presentation after exit; this issue keeps the live process alive. It is also a prerequisite for Flow / Classic (#132).
Product direction (decided)
Not hidden tmux. tmux keeps working normally inside an NMSh session.
Launch behavior:
| State at launch |
Behavior |
| No detached live sessions |
Create a new session |
| Exactly one detached live session |
Reattach automatically, with a brief notice |
| Multiple detached live sessions |
Offer the session restore picker |
| Live sessions attached elsewhere |
Do not hijack them; create a new session by default |
/resume becomes the unified continuity hub:
- LIVE: still-running attachable sessions.
- ARCHIVED: historical sessions whose process no longer exists.
No separate /sessions UI. A /sessions alias may be considered later.
Detach vs exit:
- Frontend disappearance (window close, Ghostty crash, frontend crash) detaches.
- Real termination (zsh exits, Ctrl+D where zsh would exit, explicit Kill Session) ends and archives the session.
Output while detached: the service keeps reading PTY output and recording it. Reattach shows the existing transcript, output produced while detached, any still-running process, and current session state.
Single controlling client per live session is enough for v1. Multiple simultaneous writable clients are not a v1 requirement.
Limitation
No process resurrection across OS reboot, logout or power loss. After those, only archived history/presentation can be restored (existing #22/#88 behavior).
Non-goals
- Remote/network sessions, collaboration, multi-writer clients.
- Hidden tmux/screen as the implementation.
- Cloud sync.
Architectural constraints
Checkpoints
Dependencies / related
Goal
Closing or crashing the NMSh frontend should not necessarily kill the user's shell or foreground command. A local session service owns the PTYs and zsh processes. The NMSh frontend becomes a client that can detach and reattach.
Why
Today the PTY and managed zsh live inside the frontend process, so closing a Ghostty window or a frontend crash kills the shell and any running build, server or long job. #22/#88 already restore presentation after exit; this issue keeps the live process alive. It is also a prerequisite for Flow / Classic (#132).
Product direction (decided)
Not hidden tmux. tmux keeps working normally inside an NMSh session.
Launch behavior:
/resumebecomes the unified continuity hub:No separate
/sessionsUI. A/sessionsalias may be considered later.Detach vs exit:
Output while detached: the service keeps reading PTY output and recording it. Reattach shows the existing transcript, output produced while detached, any still-running process, and current session state.
Single controlling client per live session is enough for v1. Multiple simultaneous writable clients are not a v1 requirement.
Limitation
No process resurrection across OS reboot, logout or power loss. After those, only archived history/presentation can be restored (existing #22/#88 behavior).
Non-goals
Architectural constraints
/update, Update discovery and safe /update #74) is handled without corrupting sessions.Checkpoints
/resumeLive + ArchivedDependencies / related