You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If file is too large, only read the first maxReadFileLine lines
2341
2342
isFileTruncated=true
2342
2343
@@ -2357,7 +2358,7 @@ export class Cline extends EventEmitter<ClineEvents> {
2357
2358
2358
2359
// Add truncation notice if applicable
2359
2360
if(isFileTruncated){
2360
-
content+=`\n\n[File truncated: showing ${maxReadFileLine} of ${totalLines} total lines. Use start_line and end_line if you need to read more.].${sourceCodeDef}`
2361
+
content+=`\n\n[File truncated: showing ${maxReadFileLine} of ${totalLines} total lines. Use start_line and end_line or set auto_truncate to false if you need to read more.].${sourceCodeDef}`
Copy file name to clipboardExpand all lines: src/core/prompts/tools/read-file.ts
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,13 @@ Parameters:
7
7
- path: (required) The path of the file to read (relative to the current working directory ${args.cwd})
8
8
- start_line: (optional) The starting line number to read from (1-based). If not provided, it starts from the beginning of the file.
9
9
- end_line: (optional) The ending line number to read to (1-based, inclusive). If not provided, it reads to the end of the file.
10
+
- auto_truncate: (optional) Whether to automatically truncate large files when start_line and end_line are not specified. If true and the file exceeds a certain line threshold, it will: a) return only a subset of lines to save tokens, b) include information about the total line count, and c) provide a summary of method definitions with their line ranges. You should set this to true unless you've been explicitly asked to read an entire large file at once, as this prevents context bloat that can lead to truncated responses. For backwards compatibility, it defaults to false when omitted.
10
11
Usage:
11
12
<read_file>
12
13
<path>File path here</path>
13
14
<start_line>Starting line number (optional)</start_line>
14
15
<end_line>Ending line number (optional)</end_line>
16
+
<auto_truncate>true or false (optional)</auto_truncate>
15
17
</read_file>
16
18
17
19
Examples:
@@ -40,6 +42,13 @@ Examples:
40
42
<start_line>46</start_line>
41
43
<end_line>68</end_line>
42
44
</read_file>
45
+
Note: When both start_line and end_line are provided, this tool efficiently streams only the requested lines, making it suitable for processing large files like logs, CSV files, and other large datasets without memory issues.
43
46
44
-
Note: When both start_line and end_line are provided, this tool efficiently streams only the requested lines, making it suitable for processing large files like logs, CSV files, and other large datasets without memory issues.`
47
+
5. Reading a large file with automatic truncation:
48
+
<read_file>
49
+
<path>src/large-module.ts</path>
50
+
<auto_truncate>true</auto_truncate>
51
+
</read_file>
52
+
53
+
This will return a truncated version of the file with information about total line count and method definitions, helping to prevent context size issues with very large files.`
Copy file name to clipboardExpand all lines: webview-ui/src/i18n/locales/ca/settings.json
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -267,8 +267,9 @@
267
267
"description": "Quan està habilitat, els fitxers que coincideixen amb els patrons a .rooignore es mostraran en llistes amb un símbol de cadenat. Quan està deshabilitat, aquests fitxers s'ocultaran completament de les llistes de fitxers i cerques."
268
268
},
269
269
"maxReadFile": {
270
-
"label": "Nombre màxim de línies per llegir d'un fitxer",
271
-
"description": "Nombre màxim de línies per llegir d'un fitxer a la vegada. Valors més baixos redueixen l'ús de context/recursos però poden requerir més lectures per a fitxers grans."
270
+
"label": "Llindar d'auto-truncament de lectura de fitxers",
271
+
"description": "El nombre predeterminat de línies per llegir d'un fitxer en un lot. Valors més baixos redueixen l'ús de context/recursos però poden requerir més lectures per a fitxers grans.",
Copy file name to clipboardExpand all lines: webview-ui/src/i18n/locales/de/settings.json
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -267,8 +267,9 @@
267
267
"description": "Wenn aktiviert, werden Dateien, die mit Mustern in .rooignore übereinstimmen, in Listen mit einem Schlosssymbol angezeigt. Wenn deaktiviert, werden diese Dateien vollständig aus Dateilisten und Suchen ausgeblendet."
268
268
},
269
269
"maxReadFile": {
270
-
"label": "Maximale Anzahl an Zeilen, die aus einer Datei gelesen werden",
271
-
"description": "Maximale Anzahl an Zeilen, die auf einmal aus einer Datei gelesen werden. Niedrigere Werte reduzieren den Kontext-/Ressourcenverbrauch, können aber mehr Lesevorgänge für große Dateien erfordern."
270
+
"label": "Schwellenwert für automatische Dateilesekürzung",
271
+
"description": "Die Standardanzahl an Zeilen, die in einem Durchgang aus einer Datei gelesen werden. Niedrigere Werte reduzieren den Kontext-/Ressourcenverbrauch, können aber mehr Lesevorgänge für große Dateien erfordern.",
Copy file name to clipboardExpand all lines: webview-ui/src/i18n/locales/en/settings.json
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -267,8 +267,9 @@
267
267
"description": "When enabled, files matching patterns in .rooignore will be shown in lists with a lock symbol. When disabled, these files will be completely hidden from file lists and searches."
268
268
},
269
269
"maxReadFile": {
270
-
"label": "Maximum lines to read from a file",
271
-
"description": "Maximum number of lines to read from a file at once. Lower values reduce context/resource usage but may require more reads for large files."
270
+
"label": "File read auto-truncate threshold",
271
+
"description": "The default number of lines to read from a file in one batch. Lower values reduce context/resource usage but may require more reads for large files.",
Copy file name to clipboardExpand all lines: webview-ui/src/i18n/locales/es/settings.json
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -267,8 +267,9 @@
267
267
"description": "Cuando está habilitado, los archivos que coinciden con los patrones en .rooignore se mostrarán en listas con un símbolo de candado. Cuando está deshabilitado, estos archivos se ocultarán completamente de las listas de archivos y búsquedas."
268
268
},
269
269
"maxReadFile": {
270
-
"label": "Número máximo de líneas para leer de un archivo",
271
-
"description": "Número máximo de líneas para leer de un archivo a la vez. Valores más bajos reducen el uso de contexto/recursos pero pueden requerir más lecturas para archivos grandes."
270
+
"label": "Umbral de auto-truncado de lectura de archivos",
271
+
"description": "El número predeterminado de líneas para leer de un archivo en un lote. Valores más bajos reducen el uso de contexto/recursos pero pueden requerir más lecturas para archivos grandes.",
0 commit comments