claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] Terminal Title Configuration (Script-Based, like statusLine)

Open chadfurman opened this issue 10 months ago • 1 comments

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Claude Code sets terminal titles based on the current task or just "Claude Code" - but there's no way to include:

  • Directory - which folder you're working in
  • Repository - which repo this session belongs to
  • Branch - often contains ticket numbers (e.g., ACME-1234-fix-auth)
  • PR number - when reviewing or working on a pull request
  • Original terminal name - what you had before Claude Code took over
  • Custom information - client codes, project phases, billing identifiers

This breaks automatic time tracking. Tools like RescueTime, Timing, Toggl, and ActivityWatch categorize work by window title. When every Claude Code tab just shows "Claude Code" or a task snippet, there's no way to distinguish which client or project you're working in.

For freelancers and consultants billing multiple clients, this means:

  • Manual time entry instead of automatic tracking
  • Inaccurate billing when you forget to log project switches
  • No audit trail for disputed invoices

Community tools don't solve this. Existing solutions (bluzername/claude-code-terminal-title, arorajatin/claude-code-terminal-title) auto-generate titles with fixed formats - no user control over what context appears.

Proposed Solution

Add terminalTitle to settings.json, working exactly like the existing statusLine:

{
  "terminalTitle": {
    "type": "command",
    "command": "~/.claude/terminal-title.sh"
  }
}

Claude Code passes JSON context to the script (same pattern as statusLine), script outputs the desired title:

#!/bin/bash
input=$(cat)
DIR=$(echo "$input" | jq -r '.workspace.current_dir')
PARENT=$(basename "$(dirname "$DIR")")
PROJECT=$(basename "$DIR")
BRANCH=$(git -C "$DIR" branch --show-current 2>/dev/null)

echo "${PARENT}/${PROJECT} [${BRANCH}]"
# → "acme/api [ACME-1234-auth-fix]"

Context Object - The JSON passed to the script could include:

{
  "workspace": {
    "current_dir": "/Users/dev/clients/acme/api",
    "git_branch": "ACME-1234-auth-fix",
    "git_root": "/Users/dev/clients/acme"
  },
  "model": {
    "name": "claude-opus-4-5-20251101",
    "display_name": "Opus 4.5"
  },
  "session": {
    "id": "a1b2c3",
    "task": "Fixing authentication bug",
    "original_terminal_title": "dev-server"
  }
}

Why Script-Based (Not Templates):

  1. Consistency - mirrors statusLine exactly, no new syntax to learn
  2. Flexibility - parse branch names, read project config files, call APIs, include PR numbers
  3. Power users - the people who care about this are comfortable with scripts
  4. Simpler to implement - reuse the existing statusLine infrastructure

Bonus: A /title slash command for ad-hoc overrides would be nice:

/title "🔍 [ACME] Debugging auth - 2hr estimate"

Alternative Solutions

Attempted workarounds:

  1. CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 - Documented but non-functional (#4765, open since July 2025)

  2. Community tools - bluzername/claude-code-terminal-title and arorajatin/claude-code-terminal-title auto-generate titles but offer no template/script-based customization

  3. Terminal escape sequences - Don't work due to subprocess architecture (no TTY passthrough)

Related issues this would consolidate:

  • #4765 - CLAUDE_CODE_DISABLE_TERMINAL_TITLE broken (open since July 2025)
  • #7229 - Terminal window title settings (open)
  • #15802 - Set terminal title from session (closed as duplicate)
  • #16572, #3396, #15082, #15084 - Various related issues

Priority

High - Significant impact on productivity

Feature Category

Configuration and settings

Use Case Example

Freelancer with multiple clients:

  1. I'm a freelancer working on projects for 3 clients: Acme Corp, Globex, and Initech
  2. I use Timing.app for automatic time tracking - it categorizes work by window title
  3. Currently, all my Claude Code sessions show as "Claude Code" or task snippets
  4. At end of week, I can't tell how many hours went to each client
  5. I manually reconstruct time from memory, often inaccurately

With this feature:

  1. I create ~/.claude/terminal-title.sh:
#!/bin/bash
input=$(cat)
DIR=$(echo "$input" | jq -r '.workspace.current_dir')
CLIENT=$(basename "$(dirname "$DIR")")
PROJECT=$(basename "$DIR")
echo "[$CLIENT] $PROJECT"
  1. My terminal titles now show: [acme] api, [globex] frontend, [initech] backend
  2. Timing.app automatically categorizes hours per client
  3. Invoicing is accurate, auditable, and takes 5 minutes instead of an hour

Additional Context

Technical note: This mirrors the existing statusLine configuration pattern exactly - same JSON context object, same script-based approach. Implementation could likely reuse much of that infrastructure.

Why this matters for Anthropic: Professional/freelancer adoption depends on workflow integration. Time tracking is table stakes for anyone billing hourly. This is low-effort (pattern exists), high-impact for market expansion.

chadfurman avatar Jan 13 '26 14:01 chadfurman

+1 for this feature - hitting this pain point daily with Warp terminal.

The problem in action: Here's my Window menu showing two different Quarkus-based project folders, both running Claude Code. Completely indistinguishable 😅 :

Image

I have to click through each window to find the right one.

Suggestion to enhance your proposal: Pass Claude Code's generated title to the script as a variable (e.g., "claude_title" in the JSON context). This enables a hybrid approach instead of forcing users to choose between 100% custom or 100% CC-generated:

echo "[MyProject] ${CLAUDE_TITLE} [Client-ABC]"

Users could then:

  • Prefix: "PROJ-123 | $CLAUDE_TITLE"
  • Suffix: "$CLAUDE_TITLE | Client: Acme"
  • Wrap & shorten: "[MyPrefix] (${CLAUDE_TITLE:0:10}) [Suffix]"

Interim solutions that would help:

  • Simple prefix/suffix settings (e.g., "terminalTitlePrefix": "[MyProject]")

Workaround I'm using: I manually set the tab's title every single time (despite if I could, I would use just the current folder name etc.).

batmat avatar Jan 16 '26 11:01 batmat

+1 I would be happy if just the new configurable "session name" was the title of the terminal.
Related: https://github.com/anthropics/claude-code/issues/3161

flxmrk avatar Jan 16 '26 15:01 flxmrk

+1 for Warp terminal tab title support.

Specifically, it would be helpful if Claude Code could set the Warp tab title - even just propagating the session name from /rename would be a significant improvement. Currently when working across multiple projects, all tabs look identical which makes context-switching painful.

The script-based approach proposed here would be ideal for customization, but even a simple "emit the session name to terminal title" would solve the immediate pain point.

rpedroni avatar Jan 26 '26 15:01 rpedroni

This is one of the things that slows me down a lot.

homoky avatar Jan 30 '26 10:01 homoky

We could also add "placeholders" to the terminal title where Claude can substitute things in, as well.

chadfurman avatar Feb 10 '26 16:02 chadfurman

+1 to at least add the current working directory that claude was launched from. i have multiple running in different panes on different projects and you can't tell them apart

MarkZuber avatar Feb 19 '26 17:02 MarkZuber

+1 for me I would like to set a static name for the session e.g. "mow the lawn" and retain the animated status indicator.

KyleCartmell avatar Feb 20 '26 15:02 KyleCartmell

+1 when working across multiple terminals, I need to cycle through each terminals to reach the one of internest.

biplav-crl avatar Feb 26 '26 05:02 biplav-crl

We built this to solve the tab/title/organization challenge: https://github.com/flexmark-intl/aiterm/ - personally, I feel WAY MORE productive using it than I ever was running so many different osx terminal windows each with tabs in them. Its a new project, but we use it internally every day!

flxmrk avatar Feb 27 '26 04:02 flxmrk

The new /rename feature fixed this for me

chad-fossa avatar Feb 27 '26 19:02 chad-fossa

I can confirm that.

homoky avatar Feb 27 '26 19:02 homoky

+1 — I use a tab color system in my dotfiles where each project gets a color palette (set via TABCOLOR_PRESET in .envrc + direnv). Work tabs get a bright color + emoji title (🐳 Docker), and Claude tabs inherit the same palette darkened 75% via a SessionStart hook.

The color pairing works great — I can instantly see which Claude tab belongs to which project. But Claude overwrites the tab title with its own status (* Claude Code (gopls)), so the 🤖 Docker title I set in the hook gets lost immediately.

A terminalTitle config (script-based, like statusLine) would let me keep the project context visible. Something like:

{ "terminalTitle": { "type": "command", "command": "bash ~/.claude/session-tab-title.sh" } }

paul-matthews avatar Mar 02 '26 10:03 paul-matthews

The new /rename feature fixed this for me

This is helpful for windows users with the limitations that Linux/Mac doesn't have.

If I could just call /rename automatically through a hook... It would be a great addition removing manual work.

rasmusloje avatar Mar 03 '26 12:03 rasmusloje

It seems like Claude knows how to automatically rename terminal titles based on context when starting executing plans from plan mode. That's at least my experience, consistently.

So the functionality seems to be there.

rasmusloje avatar Mar 03 '26 13:03 rasmusloje

We just decided to build our own terminal - gives you best of both worlds, your own title + term title - not to mention a swarm of other productivity features when you are working with lots of tabs and agents across projects.

TIP: Name your tab like this: YourFeature %title

And you get claude's title whenever he decides to set it AND a consistent reminder of what you are doing in that tab that never changes.

https://flexmark-intl.github.io/aiterm/

flxmrk avatar Mar 03 '26 14:03 flxmrk

I ran into this same issue, running several Claude sessions at once in iTerm. I found myself losing track of which pane was doing what. Now that Claude Code added more hook events recently, I was able to put together claude-code-pulse (ccp). It wraps the CLI and keeps titles updated in realtime.

For myself, I wanted: branch, PR number, and a live status (like when an agent is idle, or when user input was required). It's 'ccp' instead of 'claude' at launch, so not the native solution this issue is asking for, but it has worked for me.

I even added an ai title option to generate a couple word summary of the most recent prompt, to make it even easier to remember what's going on at a glance.

brianruggieri avatar Mar 05 '26 01:03 brianruggieri

Yes please. /rename doesn't work because it's manual and resets whenever you clear the conversation to start a new session. then you have to manually rename. We all have different workflows so a programatic way (like /statusline) where we can choose how the title gets set/updates via hooks would be incredible. Thanks :)

danielsht86 avatar Mar 10 '26 22:03 danielsht86

for me /rename doesn't set the tab title in PowerShell 7 running in Windows Terminal.

it's also not programmatically call able from hook scripts as far as I know

BenNewman100 avatar Mar 12 '26 03:03 BenNewman100

After using /rename a bit and encountering the challenges others have laid out on this issue like it clearing between sessions and it not being a template or scriptable, I too.am finding that while /rename improved the situation around terminal titles and Claude code, there's still a need for a "status line" style of support


Chad Furman, Lead SWE 518-227-0716 (c) @.***

On Wed, Mar 11, 2026, 23:13 Ben Newman @.***> wrote:

BenNewman100 left a comment (anthropics/claude-code#17951) https://github.com/anthropics/claude-code/issues/17951#issuecomment-4043612714

for me /rename doesn't set the tab title in PowerShell 7 running in Windows Terminal.

it's also not programmatically call able from hook scripts as far as I know

— Reply to this email directly, view it on GitHub https://github.com/anthropics/claude-code/issues/17951#issuecomment-4043612714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE3CISFAAPWTGAAPNIQTIT4QITONAVCNFSM6AAAAACRRVCH76VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DANBTGYYTENZRGQ . You are receiving this because you authored the thread.Message ID: @.***>

chadfurman avatar Mar 12 '26 17:03 chadfurman

I absolutly agree.

BenNewman100 avatar Mar 12 '26 19:03 BenNewman100