mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-02-01 22:48:03 +00:00
Better guidance about reads.
This commit is contained in:
@@ -135,7 +135,7 @@ export function renderCoreMandates(options?: CoreMandatesOptions): string {
|
||||
return `
|
||||
# Core Mandates
|
||||
|
||||
- **Context Efficiency:** Minimize context usage. Do not read entire files unless necessary. Use '${GREP_TOOL_NAME}' or '${READ_FILE_TOOL_NAME}' with 'limit' to inspect large files.
|
||||
- **Context Efficiency:** Minimize unnecessary context usage by reading as much as is needed to solve the problem best, but no more. Use '${GREP_TOOL_NAME}' to find matching lines and '${READ_FILE_TOOL_NAME}' with 'limit' to read only the necessary large files.
|
||||
- **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code. Analyze surrounding code, tests, and configuration first.
|
||||
- **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project (check imports, configuration files like 'package.json', 'Cargo.toml', 'requirements.txt', 'build.gradle', etc., or observe neighboring files) before employing it.
|
||||
- **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code in the project.
|
||||
|
||||
@@ -912,7 +912,7 @@ export class EditTool
|
||||
super(
|
||||
EditTool.Name,
|
||||
'Edit',
|
||||
`Replaces text within a file. By default, replaces a single occurrence, but can replace multiple occurrences when \`expected_replacements\` is specified. This tool requires providing significant context around the change to ensure precise targeting. Always use the ${READ_FILE_TOOL_NAME} tool (using 'offset' and 'limit' to get ~20 lines of context around the match) to examine the file's current content before attempting a text replacement.
|
||||
`Replaces text within a file. By default, replaces a single occurrence, but can replace multiple occurrences when \`expected_replacements\` is specified. This tool requires providing significant context around the change to ensure precise targeting. Always use the ${READ_FILE_TOOL_NAME} tool (using 'offset' and 'limit' to get enough lines of context around the match) to examine the file's current content before attempting a text replacement.
|
||||
|
||||
The user has the ability to modify the \`new_string\` content. If modified, this will be stated in the response.
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ export class ReadFileTool extends BaseDeclarativeTool<
|
||||
},
|
||||
limit: {
|
||||
description:
|
||||
"Optional: For text files, maximum number of lines to read. Use with 'offset' to paginate through large files. When checking for context or verifying changes, always set this to a small value (e.g. 50) to avoid reading the entire file.",
|
||||
"Optional: For text files, maximum number of lines to read. Use with 'offset' to paginate through large files. Minimize unnecessarily large reads. Set the offset and limit large enough to read the continguous block needed for your task, plus 50-100 lines of margin.",
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user