summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-09-09 23:57:13 -0500
committerGitHub <[email protected]>2025-09-09 23:57:13 -0500
commitbdc0f7c86dbfcad01a3f99c5a4cf53fd326054c1 (patch)
treea3c6c01bafd09c1a1c797b7f9b9b70ae5f872ab5
parentc8ca0368347ce4d91372e79fbe6dbfb13f188c2c (diff)
downloadopencode-bdc0f7c86dbfcad01a3f99c5a4cf53fd326054c1.tar.gz
opencode-bdc0f7c86dbfcad01a3f99c5a4cf53fd326054c1.zip
tweak: wrap build-switch w/ system-reminder (#2525)
-rw-r--r--packages/opencode/src/session/index.ts4
-rw-r--r--packages/opencode/src/session/prompt/build-switch.txt6
2 files changed, 7 insertions, 3 deletions
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts
index 83f2d0012..0fa2d66ed 100644
--- a/packages/opencode/src/session/index.ts
+++ b/packages/opencode/src/session/index.ts
@@ -766,8 +766,8 @@ export namespace Session {
})
}
- const lastAssistantMsg = msgs.filter((x) => x.info.role === "assistant").at(-1)?.info as MessageV2.Assistant
- if (lastAssistantMsg?.mode === "plan" && agent.name === "build") {
+ const wasPlan = msgs.some((msg) => msg.info.role === "assistant" && msg.info.mode === "plan")
+ if (wasPlan && agent.name === "build") {
msgs.at(-1)?.parts.push({
id: Identifier.ascending("part"),
messageID: userMsg.id,
diff --git a/packages/opencode/src/session/prompt/build-switch.txt b/packages/opencode/src/session/prompt/build-switch.txt
index 0b70fa573..3737b74d8 100644
--- a/packages/opencode/src/session/prompt/build-switch.txt
+++ b/packages/opencode/src/session/prompt/build-switch.txt
@@ -1 +1,5 @@
-Your operational mode has changed from plan to build. You are no longer in read-only mode. You are permitted to make file changes as necessary and utilize your arsenal of tools as needed.
+<system-reminder>
+Your operational mode has changed from plan to build.
+You are no longer in read-only mode.
+You are permitted to make file changes, run shell commands, and utilize your arsenal of tools as needed.
+</system-reminder>