Skip to content

Commit b9f3b38

Browse files
authored
fix(session): route all Muse family models to the Meta system prompt (#41581)
1 parent 550d1ff commit b9f3b38

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

packages/opencode/src/session/prompt/meta.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
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.
1+
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.
22

33
Use the instructions below and the tools available to assist the user.
44

@@ -61,5 +61,5 @@ Use the instructions below and the tools available to assist the user.
6161
- 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.
6262

6363
# User Help & Feedback
64-
- Users can give feedback or report issues at https://github.com/anomalyco/opencode and mention that they are using Meta Muse Spark.
64+
- Users can give feedback or report issues at https://github.com/anomalyco/opencode and mention that they are using Meta {{MODEL_NAME}}.
6565
- 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.

packages/opencode/src/session/system.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ import { MCP } from "@/mcp"
2525
import { PermissionV1 } from "@opencode-ai/core/v1/permission"
2626

2727
export function provider(model: Provider.Model) {
28-
if (model.api.id.includes("muse-spark")) return [PROMPT_META]
28+
if (model.api.id.includes("muse")) {
29+
const name = model.api.id.includes("muse-glimmer") ? "Muse Glimmer" : "Muse Spark"
30+
return [PROMPT_META.replaceAll("{{MODEL_NAME}}", name)]
31+
}
2932
if (model.api.id.includes("gpt-4") || model.api.id.includes("o1") || model.api.id.includes("o3"))
3033
return [PROMPT_BEAST]
3134
if (model.api.id.includes("gpt")) {

packages/opencode/test/session/system.test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,21 @@ const it = testEffect(
8585

8686
describe("session.system", () => {
8787
test("selects the Meta prompt for Muse Spark model IDs", () => {
88-
expect(SystemPrompt.provider({ api: { id: "meta/muse-spark-preview" } } as Provider.Model)[0]).toContain(
89-
"Meta Muse Spark",
90-
)
88+
for (const id of ["meta/muse-spark-preview", "muse-spark-1.1", "muse-spark-1.2"]) {
89+
const prompt = SystemPrompt.provider({ api: { id } } as Provider.Model)[0]
90+
expect(prompt).toContain("powered by Muse Spark,")
91+
expect(prompt).toContain("using Meta Muse Spark.")
92+
expect(prompt).not.toContain("{{MODEL_NAME}}")
93+
}
94+
})
95+
96+
test("selects the Meta prompt for Muse Glimmer model IDs", () => {
97+
for (const id of ["meta/muse-glimmer", "meta/muse-glimmer-30b", "muse-glimmer-30b"]) {
98+
const prompt = SystemPrompt.provider({ api: { id } } as Provider.Model)[0]
99+
expect(prompt).toContain("powered by Muse Glimmer,")
100+
expect(prompt).toContain("using Meta Muse Glimmer.")
101+
expect(prompt).not.toContain("{{MODEL_NAME}}")
102+
}
91103
})
92104

93105
it.effect("skills output is sorted by name and stable across calls", () =>

0 commit comments

Comments
 (0)