Auto-update session title from the regenerated recap
Feature request: auto-update the session title from the regenerated recap
Summary
Claude Code already (a) auto-generates a recap of the session and (b) has an editable session title/name that drives the terminal tab. But the two are disconnected: the title is set once (at startup, or manually via /rename) and never tracks the recap as it regenerates. Please add an option to keep the session title in sync with the latest recap.
Current behavior
- A recap is generated and regenerated during a session. It is persisted in the session transcript as a record of
type: "system",subtype: "away_summary"(in~/.claude/projects/<project>/<sessionId>.jsonl), and a new record is appended each time it regenerates. - The session name lives in
~/.claude/sessions/<pid>.json(name+nameSource: "derived" | ...) and is what Claude Code emits to the terminal as the tab title (via OSC escape sequences). - The title is set once — the auto-derived default (working-dir + suffix, e.g.
my-app-3f) at startup, or a manual/rename. It does not follow the recap after that, so the tab stays stuck at the first-prompt/default name even as the conversation moves on.
What I'd like
An opt-in behavior: after the recap regenerates, update the session title to a short title derived from that recap (e.g. ≤5 words), so the tab reflects what the session is currently about. Ideally a settings.json toggle (e.g. "autoTitleFromRecap": true) plus a length/format hint.
Why
With many concurrent sessions (I run several in iTerm2 tabs), the tab title is the primary way to tell them apart. A title frozen at the first prompt is stale by mid-session; a recap-synced title would make the tab strip genuinely navigable.
Alternatives I tried (and why they don't work today)
/renamefrom a script/hook —/renameis interactive-only; there's no CLI subcommand, hook event, or SDK call to trigger it programmatically.- A skill that reads the latest
away_summaryand renames — a skill can read the recap fine, but nothing exposed to the model can invoke the built-in/renamecommand, so it can only hand back a paste-ready line. - Editing
namein~/.claude/sessions/<pid>.json— the write persists to disk (it's not clobbered by the process), but the running process never re-readsnamemid-session, so the live tab doesn't update. - Setting the terminal tab title directly (
printf '\033]0;…\007'OSC, or iTerm2osascript set name) — Claude Code owns the OSC title channel and re-emits on every status change, overwriting any external title within ~1s. The only way to make an external title stick is to disable "Applications in terminal may change the title" in iTerm2 — which then kills the recap-driven title entirely.
Nice-to-have adjuncts (any one would unblock a DIY version)
- A hook event that fires on recap (re)generation, with the recap text available to the hook.
- A programmatic rename path — a CLI subcommand (
claude session rename <id> "<title>") or an SDK/headless call — that updates the live session name/tab, not just the on-disk file.
Environment
- Claude Code 2.1.201
- macOS, iTerm2 3.6.11