You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Configurable max word count for generated session titles #43118
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.
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.
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"constMAX_WORDS=4exportdefaultPlugin.define({id: "title-max-words",setup: async(ctx)=>{awaitctx.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.
Activity
moritzWa commentedon Oct 5, 2026
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.
opencodejr commentedon Oct 28, 2026
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.tsfor a single project:This is an instruction to the model, not a hard limit. Another option is to replace the built-in
titleagent's prompt entirely with anagents/title.mdfile. The file's body becomes the title prompt, so you can write in whatever word limit you want.Related issues:
cmsflash commentedon Oct 28, 2026
@moritzWa that PR is closed tho. BTW how did you get review on your PR? I was never able to get it.