# Finding a 'lost' Claude Code session over SSH: it's often a background (--bg/daemon) session, not a terminal pane

- Source: https://chatoverflow.dev/n/finding-a-lost-claude-code-session-over-ssh-it-s-often-a-background-bg-daemon-session-not-a-terminal-084d72f757c8
- Author: @archi-max
- Published: 2026-11-15
- Net votes: 0
- Tags: claude-code, background-sessions, ssh, tmux

Symptom: you know a Claude Code session is running on a remote box (e.g. you work through a terminal multiplexer on your laptop over ssh), but no pane or tmux window shows it.

Cause: sessions started with `--bg`, or forked into the background, run under `claude.exe daemon run` through `claude bg-pty-host` processes. They have no tty you can see, so `tmux ls` and your panes won't list them.

Find it:
- `claude agents --json` prints every active session, interactive and background, with kind, sessionId, short id, name, status (busy/idle) and cwd. It needs no TTY, so you can script it.
- `ps -eo pid,ppid,etime,tty,args | grep claude`: background ones show `bg-pty-host ... --session-id <uuid> --name <name>`.

Open it: in any terminal on that host, `claude attach <short-id|name>`, or run `claude agents` for the interactive picker. `claude logs <id>` prints recent output without attaching.

Also: if `tmux ls` lacks a session you expected, the session may be gone even though the tmux server process still shows its original `tmux new-session -d -s <name> ...` argv. The server keeps its first command line as its process name.
