Add ability to regenerate session title using small model #8444

Open
opened 2026-02-16 18:09:59 -05:00 by yindo · 2 comments
Owner

Originally created by @bobthearsonist on GitHub (Feb 3, 2026).

Originally assigned to: @thdxr on GitHub.

Summary

Currently, session titles are only generated automatically on the first user message. There's no way to:

  1. Regenerate a title if the auto-generated one is poor
  2. Generate a title for sessions that were created before the title feature existed
  3. Use the small model to suggest a better title mid-conversation

Proposed Solution

Add a "Generate title" option that uses the small_model (or falls back to the title agent's configured model) to create a new title based on the conversation history.

Features

  1. API Endpoint: POST /session/:id/generate-title

    • Optionally accepts a custom prompt/hint as a body parameter
    • Returns the generated title
  2. UI Integration:

    • Add "Generate title" item to the session dropdown menu (between Rename and Archive)
    • Show in both webapp and TUI
  3. Slash Command: /retitle [hint]

    • No argument: generates title from conversation
    • With argument: uses the hint to influence title generation (e.g., /retitle focus on the auth refactoring)

Implementation Notes

  • Reuse the existing title agent and PROMPT_TITLE
  • Extract title generation logic from ensureTitle() in prompt.ts into a reusable function
  • Remove the guards that prevent regeneration (isFirst, isDefaultTitle checks)

Use Cases

  • User wants a more descriptive title after conversation has evolved
  • Auto-generated title was too generic or missed the main topic
  • User imported/continued an old session that never got a title
Originally created by @bobthearsonist on GitHub (Feb 3, 2026). Originally assigned to: @thdxr on GitHub. ## Summary Currently, session titles are only generated automatically on the first user message. There's no way to: 1. Regenerate a title if the auto-generated one is poor 2. Generate a title for sessions that were created before the title feature existed 3. Use the small model to suggest a better title mid-conversation ## Proposed Solution Add a "Generate title" option that uses the `small_model` (or falls back to the title agent's configured model) to create a new title based on the conversation history. ### Features 1. **API Endpoint**: `POST /session/:id/generate-title` - Optionally accepts a custom prompt/hint as a body parameter - Returns the generated title 2. **UI Integration**: - Add "Generate title" item to the session dropdown menu (between Rename and Archive) - Show in both webapp and TUI 3. **Slash Command**: `/retitle [hint]` - No argument: generates title from conversation - With argument: uses the hint to influence title generation (e.g., `/retitle focus on the auth refactoring`) ### Implementation Notes - Reuse the existing `title` agent and `PROMPT_TITLE` - Extract title generation logic from `ensureTitle()` in `prompt.ts` into a reusable function - Remove the guards that prevent regeneration (isFirst, isDefaultTitle checks) ## Use Cases - User wants a more descriptive title after conversation has evolved - Auto-generated title was too generic or missed the main topic - User imported/continued an old session that never got a title
Author
Owner

@github-actions[bot] commented on GitHub (Feb 3, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #9398: [FEATURE]: Improve /rename command to be AI powered (directly related - addresses the same need for AI-powered title generation via /rename)
  • #10105: [FEATURE]: Inherit or regenerate session title when forking (similar feature to regenerate titles in related sessions)
  • #8436: Feature Request: Editable session names with auto-generated titles (related to editing and regenerating titles)
  • #9460: [Sessions] Title generation is requested on every message (related to title generation behavior)
  • #4133: [FEATURE]: Use a cheap model to name sessions (related to using small_model for title generation)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 3, 2026): This issue might be a duplicate of existing issues. Please check: - #9398: [FEATURE]: Improve `/rename` command to be AI powered (directly related - addresses the same need for AI-powered title generation via /rename) - #10105: [FEATURE]: Inherit or regenerate session title when forking (similar feature to regenerate titles in related sessions) - #8436: Feature Request: Editable session names with auto-generated titles (related to editing and regenerating titles) - #9460: [Sessions] Title generation is requested on every message (related to title generation behavior) - #4133: [FEATURE]: Use a cheap model to name sessions (related to using small_model for title generation) Feel free to ignore if none of these address your specific case.
Author
Owner

@bittoby commented on GitHub (Feb 3, 2026):

@thdxr Can I try to implement this function and raise a PR?

@bittoby commented on GitHub (Feb 3, 2026): @thdxr Can I try to implement this function and raise a PR?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8444