feat: auto-name tabs from Claude Code conversation content

Closed
HO
8mo ago
+281-22

Summary

  • Auto-generates tab titles from Claude Code conversation content using keyword frequency extraction
  • Runs in the existing claude-hook stop handler with zero additional latency (transcript is already being read)
  • Supports multilingual conversations (CJK + Latin tokenization)
  • Respects user /rename — if a custom title exists in the transcript, auto-naming is skipped

Motivation

Currently, cmux tabs running Claude Code sessions show generic names (e.g., the shell command or directory). When working with multiple Claude Code sessions across tabs, it's hard to distinguish which tab is doing what without manually /rename-ing each one.

This change automatically extracts meaningful keywords from user messages in the Claude Code transcript and uses them as the tab title. For example, a conversation about "debugging cmux hooks" would auto-name the tab something like "cmux hooks debugging".

How it works

  1. readTranscriptSummary now also extracts the first 3 and last 3 user messages (in addition to the existing lastAssistantMessage)
  2. generateTabTitle uses regex-based tokenization to extract CJK runs and Latin words, filters stop words (English + Chinese), and picks the top keywords by frequency
  3. The title is capped at 25 characters and 2-5 words
  4. If the user has /renamed the session (detected via custom-title entries in the transcript JSONL), auto-naming is completely skipped

Design decisions

DecisionRationale
Keyword extraction vs AI summaryZero latency, no external API dependency, runs in the synchronous hook path
Stop words in EN + ZHMost cmux users are English or Chinese speakers based on repo demographics
First 3 + last 3 user messagesCaptures both the initial topic and recent focus shifts
25 char / 5 word limitFits comfortably in the cmux sidebar tab width
Skip on custom-titleUser intent should always take precedence over auto-generated names

Test plan

  • Verify tab auto-names after first Claude Code response in a cmux terminal
  • Verify /rename custom title is preserved (auto-naming skipped)
  • Verify CJK conversation generates CJK tab title
  • Verify English conversation generates English tab title
  • Verify existing notification behavior is unchanged

Summary by cubic

Automatically names Claude Code tabs from recent conversation keywords so you can tell sessions apart. Also stabilizes UI test launch and fixes portal geometry after window restore.

  • New Features

    • Generates short tab titles from the first/last user messages using keyword frequency.
    • Runs in the existing claude-hook stop handler with no added latency; supports CJK and Latin.
    • Skips auto-naming if a /rename custom title is found in the transcript.
  • Bug Fixes

    • Resyncs terminal portal geometry after restore-time bind so queued layout shifts (sidebar/splits) don’t leave stale hit-targets.
    • Improves UI test reliability: retries app activation on launch and re-runs the display resolution UI test in CI on the known activation flake.

Summary by CodeRabbit

  • New Features

    • Tabs automatically rename based on conversation content when transcripts are available and no custom title is set.
  • Tests

    • Improved CI test reliability with retry logic for UI tests.
    • Enhanced UI test window stabilization during launch.