Skip to content

shpool-resume: annotate live sessions + surface closed Claude sessions#34

Open
mecattaf wants to merge 1 commit into
mainfrom
improve-shpool-resume-picker
Open

shpool-resume: annotate live sessions + surface closed Claude sessions#34
mecattaf wants to merge 1 commit into
mainfrom
improve-shpool-resume-picker

Conversation

@mecattaf

Copy link
Copy Markdown
Owner

Why

Mod+Ctrl+Shift+Return runs the shpool-resume fzf picker on the desktop. It previously listed bare session UUIDs from shpool list with no hint of what each one was running, so they were unidentifiable. Worse, a Claude session whose terminal was closed (or whose laptop rebooted, dropping the ssh attach) vanished from the picker entirely — shpool only tracks live sessions — even though its transcript is fully resumable.

This came up recovering a real closed claude session today: the picker simply couldn't surface it.

What changed

The picker now shows two groups:

  • ● live shpool sessions — annotated with cwd, the program running inside (claude / nvim / shell), an age, and an * when a client is already attached. Each session is mapped to its leader process by matching shpool list's STARTED_AT against process start times, then /proc/<pid>/cwd + a process-tree walk give cwd and program. Selecting one does shpool attach -f (force, so a stale client can't leave you with a blank screen).
  • ○ recently-closed Claude sessions — read from $CLAUDE_CONFIG_DIR transcripts (default ~/.claude-main), excluding any id currently live in a shpool session, shown with directory + opening prompt. Selecting one spawns a fresh shpool session that claude --resumes it in the right cwd, wrapped in bash -lc 'exec …' so the TUI survives shpool detaches (running claude as the bare -c command exits on detach).

Tunables: SHPOOL_RESUME_CLOSED_DAYS (default 3), SHPOOL_RESUME_CLOSED_LIMIT (default 8).

Testing

Ran on harness-desktop with SHPOOL_RESUME_LIST_ONLY=1 (a new debug hook that prints candidate lines instead of launching fzf): live sessions annotate correctly (incl. claude-as-leader recovery sessions and the attached marker), and closed Claude sessions surface with prompts while the currently-live one is correctly hidden. bash -n clean.

Deploy: chezmoi apply on harness-desktop.

🤖 Generated with Claude Code

The resume picker (Mod+Ctrl+Shift+Return) previously showed bare session
UUIDs from `shpool list`, with no hint of what each one was — and could
not show a Claude session whose terminal had been closed, since shpool
only tracks live sessions.

Now the fzf picker shows two groups:

- ● live shpool sessions, annotated with cwd, the program running inside
  (claude / nvim / shell), an age, and an `*` when already attached. Maps
  each session to its leader process by matching `shpool list`'s
  STARTED_AT against process start times, then reads /proc for cwd and
  walks the process tree for the program.

- ○ recently-closed Claude sessions read from $CLAUDE_CONFIG_DIR
  transcripts (default ~/.claude-main), excluding any whose id is live in
  a shpool session. Selecting one spawns a fresh shpool session that
  `claude --resume`s it in the right cwd, wrapped in `bash -lc 'exec …'`
  so the TUI survives shpool detaches.

Tunables: SHPOOL_RESUME_CLOSED_DAYS (3), SHPOOL_RESUME_CLOSED_LIMIT (8).
Live attach now uses `-f` so the picker reliably steals a stale client.

Co-Authored-By: Claude Opus 4.8 <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.

1 participant