diff --git a/packages/core/src/tools/definitions/__snapshots__/coreToolsModelSnapshots.test.ts.snap b/packages/core/src/tools/definitions/__snapshots__/coreToolsModelSnapshots.test.ts.snap index effab9144d..eec4d8130f 100644 --- a/packages/core/src/tools/definitions/__snapshots__/coreToolsModelSnapshots.test.ts.snap +++ b/packages/core/src/tools/definitions/__snapshots__/coreToolsModelSnapshots.test.ts.snap @@ -1304,7 +1304,21 @@ The user has the ability to modify the \`new_string\` content. If modified, this "type": "string", }, "instruction": { - "description": "A clear, semantic instruction for the code change, acting as a high-quality prompt for an expert LLM assistant. It must be self-contained and explain the goal of the change.", + "description": "A clear, semantic instruction for the code change, acting as a high-quality prompt for an expert LLM assistant. It must be self-contained and explain the goal of the change. + +A good instruction should concisely answer: +1. WHY is the change needed? (e.g., "To fix a bug where users can be null...") +2. WHERE should the change happen? (e.g., "...in the 'renderUserProfile' function...") +3. WHAT is the high-level change? (e.g., "...add a null check for the 'user' object...") +4. WHAT is the desired outcome? (e.g., "...so that it displays a loading spinner instead of crashing.") + +**GOOD Example:** "In the 'calculateTotal' function, correct the sales tax calculation by updating the 'taxRate' constant from 0.05 to 0.075 to reflect the new regional tax laws." + +**BAD Examples:** +- "Change the text." (Too vague) +- "Fix the bug." (Doesn't explain the bug or the fix) +- "Replace the line with this new line." (Brittle, just repeats the other parameters) +", "type": "string", }, "new_string": { @@ -1312,7 +1326,7 @@ The user has the ability to modify the \`new_string\` content. If modified, this "type": "string", }, "old_string": { - "description": "The exact literal text to replace, unescaped. If this string is not the exact literal text (i.e. you escaped it) or does not match exactly, the tool will fail.", + "description": "The exact literal text to replace, preferably unescaped. For single replacements (default), include at least 3 lines of context BEFORE and AFTER the target text, matching whitespace and indentation precisely. If this string is not the exact literal text (i.e. you escaped it) or does not match exactly, the tool will fail.", "type": "string", }, }, diff --git a/packages/core/src/tools/definitions/model-family-sets/gemini-3.ts b/packages/core/src/tools/definitions/model-family-sets/gemini-3.ts index 0cfe8ffbc2..5a53aa851b 100644 --- a/packages/core/src/tools/definitions/model-family-sets/gemini-3.ts +++ b/packages/core/src/tools/definitions/model-family-sets/gemini-3.ts @@ -300,12 +300,26 @@ The user has the ability to modify the \`new_string\` content. If modified, this type: 'string', }, instruction: { - description: `A clear, semantic instruction for the code change, acting as a high-quality prompt for an expert LLM assistant. It must be self-contained and explain the goal of the change.`, + description: `A clear, semantic instruction for the code change, acting as a high-quality prompt for an expert LLM assistant. It must be self-contained and explain the goal of the change. + +A good instruction should concisely answer: +1. WHY is the change needed? (e.g., "To fix a bug where users can be null...") +2. WHERE should the change happen? (e.g., "...in the 'renderUserProfile' function...") +3. WHAT is the high-level change? (e.g., "...add a null check for the 'user' object...") +4. WHAT is the desired outcome? (e.g., "...so that it displays a loading spinner instead of crashing.") + +**GOOD Example:** "In the 'calculateTotal' function, correct the sales tax calculation by updating the 'taxRate' constant from 0.05 to 0.075 to reflect the new regional tax laws." + +**BAD Examples:** +- "Change the text." (Too vague) +- "Fix the bug." (Doesn't explain the bug or the fix) +- "Replace the line with this new line." (Brittle, just repeats the other parameters) +`, type: 'string', }, old_string: { description: - 'The exact literal text to replace, unescaped. If this string is not the exact literal text (i.e. you escaped it) or does not match exactly, the tool will fail.', + 'The exact literal text to replace, preferably unescaped. For single replacements (default), include at least 3 lines of context BEFORE and AFTER the target text, matching whitespace and indentation precisely. If this string is not the exact literal text (i.e. you escaped it) or does not match exactly, the tool will fail.', type: 'string', }, new_string: {