Skip to content

feat(spawn): isolate crewmate windows in a dedicated firstmate session - #1

Merged
augustomklee merged 1 commit into
mainfrom
worktree-crew-session-isolation
Jun 24, 2026
Merged

augustomklee merged 1 commit into
mainfrom
worktree-crew-session-isolation

Conversation

@augustomklee

Copy link
Copy Markdown
Owner

What

Crewmate windows now always live in a dedicated firstmate psmux session, never the session the captain is actively working in.

Previously fm-spawn only used a dedicated session when firstmate ran outside the multiplexer; when it ran inside the captain's session, it dumped crewmate windows alongside the captain's own, flooding it.

Changes

  • bin/fm-spawn.sh - drop the in-psmux "same session" branch; always target the firstmate session. The lazy has-session guard is preserved for a crewmate spawned before bootstrap or after a restart.
  • bin/fm-bootstrap.sh - create the firstmate session eagerly at startup so it is ready to attach to immediately. Best-effort: a missing/unhappy multiplexer never blocks bootstrap.
  • bin/fm-supervise-daemon.sh - drop the firstmate:0 positional fallback for the away-mode supervisor pane. firstmate is the crewmate session now, so that guess would inject an escalation into a crewmate window. With neither FM_SUPERVISOR_TARGET nor TMUX_PANE set, startup now fails loudly instead.
  • CLAUDE.md - document the always-dedicated-session behavior in section 7.

Notes

  • Downstream scripts read the window target from state/<id>.meta (window=firstmate:fm-<id>), so peek/send/teardown/watch are unaffected.
  • The happy path of the away-mode engine uses the captain's actual pane via TMUX_PANE; only the degraded no-discovery fallback behavior changed (loud failure vs. silent wrong-pane injection).

… session

Previously fm-spawn put crewmate windows in firstmate's own session when it
ran inside the multiplexer, flooding the session the captain works in; only
the outside-psmux path used a dedicated session. Now crewmate windows always
go to a "firstmate" session, never the captain's active session.

- fm-spawn.sh: drop the in-psmux "same session" branch; always target the
  firstmate session (lazy has-session guard preserved for pre-bootstrap spawns).
- fm-bootstrap.sh: create the firstmate session eagerly at startup so it is
  ready to attach to immediately; best-effort, never blocks bootstrap.
- fm-supervise-daemon.sh: drop the firstmate:0 positional fallback for the
  away-mode supervisor pane - "firstmate" is the crewmate session now, so a
  guess there would inject into a crewmate window. Fail loud instead.
- CLAUDE.md: document the always-dedicated-session behavior.
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