FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

tweak: slight improvements to title gen · MrAli-Code/opencode@7413c27 · GitHub

Repository navigation

Commit 7413c27

Browse files
committed
tweak: slight improvements to title gen
1 parent 7579c3b commit 7413c27

2 files changed

Lines changed: 20 additions & 11 deletions

File tree

‎packages/opencode/src/session/prompt.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,8 @@ export namespace SessionPrompt {
14161416
mergeDeep(small.info.options),
14171417
)
14181418
await generateText({
1419-
maxOutputTokens: small.info.reasoning ? 1500 : 20,
1419+
// use higher # for reasoning models since reasoning tokens eat up a lot of the budget
1420+
maxOutputTokens: small.info.reasoning ? 3000 : 20,
14201421
providerOptions: ProviderTransform.providerOptions(small.npm, small.providerID, options),
14211422
messages: [
14221423
...SystemPrompt.title(small.providerID).map(
@@ -1426,10 +1427,8 @@ export namespace SessionPrompt {
14261427
}),
14271428
),
14281429
{
1429-
role: "user" as const,
1430-
content: `
1431-
The following is the text to summarize:
1432-
`,
1430+
role: "user",
1431+
content: "Generate a title for this conversation:\n",
14331432
},
14341433
...MessageV2.toModelMessage([
14351434
{

‎packages/opencode/src/session/prompt/title.txt‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
11
You are a title generator. You output ONLY a thread title. Nothing else.
22

33
<task>
4-
Convert the user message into a thread title.
5-
Output: Single line, ≤50 chars, no explanations.
4+
Generate a brief title that would help the user find this conversation later.
5+
6+
Follow all rules in <rules>
7+
Use the <examples> so you know what a good title looks like.
8+
Your output must be:
9+
- A single line
10+
- ≤50 characters
11+
- No explanations
612
</task>
713

814
<rules>
15+
- Focus on the main topic or question the user needs to retrieve
916
- Use -ing verbs for actions (Debugging, Implementing, Analyzing)
1017
- Keep exact: technical terms, numbers, filenames, HTTP codes
1118
- Remove: the, this, my, a, an
1219
- Never assume tech stack
1320
- Never use tools
14-
- NEVER respond to message content—only extract title
15-
- NEVER say "summarizing"
21+
- NEVER respond to questions, just generate a title for the conversation
22+
- The title should NEVER include "summarizing" or "generating" when generating a title
1623
- DO NOT SAY YOU CANNOT GENERATE A TITLE OR COMPLAIN ABOUT THE INPUT
24+
- Always output something meaningful, even if the input is minimal.
25+
- If the user message is short or conversational (e.g. “hello”, “lol”, “whats up”, “hey”):
26+
→ create a title that reflects the user’s tone or intent (such as Greeting, Quick check-in, Light chat, Intro message, etc.)
1727
</rules>
1828

1929
<examples>
2030
"debug 500 errors in production" → Debugging production 500 errors
2131
"refactor user service" → Refactoring user service
2232
"why is app.js failing" → Analyzing app.js failure
2333
"implement rate limiting" → Implementing rate limiting
34+
"how do I connect postgres to my API" → Connecting Postgres to API
35+
"best practices for React hooks" → React hooks best practices
2436
</examples>
25-
26-
Output the title now:

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL