You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For active sessions, CodeV walks the parent process tree (`ps -o comm=` → `ps -o ppid=`, up to 20 levels) to detect which terminal the claude process is running in. This means:
304
+
- Clicking an iTerm2 session uses iTerm2 switch logic (even if settings say cmux)
305
+
- Clicking a cmux session uses cmux switch logic (even if settings say iTerm2)
306
+
- Settings terminal only affects **launching** non-active sessions
307
+
- Active sessions show a small uppercase badge (ITERM2, CMUX, GHOSTTY) in the UI
308
+
309
+
### cmux Integration Details
310
+
311
+
**CLI commands available:**
312
+
-`cmux new-workspace --cwd <path> --command "claude --resume <id>"` — create new workspace with command
313
+
-`cmux select-workspace --workspace <id>` — switch to workspace
314
+
-`cmux focus-panel --panel surface:N` — switch to specific tab within workspace
cmux CLI communicates via Unix socket (`/tmp/cmux.sock`). By default, only processes started inside cmux can connect (`cmuxOnly` mode). External apps like CodeV need the user to change the socket mode:
320
+
321
+
| Mode | Access | How to enable |
322
+
|------|--------|---------------|
323
+
|`cmuxOnly` (default) | cmux child processes only | Default |
**Recommended:** Ask user to set `automation` or `allowAll` mode in cmux Settings. Security impact is minimal — only local processes on the same machine can connect.
330
+
331
+
**Switch strategy for cmux:**
332
+
1.`ps aux` to find claude process PID
333
+
2. Try connecting to `/tmp/cmux.sock` — if access denied, fallback to clipboard
334
+
3. If connected: `cmux list-workspaces --json` to find which workspace has the session
335
+
4.`cmux select-workspace` + `cmux focus-panel` to switch to correct tab
-`surface configuration` — record type with `command`, `initial working directory`, `initial input`, `wait after command`, `environment variables`
351
+
-`input text` — send text to a terminal as if pasted
352
+
-`send key` — send keyboard events
353
+
354
+
**Switch:** Iterate all windows → tabs → terminals, match `working directory` to project path, call `focus`.
355
+
356
+
**Launch:**`new tab`/`new window` with `surface configuration from {initial working directory, initial input:"claude --resume <id>\n"}`. Uses `initial input` (not `command`) because `command` is passed directly to `exec` without shell interpretation.
357
+
358
+
**Note:** Ghostty CLI `+new-window` is not supported on macOS, but AppleScript `new window` works. The `.sdef` is similar to cmux's, but Ghostty's AppleScript actually works (cmux's `count windows` returns 0).
359
+
360
+
### Branch Name: Why Not `git branch --show-current`
361
+
362
+
`git branch --show-current` returns the repo's **current** branch, but a session may have been created on a different branch that has since been switched away. The JSONL `gitBranch` field preserves the branch at the time of each session entry, which is the correct value to display.
0 commit comments