Skip to content

fix: name Claude tabs from the session title in its transcript - #485

Closed
vanvasten wants to merge 2 commits into
mainfrom
fix/claude-session-tab-titles
Closed

vanvasten wants to merge 2 commits into
mainfrom
fix/claude-session-tab-titles

Conversation

@vanvasten

Copy link
Copy Markdown
Contributor

What this does

Claude tabs now show the conversation's topic instead of the folder path. Claude saves every session's title (your /rename, or the one it generates) in its transcript, but it often never sends it to the terminal, especially after --resume. Programa now reads that title from the transcript when Claude starts a session, takes a prompt, or finishes a turn.

Summary

  • Sources/ClaudeTranscriptTitle.swift: reads the last 512 KB of the transcript and returns the newest custom-title, else the newest ai-title. Compiled into the app and the CLI so it can be unit tested.
  • CLI/CLI+AgentSessionTitle.swift + 3 call lines in CLI/CLI+Hooks.swift: Claude's session-start, prompt-submit and stop hooks send the title. Best effort, never fails the hook. Sent every time because the app forgets live titles on restart.
  • New socket method surface.report_agent_title (contract-first, off-main like the other report_* telemetry, length-capped).
  • Workspace.applyAgentTitle: sets the panel's live title, then reuses the restored-title hold from fix: keep restored tab titles until the terminal sends a real one #475 so the shell's cwd, the resume command line and the plain "Claude Code" title don't replace it. Any other real terminal title still does, and a manual rename still wins.

Review order: Workspace+SidebarTelemetry.swift, then ClaudeTranscriptTitle.swift, then the CLI glue; the rest is contract and wiring.

Known tradeoff: after Claude exits, the tab keeps the topic until something other than a cwd title arrives, same as a restored title.

Test Plan

  • CI unit tests pass: ClaudeTranscriptTitleTests (7 tests) and two new WorkspaceUnitTests cases
  • The first commit has the tests only and should not build or pass on its own
  • In a tagged build with the Claude integration installed, start or resume a Claude session that has a topic: the tab shows the topic after the first prompt
  • /rename in Claude updates the tab on the next prompt
  • Renaming the tab by hand still wins

@vanvasten

Copy link
Copy Markdown
Contributor Author

Not needed: Claude already sets the tab title on /rename and on resume, and #475 keeps it across restarts. Stuck tabs fix themselves after one /rename or resume.

@vanvasten vanvasten closed this Oct 23, 2026
@vanvasten
vanvasten deleted the fix/claude-session-tab-titles branch October 23, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant