Skip to content

Wrap each agent in a tmux session for persistence#35

Open
model-collapse wants to merge 1 commit intopablodelucca:mainfrom
model-collapse:main
Open

Wrap each agent in a tmux session for persistence#35
model-collapse wants to merge 1 commit intopablodelucca:mainfrom
model-collapse:main

Conversation

@model-collapse
Copy link

@model-collapse model-collapse commented Feb 25, 2026

Summary

  • Wrap each agent's Claude process in a tmux session so closing a VS Code terminal only detaches -- Claude keeps running
  • Detached agents appear semi-transparent with a gray X bubble in the office; clicking reattaches
  • On startup, orphaned tmux sessions are auto-discovered and reconnected
  • Falls back to current direct-terminal behavior when tmux is unavailable

Closes #34

Changes

  • New file src/tmuxManager.ts: Pure functions for tmux shell interactions (availability check, session naming, list/check/kill, build commands)
  • Backend: Launch wraps in tmux; terminal close → detach; focus → reattach; close → kill tmux; 5s health check; orphan discovery; persist/restore detached state
  • Webview: Detached characters at 45% opacity with gray X bubble sprite, "Detached" status overlay, --pixel-status-detached CSS variable

Test plan

  • Launch agent with tmux installed → verify tmux ls shows session
  • Close terminal → character goes semi-transparent with X bubble
  • Click detached character → reattaches via new terminal
  • Close agent via X button → tmux session killed
  • Launch agent without tmux → verify direct-terminal fallback works unchanged
  • Close VS Code → reopen → detached agents restored from persisted tmux sessions
  • Orphaned tmux sessions auto-discovered on startup
  • Manually kill tmux session while detached → agent removed within 5s

🤖 Generated with Claude Code

When tmux is available, each agent's Claude process runs inside a tmux
session. Closing a VS Code terminal only detaches — Claude keeps running.
Detached agents appear semi-transparent with a gray X bubble in the office.
Clicking a detached agent reattaches via a new terminal. On startup,
orphaned tmux sessions are auto-discovered and reconnected. Falls back
to direct-terminal behavior when tmux is unavailable.

New file: src/tmuxManager.ts (tmux shell interactions)
Backend: terminal close → detach, focus → reattach, close → kill tmux,
  5s health check, orphan discovery, persist/restore tmux state
Webview: detached visual state (45% opacity, X bubble, "Detached" overlay)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Wrap each agent in a tmux session for persistence

2 participants