Claude, What's Your Real Name?

By Rareș Gosman

Why /list-agents can show a Claude Code session's name when ccstatusline can't, and how to put it in your status line.

AI AgentsCLI

I often have more than 20 Claude Code sessions open, and they message each other. An orchestrator hands out tasks and collects the results. One session writes a draft and sends it to another for proofreading. Others split up the technical work: one has MCP servers or skills loaded that the rest don't, and another does nothing but run browser tests. Each message is addressed to the name that /list-agents prints, like yellowtail-f5 [8d651c].

A session doesn't show its own name, though. I kept running /list-agents just to find out which name belonged to the session I wanted to message, so I put the name in the status line:

A three-line Claude Code status line. Line one: model, thinking effort, and git branch. Line two: session cost and a context usage bar. Line three: the session name and ref, yellowtail-f5 [8d651c], then a blurred session ID.

The third line is the session's address. Other sessions message it by that name.

The first line shows the model, reasoning effort, git branch, and uncommitted line changes. When the branch has an open PR, the branch name links to it. The second line shows cost and context usage. It runs on ccstatusline, and a gist installs the whole setup.

Claude Code doesn't give the status line the name

ccstatusline has a session-name widget, but it came up blank. The widget reads custom-title records from the session transcript, and Claude Code only writes those when you name a session with /rename or --name.

The JSON that Claude Code sends to status line commands doesn't have the name either. Its session_name field holds a custom name or the AI-generated session title, and the docs say the default display name, such as my-app-3f, never fills it.

Resuming a session gives it a new display name but keeps its session ID, so the name seemed to belong to the running process, not the conversation. Searching ~/.claude for yellowtail-f5 found ~/.claude/sessions/80398.json, where 80398 is the Claude Code process ID. Trimmed to the two fields that matter:

{
  "name": "yellowtail-f5",
  "messagingSocketPath": "/tmp/cc-socks/80398.sock"
}

The name was there. The ref, 8d651c, wasn't.

Where the ref comes from

Hashing the session ID, the PID, and the socket path with sha256, sha1, and md5 gave nothing that matched 8d651c. So I had Claude Code search its own binary.

Claude Code ships as a single compiled executable. The strings command pulls the readable text out of a binary, which here includes the bundled JavaScript. Searching that text for a phrase from the /list-agents output, "the name other sessions use to message it," led to the code that builds the label:

token:`${i} [${kZe("session",A2o(t))}]`

The names are minified, but the shape is readable. The ref is the first six characters of a hash. The input is session: followed by the session's messaging socket path. The earlier guesses had left off that prefix.

The hash function was imported from elsewhere in the bundle. Instead of tracing it, we tried algorithms on the prefixed string until one matched:

printf 'session:/tmp/cc-socks/80398.sock' | shasum -a 256 | cut -c1-6
# 8d651c

The status line script finds its own Claude Code process by walking up parent process IDs until one has a file in ~/.claude/sessions/. Then it reads the name and socket path from that file and prints name [ref].

Where it breaks

All of this depends on undocumented internals, so a Claude Code update can break it. I've run it on Claude Code 2.1.306 with ccstatusline 2.2.32. The documented claude agents --json lists each session's name but not the socket path, so it can't produce the ref.

  • A feature flag called tengu_session_stable_address changes the address from the socket path to sid: plus the session ID. It was off in my sessions, and the script doesn't handle it.
  • /list-agents lengthens a ref when two sessions share the first six characters. The script always prints six.
  • Resuming a session starts a new process, so the name and ref change.
  • The scripts target macOS and Linux, but I've only run them on macOS.

Install it

The gist has the ccstatusline config, both helper scripts, a README, and install.sh. You need bash, jq, git, and shasum or sha256sum, plus npm if ccstatusline isn't installed yet. The installer copies the files into ~/.claude/ and points statusLine in ~/.claude/settings.json at its own ccstatusline config, so an existing ccstatusline layout stays untouched. It backs up any file it changes and is safe to run twice.

Install from a shell

dir=$(mktemp -d) && git clone https://gist.github.com/rarestg/3592a553adde3ee97e95df59ee3e35c2.git "$dir" && bash "$dir/install.sh"

Or hand the install to Claude Code:

Install with Claude Code

Paste into a Claude Code session.

Install the Claude Code status line from https://gist.github.com/rarestg/3592a553adde3ee97e95df59ee3e35c2. Clone it into a temporary directory, read install.sh and both helper scripts, and tell me what they will change in ~/.claude. Run install.sh once I say go.

The next status line refresh puts the session's name on the third line. That's the name to give the other sessions.