Skip to content

feat: Add session topic tag, auto-generated session title, and /rename command #3078

@BZ-D

Description

@BZ-D

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:

  1. 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).

  2. 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.

  3. /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:

    • Image
  • You can rename the session name with /rename command:

    • Image
  • It shows the session name(if generated or renamed manually) when you show the history session list with /resume command:

    • Image

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.tsSessionListItem.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.tstruncateText() 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

  1. 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.

  2. 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.

  3. /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.
  4. 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

Metadata

Metadata

Assignees

Labels

category/cliCommand line interface and interactioncategory/uiUser interface and displaytype/feature-requestNew feature or enhancement request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions