claude-code - 💡(How to fix) Fix [FEATURE] Surface short session IDs — shell `claude agents list` + show IDs in agent view

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fix / Workaround

Workaround today

jq -r '.workers | to_entries[] | "\(.key)\t\(.value.cwd)\t\(.value.dispatch.seed.intent // "")"' ~/.claude/daemon/roster.json

Code Example

jq -r '.workers | to_entries[] | "\(.key)\t\(.value.cwd)\t\(.value.dispatch.seed.intent // "")"' ~/.claude/daemon/roster.json
RAW_BUFFERClick to expand / collapse

The shell commands documented at Manage sessions from the shellclaude attach <id>, claude logs <id>, claude stop <id>, claude respawn <id>, claude rm <id> — all take a short ID, but the ID is hard to obtain:

  1. No shell-side list command. claude agents only opens the TUI. claude agents --help (v2.1.139) shows no list/ls subcommand. The only path today is parsing ~/.claude/daemon/roster.json and ~/.claude/jobs/<id>/state.json by hand.
  2. TUI rows don't show the short ID. Each row shows name + activity + age, but not the 8-char hash you'd type into claude attach. So even after spotting the right session visually, you have to background, jq the roster, or peek at the worktree path to find its ID.

Proposal

  • Shell: claude agents list (alias ls) — one row per session: short id, state, agent, cwd, age, one-line summary. --json for scripting. Filters mirroring the TUI grammar would be a bonus (--state working|blocked|done|stopped|failed, --agent <name>).
  • TUI: show the short ID on each row (or as a togglable column / dimmed prefix). A keybinding to copy the selected session's ID to the clipboard would be the cherry.

Use cases

  • Scripting cleanup of stopped sessions.
  • Attaching to a session by ID from a second terminal without first backgrounding the current one to open agent view.
  • Finding a session by its prompt/cwd before attach.
  • Dashboards/automation over many sessions across repos.

Workaround today

jq -r '.workers | to_entries[] | "\(.key)\t\(.value.cwd)\t\(.value.dispatch.seed.intent // "")"' ~/.claude/daemon/roster.json

Works for running sessions; stopped ones need a glob over ~/.claude/jobs/*/state.json. Both depend on undocumented on-disk layout.

Environment

  • Claude Code v2.1.139
  • Linux (devcontainer)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING