Skip to content

feat(sessions): resume a recent Claude Code session or start one in a repo - #234

Open
adefreitas wants to merge 2 commits into
StackOneHQ:mainfrom
adefreitas:feat/sessions-resume
Open

adefreitas wants to merge 2 commits into
StackOneHQ:mainfrom
adefreitas:feat/sessions-resume

Conversation

@adefreitas

Copy link
Copy Markdown
Collaborator

Summary

Starting a Claude Code session today means finding a terminal and typing cd and claude. This adds two keys to the Sessions tab: o resumes a recent session and t starts a new one in a repo, each in a new terminal window.

Changes

  • RecentSessions lists the 15 newest transcripts under ~/.claude/projects, reading only the head and tail of each file. It skips sessions that are running, subagent transcripts and folders that no longer exist.
  • SessionLauncher opens a command in a new window: Ghostty through its AppleScript API (no "allow to execute" prompt), Terminal or iTerm. STACKNUDGE_SESSION_TERMINAL picks one; unset, it is Ghostty when installed, else Terminal.app. A Ghostty without the scripting API falls back to Terminal.
  • o opens a menu of recent sessions (project and title) and resumes the pick with claude --resume. t opens a menu of repos: the git checkouts directly under STACKNUDGE_CHECKOUTS_ROOT, or with that unset, the folders of recent sessions. The root has no default.
  • Keys follow AGENTS.md. Neither is bound on Sessions and the page has no text field, so single letters are fine. Routing is the pure sessionLaunchKeyAction(for:): plain keys only (so ⌘T stays with the app) and a held key acts once. The menus are native NSMenus, driven with ↑ ↓ and ⏎; Esc closes the menu. The footer lists both keys.
  • README: key table rows and a paragraph. notify.conf.example: both settings, commented out.
  • Tests: RecentSessionsTests (title selection, clipping, skipped transcripts), SessionLauncherTests (quoting, repo discovery, terminal choice), SessionLaunchKeyTests (key table, modifiers, repeat).

Testing

Automated: ./build.sh (no new warnings), make test-without-xcode (1483 tests, 0 failures), make typecheck-tests.

Manual, after make reload, with at least one Claude Code transcript on disk that isn't running:

  1. Open the panel, go to Sessions (⌘2). The footer shows Resume… O and New… T.
  2. Press o. A menu titled "Resume a session" opens at the panel's top-left. Press ↓ then ⏎. The panel hides and a terminal opens in that session's folder running claude --resume <id>.
  3. Press Esc while the menu is open. The menu closes and the panel stays.
  4. Press t with STACKNUDGE_CHECKOUTS_ROOT unset. The menu lists the folders of recent sessions. Pick one: a terminal opens there running claude.
  5. Set STACKNUDGE_CHECKOUTS_ROOT=~/some-dir-of-repos in ~/.stack-nudge/config, press t. Only the git repos directly under it are listed.
  6. Set STACKNUDGE_SESSION_TERMINAL=iterm (then terminal), repeat step 2. The window opens in that app.
  7. Hold o. One menu opens, not a stack of them.

Related issues

None.

🤖 Generated with Claude Code

adefreitas and others added 2 commits October 30, 2026 15:09
…erminal

RecentSessions lists the newest transcripts under ~/.claude/projects, reading
only the head and tail of each so a hundred-megabyte transcript costs two
chunks. It skips sessions that are already running, subagent transcripts and
folders that no longer exist.

SessionLauncher opens a command in a new window in a folder: Ghostty through
its AppleScript API (no "allow to execute" prompt), Terminal or iTerm. The
terminal comes from STACKNUDGE_SESSION_TERMINAL, else Ghostty when installed,
else Terminal.app. Nothing calls it yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two keys on the Sessions page, each opening a native menu at the panel's top-left
so it is driven with the arrows and ⏎ like the rest of the panel:

- O lists the 15 newest sessions that aren't running and resumes the picked
  one with `claude --resume` in its own folder.
- T starts `claude` in a repo: the git checkouts under
  STACKNUDGE_CHECKOUTS_ROOT, or with that unset, the folders of recent
  sessions. The root has no default.

The keys follow the keyboard rules in AGENTS.md: neither is bound on Sessions
already and the page has no text field, so single letters are fine. Routing is
a pure function (sessionLaunchKeyAction) that takes the NSEvent, so modifiers
pass through and a held key acts once. The footer lists both.

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