@@ -116,6 +116,15 @@ agents:
116116
117117 The drafter has `read_file` access and will read the chunk from disk. Keep the
118118 delegation message short — just the file path, chunk number, project context, and any learned patterns.
119+
120+ **Include a file listing** so the drafter knows what files exist on disk. Before
121+ delegating, run:
122+ ```bash
123+ cat changed_files.txt 2>/dev/null | xargs -I{} dirname {} | sort -u | xargs -I{} ls {} 2>/dev/null
124+ ```
125+ Include the output in the delegation message as "Available files:" so the drafter
126+ can look up real paths instead of guessing. If `changed_files.txt` doesn't exist,
127+ extract changed file paths from the diff headers (`diff --git a/... b/...`) instead.
119128 5. Parse the drafter's JSON response. Collect all findings with severity "high" or "medium"
120129 and delegate them to the `verifier` in a single batch. Skip verification for "low" findings.
121130 Include the project context (from step 2) in the verifier delegation so it can validate
@@ -299,6 +308,19 @@ agents:
299308 reduce severity. Do NOT report "missing import" or "undefined function" findings
300309 without checking — these are the #1 source of false positives.
301310
311+ ## File Reading Guardrails
312+
313+ 1. **Never guess file paths.** If you need to find a file, use `list_directory`
314+ to discover what exists. Do NOT try permutations of possible file names.
315+ 2. **Circuit breaker:** If 3 consecutive `read_file` calls return "not found",
316+ STOP reading files immediately. Proceed with your analysis using only the
317+ diff context.
318+ 3. **Cap total reads:** Read at most 20 source files (excluding the diff chunk).
319+ If you hit this limit, finalize your findings with the context you have.
320+ 4. **Only read files referenced in the diff.** Check imports, function calls,
321+ and type references that appear in the `+` lines. Do NOT explore unrelated
322+ parts of the repository.
323+
302324 ## CRITICAL RULE: Only Review Changed Code
303325
304326 You MUST ONLY report issues on lines that were ADDED in this PR (lines starting with `+` in the diff).
@@ -409,7 +431,7 @@ agents:
409431
410432 toolsets :
411433 - type : filesystem
412- tools : [read_file, read_multiple_files]
434+ tools : [read_file, read_multiple_files, list_directory ]
413435
414436 verifier :
415437 model : sonnet
@@ -437,6 +459,18 @@ agents:
437459 read the file — evaluate it based on the diff content instead. Only attempt to read each
438460 file once; if it's not found, move on.
439461
462+ ## File Reading Guardrails
463+
464+ 1. **Never guess file paths.** Use `list_directory` to discover files before
465+ reading. Do NOT try permutations of possible file names.
466+ 2. **Circuit breaker:** If 3 consecutive `read_file` calls return "not found",
467+ STOP reading files. Evaluate the finding using only the diff context
468+ provided to you.
469+ 3. **Cap total reads:** Read at most 10 source files across all findings.
470+ Prioritize high-severity findings for file verification.
471+ 4. **One attempt per file:** If `read_file` fails for a path, do NOT retry
472+ with variations of the same filename.
473+
440474 CRITICAL: If the bug is in existing code that was NOT changed by this PR,
441475 set `in_changed_code: false` and `verdict: "DISMISSED"`.
442476 We only review code that was added/modified in this PR.
@@ -500,7 +534,7 @@ agents:
500534
501535 toolsets :
502536 - type : filesystem
503- tools : [read_file, read_multiple_files]
537+ tools : [read_file, read_multiple_files, list_directory ]
504538
505539permissions :
506540 allow :
0 commit comments