From 1c7fdb511c01f20b142966396c411a8a10039b0e Mon Sep 17 00:00:00 2001 From: Matthias Reso <13337103+mreso@users.noreply.github.com> Date: Mon, 10 Aug 2026 10:02:32 -0700 Subject: [PATCH] fix(session): route all Muse family models to the Meta system prompt The system prompt dispatcher only matched the substring "muse-spark", so newer Muse models such as muse-glimmer / muse-glimmer-30b fell through to PROMPT_DEFAULT instead of receiving PROMPT_META. Gate PROMPT_META on any "muse" model id and template the model name into the prompt via {{MODEL_NAME}}: render "Muse Glimmer" for muse-glimmer ids and default to "Muse Spark" for every other Muse model. --- packages/opencode/src/session/prompt/meta.txt | 4 ++-- packages/opencode/src/session/system.ts | 5 ++++- packages/opencode/test/session/system.test.ts | 18 +++++++++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/opencode/src/session/prompt/meta.txt b/packages/opencode/src/session/prompt/meta.txt index ae43d7c48e88..d5aa008c03f8 100644 --- a/packages/opencode/src/session/prompt/meta.txt +++ b/packages/opencode/src/session/prompt/meta.txt @@ -1,4 +1,4 @@ -You are OpenCode, a coding agent that helps users with software engineering tasks. You are powered by Muse Spark, a large language model trained by Meta MSL. +You are OpenCode, a coding agent that helps users with software engineering tasks. You are powered by {{MODEL_NAME}}, a large language model trained by Meta MSL. Use the instructions below and the tools available to assist the user. @@ -61,5 +61,5 @@ Use the instructions below and the tools available to assist the user. - NEVER use comments as a place for long-winded chain-of-thought. Long thinking texts must be generated as private reasoning. Comments in code must be appropriately concise. # User Help & Feedback -- Users can give feedback or report issues at https://github.com/anomalyco/opencode and mention that they are using Meta Muse Spark. +- Users can give feedback or report issues at https://github.com/anomalyco/opencode and mention that they are using Meta {{MODEL_NAME}}. - When users ask directly about OpenCode (eg. "can OpenCode do...", "are you able to do...") or its features (eg. implement a hook, write a slash command, or install an MCP server), use the WebFetch tool to gather information to answer the question from the OpenCode docs at https://opencode.ai/docs. diff --git a/packages/opencode/src/session/system.ts b/packages/opencode/src/session/system.ts index b94e79426585..952b95b63489 100644 --- a/packages/opencode/src/session/system.ts +++ b/packages/opencode/src/session/system.ts @@ -25,7 +25,10 @@ import { MCP } from "@/mcp" import { PermissionV1 } from "@opencode-ai/core/v1/permission" export function provider(model: Provider.Model) { - if (model.api.id.includes("muse-spark")) return [PROMPT_META] + if (model.api.id.includes("muse")) { + const name = model.api.id.includes("muse-glimmer") ? "Muse Glimmer" : "Muse Spark" + return [PROMPT_META.replaceAll("{{MODEL_NAME}}", name)] + } if (model.api.id.includes("gpt-4") || model.api.id.includes("o1") || model.api.id.includes("o3")) return [PROMPT_BEAST] if (model.api.id.includes("gpt")) { diff --git a/packages/opencode/test/session/system.test.ts b/packages/opencode/test/session/system.test.ts index d9d47be3df94..c8e27eef4335 100644 --- a/packages/opencode/test/session/system.test.ts +++ b/packages/opencode/test/session/system.test.ts @@ -85,9 +85,21 @@ const it = testEffect( describe("session.system", () => { test("selects the Meta prompt for Muse Spark model IDs", () => { - expect(SystemPrompt.provider({ api: { id: "meta/muse-spark-preview" } } as Provider.Model)[0]).toContain( - "Meta Muse Spark", - ) + for (const id of ["meta/muse-spark-preview", "muse-spark-1.1", "muse-spark-1.2"]) { + const prompt = SystemPrompt.provider({ api: { id } } as Provider.Model)[0] + expect(prompt).toContain("powered by Muse Spark,") + expect(prompt).toContain("using Meta Muse Spark.") + expect(prompt).not.toContain("{{MODEL_NAME}}") + } + }) + + test("selects the Meta prompt for Muse Glimmer model IDs", () => { + for (const id of ["meta/muse-glimmer", "meta/muse-glimmer-30b", "muse-glimmer-30b"]) { + const prompt = SystemPrompt.provider({ api: { id } } as Provider.Model)[0] + expect(prompt).toContain("powered by Muse Glimmer,") + expect(prompt).toContain("using Meta Muse Glimmer.") + expect(prompt).not.toContain("{{MODEL_NAME}}") + } }) it.effect("skills output is sorted by name and stable across calls", () =>