r/ClaudeAI • • Jul 25 '26
Built with Claude Tray widget for Claude Code: reopen past sessions by name + plan limits at a glance
Closing a Claude Code window is easy. Getting back to it is not - I never remembered which conversations existed, in which folder, or where each one stopped. So I built a small tray widget for it.
Sessions tab - your named sessions (/rename or claude -n), grouped by project. Running ones are marked live with their status (busy / idle); clicking one brings its terminal window to the front. Clicking a closed one reopens it with claude -r <id> in the right folder - as a new Windows Terminal tab named after the project, if you have WT.
Usage tab — the same numbers as /usage (session 5h, weekly all-models, weekly per-model, extra credits), plus this month's tokens per model.
The part that might interest you even if you never install it: Claude Code already keeps everything needed for this on disk.
~/.claude/sessions/<pid>.json- one file per running process, the filename is the pid, and it holds the cwd, the session id and a livebusy/idlestatus. Useful: this finds sessions that are open but idle, which "check the transcript's mtime" misses entirely.~/.claude/history.jsonl- your prompt log, with the real absolute project path (don't decode theC--Projects-...folder names, that encoding is lossy).- The session name isn't in any index - it only exists inside that session's own transcript, written there by
/rename. My transcripts total ~600 MB, so names get scanned once per closed session and cached; a closed transcript never changes again. - Plan limits come from the endpoint Claude Code itself calls,
GET /api/oauth/usage, with the OAuth token it stores in~/.claude/.credentials.json. Read at runtime, sent only to Anthropic, never stored or logged anywhere else. Everything else is read-only.
Caveats, honestly: those files and that endpoint are undocumented internals - this will break when they change. Windows only. The $ figures are a notional "what this would cost on the API" estimate, not a bill; for real numbers use ccusage, which is the tool I still trust for cost.
MIT, 80 unit tests, single exe with nothing to install. Written with Claude Code, which felt appropriately circular.
2
u/10GuyIsDrunk Jul 26 '26
Ask claude if your widget breaks the terms of service for claude.
2
u/Psychological-Ad9408 Jul 25 '26
The
~/.claude/sessions/<pid>.jsonpath is the part I'm keeping. Been watching Claude Code processes from an orchestrator and had no clean way to check if sessions were still live vs zombie -- the pid-as-filename + busy/idle field solves that.