From 7aa1390a614bd2052f322837771a6e4a566f19ec Mon Sep 17 00:00:00 2001 From: Rohit Mistry Date: Mon, 13 Apr 2026 00:32:01 -0400 Subject: [PATCH] fix: add Task tool delegation instructions to gemini.txt system prompt The gemini.txt system prompt is missing Task tool / sub-agent delegation instructions that are present in both anthropic.txt and default.txt. This causes Gemini models to never spawn sub-agents for codebase exploration, running all searches inline and consuming excessive context. This adds the missing Task tool usage policy and examples to gemini.txt, matching the guidance already present in the other prompts. Fixes #22244 --- packages/opencode/src/session/prompt/gemini.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/opencode/src/session/prompt/gemini.txt b/packages/opencode/src/session/prompt/gemini.txt index 87fe422bc750..ae0e6ac7a787 100644 --- a/packages/opencode/src/session/prompt/gemini.txt +++ b/packages/opencode/src/session/prompt/gemini.txt @@ -57,6 +57,19 @@ When requested to perform tasks like fixing bugs, adding features, refactoring, - **Interactive Commands:** Try to avoid shell commands that are likely to require user interaction (e.g. \`git rebase -i\`). Use non-interactive versions of commands (e.g. \`npm init -y\` instead of \`npm init\`) when available, and otherwise remind the user that interactive shell commands are not supported and may cause hangs until canceled by the user. - **Respect User Confirmations:** Most tool calls (also denoted as 'function calls') will first require confirmation from the user, where they will either approve or cancel the function call. If a user cancels a function call, respect their choice and do _not_ try to make the function call again. It is okay to request the tool call again _only_ if the user requests that same tool call on a subsequent prompt. When a user cancels a function call, assume best intentions from the user and consider inquiring if they prefer any alternative paths forward. +## Tool Usage Policy - Task Delegation +- When doing file search, prefer to use the Task tool in order to reduce context usage. +- You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description. +- VERY IMPORTANT: When exploring the codebase to gather context or to answer a question that is not a needle query for a specific file/class/function, it is CRITICAL that you use the Task tool instead of running search commands directly. + +user: Where are errors from the client handled? +assistant: [Uses the Task tool to find the files that handle client errors instead of using Glob or Grep directly] + + +user: What is the codebase structure? +assistant: [Uses the Task tool] + + ## Interaction Details - **Help Command:** The user can use '/help' to display help information. - **Feedback:** To report a bug or provide feedback, please use the /bug command.