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
Session title agent generates title from injected memory/system context rather than actual user message #23114
When automatic session title generation runs, it passes the full rendered message history to the title model via MessageV2.toModelMessagesEffect. If a memory MCP server injects prior conversation summaries or facts into the system prompt or as synthetic message parts, the title model receives that injected content and generates a title based on it rather than the actual user message.
Expected Behaviour
The title should reflect the content of the current user message only.
Actual Behaviour
The title reflects injected memory context from prior sessions. Starting a session with "hi" produced:
"Discussion on Workaround and GitHub Issue Regarding Roampal Data Location Setup and Patching cli.py"
— an accurate summary of the previous session's content, surfaced via memory context injection.
Root Cause
In packages/opencode/src/session/prompt.ts, the title generation constructs its payload as:
constcontext=input.history.slice(0,idx+1)
messages: [{role: "user",content: "Generate a title for this conversation:\n"},
...yield*MessageV2.toModelMessagesEffect(context,mdl)]
MessageV2.toModelMessagesEffect renders the full message including injected memory/system content. The title model then titles based on that rather than the actual user message.
Suggested Fix
Pass only the raw text of the first real user message to the title model:
constuserText=firstUser.parts.filter(p=>p.type==="text").map(p=>p.text).join("\n")
messages: [{role: "user",content: "Generate a title for this conversation:\n"+userText}]
This strips all synthetic/injected parts before passing to the title model.
Plugins
roampal-core
OpenCode version
1.4.6
Steps to reproduce
Configure a memory MCP server that injects prior session context into the conversation (e.g. Roampal, mem0, or similar).
Start a new session with a short or unrelated message (e.g. "hi").
Observe that the generated session title reflects content from a previous session rather than the current one.
That solution doesnt quite work because u can preload things into context like files, shell outputs, etc. These would be useful for constructing somewhat useful titles, if you strip all that out it causes issues.
How is this MCP server autoloading things to context? Or are u referring to a plugin?
Instead of a previous conversation's context I'm seeing the superpowers instructions being injected, generating a title of:
Superpowers: Generating title for conversation
Changing the title agent model to a better model that can distinguish between the injected instructions and the user prompt as a workaround worked for me
Code-level confirmation for v1.18.18 (path still identical on dev as of 2026-08-13):
SessionPrompt.ensureTitle (packages/opencode/src/session/prompt.ts:193-253) builds the title prompt from history.slice(0, idx + 1) via MessageV2.toModelMessagesEffect(context, mdl).
toModelMessagesEffect (packages/opencode/src/session/message-v2.ts:206) skips text parts only when part.ignored or empty — synthetic parts pass through:
Verified end-to-end: opencode-mem (chat.message hook, injectOn: "first") prepends a synthetic memory part to the first user message; that part is persisted in opencode.db and flows into the title prompt. With a weak small_model the title blends memory text with the user's message (e.g. "Error en certificado Arreglo en sitio pepe SSL").
Re the concern that stripping everything would lose useful preloaded context (files, shell output): those are non-synthetic user/assistant parts and would remain — filtering only synthetic: true parts (or adding a stripSynthetic option alongside the existing stripMedia) would target exactly the plugin-injected context without dropping real content.
Reproduced on OpenCode 1.18.25 with Qwen3.8-27B via oMLX, without a configured small_model. The title request sometimes answers the original user prompt instead of producing a title. Lowering temperature and reasoning effort did not prevent it, while max_tokens only limited the damage. Because title generation runs concurrently, the extra request also disabled MTP and slowed the main response. Combining the instruction and source text as proposed here looks like the right fix.
I'm seeing this when using small local models that should easily be able to handle this task but trip up because the " Plan Mode..." message is included in what is sent for the title generator.
My titles are often something like "OC | Plan mode read only constraints"
Ideally it really only sends what we type into the chat box.
Doing as @coryplastek mentioned and using a better model does work but of course it takes up more precious vram. The new gemma tiny models almost always produce a bad title. nvidia/nemotron-3-nano-4b is better but still sometimes fumbles.
Received request: POST to /v1/chat/completions with body {
"model": "google/gemma-4-e2b",
"max_tokens": 8192,
"messages": [
{
"role": "system",
"content": "You are a title generator. You output ONLY a threa... <Truncated in logs> ...ode toggle\" → Dark mode toggle in App\n</examples>\n"
},
{
"role": "user",
"content": "Generate a title for this conversation:\n"
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "good morning"
},
{
"type": "text",
"text": "<system-reminder>\n# Plan Mode - System Reminder\n\nC... <Truncated in logs> ...nstructions you have received.\n</system-reminder>\n"
}
]
}
],
I'm experiencing this as well when using OpenCode with Multica. I set a set the model for the chat to one thing and out popped another query to gemini-3.8-flash.
multica injected (cleaned up)
{
"role": "user",
"content": "You are running as a chat assistant for a Multica workspace.\nAudience: direct room.\n\nUser message:\n\n\nTo include a file or image you produced in your reply, run multica attachment upload <local-path>. The file binds to your reply automatically and appears as an attachment card below it even if you paste nothing. The command also returns a markdown snippet you may paste on its own line to place the item where you want it (files render as a card, images inline).\n\n## Task Initiator\n\nThis task was initiated by <MULTICA_USER> (<MULTICA_USER_EMAIL>), a member of this workspace.\n\nThe initiator — not the runtime owner — is who you are answering: apply any per-person privacy or access rules your instructions define. Your Multica credentials stay scoped to the runtime owner, and initiator attribution does not change what you may read or write; do not assume the initiator can see everything you can.\n\n"
}
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
rekram1-node commentedon Apr 17, 2026
That solution doesnt quite work because u can preload things into context like files, shell outputs, etc. These would be useful for constructing somewhat useful titles, if you strip all that out it causes issues.
How is this MCP server autoloading things to context? Or are u referring to a plugin?
marcusyoung commentedon Apr 17, 2026
That's the plugin component of roampal doing the injection.
coryplastek commentedon Jun 26, 2026
I'm seeing similar behavior, although based on the use of https://github.com/obra/superpowers.
Instead of a previous conversation's context I'm seeing the superpowers instructions being injected, generating a title of:
Changing the
titleagent model to a better model that can distinguish between the injected instructions and the user prompt as a workaround worked for memlopezcoria commentedon Aug 13, 2026
Code-level confirmation for v1.18.18 (path still identical on
devas of 2026-08-13):SessionPrompt.ensureTitle(packages/opencode/src/session/prompt.ts:193-253) builds the title prompt fromhistory.slice(0, idx + 1)viaMessageV2.toModelMessagesEffect(context, mdl).toModelMessagesEffect(packages/opencode/src/session/message-v2.ts:206) skips text parts only whenpart.ignoredor empty —syntheticparts pass through:opencode-mem(chat.messagehook,injectOn: "first") prepends a synthetic memory part to the first user message; that part is persisted inopencode.dband flows into the title prompt. With a weak small_model the title blends memory text with the user's message (e.g. "Error en certificado Arreglo en sitio pepe SSL").Re the concern that stripping everything would lose useful preloaded context (files, shell output): those are non-synthetic user/assistant parts and would remain — filtering only
synthetic: trueparts (or adding astripSyntheticoption alongside the existingstripMedia) would target exactly the plugin-injected context without dropping real content.RE-codes commentedon Aug 30, 2026
Reproduced on OpenCode 1.18.25 with Qwen3.8-27B via oMLX, without a configured small_model. The title request sometimes answers the original user prompt instead of producing a title. Lowering temperature and reasoning effort did not prevent it, while max_tokens only limited the damage. Because title generation runs concurrently, the extra request also disabled MTP and slowed the main response. Combining the instruction and source text as proposed here looks like the right fix.
joepetrakovich commentedon Sep 14, 2026
I'm seeing this when using small local models that should easily be able to handle this task but trip up because the " Plan Mode..." message is included in what is sent for the title generator.
My titles are often something like "OC | Plan mode read only constraints"
Ideally it really only sends what we type into the chat box.
Doing as @coryplastek mentioned and using a better model does work but of course it takes up more precious vram. The new gemma tiny models almost always produce a bad title. nvidia/nemotron-3-nano-4b is better but still sometimes fumbles.
asdf8675309 commentedon Sep 16, 2026
I'm experiencing this as well when using OpenCode with Multica. I set a set the model for the chat to one thing and out popped another query to gemini-3.8-flash.
multica injected (cleaned up)
{
"role": "user",
"content": "You are running as a chat assistant for a Multica workspace.\nAudience: direct room.\n\nUser message:\n\n\nTo include a file or image you produced in your reply, run
multica attachment upload <local-path>. The file binds to your reply automatically and appears as an attachment card below it even if you paste nothing. The command also returns amarkdownsnippet you may paste on its own line to place the item where you want it (files render as a card, images inline).\n\n## Task Initiator\n\nThis task was initiated by <MULTICA_USER> (<MULTICA_USER_EMAIL>), a member of this workspace.\n\nThe initiator — not the runtime owner — is who you are answering: apply any per-person privacy or access rules your instructions define. Your Multica credentials stay scoped to the runtime owner, and initiator attribution does not change what you may read or write; do not assume the initiator can see everything you can.\n\n"}
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊