From f2e1a5da7acf37accac5d64e76e0e159e06b6bac Mon Sep 17 00:00:00 2001 From: opencode Date: Thu, 13 Aug 2026 05:53:57 -0700 Subject: [PATCH] feat(session): route Muse Glimmer to the Meta system prompt too Hand-merged from anomalyco/opencode@b9f3b382f (fix(session): route all Muse family models to the Meta system prompt, #41581) -- their patch touched files we've customized for this fork (system.ts carries the TKT-397 docsEnvLines addition; meta.txt carries our own repointed GitHub-issues URL and "this is a fork" documentation clause), so it did not cherry-pick cleanly and was reapplied by hand on top of our own content instead of overwriting it. Sean: plans to serve Muse Glimmer instead of qwen for some workloads, suspecting it holds up better on longer-horizon tasks where qwen tends to give up partway through. Prior routing only matched "muse-spark" -- a Glimmer model ID would have silently fallen through to no system prompt at all. Templates {{MODEL_NAME}} into meta.txt so both variants share one prompt file instead of forking it. Co-Authored-By: Claude --- 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 c94a021123f1..bd322ca1f125 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/Draugur-AI/opencode/issues and mention that they are using Meta Muse Spark. +- Users can give feedback or report issues at https://github.com/Draugur-AI/opencode/issues 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 this build's own documentation, at the URL given as "Documentation for this build" in . This is a fork: documentation hosted elsewhere describes a different program and will answer confidently about behaviour this build does not have. If lists no documentation URL, or fetching it fails, say you are not certain rather than answering from general knowledge about OpenCode. diff --git a/packages/opencode/src/session/system.ts b/packages/opencode/src/session/system.ts index e9f18063f687..903184c43636 100644 --- a/packages/opencode/src/session/system.ts +++ b/packages/opencode/src/session/system.ts @@ -35,7 +35,10 @@ export function docsEnvLines(url: URL | undefined) { } 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 e1b2cf8f9ae6..dbe6ced4329b 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", () =>