Austin's Portfolio

Dispatch № 10 · claude-sessions

claude-sessions

Search, rename, and delete Claude Code sessions

GitHub

A /resume-style session picker for Claude Code, built on fish and fzf, that adds what the built-in picker lacks: deleting sessions and searching inside their contents.

By the numbers

The problem

Claude Code stores every session as a JSONL transcript under ~/.claude, but its /resume picker can't delete one or search what was said in it. Old sessions pile up, and finding the one where you solved something means remembering its title.

How it works

A Python backend parses each transcript into a row showing last use, message count, size on disk, and git branch, naming sessions with the same precedence /resume uses. A small fish function feeds those rows to fzf, with keybindings to resume, rename, copy the session ID, switch between the current directory and all projects, and toggle between matching names and searching message contents.

Safe deletes and fast reloads

Deleting moves the transcript and its tool results, file history, and session env to the Trash, so it can be undone, and sessions still running are locked. Parsed metadata is cached and only transcripts that changed since the last run are reread. Content search uses ripgrep to narrow candidates when it's installed.

Testing an internal format

The naming rules and transcript layout are Claude Code internals, not a public API. 38 pytest tests build fake transcripts in a temp directory and pin the current behavior, so a format change in a future release shows up as a failing test. CI runs ruff and the suite on macOS and Ubuntu across Python 3.10 and 3.13.

All projects Résumé