Feature: Native auto-session-title generation on first user message
Feature Request
Summary
Claude Code should natively generate a meaningful session title from the first user message, similar to how ChatGPT, Claude.ai, and other AI chat interfaces automatically name conversations.
Problem / Motivation
Currently, session titling in Claude Code relies entirely on:
- External MCP tools (e.g.
mcp__happy__change_titlefrom the Happy app) injecting a system-prompt instruction, OR - Manual
/renameby the user
The system-prompt approach has a fragility problem: mcp__happy__change_title is listed as a deferred tool in Claude Code (schema not pre-loaded). The model must first call ToolSearch to load the schema, then call the tool — a two-step process the LLM executes inconsistently. The result is sessions with untitled or stale titles, making /resume and session navigation difficult.
Proposed Solution
Add native session auto-titling built into Claude Code itself:
- Trigger: After the first user message in a new session (not
--resume/--continue) - Mechanism: Asynchronously (fire-and-forget, non-blocking) call an internal lightweight model to generate a ≤60-char title from the first user message
- Storage: Write the title to the session JSONL as a
custom-titleentry (the format already used by/rename) - Settings opt-out: Respect a new
autoTitle: falsesetting insettings.jsonfor users who prefer manual control
Prior Art / Evidence
- Happy app (largest Claude Code mobile client) already does this for Codex and Gemini by appending
CHANGE_TITLE_INSTRUCTIONto the first user message:
``js``
// runCodex-CQJbJWfw.mjs:1964
const turnPrompt = first
? message.message + "\n\n" + CHANGE_TITLE_INSTRUCTION
: message.message;
For Claude Code it relies only on system-prompt injection, which is less reliable due to deferred tool loading.
- The
terminalTitleFromRenamesetting already exists in Claude Code's schema, showing the infrastructure for session titling is partially in place.
- The
custom-titleJSONL entry format is already used and read by/resume, so no new storage schema is needed.
Workaround (for now)
A UserPromptSubmit hook injects the instruction on the first message of each session:
{
"hooks": {
"UserPromptSubmit": [{
"hooks": [{
"type": "command",
"command": "node ~/.claude/scripts/hooks/user-prompt-auto-title.js",
"timeout": 5
}]
}]
}
}
The script outputs { "hookSpecificOutput": { "hookEventName": "UserPromptSubmit", "additionalContext": "..." } } only on the first message of each session (tracked via a CLAUDE_SESSION_ID-keyed flag file in /tmp).
This works but requires per-user setup and still relies on the model following instructions — a native solution would be deterministic.
Acceptance Criteria
- [ ] New sessions (not resumed) automatically get a title generated from the first user message
- [ ] Title generation is async and does not block the first response
- [ ] Title appears in
/resumelist - [ ]
autoTitle: falseinsettings.jsondisables the feature - [ ] Works without any external MCP server or plugin
Claude Code Version
2.1.104
Platform
Linux (Ubuntu 24.04)
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗