Skip to main content

favorite-session

Claude Code has no "favorite" for sessions — only rename + a history list. This skill adds one on the platform side: mark a session you want to return to, and reopen it in one step later. It is the durable companion to the sessions-view skill (which shows live concurrent sessions) — favorites outlive the reaped session registry.

Storage — at the developer's level (cross-machine), with a safe local fallback

Favorites live in a private ("secret") GitHub gist owned by your gh account, so they travel with you between machines. The gist is rediscovered by its description (bewith-session-favorites) and created on first use. A local cache at ~/.bewith/favorites.json always mirrors it.

If your GitHub token has no gist access (or gh isn't installed), it never fails — it degrades to local-only: favorites are written to ~/.bewith/favorites.json and everything keeps working, just on this machine. The first time that happens you get a one-time notice (re-armed if syncing later succeeds) so you know they won't sync, with the exact fix (gh auth refresh -s gist).

All logic lives in the deterministic script scripts/session-favorites.mjs (code-before-model); this skill only invokes it. Each favorite stores { session_id, label, cwd, branch, surface, pinned_at } — no secrets, just enough to resume.

Actions (the four commands wrap these)

CommandScript actionWhat it does
/favorite [label]pin [label]pin the CURRENT session (optional label)
/unfavorite [id|label]unpin [id|label]remove a favorite (default: current session)
/favoriteslistlist all favorites + a ready resume command for each
/open-favorite <id|label>open <id|label>reopen one favorite

Run from the repo root:

node scripts/session-favorites.mjs pin "design-system refactor"
node scripts/session-favorites.mjs list
node scripts/session-favorites.mjs open "design-system refactor"
node scripts/session-favorites.mjs unpin "design-system refactor"

Reopening — what "open" actually does

We cannot drive the VS Code extension's UI, so "open" resumes the underlying CLI session deterministically:

  • macOS: open launches a new Terminal window running cd '<cwd>' && claude --resume <id> — a fresh attached session.
  • Anywhere: the resume command is printed for you to paste (also shown by /favorites).

session_id is the same id claude --resume uses (captured live from $CLAUDE_CODE_SESSION_ID), and the resume always runs in the favorite's original cwd.

Surfaced in /sessions too

sessions-view reads the same local cache and shows a ⭐ Favorites section in the HTML dashboard and the SwiftBar menu (where clicking a favorite re-attaches it in a terminal). The /sessions chat view also runs node scripts/session-favorites.mjs list to show them.

Notes

  • gh (GitHub CLI) authenticated enables cross-machine sync; without it you still get local favorites (see the fallback above).
  • Re-pinning the current session updates its label in place (no duplicates).
  • A secret gist is reachable by URL — favorites hold only session id + path + label, never credentials.