claude-session-tui

command module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 35 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

cst

A TUI picker for your Claude Code sessions.

CI Release Go Reference Go 1.26

 ✻ Claude Sessions                                    3 sessions · sort:recency

╭───────────────────────────────╮───────────────────────────────────────────╮
│  ❯ Fix auth middleware  18 2h │  ✻ Fix auth middleware                    │
│    Add rate limiting    7 yest│  ────────────────────────────────────     │
│                               │                                           │
│  ~/Desktop/misc/tui           │  path   ~/work/api-service                │
│    Picker design       31 5m  │  18 msgs · 2h ago · main · opus-4-8       │
│                               │                                           │
│                               │  ✎ first                                  │
│                               │  auth expiry uses < not <=                │
│                               │                                           │
│                               │  ✦ last                                   │
│                               │  fixed, all tests pass                    │
╰───────────────────────────────╯───────────────────────────────────────────╯

 ↵ resume · / filter · space mark · d delete · . scope · q quit
                                       made with ♥ by ThirdEyeSqueegee and Claude

Features

  • 🗂️ Grouped your way — every session under ~/.claude/projects, bucketed by project, date, or branch
  • 🔍 Fuzzy filter — match across title, path, and first message (space = AND)
  • 👀 Live detail pane — first/last message, branch, model, message count, transcript size, token usage + est. cost
  • 🔄 Live reload — the list follows ~/.claude/projects as sessions come and go (fsnotify, off by default)
  • ⚡ Instant resume — chdirs into the project and relaunches Claude where you left off
  • 🎯 Project scope — one key to show only the current repo's sessions
  • 🧹 Safe bulk delete — multi-select, UUID-validated, path-confined to ~/.claude
  • 🎨 Warm theme + kitty tab coloring — fully configurable via TOML
  • 🚀 Fast cold start — transcripts parsed in parallel, off the UI thread

Install

mise
mise use -g github:ThirdEyeSqueegee/claude-session-tui
Prebuilt binary

Grab the archive for your platform from the latest release, verify it against *_checksums.txt, and drop cst on your PATH.

From source
go install github.com/ThirdEyeSqueegee/claude-session-tui@latest

Or clone and use the Makefile (builds a version-stamped binary into ~/.local/bin):

git clone https://github.com/ThirdEyeSqueegee/claude-session-tui
cd claude-session-tui
make install

Requirements: Go 1.26+ to build. Runs on macOS and Linux.

Usage

Just run it:

cst

Pick a session with ↵ and cst chdirs into that session's project directory, then launches the resume command (default: a plain claude --resume <id>), waits for it, and restores your terminal afterward.

Keybindings
Key Action
↵ Resume the selected session
j / k, ↑ / ↓ Move (skips group headers)
ctrl-d / ctrl-u Half-page jump
g / G Jump to top / bottom
/ Fuzzy filter (title + path + first message)
space Mark / unmark a row for bulk delete
A Clear all marks
. Toggle scope to the launch repo only
s Cycle sort: recency → project → msgs → size
S Cycle grouping: project → date → branch
y / Y Copy session id / project path (OSC-52)
p Preview the full transcript (/ to search, n/N to step)
d Delete (marked rows, or the cursor row)
q / esc Quit
Flags
Flag Behavior
-p, --print Print the chosen session id and exit
-o, --output <file> Write the chosen id to <file> and exit
-c, --config <path> Use a specific config file
-C, --print-config Print the resolved effective config and exit
-v, --version Print the build version
-h, --help Show help
Commands
Command Behavior
prune (or p) Sweep orphaned session state, asking before removing

--print / --output let a wrapper own the launch instead of cst. With either flag the picker draws on stderr, so id=$(cst --print) captures just the id. Exit code 130 means you quit without choosing.

Configuration

cst reads an optional TOML file, resolved in this order:

  1. --config <path>
  2. $CST_CONFIG
  3. $XDG_CONFIG_HOME/cst/config.toml
  4. ~/.config/cst/config.toml

Every key is optional — a missing file means all defaults. A bad value (malformed hex, an unknown sort) keeps the default and shows a config ⚠ note in the title bar; run cst --print-config to dump the resolved config. The full annotated schema lives in config.example.toml.

[resume]
command = "claude"   # the binary to launch
args = []            # extra flags, e.g. ["--dangerously-skip-permissions"]

[tab_color]
enabled = true
per_project = true   # distinct kitty tab hue per repo

[ui]
sort = "recency"      # "recency" | "project" | "msgs" | "size"
group = "project"     # "project" | "date" | "branch"
default_scope = "all" # "all" | "cwd"
git_status = true     # flag sessions whose project dir / branch is gone
watch = false         # live-reload the list when ~/.claude/projects changes
Project scope

Press . to toggle a view of just the sessions whose project directory matches the directory cst was launched from — the inline equivalent of a per-repo resume picker. Both paths are symlink-resolved, so jj worktrees and symlinked checkouts still match. Start scoped with default_scope = "cwd".

Bulk delete

space marks rows (shown with a ✓ in the gutter); d then deletes all marked sessions behind a single delete N chats forever? confirm, or just the cursor row when nothing is marked.

Deleting removes the transcript plus its satellite state: session-env, file-history, subagent project dirs, the short-id-keyed tasks/session-<id>, jobs/<id>, and teams/session-<id> dirs, the sessions/<pid>.json metadata file (matched on its inner sessionId, not its pid filename), and paste-cache / tasks / todos entries keyed by the session id. When the transcript was the last one in its project directory, that now-empty projects/<encoded-cwd> directory is removed too. The session's prompt lines are also stripped from the shared history.jsonl (atomic temp-file + rename, so a crash can't truncate it). Every id is validated as a UUID and every removed path is confirmed to live strictly under ~/.claude before deletion, so a malformed id can never escape that tree. A row is dropped from the list only when its own on-disk state actually goes; failures stay marked and are reported in the help bar. A bulk delete rewrites the shared history.jsonl once for the whole set rather than once per session, so marking dozens of rows doesn't stall the UI.

Prune orphans

Crashes, manual deletes, and moved transcripts can leave session state behind with no transcript backing it. cst prune sweeps for it — the inverse of a normal delete: it walks session-env, file-history, subagent dirs, tasks/session-<id>, jobs/<id>, teams/session-<id>, sessions/*.json, and transcript-less projects/<encoded-cwd> husks, and flags everything whose id isn't in the live transcript set — plus orphaned prompt lines in the shared history.jsonl.

cst prune   # list orphans, then ask y / N before removing
cst p       # same, short alias

It lists everything it found first, then asks for confirmation; a bare enter or n removes nothing, and the sweep acts on exactly the set it showed you rather than re-scanning after the prompt. Every removal goes through the same ~/.claude-confined path check as a normal delete.

kitty tab coloring

Inside kitty, cst tints the terminal tab while a session runs and restores it on exit (via kitten @ set-tab-color). That's why cst waits on the child rather than replacing itself with it. Set per_project = true under [tab_color] to derive a stable, distinct hue per repo so a wall of concurrent tabs is scannable at a glance. Outside kitty — or if remote control is off — it silently no-ops.

How it works

Each session is parsed straight from its .jsonl transcript:

  • Title — custom title, else AI-generated title, else the first user message
  • Project path — the session's cwd, home-collapsed
  • Message count — real user messages only (sidechain, meta, and tool results excluded)
  • Cost — includes subagent and workflow transcripts, and prices 1-hour cache writes at 2× (5-minute at 1.25×). An estimate, not a bill: it is derived from the transcript's own token counts.
  • Detail — branch, model, first message, last assistant reply

Sessions load asynchronously behind a spinner, so a heavy ~/.claude/projects never stalls startup. Unreadable or truncated transcripts surface as an advisory count in the title bar instead of silently vanishing. On a terminal too narrow for two panes, the layout collapses to a single full-width list.

Built with Bubble Tea, Bubbles, and Lip Gloss.

Development

make build   # version-stamped binary
make test    # go test ./...
make race    # go test -race ./...
make vet     # go vet ./...
make fmt     # gofmt -w .

CI runs on every push and PR: a go test -race matrix on macOS + Linux, golangci-lint, govulncheck, actionlint, and a gofmt gate — each under harden-runner with a least-privilege token. Actions are pinned to major versions and bumped by Dependabot.

Releasing

Releases are cut by GoReleaser on a pushed semver tag, producing cross-compiled darwin/linux × amd64/arm64 archives plus a checksums file:

git tag -a v0.1.0 -m v0.1.0
git push origin v0.1.0

Contributing

Issues and PRs welcome. Before opening a PR, please run make fmt, make vet, and make race — CI enforces all three.

License

MIT © ThirdEyeSqueegee

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址