summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-11-23 14:04:34 -0600
committerAiden Cline <[email protected]>2025-11-23 14:04:39 -0600
commit7413c2715c208a92d1ca3c4f31988a4449b877a0 (patch)
tree5b6540f8f0809ecea68b5cd2bcb991452b443331
parent7579c3bb1591c527eef97bb5eb35d7c6a2d66e75 (diff)
downloadopencode-7413c2715c208a92d1ca3c4f31988a4449b877a0.tar.gz
opencode-7413c2715c208a92d1ca3c4f31988a4449b877a0.zip
tweak: slight improvements to title gen
-rw-r--r--packages/opencode/src/session/prompt.ts9
-rw-r--r--packages/opencode/src/session/prompt/title.txt22
2 files changed, 20 insertions, 11 deletions
diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts
index e9827a099..6b255981b 100644
--- a/packages/opencode/src/session/prompt.ts
+++ b/packages/opencode/src/session/prompt.ts
@@ -1416,7 +1416,8 @@ export namespace SessionPrompt {
mergeDeep(small.info.options),
)
await generateText({
- maxOutputTokens: small.info.reasoning ? 1500 : 20,
+ // use higher # for reasoning models since reasoning tokens eat up a lot of the budget
+ maxOutputTokens: small.info.reasoning ? 3000 : 20,
providerOptions: ProviderTransform.providerOptions(small.npm, small.providerID, options),
messages: [
...SystemPrompt.title(small.providerID).map(
@@ -1426,10 +1427,8 @@ export namespace SessionPrompt {
}),
),
{
- role: "user" as const,
- content: `
- The following is the text to summarize:
- `,
+ role: "user",
+ content: "Generate a title for this conversation:\n",
},
...MessageV2.toModelMessage([
{
diff --git a/packages/opencode/src/session/prompt/title.txt b/packages/opencode/src/session/prompt/title.txt
index 9cc80948f..e297dc460 100644
--- a/packages/opencode/src/session/prompt/title.txt
+++ b/packages/opencode/src/session/prompt/title.txt
@@ -1,19 +1,29 @@
You are a title generator. You output ONLY a thread title. Nothing else.
<task>
-Convert the user message into a thread title.
-Output: Single line, ≤50 chars, no explanations.
+Generate a brief title that would help the user find this conversation later.
+
+Follow all rules in <rules>
+Use the <examples> so you know what a good title looks like.
+Your output must be:
+- A single line
+- ≤50 characters
+- No explanations
</task>
<rules>
+- Focus on the main topic or question the user needs to retrieve
- Use -ing verbs for actions (Debugging, Implementing, Analyzing)
- Keep exact: technical terms, numbers, filenames, HTTP codes
- Remove: the, this, my, a, an
- Never assume tech stack
- Never use tools
-- NEVER respond to message content—only extract title
-- NEVER say "summarizing"
+- NEVER respond to questions, just generate a title for the conversation
+- The title should NEVER include "summarizing" or "generating" when generating a title
- DO NOT SAY YOU CANNOT GENERATE A TITLE OR COMPLAIN ABOUT THE INPUT
+- Always output something meaningful, even if the input is minimal.
+- If the user message is short or conversational (e.g. “hello”, “lol”, “whats up”, “hey”):
+ → create a title that reflects the user’s tone or intent (such as Greeting, Quick check-in, Light chat, Intro message, etc.)
</rules>
<examples>
@@ -21,6 +31,6 @@ Output: Single line, ≤50 chars, no explanations.
"refactor user service" → Refactoring user service
"why is app.js failing" → Analyzing app.js failure
"implement rate limiting" → Implementing rate limiting
+"how do I connect postgres to my API" → Connecting Postgres to API
+"best practices for React hooks" → React hooks best practices
</examples>
-
-Output the title now: