summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoraron <[email protected]>2025-07-15 22:16:27 -0300
committerGitHub <[email protected]>2025-07-15 21:16:27 -0400
commit1bbd84008ff7460873c505e140852a3f507e569e (patch)
treef45d635cb8affd3d349387bd159ddc676e98cb60
parentfdfd4d69d342f5708ab82758aad013ba8d4fa520 (diff)
downloadopencode-1bbd84008ff7460873c505e140852a3f507e569e.tar.gz
opencode-1bbd84008ff7460873c505e140852a3f507e569e.zip
move spoof prompt to support anthropic with custom modes (#1031)
-rw-r--r--packages/opencode/src/session/index.ts4
-rw-r--r--packages/opencode/src/session/system.ts3
2 files changed, 4 insertions, 3 deletions
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts
index 4877d91d7..c3c363e31 100644
--- a/packages/opencode/src/session/index.ts
+++ b/packages/opencode/src/session/index.ts
@@ -17,6 +17,7 @@ import {
import PROMPT_INITIALIZE from "../session/prompt/initialize.txt"
import PROMPT_PLAN from "../session/prompt/plan.txt"
+import PROMPT_ANTHROPIC_SPOOF from "../session/prompt/anthropic_spoof.txt"
import { App } from "../app/app"
import { Bus } from "../bus"
@@ -546,7 +547,8 @@ export namespace Session {
msgs.push({ info: userMsg, parts: userParts })
const mode = await Mode.get(input.mode ?? "build")
- let system = mode.prompt ? [mode.prompt] : SystemPrompt.provider(input.providerID, input.modelID)
+ let system = input.providerID === "anthropic" ? [PROMPT_ANTHROPIC_SPOOF.trim()] : []
+ system.push(...(mode.prompt ? [mode.prompt] : SystemPrompt.provider(input.modelID)))
system.push(...(await SystemPrompt.environment()))
system.push(...(await SystemPrompt.custom()))
// max 2 system prompt messages for caching purposes
diff --git a/packages/opencode/src/session/system.ts b/packages/opencode/src/session/system.ts
index 9605f4d04..375b627bc 100644
--- a/packages/opencode/src/session/system.ts
+++ b/packages/opencode/src/session/system.ts
@@ -14,8 +14,7 @@ import PROMPT_SUMMARIZE from "./prompt/summarize.txt"
import PROMPT_TITLE from "./prompt/title.txt"
export namespace SystemPrompt {
- export function provider(providerID: string, modelID: string) {
- if (providerID === "anthropic") return [PROMPT_ANTHROPIC_SPOOF.trim(), PROMPT_ANTHROPIC]
+ export function provider(modelID: string) {
if (modelID.includes("gpt-") || modelID.includes("o1") || modelID.includes("o3")) return [PROMPT_BEAST]
if (modelID.includes("gemini-")) return [PROMPT_GEMINI]
return [PROMPT_ANTHROPIC]