summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-08-19 15:32:31 -0500
committerGitHub <[email protected]>2025-08-19 15:32:31 -0500
commit25f43adaa0c5168927e8d7358cbaee878bc28721 (patch)
treefe24539972268b1d5edb1636bacf90ac356699bb
parent4913ee6afdb29d9ffbc27fd417aabbf35aaf1749 (diff)
downloadopencode-25f43adaa0c5168927e8d7358cbaee878bc28721.tar.gz
opencode-25f43adaa0c5168927e8d7358cbaee878bc28721.zip
tweak: notify agent it is in build mode when switching from plan mode (#2065)
-rw-r--r--packages/opencode/src/session/index.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts
index 2455962d8..796294ec4 100644
--- a/packages/opencode/src/session/index.ts
+++ b/packages/opencode/src/session/index.ts
@@ -726,6 +726,18 @@ export namespace Session {
synthetic: true,
})
}
+
+ const lastAssistantMsg = msgs.filter((x) => x.info.role === "assistant").at(-1)?.info as MessageV2.Assistant
+ if (lastAssistantMsg?.mode === "plan" && agent.name === "build") {
+ msgs.at(-1)?.parts.push({
+ id: Identifier.ascending("part"),
+ messageID: userMsg.id,
+ sessionID: input.sessionID,
+ type: "text",
+ text: "You are now in build mode and are permitted to make edits",
+ synthetic: true,
+ })
+ }
let system = SystemPrompt.header(input.providerID)
system.push(
...(() => {