diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap index ee8a50e993..10b37baaa7 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/architect-mode-prompt.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap index 4428748632..292b73dc2f 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/ask-mode-prompt.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap index 48b39d001f..5aa68a899e 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-disabled.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap index acc36d1ffd..8c68ec50fc 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/mcp-server-creation-enabled.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap index ac93623fda..10b37baaa7 100644 --- a/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap +++ b/src/core/prompts/__tests__/__snapshots__/add-custom-instructions/partial-reads-enabled.snap @@ -32,10 +32,11 @@ Description: Request to read the contents of one or more files. The tool outputs **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. + Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive) + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: @@ -90,7 +91,7 @@ IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST combine adjacent line ranges (<10 lines apart) - You MUST use multiple ranges for content separated by >10 lines - You MUST include sufficient line context for planned modifications while keeping ranges minimal - +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap index ee8a50e993..10b37baaa7 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/consistent-system-prompt.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap index 8edc23260e..768ded218c 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-computer-use-support.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap index ee8a50e993..10b37baaa7 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-false.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap index 54df428abd..52c00157ed 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap index ee8a50e993..10b37baaa7 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-undefined.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap index ee8a50e993..10b37baaa7 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-different-viewport-size.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap index acc36d1ffd..8c68ec50fc 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-mcp-hub-provided.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap index ee8a50e993..10b37baaa7 100644 --- a/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap +++ b/src/core/prompts/__tests__/__snapshots__/system-prompt/with-undefined-mcp-hub.snap @@ -27,22 +27,23 @@ Always use the actual tool name as the XML tag name for proper parsing and execu # Tools ## read_file -Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of one or more files. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. **IMPORTANT: You can read a maximum of 5 files in a single request.** If you need to read more files, use multiple sequential read_file requests. +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory /test/path) - + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - + start-end @@ -54,7 +55,7 @@ Examples: src/app.ts - + 1-1000 @@ -64,11 +65,12 @@ Examples: src/app.ts - + 1-50 + 100-150 src/utils.ts - + 10-20 @@ -85,7 +87,11 @@ Examples: IMPORTANT: You MUST use this Efficient Reading Strategy: - You MUST read all related files and implementations together in a single operation (up to 5 files at once) - You MUST obtain all necessary context before proceeding with changes - +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST combine adjacent line ranges (<10 lines apart) +- You MUST use multiple ranges for content separated by >10 lines +- You MUST include sufficient line context for planned modifications while keeping ranges minimal +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. - When you need to read more than 5 files, prioritize the most critical files first, then use subsequent read_file requests for additional files ## fetch_instructions diff --git a/src/core/prompts/tools/read-file.ts b/src/core/prompts/tools/read-file.ts index 86f4dc8c64..8dc6460471 100644 --- a/src/core/prompts/tools/read-file.ts +++ b/src/core/prompts/tools/read-file.ts @@ -5,22 +5,23 @@ export function getReadFileDescription(args: ToolArgs): string { const isMultipleReadsEnabled = maxConcurrentReads > 1 return `## read_file -Description: Request to read the contents of ${isMultipleReadsEnabled ? "one or more files" : "a file"}. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code.${args.partialReadsEnabled ? " Use line ranges to efficiently read specific portions of large files." : ""} Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. +Description: Request to read the contents of ${isMultipleReadsEnabled ? "one or more files" : "a file"}. The tool outputs line-numbered content (e.g. "1 | const x = 1") for easy reference when creating diffs or discussing code. Use line ranges to efficiently read specific portions of large files. Supports text extraction from PDF and DOCX files, but may not handle other binary files properly. ${isMultipleReadsEnabled ? `**IMPORTANT: You can read a maximum of ${maxConcurrentReads} files in a single request.** If you need to read more files, use multiple sequential read_file requests.` : "**IMPORTANT: Multiple file reads are currently disabled. You can only read one file at a time.**"} -${args.partialReadsEnabled ? `By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory.` : ""} +By specifying line ranges, you can efficiently read specific portions of large files without loading the entire file into memory. + Parameters: - args: Contains one or more file elements, where each file contains: - path: (required) File path (relative to workspace directory ${args.cwd}) - ${args.partialReadsEnabled ? `- line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive)` : ""} + - line_range: (optional) One or more line range elements in format "start-end" (1-based, inclusive). Use this to read specific sections of a file, especially useful for continuing to read a large file that was truncated. Usage: path/to/file - ${args.partialReadsEnabled ? `start-end` : ""} + start-end @@ -32,7 +33,7 @@ Examples: src/app.ts - ${args.partialReadsEnabled ? `1-1000` : ""} + 1-1000 @@ -44,16 +45,12 @@ ${isMultipleReadsEnabled ? `2. Reading multiple files (within the ${maxConcurren src/app.ts - ${ - args.partialReadsEnabled - ? `1-50 - 100-150` - : "" - } + 1-50 + 100-150 src/utils.ts - ${args.partialReadsEnabled ? `10-20` : ""} + 10-20 ` @@ -72,14 +69,10 @@ ${isMultipleReadsEnabled ? "3. " : "2. "}Reading an entire file: IMPORTANT: You MUST use this Efficient Reading Strategy: - ${isMultipleReadsEnabled ? `You MUST read all related files and implementations together in a single operation (up to ${maxConcurrentReads} files at once)` : "You MUST read files one at a time, as multiple file reads are currently disabled"} - You MUST obtain all necessary context before proceeding with changes -${ - args.partialReadsEnabled - ? `- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed +- You MUST use line ranges to read specific portions of large files, rather than reading entire files when not needed - You MUST combine adjacent line ranges (<10 lines apart) - You MUST use multiple ranges for content separated by >10 lines - You MUST include sufficient line context for planned modifications while keeping ranges minimal -` - : "" -} +- When a file is too large to display completely, the tool will show a truncation notice with the exact line number to continue from. Use the line_range parameter to read the next section of the file. ${isMultipleReadsEnabled ? `- When you need to read more than ${maxConcurrentReads} files, prioritize the most critical files first, then use subsequent read_file requests for additional files` : ""}` }