fix: add Task tool delegation instructions to gemini.txt system prompt#22245
Open
rrmistry wants to merge 3 commits intoanomalyco:devfrom
Open
fix: add Task tool delegation instructions to gemini.txt system prompt#22245rrmistry wants to merge 3 commits intoanomalyco:devfrom
rrmistry wants to merge 3 commits intoanomalyco:devfrom
Conversation
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 anomalyco#22244
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #22244
Type of change
What does this PR do?
The
gemini.txtsystem prompt is missing Task tool / sub-agent delegation instructions that are present in bothanthropic.txtanddefault.txt. This causes Gemini models to never spawn sub-agents for codebase exploration — they run all searches inline in the parent context, consuming excessive tokens and producing shallow results.Root cause: In
anthropic.txt(lines 79-94) anddefault.txt(line 91+), there are explicit instructions telling the model to use the Task tool for codebase exploration, plus two concrete examples.gemini.txthas zero mentions of the Task tool or delegation. The tool is registered and available, but the model is never prompted to use it.Fix: Added a
## Tool Usage Policy - Task Delegationsection togemini.txtwith the same three directives and two examples already present in the other prompt files. This is a minimal, targeted addition — no restructuring of the existing prompt.I investigated the source code (
packages/opencode/src/session/system.tsline 29 selectsPROMPT_GEMINIfor Gemini models, andllm.tsline 109 shows agent prompts replace provider prompts entirely) to confirm the prompt selection path. Thegemini.txtprompt appears to have been imported fromgemini-cli(as noted in #13605) and never updated with Task tool guidance.How did you verify your code works?
gemini-3.1-pro-previewvia Vertex AI in automated code analysis workflowsanthropic.txtconsistently spawn 4-6 explore sub-agents for the same tasks, confirming the prompt is the differentiatorScreenshots / recordings
N/A - system prompt text change, no UI impact.
Checklist
Related issues