[FEATURE] Include conversation title in statusline JSON
Problem Statement
Custom statuslines can show useful context like model, cost, cwd, and git branch - but there's no way to display which conversation/session the user is in. When working on multiple tasks or switching between terminals, users can't quickly identify their session without running claude --resume to see the list.
The conversation title is already computed and displayed in --resume output, so the data exists - it's just not exposed to the statusline.
Proposed Solution
Add a session.title field to the statusline JSON payload:
{
"session_id": "abc123",
"session": {
"title": "Optimize Claude Code settings for faster team workflow"
},
...existing fields...
}
This would allow statusline scripts to display the title at the end where it can naturally overflow:
Opus 4.5 | ~/project (main) | ctx: 45% | Optimize Claude Code settings for faster team workflow
Alternative Solutions
- Parse transcript_path: The
transcript_pathfield points to the session file, which could be parsed for metadata. However, this adds latency to every statusline render and is fragile if the file format changes. - Use session_id: Could display the raw ID, but it's not human-readable.
Priority
Medium - Would be very helpful
Feature Category
Configuration and settings
Use Case Example
- Developer is working on multiple features across different terminals
- Each terminal has a Claude Code session open
- They switch to a terminal and see their custom statusline showing:
Opus 4.5 | ~/myapp (main) | ctx: 32% | Add authentication to API endpoints
- They immediately know which task this session is for without running any commands
- This prevents accidentally continuing work in the wrong session
Example statusline.sh
#!/bin/bash
input=$(cat)
MODEL=$(echo "$input" | jq -r '.model.display_name')
TITLE=$(echo "$input" | jq -r '.session.title // empty')
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)
CWD=$(echo "$input" | jq -r '.workspace.current_dir')
# Get git branch if in a repo
BRANCH=""
if git -C "$CWD" rev-parse --git-dir > /dev/null 2>&1; then
BRANCH=$(git -C "$CWD" branch --show-current 2>/dev/null)
[ -n "$BRANCH" ] && BRANCH=" ($BRANCH)"
fi
# Shorten path: replace home with ~, show last 2 dirs
SHORT_CWD=$(echo "$CWD" | sed "s|^$HOME|~|" | awk -F/ '{if(NF>2) print "…/"$(NF-1)"/"$NF; else print $0}')
# Title at end so it can overflow
if [ -n "$TITLE" ]; then
echo "${MODEL} | ${SHORT_CWD}${BRANCH} | ctx: ${PCT}% | ${TITLE}"
else
echo "${MODEL} | ${SHORT_CWD}${BRANCH} | ctx: ${PCT}%"
fiThis issue has 2 comments on GitHub. Read the full discussion on GitHub ↗