Add session topic tag, auto-generated session title, and /rename command
What would you like to be added?
Three related features to improve session management and UX:
-
Session topic tag in the input area — A small pill/tag displayed in the top-right corner of the input area (not the status line) showing the current session's topic or title, similar to Claude Code's auto-detect-terminal-theme tag. The tag only appears after a title has been generated (auto or manual).
-
Auto-generated session title — After the conversation has accumulated enough context, automatically generate a concise, descriptive title from the conversation via LLM. This is not triggered immediately at session start — it fires lazily once sufficient context exists. The title is persisted alongside session metadata and displayed in the input area tag.
-
/rename command — A new slash command to rename the current session:
/rename (no args): Auto-generate a title from the current conversation and apply it.
/rename <new-title>: Set the session title to the provided argument.
- The renamed title is persisted and shown in the input area tag,
/resume session picker, and anywhere session titles are displayed.
Why is this needed?
This is how session abstract is shown in claude:
-
When reaching enough context, claude will automatically summarize current session and generate an abstract, showing it in the top-right section:
-
You can rename the session name with /rename command:
-
It shows the session name(if generated or renamed manually) when you show the history session list with /resume command:
Needed Reasons
- Session identification: When using
/resume, sessions are currently listed by the raw first user prompt (e.g., "你好", "fix bugs"), which is often unhelpful for identification. AI-generated titles like "fix terminal theme detection" are much more scannable.
- UX parity: Claude Code displays a topic tag in the input area, giving users at-a-glance awareness of what the current session is about. Qwen Code lacks this visual affordance.
- Session management: Users frequently want to rename sessions post-hoc (e.g., after a conversation evolves beyond its initial topic). Without a
/rename command, there is no way to update a session's display name.
Additional Context
Current Implementation
Session title sourcing: Session titles in /resume are extracted directly from the first user prompt, truncated to 200 characters. No LLM-based summarization is performed.
packages/core/src/services/sessionService.ts — SessionListItem.prompt stores the first user prompt text. extractFirstPromptFromRecords() scans the first N records of a JSONL session file for the first type === 'user' message.
packages/cli/src/ui/hooks/useSessionPicker.ts — Renders the session picker dialog using SessionListItem data.
packages/cli/src/ui/utils/sessionPickerUtils.ts — truncateText() truncates display text.
Existing summary command: /summary generates a project-level summary and saves it to .qwen/PROJECT_SUMMARY.md. This is unrelated to session titling.
packages/cli/src/ui/commands/summaryCommand.ts — Uses getProjectSummaryPrompt() to ask the LLM for a project context summary. Not session-aware.
Proposed Implementation
-
Session title storage: Add a title field to the session JSONL metadata (or a sidecar .meta.json file). The SessionListItem interface would include an optional title field. When title is absent, fall back to the current first-prompt behavior.
-
Auto-title generation: Lazily trigger an LLM call to generate a short title once the conversation has accumulated enough context (e.g., after N messages or N tokens). This is not triggered at session start. Cache the result in the session metadata. This can be done asynchronously without blocking the conversation.
-
/rename command: Create packages/cli/src/ui/commands/renameCommand.ts following the pattern of existing commands (e.g., summaryCommand.ts). The command:
- Calls the LLM to generate a title if no argument is provided.
- Updates the session metadata file.
- Refreshes the UI state to reflect the new title in the input area tag and session picker.
-
Input area topic tag: Add a SessionTopicTag component rendered in the top-right corner of the input area (above or adjacent to the prompt input). It displays the current session title as a small pill/tag when available, and is hidden when no title has been set.
Related Files
| File |
Purpose |
packages/core/src/services/sessionService.ts |
Add title to SessionListItem; add methods to read/write session title |
packages/cli/src/ui/hooks/useSessionPicker.ts |
Display session titles in the picker |
packages/cli/src/ui/components/InputArea.tsx (or equivalent) |
Render the SessionTopicTag component in the input area |
packages/cli/src/ui/commands/renameCommand.ts |
New file — implement the /rename slash command |
packages/cli/src/ui/contexts/SessionContext.tsx |
Add session title to session state |
packages/core/src/services/chatRecordingService.ts |
Possibly extend ChatRecord to support title metadata |
Add session topic tag, auto-generated session title, and
/renamecommandWhat would you like to be added?
Three related features to improve session management and UX:
Session topic tag in the input area — A small pill/tag displayed in the top-right corner of the input area (not the status line) showing the current session's topic or title, similar to Claude Code's
auto-detect-terminal-themetag. The tag only appears after a title has been generated (auto or manual).Auto-generated session title — After the conversation has accumulated enough context, automatically generate a concise, descriptive title from the conversation via LLM. This is not triggered immediately at session start — it fires lazily once sufficient context exists. The title is persisted alongside session metadata and displayed in the input area tag.
/renamecommand — A new slash command to rename the current session:/rename(no args): Auto-generate a title from the current conversation and apply it./rename <new-title>: Set the session title to the provided argument./resumesession picker, and anywhere session titles are displayed.Why is this needed?
This is how session abstract is shown in claude:
When reaching enough context, claude will automatically summarize current session and generate an abstract, showing it in the top-right section:
You can rename the session name with
/renamecommand:It shows the session name(if generated or renamed manually) when you show the history session list with
/resumecommand:Needed Reasons
/resume, sessions are currently listed by the raw first user prompt (e.g., "你好", "fix bugs"), which is often unhelpful for identification. AI-generated titles like "fix terminal theme detection" are much more scannable./renamecommand, there is no way to update a session's display name.Additional Context
Current Implementation
Session title sourcing: Session titles in
/resumeare extracted directly from the first user prompt, truncated to 200 characters. No LLM-based summarization is performed.packages/core/src/services/sessionService.ts—SessionListItem.promptstores the first user prompt text.extractFirstPromptFromRecords()scans the first N records of a JSONL session file for the firsttype === 'user'message.packages/cli/src/ui/hooks/useSessionPicker.ts— Renders the session picker dialog usingSessionListItemdata.packages/cli/src/ui/utils/sessionPickerUtils.ts—truncateText()truncates display text.Existing summary command:
/summarygenerates a project-level summary and saves it to.qwen/PROJECT_SUMMARY.md. This is unrelated to session titling.packages/cli/src/ui/commands/summaryCommand.ts— UsesgetProjectSummaryPrompt()to ask the LLM for a project context summary. Not session-aware.Proposed Implementation
Session title storage: Add a
titlefield to the session JSONL metadata (or a sidecar.meta.jsonfile). TheSessionListIteminterface would include an optionaltitlefield. Whentitleis absent, fall back to the current first-prompt behavior.Auto-title generation: Lazily trigger an LLM call to generate a short title once the conversation has accumulated enough context (e.g., after N messages or N tokens). This is not triggered at session start. Cache the result in the session metadata. This can be done asynchronously without blocking the conversation.
/renamecommand: Createpackages/cli/src/ui/commands/renameCommand.tsfollowing the pattern of existing commands (e.g.,summaryCommand.ts). The command:Input area topic tag: Add a
SessionTopicTagcomponent rendered in the top-right corner of the input area (above or adjacent to the prompt input). It displays the current session title as a small pill/tag when available, and is hidden when no title has been set.Related Files
packages/core/src/services/sessionService.tstitletoSessionListItem; add methods to read/write session titlepackages/cli/src/ui/hooks/useSessionPicker.tspackages/cli/src/ui/components/InputArea.tsx(or equivalent)SessionTopicTagcomponent in the input areapackages/cli/src/ui/commands/renameCommand.ts/renameslash commandpackages/cli/src/ui/contexts/SessionContext.tsxpackages/core/src/services/chatRecordingService.tsChatRecordto support title metadata