From 9d1f57fc0d32800a816ae8acad0b686f3d1f34ae Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 23 Jul 2026 16:52:23 +0300 Subject: [PATCH] fix(plugin): consolidate system prompt injections into single array element The plugin previously pushes planning prompts and improvement contexts as separate elements in the output.system array. This change appends them to output.system[0] with newline separators instead. This keeps all system instructions within a single message block to prevent potential parsing or formatting issues when the agent processes the context. --- apps/opencode-plugin/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/opencode-plugin/index.ts b/apps/opencode-plugin/index.ts index 48f56fa41..b244b4879 100644 --- a/apps/opencode-plugin/index.ts +++ b/apps/opencode-plugin/index.ts @@ -476,7 +476,7 @@ tools (except writing markdown files), or otherwise make changes to the system. const stripped = stripConflictingPlanModeRules(output.system); output.system.length = 0; output.system.push(...stripped); - output.system.push(getPlanningPrompt()); + output.system[0] += "\n\n" + getPlanningPrompt(); const hook = readImprovementHook("enterplanmode-improve"); const pfmEnabled = loadConfig().pfmReminder === true; @@ -485,7 +485,7 @@ tools (except writing markdown files), or otherwise make changes to the system. improvementHookContent: hook?.content ?? null, }); if (improveContext) { - output.system.push(improveContext); + output.system[0] += "\n\n" + improveContext; } return; @@ -493,13 +493,13 @@ tools (except writing markdown files), or otherwise make changes to the system. if (!shouldInjectGenericPlanReminder(lastUserAgent, isSubagent, workflowOptions)) return; - output.system.push(`## Plan Submission + output.system[0] += `\n\n## Plan Submission When you have completed your plan, call the \`submit_plan\` tool to submit it for user review. Pass your full plan as a single edit: \`{ "edits": [{ "start": 1, "content": "..." }] }\`. The user will review your plan in a visual UI where they can annotate, approve, or request changes. If rejected, the response includes your plan with line numbers; use targeted edits to revise specific sections. -Do NOT proceed with implementation until your plan is approved.`); +Do NOT proceed with implementation until your plan is approved.`; }, // Intercept plannotator commands before the agent sees them.