Skip to content

feat: LLM-generated session titles #1063

Closed

Description

@Astro-Han

Problem

Desktop sessions all show "New Chat" in the sidebar until the user manually renames them. CLI TUI (maka chat) uses prompt.slice(0, 42) as the title, which works but produces truncated, hard-to-scan titles for long first messages. There is no automatic title generation from conversation content.

Desired outcome

Sessions get a descriptive 5-10 word title automatically, generated by an LLM call after the first user message. The user sees a meaningful title in the sidebar / session list without manual action.

Design decisions (informed by surveying Grok Build, Codex, OpenCode, DeepSeek-Reasonix, OpenHands):

  • LLM generation: Use the session's current model to generate a short title via a lightweight tool call. No dedicated small-model config; reuse the existing connection.
  • Trigger: After the first user message, async, does not block the agent loop. All surveyed products (Grok Build, Codex, OpenCode, DeepSeek-Reasonix) trigger at first user message, none wait for the first turn to complete.
  • Input: First user message only. Strip <system-reminder> blocks and skill XML markup, cap at 8 KB (same preprocessing as Grok Build's title_source_text).
  • Fallback: If the LLM call fails or returns empty, fall back to firstLine(prompt).slice(0, 42) (the CLI's existing logic).
  • Manual rename priority: Add titleIsManual: boolean to SessionHeader. Manual rename sets it to true; auto-generated titles only write when titleIsManual === false and the name is still the default. This prevents a late-arriving auto title from clobbering a user-set name.
  • Scope: Desktop sidebar + CLI TUI maka chat. maka run keeps its existing firstLine(prompt).slice(0, 42) logic (one-shot execution, no need for async title generation).

Implementation areas:

  • packages/storage: SessionHeader.titleIsManual field; setGeneratedTitleIfAbsent() method (only writes when not manual and name is default)
  • packages/runtime: title generation logic (LLM tool call + fallback), triggered after first user message
  • apps/desktop: wire auto-title into first-message event, update sidebar on title arrival
  • packages/cli: session-driver.ts triggers auto-title in TUI chat mode; existing prompt.slice(0, 42) becomes fallback

Alternatives or workarounds

Today the user must manually rename every session via /rename (CLI) or the sidebar inline rename (Desktop). The alternative of截断首条消息 (truncating the first message, as CLI already does) is cheap but produces low-quality titles for long or complex prompts. No LLM-based auto-naming exists today.

Activity

  1. added
    enhancement
    on Jul 16, 2026
  2. Colafornia commented on Jul 16, 2026

    @Colafornia
    Member

    I’d like to work on this issue.

  3. Astro-Han commented on Jul 16, 2026

    @Astro-Han
    ContributorAuthor

    Assigned @Colafornia !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions