diff --git a/packages/core/src/prompts/snippets.ts b/packages/core/src/prompts/snippets.ts index f2b7a53a97..92262f6e43 100644 --- a/packages/core/src/prompts/snippets.ts +++ b/packages/core/src/prompts/snippets.ts @@ -572,20 +572,20 @@ function workflowStepResearch(options: PrimaryWorkflowsOptions): string { } const validationClause = options.enableGrep - ? ` Use ${grepName} with context or ${readFileName} with precise ranges to validate all assumptions.` - : ` Use ${readFileName} to validate all assumptions.`; + ? `Use ${grepName} with context or ${readFileName} with precise ranges to validate all assumptions.` + : `Use ${readFileName} to validate all assumptions.`; if (options.enableCodebaseInvestigator) { let subAgentSearch = ''; if (searchTools.length > 0) { const toolsStr = searchTools.join(' or '); - subAgentSearch = ` For **simple, targeted searches** (like finding a specific function name, file path, or variable declaration), use ${toolsStr} directly in parallel.`; + subAgentSearch = `For **simple, targeted searches** (like finding a specific function name, file path, or variable declaration), use ${toolsStr} directly in parallel. `; } - return `1. **Research:** Systematically map the codebase and validate assumptions. Utilize specialized sub-agents (e.g., \`codebase_investigator\`) as the primary mechanism for initial discovery when the task involves **complex refactoring, codebase exploration or system-wide analysis**.${subAgentSearch}${validationClause} **Prioritize empirical reproduction of reported issues to confirm the failure state.**${suggestion}`; + return `1. **Research:** Systematically map the codebase and validate assumptions. Utilize specialized sub-agents (e.g., \`codebase_investigator\`) as the primary mechanism for initial discovery when the task involves **complex refactoring, codebase exploration or system-wide analysis**. ${subAgentSearch}${validationClause} **Prioritize empirical reproduction of reported issues to confirm the failure state.**${suggestion}`; } - return `1. **Research:** Systematically map the codebase and validate assumptions.${searchSentence}${validationClause} **Prioritize empirical reproduction of reported issues to confirm the failure state.**${suggestion}`; + return `1. **Research:** Systematically map the codebase and validate assumptions.${searchSentence} ${validationClause} **Prioritize empirical reproduction of reported issues to confirm the failure state.**${suggestion}`; } function workflowStepStrategy(options: PrimaryWorkflowsOptions): string { diff --git a/packages/core/src/tools/read-file.ts b/packages/core/src/tools/read-file.ts index 4399602386..38d99826a1 100644 --- a/packages/core/src/tools/read-file.ts +++ b/packages/core/src/tools/read-file.ts @@ -14,6 +14,7 @@ import type { FunctionDeclaration, PartUnion } from '@google/genai'; import { processSingleFileContent, getSpecificMimeType, + DEFAULT_MAX_LINES_TEXT_FILE, } from '../utils/fileUtils.js'; import type { Config } from '../config/config.js'; import { FileOperation } from '../telemetry/metrics.js'; @@ -264,7 +265,7 @@ export class ReadFileTool extends BaseDeclarativeTool< return { name: this.name, description: isGemini3 - ? `Reads a specific range of a file (up to 2,000 lines). **Important:** For high token efficiency, avoid reading large files in their entirety. Use 'grep_search' to find symbols or 'run_shell_command' with 'sed' for surgical block extraction instead of broad file reads. Handles text, images, audio, and PDF files.` + ? `Reads a specific range of a file (up to ${DEFAULT_MAX_LINES_TEXT_FILE} lines). **Important:** For high token efficiency, avoid reading large files in their entirety. Use 'grep_search' to find symbols or 'run_shell_command' with 'sed' for surgical block extraction instead of broad file reads. Handles text, images, audio, and PDF files.` : `Reads and returns the content of a specified file. If the file is large, the content will be truncated. The tool's response will clearly indicate if truncation has occurred and will provide details on how to read more of the file using the 'offset' and 'limit' parameters. Handles text, images, audio, and PDF files. For text files, it can read specific line ranges.`, parametersJsonSchema: { properties, diff --git a/packages/core/src/tools/ripGrep.ts b/packages/core/src/tools/ripGrep.ts index c08d289701..2e24977b9e 100644 --- a/packages/core/src/tools/ripGrep.ts +++ b/packages/core/src/tools/ripGrep.ts @@ -18,6 +18,7 @@ import type { Config } from '../config/config.js'; import { fileExists } from '../utils/fileUtils.js'; import { Storage } from '../config/storage.js'; import { GREP_TOOL_NAME } from './tool-names.js'; +import { GREP_DEFINITION } from './definitions/coreTools.js'; import { debugLogger } from '../utils/debugLogger.js'; import { FileExclusions, @@ -559,7 +560,7 @@ export class RipGrepTool extends BaseDeclarativeTool< super( RipGrepTool.Name, 'SearchText', - 'FAST regular expression search. This is the **primary discovery tool** for locating code. Use context parameters (`context`, `after`, `before`) to read code surrounding matches in a single turn, often eliminating the need for a separate `read_file` call. (max 100 matches).', + GREP_DEFINITION.base.description, Kind.Search, { properties: {