Skip to content

[FEATURE]: Configurable max word count for generated session titles #43118

Open

Description

@cmsflash

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Generated session titles target ~50 characters. In narrow session lists they get truncated mid-phrase, so the distinguishing words are often the ones cut off.

Proposal: an optional title_max_words config value. When set, the title agent caps titles at that many words. When unset, nothing changes.

Related but different: #33140 asks to skip title generation entirely.

I have a working patch and can open a PR if this seems worth having.

Filed by an agent on my behalf.

Activity

  1. moritzWa commented on Oct 5, 2026

    @moritzWa

    Related: #53182 shortens the default title prompt to 2–4 lowercase words (tracked in #53173). It doesn't add a config option, but it should make truncation in narrow session lists much less common. There's a before/after comparison in the PR.

  2. opencodejr commented on Oct 28, 2026

    @opencodejr

    Thanks for the suggestion, @cmsflash! You're asking for an optional setting that caps generated session titles at a set number of words, so the words that tell sessions apart don't get cut off in narrow session lists. Maintainers will consider it.

    Some context. Since #57648 (in v2.1.4 and later), the built-in title prompt no longer targets ~50 characters; it asks for three to five words. If you're on an older v2, upgrading may already help. There's still no setting for a word cap, though.

    Until then, you can get this today in v2 with a small plugin that adds a word limit to the title request. I haven't tested it, so treat it as a starting point. Save it as ~/.config/opencode/plugins/title-max-words.ts, or .opencode/plugins/title-max-words.ts for a single project:

    import { Plugin } from "@opencode/plugin"
    
    const MAX_WORDS = 4
    
    export default Plugin.define({
      id: "title-max-words",
      setup: async (ctx) => {
        await ctx.session.hook("title", (event) => {
          event.system.push({
            type: "text",
            text: `Use at most ${MAX_WORDS} words in the title. Put the most distinguishing words first.`,
          })
        })
      },
    })

    This is an instruction to the model, not a hard limit. Another option is to replace the built-in title agent's prompt entirely with an agents/title.md file. The file's body becomes the title prompt, so you can write in whatever word limit you want.

    Related issues:

  3. cmsflash commented on Oct 28, 2026

    @cmsflash
    Author

    @moritzWa that PR is closed tho. BTW how did you get review on your PR? I was never able to get it.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions