gemini-cli - 💡(How to fix) Fix Subagents are leaking context even when not enabled [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25595Fetched 2026-04-18 05:57:35
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×2cross-referenced ×1

Code Example

---
name: indian-veg-recipe
description: Searches for Indian Vegetarian recipes whenever asked to search for any recipe
tools:
    - google_web_search
model: gemini-3-flash-preview
temperature: 0.3
---

You are an expert chef that specialises in Indian Vegetarian cooking. 

You will use `googlesearch` to search for recipes that are vegetarian and Indian cuisine. Search for exactly one recipe at a time.
You will neatly format the recipe into 
  a. list of ingredients with standard intenational measurement units
  b. clear timelines of events that includes active preparation steps and passive waiting for cooking steps. 
  c. a desccription of the expectation of what the final item should look like, with plating / serving instructions like hot / cold, portion size, calories per portion etc.

  Return only this structured information and nothing else

---

> /about
About Gemini CLI│                                                                                                                                                             │
CLI Version                                           0.38.1Git Commit                                            7f5580034                                                                                             │
Model                                                 gemini-3-flash-preview                                                                                │
Sandbox                                               no sandbox                                                                                            │
OS                                                    linux                                                                                                 │
Auth Method                                           Signed in with Google (ksprashanth82@gmail.com)Tier                                                  Gemini Code AssistGCP Project                                           cloudshell-gca                                                                                        │
IDE Client                                            Cloud Shell
RAW_BUFFERClick to expand / collapse

What happened?

I have created a local subagent. This is in the .gemini folder in my local directory.

---
name: indian-veg-recipe
description: Searches for Indian Vegetarian recipes whenever asked to search for any recipe
tools:
    - google_web_search
model: gemini-3-flash-preview
temperature: 0.3
---

You are an expert chef that specialises in Indian Vegetarian cooking. 

You will use `googlesearch` to search for recipes that are vegetarian and Indian cuisine. Search for exactly one recipe at a time.
You will neatly format the recipe into 
  a. list of ingredients with standard intenational measurement units
  b. clear timelines of events that includes active preparation steps and passive waiting for cooking steps. 
  c. a desccription of the expectation of what the final item should look like, with plating / serving instructions like hot / cold, portion size, calories per portion etc.

  Return only this structured information and nothing else

The agent is currently disabled and the context is fully cleared - new instance, and also with /clear.

<img width="1129" height="256" alt="Image" src="https://github.com/user-attachments/assets/155d0118-071d-49ad-bb6c-c63372356af9" />

However whenver I send a prompt, it looks like it uses the instructions in the subagent. Specifically it looks like it is using the description of the subagents and prioritising it for completions.

<img width="971" height="341" alt="Image" src="https://github.com/user-attachments/assets/6b5ee24f-9fef-4e35-881b-f9a9af0b2119" />

What did you expect to happen?

I've tried the prompt multiple times and it never recommends anything other than Indian. Looks like this has polluted the context.

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
│ About Gemini CLI                                                                                                                                            │
│                                                                                                                                                             │
│ CLI Version                                           0.38.1                                                                                                │
│ Git Commit                                            7f5580034                                                                                             │
│ Model                                                 gemini-3-flash-preview                                                                                │
│ Sandbox                                               no sandbox                                                                                            │
│ OS                                                    linux                                                                                                 │
│ Auth Method                                           Signed in with Google ([email protected])                                                       │
│ Tier                                                  Gemini Code Assist                                                                                    │
│ GCP Project                                           cloudshell-gca                                                                                        │
│ IDE Client                                            Cloud Shell
</details>

Login information

No response

Anything else we need to know?

No response

extent analysis

TL;DR

The issue can be resolved by adjusting the subagent configuration to prevent it from influencing the main agent's completions.

Guidance

  • Review the subagent configuration in the .gemini folder to ensure it is not overriding the main agent's settings.
  • Check the tools and model specified in the subagent configuration to see if they are causing the main agent to prioritize Indian recipes.
  • Try modifying the subagent configuration to use a more specific or restrictive prompt to prevent it from influencing the main agent's completions.
  • Verify that the issue is not related to the temperature setting in the subagent configuration, which may be affecting the main agent's output.

Example

No code snippet is provided as the issue is related to configuration and not code.

Notes

The issue may be specific to the gemini-3-flash-preview model or the google_web_search tool, and further investigation may be needed to determine the root cause.

Recommendation

Apply workaround: Adjust the subagent configuration to prevent it from influencing the main agent's completions, as this is the most likely cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - 💡(How to fix) Fix Subagents are leaking context even when not enabled [1 participants]