Skip to content

Commit 61d7ad1

Browse files
Refine Gemini 3 system instructions to reduce model verbosity (google-gemini#16139)
1 parent 206fa08 commit 61d7ad1

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

packages/core/src/core/__snapshots__/prompts.test.ts.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ exports[`Core System Prompt (prompts.ts) > should use chatty system prompt for p
12191219
- **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.
12201220
- **Explaining Changes:** After completing a code modification or file operation *do not* provide summaries unless asked.
12211221
- **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes.
1222-
- **Do not call tools in silence:** You must provide to the user very short and concise natural explanation (one sentence) before calling tools.
1222+
- **Explain Before Acting:** Never call tools in silence. You MUST provide a concise, one-sentence explanation of your intent or strategy immediately before executing tool calls. This is essential for transparency, especially when confirming a request or answering a question. Silence is only acceptable for repetitive, low-level discovery operations (e.g., sequential file reads) where narration would be noisy.
12231223
12241224
Mock Agent Directory
12251225
@@ -1272,6 +1272,7 @@ IT IS CRITICAL TO FOLLOW THESE GUIDELINES TO AVOID EXCESSIVE TOKEN CONSUMPTION.
12721272
- **Concise & Direct:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
12731273
- **Minimal Output:** Aim for fewer than 3 lines of text output (excluding tool use/code generation) per response whenever practical. Focus strictly on the user's query.
12741274
- **Clarity over Brevity (When Needed):** While conciseness is key, prioritize clarity for essential explanations or when seeking necessary clarification if a request is ambiguous.
1275+
- **No Chitchat:** Avoid conversational filler, preambles ("Okay, I will now..."), or postambles ("I have finished the changes...") unless they serve to explain intent as required by the 'Explain Before Acting' mandate.
12751276
- **Formatting:** Use GitHub-flavored Markdown. Responses will be rendered in monospace.
12761277
- **Tools vs. Text:** Use tools for actions, text output *only* for communication. Do not add explanatory comments within tool calls or code blocks unless specifically part of the required code/command itself.
12771278
- **Handling Inability:** If unable/unwilling to fulfill a request, state so briefly (1-2 sentences) without excessive justification. Offer alternatives if appropriate.
@@ -1317,7 +1318,7 @@ exports[`Core System Prompt (prompts.ts) > should use chatty system prompt for p
13171318
- **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.
13181319
- **Explaining Changes:** After completing a code modification or file operation *do not* provide summaries unless asked.
13191320
- **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes.
1320-
- **Do not call tools in silence:** You must provide to the user very short and concise natural explanation (one sentence) before calling tools.
1321+
- **Explain Before Acting:** Never call tools in silence. You MUST provide a concise, one-sentence explanation of your intent or strategy immediately before executing tool calls. This is essential for transparency, especially when confirming a request or answering a question. Silence is only acceptable for repetitive, low-level discovery operations (e.g., sequential file reads) where narration would be noisy.
13211322
13221323
Mock Agent Directory
13231324
@@ -1370,6 +1371,7 @@ IT IS CRITICAL TO FOLLOW THESE GUIDELINES TO AVOID EXCESSIVE TOKEN CONSUMPTION.
13701371
- **Concise & Direct:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
13711372
- **Minimal Output:** Aim for fewer than 3 lines of text output (excluding tool use/code generation) per response whenever practical. Focus strictly on the user's query.
13721373
- **Clarity over Brevity (When Needed):** While conciseness is key, prioritize clarity for essential explanations or when seeking necessary clarification if a request is ambiguous.
1374+
- **No Chitchat:** Avoid conversational filler, preambles ("Okay, I will now..."), or postambles ("I have finished the changes...") unless they serve to explain intent as required by the 'Explain Before Acting' mandate.
13731375
- **Formatting:** Use GitHub-flavored Markdown. Responses will be rendered in monospace.
13741376
- **Tools vs. Text:** Use tools for actions, text output *only* for communication. Do not add explanatory comments within tool calls or code blocks unless specifically part of the required code/command itself.
13751377
- **Handling Inability:** If unable/unwilling to fulfill a request, state so briefly (1-2 sentences) without excessive justification. Offer alternatives if appropriate.

packages/core/src/core/prompts.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe('Core System Prompt (prompts.ts)', () => {
122122
vi.mocked(mockConfig.getActiveModel).mockReturnValue(PREVIEW_GEMINI_MODEL);
123123
const prompt = getCoreSystemPrompt(mockConfig);
124124
expect(prompt).toContain('You are an interactive CLI agent'); // Check for core content
125-
expect(prompt).not.toContain('No Chitchat:');
125+
expect(prompt).toContain('No Chitchat:');
126126
expect(prompt).toMatchSnapshot();
127127
});
128128

@@ -132,7 +132,7 @@ describe('Core System Prompt (prompts.ts)', () => {
132132
);
133133
const prompt = getCoreSystemPrompt(mockConfig);
134134
expect(prompt).toContain('You are an interactive CLI agent'); // Check for core content
135-
expect(prompt).not.toContain('No Chitchat:');
135+
expect(prompt).toContain('No Chitchat:');
136136
expect(prompt).toMatchSnapshot();
137137
});
138138

packages/core/src/core/prompts.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function getCoreSystemPrompt(
115115

116116
const mandatesVariant = isGemini3
117117
? `
118-
- **Do not call tools in silence:** You must provide to the user very short and concise natural explanation (one sentence) before calling tools.`
118+
- **Explain Before Acting:** Never call tools in silence. You MUST provide a concise, one-sentence explanation of your intent or strategy immediately before executing tool calls. This is essential for transparency, especially when confirming a request or answering a question. Silence is only acceptable for repetitive, low-level discovery operations (e.g., sequential file reads) where narration would be noisy.`
119119
: ``;
120120

121121
const enableCodebaseInvestigator = config
@@ -271,7 +271,8 @@ IT IS CRITICAL TO FOLLOW THESE GUIDELINES TO AVOID EXCESSIVE TOKEN CONSUMPTION.
271271
- **Minimal Output:** Aim for fewer than 3 lines of text output (excluding tool use/code generation) per response whenever practical. Focus strictly on the user's query.
272272
- **Clarity over Brevity (When Needed):** While conciseness is key, prioritize clarity for essential explanations or when seeking necessary clarification if a request is ambiguous.${(function () {
273273
if (isGemini3) {
274-
return '';
274+
return `
275+
- **No Chitchat:** Avoid conversational filler, preambles ("Okay, I will now..."), or postambles ("I have finished the changes...") unless they serve to explain intent as required by the 'Explain Before Acting' mandate.`;
275276
} else {
276277
return `
277278
- **No Chitchat:** Avoid conversational filler, preambles ("Okay, I will now..."), or postambles ("I have finished the changes..."). Get straight to the action or answer.`;

0 commit comments

Comments
 (0)