summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-08-11 01:14:46 -0400
committerDax Raad <[email protected]>2025-08-11 01:15:12 -0400
commit457386ad08c8add2b8f9c80434582785ca07c557 (patch)
tree36df17913cefa00cb8152edf14167d7f2c96e0b1 /packages
parentfce04dc48b87b35ee66814632329ab9859947c99 (diff)
downloadopencode-457386ad08c8add2b8f9c80434582785ca07c557.tar.gz
opencode-457386ad08c8add2b8f9c80434582785ca07c557.zip
fix plan mode bash tool making changes
Diffstat (limited to 'packages')
-rw-r--r--packages/opencode/src/session/index.ts22
-rw-r--r--packages/opencode/src/session/prompt/plan.txt7
-rw-r--r--packages/opencode/src/session/system.ts1
3 files changed, 18 insertions, 12 deletions
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts
index 594663f91..5565f3e0a 100644
--- a/packages/opencode/src/session/index.ts
+++ b/packages/opencode/src/session/index.ts
@@ -15,6 +15,7 @@ import {
} from "ai"
import PROMPT_INITIALIZE from "../session/prompt/initialize.txt"
+import PROMPT_PLAN from "../session/prompt/plan.txt"
import { App } from "../app/app"
import { Bus } from "../bus"
@@ -607,17 +608,6 @@ export namespace Session {
]
}),
).then((x) => x.flat())
- /*
- if (inputAgent === "plan")
- userParts.push({
- id: Identifier.ascending("part"),
- messageID: userMsg.id,
- sessionID: input.sessionID,
- type: "text",
- text: PROMPT_PLAN,
- synthetic: true,
- })
- */
await Plugin.trigger(
"chat.message",
{},
@@ -720,6 +710,16 @@ export namespace Session {
}
const agent = await Agent.get(inputAgent)
+ if (agent.name === "plan") {
+ msgs.at(-1)?.parts.push({
+ id: Identifier.ascending("part"),
+ messageID: userMsg.id,
+ sessionID: input.sessionID,
+ type: "text",
+ text: PROMPT_PLAN,
+ synthetic: true,
+ })
+ }
let system = SystemPrompt.header(input.providerID)
system.push(
...(() => {
diff --git a/packages/opencode/src/session/prompt/plan.txt b/packages/opencode/src/session/prompt/plan.txt
index f0e02d266..b17ca1d86 100644
--- a/packages/opencode/src/session/prompt/plan.txt
+++ b/packages/opencode/src/session/prompt/plan.txt
@@ -1,3 +1,8 @@
<system-reminder>
-Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supersedes any other instructions you have received (for example, to make edits).
+Plan mode is active. The user indicated that they do not want you to execute yet
+-- you MUST NOT make any edits, run any non-readonly tools (including changing
+configs or making commits), or otherwise make any changes to the system. This
+supersedes any other instructions you have received (for example, to make
+edits). Bash tool must only run readonly commands
</system-reminder>
+
diff --git a/packages/opencode/src/session/system.ts b/packages/opencode/src/session/system.ts
index ec27dc627..2f767c120 100644
--- a/packages/opencode/src/session/system.ts
+++ b/packages/opencode/src/session/system.ts
@@ -20,6 +20,7 @@ export namespace SystemPrompt {
if (providerID.includes("anthropic")) return [PROMPT_ANTHROPIC_SPOOF.trim()]
return []
}
+
export function provider(modelID: string) {
if (modelID.includes("gpt-5")) return [PROMPT_CODEX]
if (modelID.includes("gpt-") || modelID.includes("o1") || modelID.includes("o3")) return [PROMPT_BEAST]